software.amazon.awssdk.services.iottwinmaker.DefaultIoTTwinMakerAsyncClient Maven / Gradle / Ivy
Show all versions of iottwinmaker Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.iottwinmaker;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.iottwinmaker.model.AccessDeniedException;
import software.amazon.awssdk.services.iottwinmaker.model.BatchPutPropertyValuesRequest;
import software.amazon.awssdk.services.iottwinmaker.model.BatchPutPropertyValuesResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ConflictException;
import software.amazon.awssdk.services.iottwinmaker.model.ConnectorFailureException;
import software.amazon.awssdk.services.iottwinmaker.model.ConnectorTimeoutException;
import software.amazon.awssdk.services.iottwinmaker.model.CreateComponentTypeRequest;
import software.amazon.awssdk.services.iottwinmaker.model.CreateComponentTypeResponse;
import software.amazon.awssdk.services.iottwinmaker.model.CreateEntityRequest;
import software.amazon.awssdk.services.iottwinmaker.model.CreateEntityResponse;
import software.amazon.awssdk.services.iottwinmaker.model.CreateSceneRequest;
import software.amazon.awssdk.services.iottwinmaker.model.CreateSceneResponse;
import software.amazon.awssdk.services.iottwinmaker.model.CreateSyncJobRequest;
import software.amazon.awssdk.services.iottwinmaker.model.CreateSyncJobResponse;
import software.amazon.awssdk.services.iottwinmaker.model.CreateWorkspaceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.CreateWorkspaceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteComponentTypeRequest;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteComponentTypeResponse;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteEntityRequest;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteEntityResponse;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteSceneRequest;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteSceneResponse;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteSyncJobRequest;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteSyncJobResponse;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteWorkspaceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.DeleteWorkspaceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ExecuteQueryRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ExecuteQueryResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetComponentTypeRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetComponentTypeResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetEntityRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetEntityResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetPricingPlanRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetPricingPlanResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueHistoryRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueHistoryResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetSceneRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetSceneResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetSyncJobRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetSyncJobResponse;
import software.amazon.awssdk.services.iottwinmaker.model.GetWorkspaceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.GetWorkspaceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.InternalServerException;
import software.amazon.awssdk.services.iottwinmaker.model.IoTTwinMakerException;
import software.amazon.awssdk.services.iottwinmaker.model.IoTTwinMakerRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListComponentTypesRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListComponentTypesResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ListEntitiesRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListEntitiesResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ListScenesRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListScenesResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ListSyncJobsRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListSyncJobsResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ListSyncResourcesRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListSyncResourcesResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ListWorkspacesRequest;
import software.amazon.awssdk.services.iottwinmaker.model.ListWorkspacesResponse;
import software.amazon.awssdk.services.iottwinmaker.model.QueryTimeoutException;
import software.amazon.awssdk.services.iottwinmaker.model.ResourceNotFoundException;
import software.amazon.awssdk.services.iottwinmaker.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.iottwinmaker.model.TagResourceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.TagResourceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ThrottlingException;
import software.amazon.awssdk.services.iottwinmaker.model.TooManyTagsException;
import software.amazon.awssdk.services.iottwinmaker.model.UntagResourceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.UntagResourceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateComponentTypeRequest;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateComponentTypeResponse;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateEntityRequest;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateEntityResponse;
import software.amazon.awssdk.services.iottwinmaker.model.UpdatePricingPlanRequest;
import software.amazon.awssdk.services.iottwinmaker.model.UpdatePricingPlanResponse;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateSceneRequest;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateSceneResponse;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateWorkspaceRequest;
import software.amazon.awssdk.services.iottwinmaker.model.UpdateWorkspaceResponse;
import software.amazon.awssdk.services.iottwinmaker.model.ValidationException;
import software.amazon.awssdk.services.iottwinmaker.paginators.ExecuteQueryPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.GetPropertyValueHistoryPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.GetPropertyValuePublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.ListComponentTypesPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.ListEntitiesPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.ListScenesPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.ListSyncJobsPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.ListSyncResourcesPublisher;
import software.amazon.awssdk.services.iottwinmaker.paginators.ListWorkspacesPublisher;
import software.amazon.awssdk.services.iottwinmaker.transform.BatchPutPropertyValuesRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.CreateComponentTypeRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.CreateEntityRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.CreateSceneRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.CreateSyncJobRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.CreateWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.DeleteComponentTypeRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.DeleteEntityRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.DeleteSceneRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.DeleteSyncJobRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.DeleteWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ExecuteQueryRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetComponentTypeRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetEntityRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetPricingPlanRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetPropertyValueHistoryRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetPropertyValueRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetSceneRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetSyncJobRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.GetWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListComponentTypesRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListEntitiesRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListScenesRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListSyncJobsRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListSyncResourcesRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.ListWorkspacesRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.UpdateComponentTypeRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.UpdateEntityRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.UpdatePricingPlanRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.UpdateSceneRequestMarshaller;
import software.amazon.awssdk.services.iottwinmaker.transform.UpdateWorkspaceRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link IoTTwinMakerAsyncClient}.
*
* @see IoTTwinMakerAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultIoTTwinMakerAsyncClient implements IoTTwinMakerAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultIoTTwinMakerAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
private final IoTTwinMakerServiceClientConfiguration serviceClientConfiguration;
protected DefaultIoTTwinMakerAsyncClient(IoTTwinMakerServiceClientConfiguration serviceClientConfiguration,
SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.serviceClientConfiguration = serviceClientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Sets values for multiple time series properties.
*
*
* @param batchPutPropertyValuesRequest
* @return A Java Future containing the result of the BatchPutPropertyValues operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.BatchPutPropertyValues
* @see AWS API Documentation
*/
@Override
public CompletableFuture batchPutPropertyValues(
BatchPutPropertyValuesRequest batchPutPropertyValuesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, batchPutPropertyValuesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchPutPropertyValues");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchPutPropertyValuesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "data.";
String resolvedHostExpression = "data.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("BatchPutPropertyValues")
.withMarshaller(new BatchPutPropertyValuesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(batchPutPropertyValuesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a component type.
*
*
* @param createComponentTypeRequest
* @return A Java Future containing the result of the CreateComponentType operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConflictException A conflict occurred.
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.CreateComponentType
* @see AWS API Documentation
*/
@Override
public CompletableFuture createComponentType(
CreateComponentTypeRequest createComponentTypeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createComponentTypeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateComponentType");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateComponentTypeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateComponentType")
.withMarshaller(new CreateComponentTypeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(createComponentTypeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates an entity.
*
*
* @param createEntityRequest
* @return A Java Future containing the result of the CreateEntity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConflictException A conflict occurred.
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.CreateEntity
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createEntity(CreateEntityRequest createEntityRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createEntityRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateEntity");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateEntityResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateEntity").withMarshaller(new CreateEntityRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(createEntityRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a scene.
*
*
* @param createSceneRequest
* @return A Java Future containing the result of the CreateScene operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConflictException A conflict occurred.
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.CreateScene
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createScene(CreateSceneRequest createSceneRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSceneRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateScene");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateSceneResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateScene").withMarshaller(new CreateSceneRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(createSceneRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* This action creates a SyncJob.
*
*
* @param createSyncJobRequest
* @return A Java Future containing the result of the CreateSyncJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConflictException A conflict occurred.
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.CreateSyncJob
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createSyncJob(CreateSyncJobRequest createSyncJobRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSyncJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSyncJob");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateSyncJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSyncJob")
.withMarshaller(new CreateSyncJobRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(createSyncJobRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a workplace.
*
*
* @param createWorkspaceRequest
* @return A Java Future containing the result of the CreateWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConflictException A conflict occurred.
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.CreateWorkspace
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createWorkspace(CreateWorkspaceRequest createWorkspaceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createWorkspaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateWorkspace");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateWorkspaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateWorkspace")
.withMarshaller(new CreateWorkspaceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(createWorkspaceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a component type.
*
*
* @param deleteComponentTypeRequest
* @return A Java Future containing the result of the DeleteComponentType operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.DeleteComponentType
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteComponentType(
DeleteComponentTypeRequest deleteComponentTypeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteComponentTypeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteComponentType");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteComponentTypeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteComponentType")
.withMarshaller(new DeleteComponentTypeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(deleteComponentTypeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes an entity.
*
*
* @param deleteEntityRequest
* @return A Java Future containing the result of the DeleteEntity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.DeleteEntity
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteEntity(DeleteEntityRequest deleteEntityRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteEntityRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteEntity");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteEntityResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteEntity").withMarshaller(new DeleteEntityRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(deleteEntityRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a scene.
*
*
* @param deleteSceneRequest
* @return A Java Future containing the result of the DeleteScene operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.DeleteScene
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteScene(DeleteSceneRequest deleteSceneRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSceneRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteScene");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteSceneResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteScene").withMarshaller(new DeleteSceneRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(deleteSceneRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Delete the SyncJob.
*
*
* @param deleteSyncJobRequest
* @return A Java Future containing the result of the DeleteSyncJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.DeleteSyncJob
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteSyncJob(DeleteSyncJobRequest deleteSyncJobRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSyncJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSyncJob");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteSyncJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSyncJob")
.withMarshaller(new DeleteSyncJobRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(deleteSyncJobRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a workspace.
*
*
* @param deleteWorkspaceRequest
* @return A Java Future containing the result of the DeleteWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.DeleteWorkspace
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteWorkspace(DeleteWorkspaceRequest deleteWorkspaceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWorkspaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWorkspace");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteWorkspaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteWorkspace")
.withMarshaller(new DeleteWorkspaceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(deleteWorkspaceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Run queries to access information from your knowledge graph of entities within individual workspaces.
*
*
* @param executeQueryRequest
* @return A Java Future containing the result of the ExecuteQuery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - QueryTimeoutException The query timeout exception.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ExecuteQuery
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture executeQuery(ExecuteQueryRequest executeQueryRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, executeQueryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExecuteQuery");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ExecuteQueryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ExecuteQuery").withMarshaller(new ExecuteQueryRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(executeQueryRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Run queries to access information from your knowledge graph of entities within individual workspaces.
*
*
*
* This is a variant of
* {@link #executeQuery(software.amazon.awssdk.services.iottwinmaker.model.ExecuteQueryRequest)} operation. The
* return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ExecuteQueryPublisher publisher = client.executeQueryPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ExecuteQueryPublisher publisher = client.executeQueryPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ExecuteQueryResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #executeQuery(software.amazon.awssdk.services.iottwinmaker.model.ExecuteQueryRequest)} operation.
*
*
* @param executeQueryRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - QueryTimeoutException The query timeout exception.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ExecuteQuery
* @see AWS API
* Documentation
*/
public ExecuteQueryPublisher executeQueryPaginator(ExecuteQueryRequest executeQueryRequest) {
return new ExecuteQueryPublisher(this, applyPaginatorUserAgent(executeQueryRequest));
}
/**
*
* Retrieves information about a component type.
*
*
* @param getComponentTypeRequest
* @return A Java Future containing the result of the GetComponentType operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetComponentType
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getComponentType(GetComponentTypeRequest getComponentTypeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getComponentTypeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetComponentType");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetComponentTypeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetComponentType")
.withMarshaller(new GetComponentTypeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(getComponentTypeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about an entity.
*
*
* @param getEntityRequest
* @return A Java Future containing the result of the GetEntity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetEntity
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getEntity(GetEntityRequest getEntityRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getEntityRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEntity");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetEntityResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetEntity")
.withMarshaller(new GetEntityRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.hostPrefixExpression(resolvedHostExpression).withInput(getEntityRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the pricing plan.
*
*
* @param getPricingPlanRequest
* @return A Java Future containing the result of the GetPricingPlan operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetPricingPlan
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getPricingPlan(GetPricingPlanRequest getPricingPlanRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getPricingPlanRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPricingPlan");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetPricingPlanResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetPricingPlan")
.withMarshaller(new GetPricingPlanRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(getPricingPlanRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the property values for a component, component type, entity, or workspace.
*
*
* You must specify a value for either componentName
, componentTypeId
,
* entityId
, or workspaceId
.
*
*
* @param getPropertyValueRequest
* @return A Java Future containing the result of the GetPropertyValue operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ConnectorFailureException The connector failed.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConnectorTimeoutException The connector timed out.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetPropertyValue
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getPropertyValue(GetPropertyValueRequest getPropertyValueRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getPropertyValueRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPropertyValue");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetPropertyValueResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "data.";
String resolvedHostExpression = "data.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetPropertyValue")
.withMarshaller(new GetPropertyValueRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(getPropertyValueRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the history of a time series property value for a component, component type, entity,
* or workspace.
*
*
* You must specify a value for workspaceId
. For entity-specific queries, specify values for
* componentName
and entityId
. For cross-entity quries, specify a value for
* componentTypeId
.
*
*
* @param getPropertyValueHistoryRequest
* @return A Java Future containing the result of the GetPropertyValueHistory operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ConnectorFailureException The connector failed.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConnectorTimeoutException The connector timed out.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetPropertyValueHistory
* @see AWS API Documentation
*/
@Override
public CompletableFuture getPropertyValueHistory(
GetPropertyValueHistoryRequest getPropertyValueHistoryRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getPropertyValueHistoryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPropertyValueHistory");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetPropertyValueHistoryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "data.";
String resolvedHostExpression = "data.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetPropertyValueHistory")
.withMarshaller(new GetPropertyValueHistoryRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(getPropertyValueHistoryRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the history of a time series property value for a component, component type, entity,
* or workspace.
*
*
* You must specify a value for workspaceId
. For entity-specific queries, specify values for
* componentName
and entityId
. For cross-entity quries, specify a value for
* componentTypeId
.
*
*
*
* This is a variant of
* {@link #getPropertyValueHistory(software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueHistoryRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.GetPropertyValueHistoryPublisher publisher = client.getPropertyValueHistoryPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.GetPropertyValueHistoryPublisher publisher = client.getPropertyValueHistoryPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueHistoryResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getPropertyValueHistory(software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueHistoryRequest)}
* operation.
*
*
* @param getPropertyValueHistoryRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ConnectorFailureException The connector failed.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConnectorTimeoutException The connector timed out.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetPropertyValueHistory
* @see AWS API Documentation
*/
public GetPropertyValueHistoryPublisher getPropertyValueHistoryPaginator(
GetPropertyValueHistoryRequest getPropertyValueHistoryRequest) {
return new GetPropertyValueHistoryPublisher(this, applyPaginatorUserAgent(getPropertyValueHistoryRequest));
}
/**
*
* Gets the property values for a component, component type, entity, or workspace.
*
*
* You must specify a value for either componentName
, componentTypeId
,
* entityId
, or workspaceId
.
*
*
*
* This is a variant of
* {@link #getPropertyValue(software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueRequest)} operation.
* The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.GetPropertyValuePublisher publisher = client.getPropertyValuePaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.GetPropertyValuePublisher publisher = client.getPropertyValuePaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getPropertyValue(software.amazon.awssdk.services.iottwinmaker.model.GetPropertyValueRequest)}
* operation.
*
*
* @param getPropertyValueRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ConnectorFailureException The connector failed.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConnectorTimeoutException The connector timed out.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetPropertyValue
* @see AWS
* API Documentation
*/
public GetPropertyValuePublisher getPropertyValuePaginator(GetPropertyValueRequest getPropertyValueRequest) {
return new GetPropertyValuePublisher(this, applyPaginatorUserAgent(getPropertyValueRequest));
}
/**
*
* Retrieves information about a scene.
*
*
* @param getSceneRequest
* @return A Java Future containing the result of the GetScene operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetScene
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getScene(GetSceneRequest getSceneRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSceneRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetScene");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSceneResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetScene")
.withMarshaller(new GetSceneRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.hostPrefixExpression(resolvedHostExpression).withInput(getSceneRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the SyncJob.
*
*
* @param getSyncJobRequest
* @return A Java Future containing the result of the GetSyncJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetSyncJob
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getSyncJob(GetSyncJobRequest getSyncJobRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSyncJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSyncJob");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSyncJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetSyncJob")
.withMarshaller(new GetSyncJobRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(getSyncJobRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about a workspace.
*
*
* @param getWorkspaceRequest
* @return A Java Future containing the result of the GetWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.GetWorkspace
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getWorkspace(GetWorkspaceRequest getWorkspaceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getWorkspaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWorkspace");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetWorkspaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetWorkspace").withMarshaller(new GetWorkspaceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(getWorkspaceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists all component types in a workspace.
*
*
* @param listComponentTypesRequest
* @return A Java Future containing the result of the ListComponentTypes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListComponentTypes
* @see AWS API Documentation
*/
@Override
public CompletableFuture listComponentTypes(ListComponentTypesRequest listComponentTypesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listComponentTypesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListComponentTypes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListComponentTypesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListComponentTypes")
.withMarshaller(new ListComponentTypesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listComponentTypesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists all component types in a workspace.
*
*
*
* This is a variant of
* {@link #listComponentTypes(software.amazon.awssdk.services.iottwinmaker.model.ListComponentTypesRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListComponentTypesPublisher publisher = client.listComponentTypesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListComponentTypesPublisher publisher = client.listComponentTypesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ListComponentTypesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listComponentTypes(software.amazon.awssdk.services.iottwinmaker.model.ListComponentTypesRequest)}
* operation.
*
*
* @param listComponentTypesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListComponentTypes
* @see AWS API Documentation
*/
public ListComponentTypesPublisher listComponentTypesPaginator(ListComponentTypesRequest listComponentTypesRequest) {
return new ListComponentTypesPublisher(this, applyPaginatorUserAgent(listComponentTypesRequest));
}
/**
*
* Lists all entities in a workspace.
*
*
* @param listEntitiesRequest
* @return A Java Future containing the result of the ListEntities operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListEntities
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listEntities(ListEntitiesRequest listEntitiesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listEntitiesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEntities");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListEntitiesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListEntities").withMarshaller(new ListEntitiesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listEntitiesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists all entities in a workspace.
*
*
*
* This is a variant of
* {@link #listEntities(software.amazon.awssdk.services.iottwinmaker.model.ListEntitiesRequest)} operation. The
* return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListEntitiesPublisher publisher = client.listEntitiesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListEntitiesPublisher publisher = client.listEntitiesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ListEntitiesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listEntities(software.amazon.awssdk.services.iottwinmaker.model.ListEntitiesRequest)} operation.
*
*
* @param listEntitiesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListEntities
* @see AWS API
* Documentation
*/
public ListEntitiesPublisher listEntitiesPaginator(ListEntitiesRequest listEntitiesRequest) {
return new ListEntitiesPublisher(this, applyPaginatorUserAgent(listEntitiesRequest));
}
/**
*
* Lists all scenes in a workspace.
*
*
* @param listScenesRequest
* @return A Java Future containing the result of the ListScenes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListScenes
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listScenes(ListScenesRequest listScenesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listScenesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListScenes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListScenesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("ListScenes")
.withMarshaller(new ListScenesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listScenesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists all scenes in a workspace.
*
*
*
* This is a variant of {@link #listScenes(software.amazon.awssdk.services.iottwinmaker.model.ListScenesRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListScenesPublisher publisher = client.listScenesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListScenesPublisher publisher = client.listScenesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ListScenesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listScenes(software.amazon.awssdk.services.iottwinmaker.model.ListScenesRequest)} operation.
*
*
* @param listScenesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListScenes
* @see AWS API
* Documentation
*/
public ListScenesPublisher listScenesPaginator(ListScenesRequest listScenesRequest) {
return new ListScenesPublisher(this, applyPaginatorUserAgent(listScenesRequest));
}
/**
*
* List all SyncJobs.
*
*
* @param listSyncJobsRequest
* @return A Java Future containing the result of the ListSyncJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListSyncJobs
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listSyncJobs(ListSyncJobsRequest listSyncJobsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSyncJobsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSyncJobs");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListSyncJobsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListSyncJobs").withMarshaller(new ListSyncJobsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listSyncJobsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* List all SyncJobs.
*
*
*
* This is a variant of
* {@link #listSyncJobs(software.amazon.awssdk.services.iottwinmaker.model.ListSyncJobsRequest)} operation. The
* return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListSyncJobsPublisher publisher = client.listSyncJobsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListSyncJobsPublisher publisher = client.listSyncJobsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ListSyncJobsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listSyncJobs(software.amazon.awssdk.services.iottwinmaker.model.ListSyncJobsRequest)} operation.
*
*
* @param listSyncJobsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListSyncJobs
* @see AWS API
* Documentation
*/
public ListSyncJobsPublisher listSyncJobsPaginator(ListSyncJobsRequest listSyncJobsRequest) {
return new ListSyncJobsPublisher(this, applyPaginatorUserAgent(listSyncJobsRequest));
}
/**
*
* Lists the sync resources.
*
*
* @param listSyncResourcesRequest
* @return A Java Future containing the result of the ListSyncResources operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListSyncResources
* @see AWS API Documentation
*/
@Override
public CompletableFuture listSyncResources(ListSyncResourcesRequest listSyncResourcesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSyncResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSyncResources");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSyncResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListSyncResources")
.withMarshaller(new ListSyncResourcesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listSyncResourcesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the sync resources.
*
*
*
* This is a variant of
* {@link #listSyncResources(software.amazon.awssdk.services.iottwinmaker.model.ListSyncResourcesRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListSyncResourcesPublisher publisher = client.listSyncResourcesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListSyncResourcesPublisher publisher = client.listSyncResourcesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ListSyncResourcesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listSyncResources(software.amazon.awssdk.services.iottwinmaker.model.ListSyncResourcesRequest)}
* operation.
*
*
* @param listSyncResourcesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListSyncResources
* @see AWS API Documentation
*/
public ListSyncResourcesPublisher listSyncResourcesPaginator(ListSyncResourcesRequest listSyncResourcesRequest) {
return new ListSyncResourcesPublisher(this, applyPaginatorUserAgent(listSyncResourcesRequest));
}
/**
*
* Lists all tags associated with a resource.
*
*
* @param listTagsForResourceRequest
* @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public CompletableFuture listTagsForResource(
ListTagsForResourceRequest listTagsForResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource")
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listTagsForResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about workspaces in the current account.
*
*
* @param listWorkspacesRequest
* @return A Java Future containing the result of the ListWorkspaces operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListWorkspaces
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listWorkspaces(ListWorkspacesRequest listWorkspacesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listWorkspacesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListWorkspaces");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListWorkspacesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListWorkspaces")
.withMarshaller(new ListWorkspacesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(listWorkspacesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about workspaces in the current account.
*
*
*
* This is a variant of
* {@link #listWorkspaces(software.amazon.awssdk.services.iottwinmaker.model.ListWorkspacesRequest)} operation. The
* return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListWorkspacesPublisher publisher = client.listWorkspacesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.iottwinmaker.paginators.ListWorkspacesPublisher publisher = client.listWorkspacesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.iottwinmaker.model.ListWorkspacesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listWorkspaces(software.amazon.awssdk.services.iottwinmaker.model.ListWorkspacesRequest)} operation.
*
*
* @param listWorkspacesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.ListWorkspaces
* @see AWS
* API Documentation
*/
public ListWorkspacesPublisher listWorkspacesPaginator(ListWorkspacesRequest listWorkspacesRequest) {
return new ListWorkspacesPublisher(this, applyPaginatorUserAgent(listWorkspacesRequest));
}
/**
*
* Adds tags to a resource.
*
*
* @param tagResourceRequest
* @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - TooManyTagsException The number of tags exceeds the limit.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("TagResource").withMarshaller(new TagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(tagResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes tags from a resource.
*
*
* @param untagResourceRequest
* @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.UntagResource
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UntagResource")
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(untagResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates information in a component type.
*
*
* @param updateComponentTypeRequest
* @return A Java Future containing the result of the UpdateComponentType operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.UpdateComponentType
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateComponentType(
UpdateComponentTypeRequest updateComponentTypeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateComponentTypeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateComponentType");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateComponentTypeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateComponentType")
.withMarshaller(new UpdateComponentTypeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(updateComponentTypeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates an entity.
*
*
* @param updateEntityRequest
* @return A Java Future containing the result of the UpdateEntity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ConflictException A conflict occurred.
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.UpdateEntity
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateEntity(UpdateEntityRequest updateEntityRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateEntityRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateEntity");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateEntityResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateEntity").withMarshaller(new UpdateEntityRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(updateEntityRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Update the pricing plan.
*
*
* @param updatePricingPlanRequest
* @return A Java Future containing the result of the UpdatePricingPlan operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.UpdatePricingPlan
* @see AWS API Documentation
*/
@Override
public CompletableFuture updatePricingPlan(UpdatePricingPlanRequest updatePricingPlanRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updatePricingPlanRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdatePricingPlan");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdatePricingPlanResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdatePricingPlan")
.withMarshaller(new UpdatePricingPlanRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(updatePricingPlanRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates a scene.
*
*
* @param updateSceneRequest
* @return A Java Future containing the result of the UpdateScene operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.UpdateScene
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateScene(UpdateSceneRequest updateSceneRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSceneRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateScene");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateSceneResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateScene").withMarshaller(new UpdateSceneRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(updateSceneRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates a workspace.
*
*
* @param updateWorkspaceRequest
* @return A Java Future containing the result of the UpdateWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InternalServerException An unexpected error has occurred.
* - AccessDeniedException Access is denied.
* - ResourceNotFoundException The resource wasn't found.
* - ThrottlingException The rate exceeds the limit.
* - ValidationException Failed
* - ServiceQuotaExceededException The service quota was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - IoTTwinMakerException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample IoTTwinMakerAsyncClient.UpdateWorkspace
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture updateWorkspace(UpdateWorkspaceRequest updateWorkspaceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkspaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "IoTTwinMaker");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkspace");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateWorkspaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
String hostPrefix = "api.";
String resolvedHostExpression = "api.";
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateWorkspace")
.withMarshaller(new UpdateWorkspaceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(updateWorkspaceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
@Override
public final IoTTwinMakerServiceClientConfiguration serviceClientConfiguration() {
return this.serviceClientConfiguration;
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(IoTTwinMakerException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConnectorFailureException")
.exceptionBuilderSupplier(ConnectorFailureException::builder).httpStatusCode(424).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottlingException")
.exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException")
.exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerException")
.exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TooManyTagsException")
.exceptionBuilderSupplier(TooManyTagsException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConnectorTimeoutException")
.exceptionBuilderSupplier(ConnectorTimeoutException::builder).httpStatusCode(424).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ValidationException")
.exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("QueryTimeoutException")
.exceptionBuilderSupplier(QueryTimeoutException::builder).httpStatusCode(400).build());
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
@Override
public void close() {
clientHandler.close();
}
}