(@ShellOption(optOut = true) @Valid Args args)
| 79 | } |
| 80 | |
| 81 | @ShellMethod("【远端对象存储配置】Config bucket connect and list active session manipulation and interaction... \nYou should have read permission to the bucket. \nUse config --help for more information") |
| 82 | public String config(@ShellOption(optOut = true) @Valid Args args) { |
| 83 | |
| 84 | setBucketname(args.bucketname); |
| 85 | setEndpoint(args.endpoint); |
| 86 | setAccessKeyId(args.accessKeyId); |
| 87 | setAccessKeySecret(args.accessKeySecret); |
| 88 | setPath(args.path); |
| 89 | setType(args.type.toUpperCase()); |
| 90 | JCommander jCommander = new JCommander(args); |
| 91 | |
| 92 | if (args.help) { |
| 93 | jCommander.setProgramName("config"); |
| 94 | jCommander.usage(); |
| 95 | return ""; |
| 96 | } |
| 97 | if (args.v) { |
| 98 | return "Version : 2.0 (2020-10-06 21:44:14) On " + System.getProperty("os.name"); |
| 99 | } |
| 100 | |
| 101 | if ("OSS".equals(getType())) { |
| 102 | OSS ossClient = OSSConn(); |
| 103 | if (ossClient != null) { |
| 104 | return sessionsTitle + listOSSSessions(ossClient); |
| 105 | } else { |
| 106 | setCommandstate(false); |
| 107 | return "【阿里云对象存储连接错误】Aliyun OSS Object-Based Storage Connect Error,may be wrong ak & sk?\n"; |
| 108 | |
| 109 | } |
| 110 | } else if ("COS".equals(getType())) { |
| 111 | |
| 112 | COSClient cosClient = COSConn(); |
| 113 | if (cosClient != null) { |
| 114 | return sessionsTitle + listOSSSessions(cosClient); |
| 115 | |
| 116 | } else { |
| 117 | setCommandstate(false); |
| 118 | return "【腾讯云对象存储连接错误】Tencent COS Object-Based Storage Connect Error,may be wrong ak & sk?\n"; |
| 119 | |
| 120 | } |
| 121 | |
| 122 | } else if ("S3".equals(getType())) { |
| 123 | AmazonS3 s3Client = S3Conn(); |
| 124 | |
| 125 | if (s3Client != null) { |
| 126 | return sessionsTitle + listS3Sessions(s3Client); |
| 127 | |
| 128 | } else { |
| 129 | setCommandstate(false); |
| 130 | return "【亚马逊s3对象存储链接错误】S3 Object-Based Storage Connect Error,may be wrong ak & sk?\n"; |
| 131 | |
| 132 | } |
| 133 | |
| 134 | } |
| 135 | |
| 136 | jCommander.usage(); |
| 137 | return ""; |
| 138 | } |
nothing calls this directly
no test coverage detected