software.amazon.awssdk.awscore.AwsResponse Java Examples

The following examples show how to use software.amazon.awssdk.awscore.AwsResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsServiceBaseResponseSpec.java    From aws-sdk-java-v2 with Apache License 2.0 6 votes vote down vote up
@Override
public TypeSpec poetSpec() {
    MethodSpec.Builder constructorBuilder =
        MethodSpec.constructorBuilder()
                  .addModifiers(Modifier.PROTECTED)
                  .addParameter(className().nestedClass("Builder"), "builder")
                  .addStatement("super(builder)");

    TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className())
                                       .addAnnotation(PoetUtils.generatedAnnotation())
                                       .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
                                       .superclass(ClassName.get(AwsResponse.class))
                                       .addType(builderInterfaceSpec())
                                       .addType(builderImplSpec());

    addResponseMetadata(classBuilder, constructorBuilder);

    classBuilder.addMethod(constructorBuilder.build());
    return classBuilder.build();
}
 
Example #2
Source File: AmazonWebServicesClientProxy.java    From cloudformation-cli-java-plugin with Apache License 2.0 6 votes vote down vote up
public <RequestT extends AwsRequest, ResultT extends AwsResponse>
    ResponseBytes<ResultT>
    injectCredentialsAndInvokeV2Bytes(final RequestT request,
                                      final Function<RequestT, ResponseBytes<ResultT>> requestFunction) {

    AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
        .credentialsProvider(v2CredentialsProvider).build();

    @SuppressWarnings("unchecked")
    RequestT wrappedRequest = (RequestT) request.toBuilder().overrideConfiguration(overrideConfiguration).build();

    try {
        ResponseBytes<ResultT> response = requestFunction.apply(wrappedRequest);
        logRequestMetadataV2(request, response.response());
        return response;
    } catch (final Throwable e) {
        loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage()));
        throw e;
    }
}
 
Example #3
Source File: AmazonWebServicesClientProxy.java    From cloudformation-cli-java-plugin with Apache License 2.0 6 votes vote down vote up
public <RequestT extends AwsRequest, ResultT extends AwsResponse>
    ResponseInputStream<ResultT>
    injectCredentialsAndInvokeV2InputStream(final RequestT request,
                                            final Function<RequestT, ResponseInputStream<ResultT>> requestFunction) {

    AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
        .credentialsProvider(v2CredentialsProvider).build();

    @SuppressWarnings("unchecked")
    RequestT wrappedRequest = (RequestT) request.toBuilder().overrideConfiguration(overrideConfiguration).build();

    try {
        ResponseInputStream<ResultT> response = requestFunction.apply(wrappedRequest);
        logRequestMetadataV2(request, response.response());
        return response;
    } catch (final Throwable e) {
        loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage()));
        throw e;
    }
}
 
Example #4
Source File: AmazonWebServicesClientProxy.java    From cloudformation-cli-java-plugin with Apache License 2.0 6 votes vote down vote up
public <RequestT extends AwsRequest, ResultT extends AwsResponse, IterableT extends SdkIterable<ResultT>>
    IterableT
    injectCredentialsAndInvokeIterableV2(final RequestT request, final Function<RequestT, IterableT> requestFunction) {

    AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
        .credentialsProvider(v2CredentialsProvider).build();

    @SuppressWarnings("unchecked")
    RequestT wrappedRequest = (RequestT) request.toBuilder().overrideConfiguration(overrideConfiguration).build();

    try {
        IterableT response = requestFunction.apply(wrappedRequest);
        response.forEach(r -> logRequestMetadataV2(request, r));
        return response;
    } catch (final Throwable e) {
        loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage()));
        throw e;
    }
}
 
