Skip to content

Commit 5ef9ec8

Browse files
author
BitsAdmin
committed
Merge branch 'sts-Java-2018-01-01-online-1781-2025_11_05_14_26_34' into 'integration_2025-11-06_1076839247618'
feat: [development task] sts-1781-Java (1806255) See merge request iaasng/volcengine-java-sdk!726
2 parents 35b5490 + b98795b commit 5ef9ec8

File tree

3 files changed

+353
-0
lines changed

3 files changed

+353
-0
lines changed

volcengine-java-sdk-sts/src/main/java/com/volcengine/sts/StsApi.java

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
import com.volcengine.sts.model.AssumeRoleRequest;
3131
import com.volcengine.sts.model.AssumeRoleResponse;
32+
import com.volcengine.sts.model.GetCallerIdentityRequest;
33+
import com.volcengine.sts.model.GetCallerIdentityResponse;
3234

3335
import java.lang.reflect.Type;
3436
import java.util.ArrayList;
@@ -179,4 +181,128 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
179181
apiClient.executeAsync(call, localVarReturnType, callback);
180182
return call;
181183
}
184+
/**
185+
* Build call for getCallerIdentity
186+
* @param body (required)
187+
* @param progressListener Progress listener
188+
* @param progressRequestListener Progress request listener
189+
* @return Call to execute
190+
* @throws ApiException If fail to serialize the request body object
191+
*/
192+
public com.squareup.okhttp.Call getCallerIdentityCall(GetCallerIdentityRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
193+
Object localVarPostBody = body;
194+
195+
// create path and map variables
196+
String localVarPath = "/GetCallerIdentity/2018-01-01/sts/post/application_x-www-form-urlencoded/";
197+
198+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
199+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
200+
201+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
202+
203+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
204+
205+
final String[] localVarAccepts = {
206+
"application/json"
207+
};
208+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
209+
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
210+
211+
final String[] localVarContentTypes = {
212+
"text/plain"
213+
};
214+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
215+
localVarHeaderParams.put("Content-Type", localVarContentType);
216+
217+
if(progressListener != null) {
218+
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
219+
@Override
220+
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
221+
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
222+
return originalResponse.newBuilder()
223+
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
224+
.build();
225+
}
226+
});
227+
}
228+
229+
String[] localVarAuthNames = new String[] { "volcengineSign" };
230+
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
231+
}
232+
233+
@SuppressWarnings("rawtypes")
234+
private com.squareup.okhttp.Call getCallerIdentityValidateBeforeCall(GetCallerIdentityRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
235+
// verify the required parameter 'body' is set
236+
if (body == null) {
237+
throw new ApiException("Missing the required parameter 'body' when calling getCallerIdentity(Async)");
238+
}
239+
240+
com.squareup.okhttp.Call call = getCallerIdentityCall(body, progressListener, progressRequestListener);
241+
return call;
242+
243+
244+
245+
246+
247+
}
248+
249+
/**
250+
*
251+
*
252+
* @param body (required)
253+
* @return GetCallerIdentityResponse
254+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
255+
*/
256+
public GetCallerIdentityResponse getCallerIdentity(GetCallerIdentityRequest body) throws ApiException {
257+
ApiResponse<GetCallerIdentityResponse> resp = getCallerIdentityWithHttpInfo(body);
258+
return resp.getData();
259+
}
260+
261+
/**
262+
*
263+
*
264+
* @param body (required)
265+
* @return ApiResponse&lt;GetCallerIdentityResponse&gt;
266+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
267+
*/
268+
public ApiResponse<GetCallerIdentityResponse> getCallerIdentityWithHttpInfo( @NotNull GetCallerIdentityRequest body) throws ApiException {
269+
com.squareup.okhttp.Call call = getCallerIdentityValidateBeforeCall(body, null, null);
270+
Type localVarReturnType = new TypeToken<GetCallerIdentityResponse>(){}.getType();
271+
return apiClient.execute(call, localVarReturnType);
272+
}
273+
274+
/**
275+
* (asynchronously)
276+
*
277+
* @param body (required)
278+
* @param callback The callback to be executed when the API call finishes
279+
* @return The request call
280+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
281+
*/
282+
public com.squareup.okhttp.Call getCallerIdentityAsync(GetCallerIdentityRequest body, final ApiCallback<GetCallerIdentityResponse> callback) throws ApiException {
283+
284+
ProgressResponseBody.ProgressListener progressListener = null;
285+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
286+
287+
if (callback != null) {
288+
progressListener = new ProgressResponseBody.ProgressListener() {
289+
@Override
290+
public void update(long bytesRead, long contentLength, boolean done) {
291+
callback.onDownloadProgress(bytesRead, contentLength, done);
292+
}
293+
};
294+
295+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
296+
@Override
297+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
298+
callback.onUploadProgress(bytesWritten, contentLength, done);
299+
}
300+
};
301+
}
302+
303+
com.squareup.okhttp.Call call = getCallerIdentityValidateBeforeCall(body, progressListener, progressRequestListener);
304+
Type localVarReturnType = new TypeToken<GetCallerIdentityResponse>(){}.getType();
305+
apiClient.executeAsync(call, localVarReturnType, callback);
306+
return call;
307+
}
182308
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* sts
3+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4+
*
5+
* OpenAPI spec version: common-version
6+
*
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package com.volcengine.sts.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import javax.validation.constraints.*;
18+
import javax.validation.Valid;
19+
/**
20+
* GetCallerIdentityRequest
21+
*/
22+
23+
24+
25+
public class GetCallerIdentityRequest {
26+
27+
@Override
28+
public boolean equals(java.lang.Object o) {
29+
if (this == o) {
30+
return true;
31+
}
32+
if (o == null || getClass() != o.getClass()) {
33+
return false;
34+
}
35+
return true;
36+
}
37+
38+
@Override
39+
public int hashCode() {
40+
return Objects.hash();
41+
}
42+
43+
44+
@Override
45+
public String toString() {
46+
StringBuilder sb = new StringBuilder();
47+
sb.append("class GetCallerIdentityRequest {\n");
48+
49+
sb.append("}");
50+
return sb.toString();
51+
}
52+
53+
/**
54+
* Convert the given object to string with each line indented by 4 spaces
55+
* (except the first line).
56+
*/
57+
private String toIndentedString(java.lang.Object o) {
58+
if (o == null) {
59+
return "null";
60+
}
61+
return o.toString().replace("\n", "\n ");
62+
}
63+
64+
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
/*
2+
* sts
3+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4+
*
5+
* OpenAPI spec version: common-version
6+
*
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package com.volcengine.sts.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import com.google.gson.TypeAdapter;
18+
import com.google.gson.annotations.JsonAdapter;
19+
import com.google.gson.annotations.SerializedName;
20+
import com.google.gson.stream.JsonReader;
21+
import com.google.gson.stream.JsonWriter;
22+
import io.swagger.v3.oas.annotations.media.Schema;
23+
import java.io.IOException;
24+
import javax.validation.constraints.*;
25+
import javax.validation.Valid;
26+
/**
27+
* GetCallerIdentityResponse
28+
*/
29+
30+
31+
32+
public class GetCallerIdentityResponse extends com.volcengine.model.AbstractResponse {
33+
@SerializedName("AccountId")
34+
private Long accountId = null;
35+
36+
@SerializedName("IdentityId")
37+
private String identityId = null;
38+
39+
@SerializedName("IdentityType")
40+
private String identityType = null;
41+
42+
@SerializedName("Trn")
43+
private String trn = null;
44+
45+
public GetCallerIdentityResponse accountId(Long accountId) {
46+
this.accountId = accountId;
47+
return this;
48+
}
49+
50+
/**
51+
* Get accountId
52+
* @return accountId
53+
**/
54+
@Schema(description = "")
55+
public Long getAccountId() {
56+
return accountId;
57+
}
58+
59+
public void setAccountId(Long accountId) {
60+
this.accountId = accountId;
61+
}
62+
63+
public GetCallerIdentityResponse identityId(String identityId) {
64+
this.identityId = identityId;
65+
return this;
66+
}
67+
68+
/**
69+
* Get identityId
70+
* @return identityId
71+
**/
72+
@Schema(description = "")
73+
public String getIdentityId() {
74+
return identityId;
75+
}
76+
77+
public void setIdentityId(String identityId) {
78+
this.identityId = identityId;
79+
}
80+
81+
public GetCallerIdentityResponse identityType(String identityType) {
82+
this.identityType = identityType;
83+
return this;
84+
}
85+
86+
/**
87+
* Get identityType
88+
* @return identityType
89+
**/
90+
@Schema(description = "")
91+
public String getIdentityType() {
92+
return identityType;
93+
}
94+
95+
public void setIdentityType(String identityType) {
96+
this.identityType = identityType;
97+
}
98+
99+
public GetCallerIdentityResponse trn(String trn) {
100+
this.trn = trn;
101+
return this;
102+
}
103+
104+
/**
105+
* Get trn
106+
* @return trn
107+
**/
108+
@Schema(description = "")
109+
public String getTrn() {
110+
return trn;
111+
}
112+
113+
public void setTrn(String trn) {
114+
this.trn = trn;
115+
}
116+
117+
118+
@Override
119+
public boolean equals(java.lang.Object o) {
120+
if (this == o) {
121+
return true;
122+
}
123+
if (o == null || getClass() != o.getClass()) {
124+
return false;
125+
}
126+
GetCallerIdentityResponse getCallerIdentityResponse = (GetCallerIdentityResponse) o;
127+
return Objects.equals(this.accountId, getCallerIdentityResponse.accountId) &&
128+
Objects.equals(this.identityId, getCallerIdentityResponse.identityId) &&
129+
Objects.equals(this.identityType, getCallerIdentityResponse.identityType) &&
130+
Objects.equals(this.trn, getCallerIdentityResponse.trn);
131+
}
132+
133+
@Override
134+
public int hashCode() {
135+
return Objects.hash(accountId, identityId, identityType, trn);
136+
}
137+
138+
139+
@Override
140+
public String toString() {
141+
StringBuilder sb = new StringBuilder();
142+
sb.append("class GetCallerIdentityResponse {\n");
143+
144+
sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n");
145+
sb.append(" identityId: ").append(toIndentedString(identityId)).append("\n");
146+
sb.append(" identityType: ").append(toIndentedString(identityType)).append("\n");
147+
sb.append(" trn: ").append(toIndentedString(trn)).append("\n");
148+
sb.append("}");
149+
return sb.toString();
150+
}
151+
152+
/**
153+
* Convert the given object to string with each line indented by 4 spaces
154+
* (except the first line).
155+
*/
156+
private String toIndentedString(java.lang.Object o) {
157+
if (o == null) {
158+
return "null";
159+
}
160+
return o.toString().replace("\n", "\n ");
161+
}
162+
163+
}

0 commit comments

Comments
 (0)