wangmengmeng
2024-12-24 24432a361d5c6bd6f3d8c008693e9f1155d62517
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package com.dji.sdk.cloudapi.log;
 
import com.dji.sdk.cloudapi.storage.CredentialsToken;
import com.dji.sdk.cloudapi.storage.OssTypeEnum;
import com.dji.sdk.cloudapi.storage.StsCredentialsResponse;
import com.dji.sdk.common.BaseModel;
 
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
 
/**
 * @author sean
 * @version 1.2
 * @date 2022/9/8
 */
public class FileUploadStartRequest extends BaseModel {
 
    @NotNull
    private String bucket;
 
    @NotNull
    @Valid
    private CredentialsToken credentials;
 
    @NotNull
    private String endpoint;
 
    @NotNull
    private String fileStoreDir;
 
    @NotNull
    private OssTypeEnum provider;
 
    @NotNull
    private String fileType = "text_log";
 
    @NotNull
    @Valid
    private FileUploadStartParam params;
 
    @NotNull
    private String region;
 
    public FileUploadStartRequest(StsCredentialsResponse sts) {
        this.bucket = sts.getBucket();
        long expire = sts.getCredentials().getExpire();
        sts.getCredentials().setExpire(System.currentTimeMillis() + (expire - 60) * 1000);
        this.credentials = sts.getCredentials();
        this.endpoint = sts.getEndpoint();
        this.fileStoreDir = sts.getObjectKeyPrefix();
        this.provider = sts.getProvider();
        this.region = sts.getRegion();
    }
 
    public FileUploadStartRequest() {
    }
 
    @Override
    public String toString() {
        return "FileUploadStartRequest{" +
                "bucket='" + bucket + '\'' +
                ", credentials=" + credentials +
                ", endpoint='" + endpoint + '\'' +
                ", fileStoreDir='" + fileStoreDir + '\'' +
                ", provider=" + provider +
                ", fileType='" + fileType + '\'' +
                ", params=" + params +
                ", region='" + region + '\'' +
                '}';
    }
 
    public String getBucket() {
        return bucket;
    }
 
    public FileUploadStartRequest setBucket(String bucket) {
        this.bucket = bucket;
        return this;
    }
 
    public CredentialsToken getCredentials() {
        return credentials;
    }
 
    public FileUploadStartRequest setCredentials(CredentialsToken credentials) {
        this.credentials = credentials;
        return this;
    }
 
    public String getEndpoint() {
        return endpoint;
    }
 
    public FileUploadStartRequest setEndpoint(String endpoint) {
        this.endpoint = endpoint;
        return this;
    }
 
    public String getFileStoreDir() {
        return fileStoreDir;
    }
 
    public FileUploadStartRequest setFileStoreDir(String fileStoreDir) {
        this.fileStoreDir = fileStoreDir;
        return this;
    }
 
    public OssTypeEnum getProvider() {
        return provider;
    }
 
    public FileUploadStartRequest setProvider(OssTypeEnum provider) {
        this.provider = provider;
        return this;
    }
 
    public String getFileType() {
        return fileType;
    }
 
    public FileUploadStartParam getParams() {
        return params;
    }
 
    public FileUploadStartRequest setParams(FileUploadStartParam params) {
        this.params = params;
        return this;
    }
 
    public String getRegion() {
        return region;
    }
 
    public FileUploadStartRequest setRegion(String region) {
        this.region = region;
        return this;
    }
}