Example #5
Source File: AmazonWebServicesClientProxy.java    From cloudformation-cli-java-plugin with Apache License 2.0 6 votes vote down vote up
public <RequestT extends AwsRequest, ResultT extends AwsResponse>
    CompletableFuture<ResultT>
    injectCredentialsAndInvokeV2Async(final RequestT request,
                                      final Function<RequestT, CompletableFuture<ResultT>> requestFunction) {

    AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
        .credentialsProvider(v2CredentialsProvider).build();

    @SuppressWarnings("unchecked")
    RequestT wrappedRequest = (RequestT) request.toBuilder().overrideConfiguration(overrideConfiguration).build();

    try {
        CompletableFuture<ResultT> response = requestFunction.apply(wrappedRequest).thenApplyAsync(resultT -> {
            logRequestMetadataV2(request, resultT);
            return resultT;
        });
        return response;
    } catch (final Throwable e) {
        loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage()));
        throw e;
    }
}
 
Example #6
Source File: AmazonWebServicesClientProxy.java    From cloudformation-cli-java-plugin with Apache License 2.0 6 votes vote down vote up
public <RequestT extends AwsRequest, ResultT extends AwsResponse>
    ResultT
    injectCredentialsAndInvokeV2(final RequestT request, final Function<RequestT, ResultT> requestFunction) {

    AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
        .credentialsProvider(v2CredentialsProvider).build();

    @SuppressWarnings("unchecked")
    RequestT wrappedRequest = (RequestT) request.toBuilder().overrideConfiguration(overrideConfiguration).build();

    try {
        ResultT response = requestFunction.apply(wrappedRequest);
        logRequestMetadataV2(request, response);
        return response;
    } catch (final Throwable e) {
        loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage()));
        throw e;
    }
}
 
Example #7
Source File: AwsServiceBaseResponseSpec.java    From aws-sdk-java-v2 with Apache License 2.0 6 votes vote down vote up
private TypeSpec builderImplSpec() {
    MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder()
                                                      .addModifiers(Modifier.PROTECTED)
                                                      .addParameter(className(), "response")
                                                      .addStatement("super(response)")
                                                      .addStatement("this.responseMetadata = response.responseMetadata()");

    TypeSpec.Builder classBuilder = TypeSpec.classBuilder("BuilderImpl")
                                       .addModifiers(Modifier.PROTECTED, Modifier.STATIC, Modifier.ABSTRACT)
                                       .addSuperinterface(className().nestedClass("Builder"))
                                       .superclass(ClassName.get(AwsResponse.class).nestedClass("BuilderImpl"))
                                       .addMethod(MethodSpec.constructorBuilder()
                                                            .addModifiers(Modifier.PROTECTED)
                                                            .build())
                                       .addMethod(constructorBuilder.build());

    addResponseMetadataToImpl(classBuilder);

    return classBuilder.build();
}
 
Example #8
Source File: AwsScanner.java    From clouditor with Apache License 2.0 6 votes vote down vote up
<O extends AwsResponse, R extends AwsRequest, S extends ToCopyableBuilder> void enrich(
    AssetProperties properties,
    String key,
    Function<R, O> listFunction,
    Function<O, S> valueFunction,
    R builder) {

  try {
    var response = listFunction.apply(builder);

    properties.put(
        key,
        MAPPER.convertValue(valueFunction.apply(response).toBuilder(), AssetProperties.class));
  } catch (AwsServiceException ex) {
    // ignore if error is 404, since this just means that the value is empty
    if (ex.statusCode() != 404) {
      LOGGER.info(
          "Got exception from {} while retrieving info for {}: {}",
          this.getClass(),
          key,
          ex.getMessage());
    }
  }
}
 
Example #9
Source File: AwsScanner.java    From clouditor with Apache License 2.0 6 votes vote down vote up
<O extends AwsResponse, R extends AwsRequest, S> void enrichSimple(
    Asset asset, String key, Function<R, O> function, Function<O, S> valueFunction, R builder) {
  try {
    var response = function.apply(builder);

    asset.setProperty(key, valueFunction.apply(response));
  } catch (AwsServiceException ex) {
    // ignore if error is 404, since this just means that the value is empty
    if (ex.awsErrorDetails().sdkHttpResponse().statusCode() != 404) {
      LOGGER.info(
          "Got exception from {} while retrieving info for {}: {}",
          this.getClass(),
          key,
          ex.getMessage());
    }
  }
}
 
