Search in sources :

Example 1 with AwsFileProperties

use of com.zhouzifei.tool.config.AwsFileProperties in project simpleFS by shengdingbox.

the class AwsS3ApiClient method init.

@Override
public AwsS3ApiClient init(FileProperties fileProperties) {
    final AwsFileProperties awsFileProperties = fileProperties.getAws();
    this.accessKey = awsFileProperties.getSecretKey();
    this.secretKey = awsFileProperties.getSecretKey();
    this.domainUrl = awsFileProperties.getDomainUrl();
    this.endpoint = awsFileProperties.getEndpoint();
    this.region = awsFileProperties.getRegion();
    this.bucketName = awsFileProperties.getBucketName();
    checkDomainUrl(domainUrl);
    return this;
}
Also used : AwsFileProperties(com.zhouzifei.tool.config.AwsFileProperties)

Example 2 with AwsFileProperties

use of com.zhouzifei.tool.config.AwsFileProperties in project simpleFS by shengdingbox.

the class AwsS3ApiClient method main.

public static void main(String[] args) {
    final FileProperties fileProperties = new FileProperties();
    final AwsFileProperties awsFileProperties = fileProperties.getAws();
    awsFileProperties.setAccessKey("LTAI5tFpTDE26XYiPmH9dxDz");
    awsFileProperties.setSecretKey("9gC7gs5kEJJmZec6a6QupoefIL82Kr");
    awsFileProperties.setEndpoint("oss-cn-beijing.aliyuncs.com");
    awsFileProperties.setBucketName("simple-fs");
    awsFileProperties.setDomainUrl("https://simple-fs.oss-cn-beijing.aliyuncs.com/");
    final AwsS3ApiClient awsS3ApiClient = new AwsS3ApiClient(fileProperties);
    final File file = new File("/Users/Dabao/Downloads/videoplayback.mp4");
    final VirtualFile virtualFile = awsS3ApiClient.uploadFile(file);
    System.out.println(virtualFile);
    System.out.println(1);
}
Also used : VirtualFile(com.zhouzifei.tool.dto.VirtualFile) FileProperties(com.zhouzifei.tool.config.FileProperties) AwsFileProperties(com.zhouzifei.tool.config.AwsFileProperties) AwsFileProperties(com.zhouzifei.tool.config.AwsFileProperties) VirtualFile(com.zhouzifei.tool.dto.VirtualFile) File(java.io.File)

Aggregations

AwsFileProperties (com.zhouzifei.tool.config.AwsFileProperties)2 FileProperties (com.zhouzifei.tool.config.FileProperties)1 VirtualFile (com.zhouzifei.tool.dto.VirtualFile)1 File (java.io.File)1