|
29 | 29 |
|
30 | 30 | import com.volcengine.sts.model.AssumeRoleRequest; |
31 | 31 | import com.volcengine.sts.model.AssumeRoleResponse; |
| 32 | +import com.volcengine.sts.model.GetCallerIdentityRequest; |
| 33 | +import com.volcengine.sts.model.GetCallerIdentityResponse; |
32 | 34 |
|
33 | 35 | import java.lang.reflect.Type; |
34 | 36 | import java.util.ArrayList; |
@@ -179,4 +181,128 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don |
179 | 181 | apiClient.executeAsync(call, localVarReturnType, callback); |
180 | 182 | return call; |
181 | 183 | } |
| 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<GetCallerIdentityResponse> |
| 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 | + } |
182 | 308 | } |
0 commit comments