Example #10
Source File: AwsServiceBaseResponseSpec.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
private TypeSpec builderInterfaceSpec() {
    TypeSpec.Builder builder = TypeSpec.interfaceBuilder("Builder")
                                       .addModifiers(Modifier.PUBLIC)
                                       .addSuperinterface(ClassName.get(AwsResponse.class).nestedClass("Builder"))
                                       .addMethod(MethodSpec.methodBuilder("build")
                                                            .addAnnotation(Override.class)
                                                            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
                                                            .returns(className())
                                                            .build());

    addResponseMetadataToInterface(builder);
    return builder.build();
}
 
Example #11
Source File: AwsScanner.java    From clouditor with Apache License 2.0 5 votes vote down vote up
<O extends AwsResponse, R extends AwsRequest, S extends ToCopyableBuilder> void enrich(
    Asset asset,
    String key,
    Function<R, O> listFunction,
    Function<O, S> valueFunction,
    R builder) {
  this.enrich(asset.getProperties(), key, listFunction, valueFunction, builder);
}
 
Example #12
Source File: TracingInterceptor.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
private String extractRequestIdFromResponse(SdkResponse response) {
    if (response instanceof AwsResponse) {
        return ((AwsResponse) response).responseMetadata().requestId();
    }

    return null;
}
 
Example #13
Source File: AmazonWebServicesClientProxyTest.java    From cloudformation-cli-java-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public <ResultT extends AwsResponse, IterableT extends SdkIterable<ResultT>> void testInjectCredentialsAndInvokeV2Iterable() {

    final LoggerProxy loggerProxy = mock(LoggerProxy.class);
    final Credentials credentials = new Credentials("accessKeyId", "secretAccessKey", "sessionToken");
    final ListObjectsV2Iterable response = mock(ListObjectsV2Iterable.class);

    final AmazonWebServicesClientProxy proxy = new AmazonWebServicesClientProxy(loggerProxy, credentials, () -> 1000L);

    final software.amazon.awssdk.services.s3.model.ListObjectsV2Request wrappedRequest = mock(
        software.amazon.awssdk.services.s3.model.ListObjectsV2Request.class);

    final software.amazon.awssdk.services.s3.model.ListObjectsV2Request.Builder builder = mock(
        software.amazon.awssdk.services.s3.model.ListObjectsV2Request.Builder.class);
    when(builder.overrideConfiguration(any(AwsRequestOverrideConfiguration.class))).thenReturn(builder);
    when(builder.build()).thenReturn(wrappedRequest);
    final software.amazon.awssdk.services.s3.model.ListObjectsV2Request request = mock(
        software.amazon.awssdk.services.s3.model.ListObjectsV2Request.class);
    when(request.toBuilder()).thenReturn(builder);

    final S3Client client = mock(S3Client.class);

    when(client.listObjectsV2Paginator(any(software.amazon.awssdk.services.s3.model.ListObjectsV2Request.class)))
        .thenReturn(response);

    final ListObjectsV2Iterable result = proxy.injectCredentialsAndInvokeIterableV2(request, client::listObjectsV2Paginator);

    // verify request is rebuilt for injection
    verify(request).toBuilder();

    // verify the wrapped request is sent over the initiate
    verify(client).listObjectsV2Paginator(wrappedRequest);

    // ensure the return type matches
    assertThat(result).isEqualTo(response);
}
 
Example #14
Source File: AmazonWebServicesClientProxy.java    From cloudformation-cli-java-plugin with Apache License 2.0 5 votes vote down vote up
private <RequestT extends AwsRequest, ResultT extends AwsResponse> void logRequestMetadataV2(final RequestT request,
                                                                                             final ResultT response) {
    try {
        String requestName = request.getClass().getSimpleName();
        String requestId = (response == null || response.responseMetadata() == null)
            ? ""
            : response.responseMetadata().requestId();
        loggerProxy
            .log(String.format("{\"apiRequest\": {\"requestId\": \"%s\", \"requestName\": \"%s\"}}", requestId, requestName));
    } catch (final Exception e) {
        loggerProxy.log(e.getMessage());
    }
}
 
Example #15
Source File: IntermediateModel.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
public String getSdkBaseResponseFqcn() {
    if (metadata.getProtocol() == Protocol.API_GATEWAY) {
        return "software.amazon.awssdk.opensdk.BaseResult";
    } else {
        return String.format("%s<%s>",
                             AwsResponse.class.getName(),
                             getResponseMetadataClassName());
    }
}
 
Example #16
Source File: AwsS3ProtocolFactory.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
private <T extends AwsResponse> HttpResponseHandler<Response<T>> createErrorCouldBeInBodyResponseHandler(
    Supplier<SdkPojo> pojoSupplier, XmlOperationMetadata staxOperationMetadata) {

    return new AwsXmlPredicatedResponseHandler<>(r -> pojoSupplier.get(),
                                                 createResponseTransformer(pojoSupplier),
                                                 createErrorTransformer(),
                                                 DecorateErrorFromResponseBodyUnmarshaller.of(this::getErrorRoot),
                                                 staxOperationMetadata.isHasStreamingSuccessResponse());
}
 
Example #17
Source File: AwsJsonResponseHandler.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public T handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) throws Exception {
    T result = responseHandler.handle(response, executionAttributes);

    // As T is not bounded to AwsResponse, we need to do explicitly cast here.
    if (result instanceof AwsResponse) {
        AwsResponseMetadata responseMetadata = generateResponseMetadata(response);
        return (T) ((AwsResponse) result).toBuilder().responseMetadata(responseMetadata).build();
    }

    return result;
}
 
Example #18
Source File: Translator.java    From cloudformation-cli-java-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Translates resource objects from sdk into a resource model (primary identifier only)
 * @param awsResponse the aws service describe resource response
 * @return list of resource models
 */
static List<ResourceModel> translateFromListRequest(final AwsResponse awsResponse) {
  // e.g. https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/blob/2077c92299aeb9a68ae8f4418b5e932b12a8b186/aws-logs-loggroup/src/main/java/com/aws/logs/loggroup/Translator.java#L75-L82
  return streamOfOrEmpty(Lists.newArrayList())
      .map(resource -> ResourceModel.builder()
          // include only primary identifier
          .build())
      .collect(Collectors.toList());
}
 
Example #19
Source File: Translator.java    From cloudformation-cli-java-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Translates resource object from sdk into a resource model
 * @param awsResponse the aws service describe resource response
 * @return model resource model
 */
static ResourceModel translateFromReadResponse(final AwsResponse awsResponse) {
  // e.g. https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/blob/2077c92299aeb9a68ae8f4418b5e932b12a8b186/aws-logs-loggroup/src/main/java/com/aws/logs/loggroup/Translator.java#L58-L73
  return ResourceModel.builder()
      //.someProperty(response.property())
      .build();
}
 
Example #20
Source File: AwsScanner.java    From clouditor with Apache License 2.0 5 votes vote down vote up
<O extends AwsResponse, R extends AwsRequest, S extends ToCopyableBuilder> void enrichList(
    Asset asset,
    String key,
    Function<R, O> listFunction,
    Function<O, List<S>> valueFunction,
    R builder) {
  try {
    var response = listFunction.apply(builder);

    var list = valueFunction.apply(response);

    asset.setProperty(
        key,
        list.stream()
            .map(x -> MAPPER.convertValue(x.toBuilder(), AssetProperties.class))
            .collect(Collectors.toList()));
  } catch (AwsServiceException ex) {
    // ignore if error is 404, since this just means that the value is empty
    if (ex.statusCode() != 404) {
      LOGGER.info(
          "Got exception from {} while retrieving info for {}: {}",
          this.getClass(),
          key,
          ex.getMessage());
    }
  }
}
 
Example #21
Source File: SdkHttpResponseTest.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
private void verifySdkHttpResponse(AwsResponse response) {
    SdkHttpResponse sdkHttpResponse = response.sdkHttpResponse();
    assertThat(sdkHttpResponse.statusCode()).isEqualTo(200);
    assertThat(sdkHttpResponse.statusText().get()).isEqualTo(STATUS_TEXT);
    EXPECTED_HEADERS.entrySet().forEach(entry -> assertThat(sdkHttpResponse.headers()).contains(entry));
}
 
Example #22
Source File: StubReadHandler.java    From cloudformation-cli-java-plugin with Apache License 2.0 4 votes vote down vote up
protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
    final AmazonWebServicesClientProxy proxy,
    final ResourceHandlerRequest<ResourceModel> request,
    final CallbackContext callbackContext,
    final ProxyClient<SdkClient> proxyClient,
    final Logger logger) {

    this.logger = logger;

    // TODO: Adjust Progress Chain according to your implementation
    // https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/blob/master/src/main/java/software/amazon/cloudformation/proxy/CallChain.java

    // STEP 1 [initialize a proxy context]
    return proxy.initiate("{{ call_graph }}::{{ operation }}", proxyClient, request.getDesiredResourceState(), callbackContext)

        // STEP 2 [TODO: construct a body of a request]
        .translateToServiceRequest(Translator::translateToReadRequest)

        // STEP 3 [TODO: make an api call]
        // Implement client invocation of the read request through the proxyClient, which is already initialised with
        // caller credentials, correct region and retry settings
        .makeServiceCall((awsRequest, client) -> {
            AwsResponse awsResponse = null;
            try {

                // TODO: add custom read resource logic

            } catch (final AwsServiceException e) { // ResourceNotFoundException
                /*
                * While the handler contract states that the handler must always return a progress event,
                * you may throw any instance of BaseHandlerException, as the wrapper map it to a progress event.
                * Each BaseHandlerException maps to a specific error code, and you should map service exceptions as closely as possible
                * to more specific error codes
                */
                throw new CfnGeneralServiceException(ResourceModel.TYPE_NAME, e); // e.g. https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/commit/2077c92299aeb9a68ae8f4418b5e932b12a8b186#diff-5761e3a9f732dc1ef84103dc4bc93399R56-R63
            }

            logger.log(String.format("%s has successfully been read.", ResourceModel.TYPE_NAME));
            return awsResponse;
        })

        // STEP 4 [TODO: gather all properties of the resource]
        // Implement client invocation of the read request through the proxyClient, which is already initialised with
        // caller credentials, correct region and retry settings
        .done(awsResponse -> ProgressEvent.defaultSuccessHandler(Translator.translateFromReadResponse(awsResponse)));
}
 
Example #23
Source File: AwsXmlProtocolFactory.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public <T extends AwsResponse> HttpResponseHandler<T> createResponseHandler(Supplier<SdkPojo> pojoSupplier,
                                                                            XmlOperationMetadata staxOperationMetadata) {
    return new AwsXmlResponseHandler<>(
        XML_PROTOCOL_UNMARSHALLER, r -> pojoSupplier.get(),
        staxOperationMetadata.isHasStreamingSuccessResponse());
}
 
Example #24
Source File: AwsXmlProtocolFactory.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
protected <T extends AwsResponse> Function<AwsXmlUnmarshallingContext, T> createResponseTransformer(
    Supplier<SdkPojo> pojoSupplier) {

    return new AwsXmlResponseTransformer<>(
        XML_PROTOCOL_UNMARSHALLER, r -> pojoSupplier.get());
}
 
Example #25
Source File: AwsXmlProtocolFactory.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
public <T extends AwsResponse> HttpResponseHandler<Response<T>> createCombinedResponseHandler(
    Supplier<SdkPojo> pojoSupplier, XmlOperationMetadata staxOperationMetadata) {

    return new CombinedResponseHandler<>(createResponseHandler(pojoSupplier, staxOperationMetadata),
                                         createErrorResponseHandler());
}
 
Example #26
Source File: AwsS3ProtocolFactory.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public <T extends AwsResponse> HttpResponseHandler<Response<T>> createCombinedResponseHandler(
    Supplier<SdkPojo> pojoSupplier, XmlOperationMetadata staxOperationMetadata) {

    return createErrorCouldBeInBodyResponseHandler(pojoSupplier, staxOperationMetadata);
}
 
Example #27
Source File: ProxyClient.java    From cloudformation-cli-java-plugin with Apache License 2.0 3 votes vote down vote up
/**
 * This is a synchronous version of making API calls which implement
 * ResponseInputStream in the SDKv2
 *
 * @param request, the AWS service request that we need to make
 * @param requestFunction, this is a Lambda closure that provide the actual API
 *            that needs to be invoked.
 * @param <RequestT> the request type
 * @param <ResponseT> the response from the request
 * @return the response if successful. Else it will propagate all
 *         {@link software.amazon.awssdk.awscore.exception.AwsServiceException}
 *         that is thrown or
 *         {@link software.amazon.awssdk.core.exception.SdkClientException} if
 *         there is client side problem
 */
default <RequestT extends AwsRequest, ResponseT extends AwsResponse>
    ResponseInputStream<ResponseT>
    injectCredentialsAndInvokeV2InputStream(RequestT request,
                                            Function<RequestT, ResponseInputStream<ResponseT>> requestFunction) {
    throw new UnsupportedOperationException();
}
 
Example #28
Source File: AwsQueryProtocolFactory.java    From aws-sdk-java-v2 with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the success response handler to unmarshall the response into a POJO.
 *
 * @param pojoSupplier Supplier of the POJO builder we are unmarshalling into.
 * @param <T> Type being unmarshalled.
 * @return New {@link HttpResponseHandler} for success responses.
 */
public final <T extends AwsResponse> HttpResponseHandler<T> createResponseHandler(Supplier<SdkPojo> pojoSupplier) {
    return new AwsQueryResponseHandler<>(QueryProtocolUnmarshaller.builder()
                                                                  .hasResultWrapper(!isEc2())
                                                                  .build(),
        r -> pojoSupplier.get());
}
 
Example #29
Source File: ProxyClient.java    From cloudformation-cli-java-plugin with Apache License 2.0 2 votes vote down vote up
/**
 * This is a synchronous version of making API calls which implement
 * ResponseBytes in the SDKv2
 *
 * @param request, the AWS service request that we need to make
 * @param requestFunction, this is a Lambda closure that provide the actual API
 *            that needs to be invoked.
 * @param <RequestT> the request type
 * @param <ResponseT> the response from the request
 * @return the response if successful. Else it will propagate all
 *         {@link software.amazon.awssdk.awscore.exception.AwsServiceException}
 *         that is thrown or
 *         {@link software.amazon.awssdk.core.exception.SdkClientException} if
 *         there is client side problem
 */
default <RequestT extends AwsRequest, ResponseT extends AwsResponse>
    ResponseBytes<ResponseT>
    injectCredentialsAndInvokeV2Bytes(RequestT request, Function<RequestT, ResponseBytes<ResponseT>> requestFunction) {
    throw new UnsupportedOperationException();
}
 
Example #30
Source File: ProxyClient.java    From cloudformation-cli-java-plugin with Apache License 2.0 2 votes vote down vote up
/**
 * This is a synchronous version of making API calls which implement Iterable in
 * the SDKv2
 *
 * @param request, the AWS service request that we need to make
 * @param requestFunction, this is a Lambda closure that provide the actual API
 *            that needs to be invoked.
 * @param <RequestT> the request type
 * @param <ResponseT> the response from the request
 * @param <IterableT> the iterable collection from the response
 * @return the response if successful. Else it will propagate all
 *         {@link software.amazon.awssdk.awscore.exception.AwsServiceException}
 *         that is thrown or
 *         {@link software.amazon.awssdk.core.exception.SdkClientException} if
 *         there is client side problem
 */
default <RequestT extends AwsRequest, ResponseT extends AwsResponse, IterableT extends SdkIterable<ResponseT>>
    IterableT
    injectCredentialsAndInvokeIterableV2(RequestT request, Function<RequestT, IterableT> requestFunction) {
    throw new UnsupportedOperationException();
}