
software.amazon.awssdk.services.xray.DefaultXRayClient Maven / Gradle / Ivy
/*
* 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.xray;
import java.util.function.Consumer;
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.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.util.VersionInfo;
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.xray.model.BatchGetTracesRequest;
import software.amazon.awssdk.services.xray.model.BatchGetTracesResponse;
import software.amazon.awssdk.services.xray.model.CreateGroupRequest;
import software.amazon.awssdk.services.xray.model.CreateGroupResponse;
import software.amazon.awssdk.services.xray.model.CreateSamplingRuleRequest;
import software.amazon.awssdk.services.xray.model.CreateSamplingRuleResponse;
import software.amazon.awssdk.services.xray.model.DeleteGroupRequest;
import software.amazon.awssdk.services.xray.model.DeleteGroupResponse;
import software.amazon.awssdk.services.xray.model.DeleteSamplingRuleRequest;
import software.amazon.awssdk.services.xray.model.DeleteSamplingRuleResponse;
import software.amazon.awssdk.services.xray.model.GetEncryptionConfigRequest;
import software.amazon.awssdk.services.xray.model.GetEncryptionConfigResponse;
import software.amazon.awssdk.services.xray.model.GetGroupRequest;
import software.amazon.awssdk.services.xray.model.GetGroupResponse;
import software.amazon.awssdk.services.xray.model.GetGroupsRequest;
import software.amazon.awssdk.services.xray.model.GetGroupsResponse;
import software.amazon.awssdk.services.xray.model.GetSamplingRulesRequest;
import software.amazon.awssdk.services.xray.model.GetSamplingRulesResponse;
import software.amazon.awssdk.services.xray.model.GetSamplingStatisticSummariesRequest;
import software.amazon.awssdk.services.xray.model.GetSamplingStatisticSummariesResponse;
import software.amazon.awssdk.services.xray.model.GetSamplingTargetsRequest;
import software.amazon.awssdk.services.xray.model.GetSamplingTargetsResponse;
import software.amazon.awssdk.services.xray.model.GetServiceGraphRequest;
import software.amazon.awssdk.services.xray.model.GetServiceGraphResponse;
import software.amazon.awssdk.services.xray.model.GetTimeSeriesServiceStatisticsRequest;
import software.amazon.awssdk.services.xray.model.GetTimeSeriesServiceStatisticsResponse;
import software.amazon.awssdk.services.xray.model.GetTraceGraphRequest;
import software.amazon.awssdk.services.xray.model.GetTraceGraphResponse;
import software.amazon.awssdk.services.xray.model.GetTraceSummariesRequest;
import software.amazon.awssdk.services.xray.model.GetTraceSummariesResponse;
import software.amazon.awssdk.services.xray.model.InvalidRequestException;
import software.amazon.awssdk.services.xray.model.PutEncryptionConfigRequest;
import software.amazon.awssdk.services.xray.model.PutEncryptionConfigResponse;
import software.amazon.awssdk.services.xray.model.PutTelemetryRecordsRequest;
import software.amazon.awssdk.services.xray.model.PutTelemetryRecordsResponse;
import software.amazon.awssdk.services.xray.model.PutTraceSegmentsRequest;
import software.amazon.awssdk.services.xray.model.PutTraceSegmentsResponse;
import software.amazon.awssdk.services.xray.model.RuleLimitExceededException;
import software.amazon.awssdk.services.xray.model.ThrottledException;
import software.amazon.awssdk.services.xray.model.UpdateGroupRequest;
import software.amazon.awssdk.services.xray.model.UpdateGroupResponse;
import software.amazon.awssdk.services.xray.model.UpdateSamplingRuleRequest;
import software.amazon.awssdk.services.xray.model.UpdateSamplingRuleResponse;
import software.amazon.awssdk.services.xray.model.XRayException;
import software.amazon.awssdk.services.xray.model.XRayRequest;
import software.amazon.awssdk.services.xray.paginators.BatchGetTracesIterable;
import software.amazon.awssdk.services.xray.paginators.GetGroupsIterable;
import software.amazon.awssdk.services.xray.paginators.GetSamplingRulesIterable;
import software.amazon.awssdk.services.xray.paginators.GetSamplingStatisticSummariesIterable;
import software.amazon.awssdk.services.xray.paginators.GetServiceGraphIterable;
import software.amazon.awssdk.services.xray.paginators.GetTimeSeriesServiceStatisticsIterable;
import software.amazon.awssdk.services.xray.paginators.GetTraceGraphIterable;
import software.amazon.awssdk.services.xray.paginators.GetTraceSummariesIterable;
import software.amazon.awssdk.services.xray.transform.BatchGetTracesRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.CreateGroupRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.CreateSamplingRuleRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.DeleteGroupRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.DeleteSamplingRuleRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetEncryptionConfigRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetGroupRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetGroupsRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetSamplingRulesRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetSamplingStatisticSummariesRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetSamplingTargetsRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetServiceGraphRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetTimeSeriesServiceStatisticsRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetTraceGraphRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.GetTraceSummariesRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.PutEncryptionConfigRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.PutTelemetryRecordsRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.PutTraceSegmentsRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.UpdateGroupRequestMarshaller;
import software.amazon.awssdk.services.xray.transform.UpdateSamplingRuleRequestMarshaller;
/**
* Internal implementation of {@link XRayClient}.
*
* @see XRayClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultXRayClient implements XRayClient {
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultXRayClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Retrieves a list of traces specified by ID. Each trace is a collection of segment documents that originates from
* a single request. Use GetTraceSummaries
to get a list of trace IDs.
*
*
* @param batchGetTracesRequest
* @return Result of the BatchGetTraces operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.BatchGetTraces
* @see AWS API
* Documentation
*/
@Override
public BatchGetTracesResponse batchGetTraces(BatchGetTracesRequest batchGetTracesRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
BatchGetTracesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("BatchGetTraces").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(batchGetTracesRequest)
.withMarshaller(new BatchGetTracesRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves a list of traces specified by ID. Each trace is a collection of segment documents that originates from
* a single request. Use GetTraceSummaries
to get a list of trace IDs.
*
*
*
* This is a variant of {@link #batchGetTraces(software.amazon.awssdk.services.xray.model.BatchGetTracesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.BatchGetTracesIterable responses = client.batchGetTracesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.BatchGetTracesIterable responses = client.batchGetTracesPaginator(request);
* for (software.amazon.awssdk.services.xray.model.BatchGetTracesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.BatchGetTracesIterable responses = client.batchGetTracesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #batchGetTraces(software.amazon.awssdk.services.xray.model.BatchGetTracesRequest)} operation.
*
*
* @param batchGetTracesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.BatchGetTraces
* @see AWS API
* Documentation
*/
@Override
public BatchGetTracesIterable batchGetTracesPaginator(BatchGetTracesRequest batchGetTracesRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new BatchGetTracesIterable(this, applyPaginatorUserAgent(batchGetTracesRequest));
}
/**
*
* Creates a group resource with a name and a filter expression.
*
*
* @param createGroupRequest
* @return Result of the CreateGroup operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.CreateGroup
* @see AWS API
* Documentation
*/
@Override
public CreateGroupResponse createGroup(CreateGroupRequest createGroupRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createGroupRequest)
.withMarshaller(new CreateGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Creates a rule to control sampling behavior for instrumented applications. Services retrieve rules with
* GetSamplingRules, and evaluate each rule in ascending order of priority for each request. If a rule
* matches, the service records a trace, borrowing it from the reservoir size. After 10 seconds, the service reports
* back to X-Ray with GetSamplingTargets to get updated versions of each in-use rule. The updated rule
* contains a trace quota that the service can use instead of borrowing from the reservoir.
*
*
* @param createSamplingRuleRequest
* @return Result of the CreateSamplingRule operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws RuleLimitExceededException
* You have reached the maximum number of sampling rules.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.CreateSamplingRule
* @see AWS API
* Documentation
*/
@Override
public CreateSamplingRuleResponse createSamplingRule(CreateSamplingRuleRequest createSamplingRuleRequest)
throws InvalidRequestException, ThrottledException, RuleLimitExceededException, AwsServiceException,
SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSamplingRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateSamplingRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createSamplingRuleRequest)
.withMarshaller(new CreateSamplingRuleRequestMarshaller(protocolFactory)));
}
/**
*
* Deletes a group resource.
*
*
* @param deleteGroupRequest
* @return Result of the DeleteGroup operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.DeleteGroup
* @see AWS API
* Documentation
*/
@Override
public DeleteGroupResponse deleteGroup(DeleteGroupRequest deleteGroupRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteGroupRequest)
.withMarshaller(new DeleteGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Deletes a sampling rule.
*
*
* @param deleteSamplingRuleRequest
* @return Result of the DeleteSamplingRule operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.DeleteSamplingRule
* @see AWS API
* Documentation
*/
@Override
public DeleteSamplingRuleResponse deleteSamplingRule(DeleteSamplingRuleRequest deleteSamplingRuleRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSamplingRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteSamplingRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteSamplingRuleRequest)
.withMarshaller(new DeleteSamplingRuleRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves the current encryption configuration for X-Ray data.
*
*
* @param getEncryptionConfigRequest
* @return Result of the GetEncryptionConfig operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetEncryptionConfig
* @see AWS API
* Documentation
*/
@Override
public GetEncryptionConfigResponse getEncryptionConfig(GetEncryptionConfigRequest getEncryptionConfigRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetEncryptionConfigResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetEncryptionConfig").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getEncryptionConfigRequest)
.withMarshaller(new GetEncryptionConfigRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves group resource details.
*
*
* @param getGroupRequest
* @return Result of the GetGroup operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetGroup
* @see AWS API
* Documentation
*/
@Override
public GetGroupResponse getGroup(GetGroupRequest getGroupRequest) throws InvalidRequestException, ThrottledException,
AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams().withOperationName("GetGroup")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withInput(getGroupRequest)
.withMarshaller(new GetGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves all active group details.
*
*
* @param getGroupsRequest
* @return Result of the GetGroups operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetGroups
* @see AWS API
* Documentation
*/
@Override
public GetGroupsResponse getGroups(GetGroupsRequest getGroupsRequest) throws InvalidRequestException, ThrottledException,
AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetGroups").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getGroupsRequest)
.withMarshaller(new GetGroupsRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves all active group details.
*
*
*
* This is a variant of {@link #getGroups(software.amazon.awssdk.services.xray.model.GetGroupsRequest)} operation.
* The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally
* handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetGroupsIterable responses = client.getGroupsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetGroupsIterable responses = client.getGroupsPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetGroupsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetGroupsIterable responses = client.getGroupsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getGroups(software.amazon.awssdk.services.xray.model.GetGroupsRequest)} operation.
*
*
* @param getGroupsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetGroups
* @see AWS API
* Documentation
*/
@Override
public GetGroupsIterable getGroupsPaginator(GetGroupsRequest getGroupsRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetGroupsIterable(this, applyPaginatorUserAgent(getGroupsRequest));
}
/**
*
* Retrieves all sampling rules.
*
*
* @param getSamplingRulesRequest
* @return Result of the GetSamplingRules operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetSamplingRules
* @see AWS API
* Documentation
*/
@Override
public GetSamplingRulesResponse getSamplingRules(GetSamplingRulesRequest getSamplingRulesRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSamplingRulesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSamplingRules").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getSamplingRulesRequest)
.withMarshaller(new GetSamplingRulesRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves all sampling rules.
*
*
*
* This is a variant of
* {@link #getSamplingRules(software.amazon.awssdk.services.xray.model.GetSamplingRulesRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetSamplingRulesIterable responses = client.getSamplingRulesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetSamplingRulesIterable responses = client
* .getSamplingRulesPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetSamplingRulesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetSamplingRulesIterable responses = client.getSamplingRulesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getSamplingRules(software.amazon.awssdk.services.xray.model.GetSamplingRulesRequest)} operation.
*
*
* @param getSamplingRulesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetSamplingRules
* @see AWS API
* Documentation
*/
@Override
public GetSamplingRulesIterable getSamplingRulesPaginator(GetSamplingRulesRequest getSamplingRulesRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetSamplingRulesIterable(this, applyPaginatorUserAgent(getSamplingRulesRequest));
}
/**
*
* Retrieves information about recent sampling results for all sampling rules.
*
*
* @param getSamplingStatisticSummariesRequest
* @return Result of the GetSamplingStatisticSummaries operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetSamplingStatisticSummaries
* @see AWS API Documentation
*/
@Override
public GetSamplingStatisticSummariesResponse getSamplingStatisticSummaries(
GetSamplingStatisticSummariesRequest getSamplingStatisticSummariesRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSamplingStatisticSummariesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetSamplingStatisticSummaries").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getSamplingStatisticSummariesRequest)
.withMarshaller(new GetSamplingStatisticSummariesRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves information about recent sampling results for all sampling rules.
*
*
*
* This is a variant of
* {@link #getSamplingStatisticSummaries(software.amazon.awssdk.services.xray.model.GetSamplingStatisticSummariesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetSamplingStatisticSummariesIterable responses = client.getSamplingStatisticSummariesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetSamplingStatisticSummariesIterable responses = client
* .getSamplingStatisticSummariesPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetSamplingStatisticSummariesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetSamplingStatisticSummariesIterable responses = client.getSamplingStatisticSummariesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getSamplingStatisticSummaries(software.amazon.awssdk.services.xray.model.GetSamplingStatisticSummariesRequest)}
* operation.
*
*
* @param getSamplingStatisticSummariesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetSamplingStatisticSummaries
* @see AWS API Documentation
*/
@Override
public GetSamplingStatisticSummariesIterable getSamplingStatisticSummariesPaginator(
GetSamplingStatisticSummariesRequest getSamplingStatisticSummariesRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetSamplingStatisticSummariesIterable(this, applyPaginatorUserAgent(getSamplingStatisticSummariesRequest));
}
/**
*
* Requests a sampling quota for rules that the service is using to sample requests.
*
*
* @param getSamplingTargetsRequest
* @return Result of the GetSamplingTargets operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetSamplingTargets
* @see AWS API
* Documentation
*/
@Override
public GetSamplingTargetsResponse getSamplingTargets(GetSamplingTargetsRequest getSamplingTargetsRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSamplingTargetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSamplingTargets").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getSamplingTargetsRequest)
.withMarshaller(new GetSamplingTargetsRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves a document that describes services that process incoming requests, and downstream services that they
* call as a result. Root services process incoming requests and make calls to downstream services. Root services
* are applications that use the AWS X-Ray SDK. Downstream
* services can be other applications, AWS resources, HTTP web APIs, or SQL databases.
*
*
* @param getServiceGraphRequest
* @return Result of the GetServiceGraph operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetServiceGraph
* @see AWS API
* Documentation
*/
@Override
public GetServiceGraphResponse getServiceGraph(GetServiceGraphRequest getServiceGraphRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetServiceGraphResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetServiceGraph").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getServiceGraphRequest)
.withMarshaller(new GetServiceGraphRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves a document that describes services that process incoming requests, and downstream services that they
* call as a result. Root services process incoming requests and make calls to downstream services. Root services
* are applications that use the AWS X-Ray SDK. Downstream
* services can be other applications, AWS resources, HTTP web APIs, or SQL databases.
*
*
*
* This is a variant of {@link #getServiceGraph(software.amazon.awssdk.services.xray.model.GetServiceGraphRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetServiceGraphIterable responses = client.getServiceGraphPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetServiceGraphIterable responses = client.getServiceGraphPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetServiceGraphResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetServiceGraphIterable responses = client.getServiceGraphPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getServiceGraph(software.amazon.awssdk.services.xray.model.GetServiceGraphRequest)} operation.
*
*
* @param getServiceGraphRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetServiceGraph
* @see AWS API
* Documentation
*/
@Override
public GetServiceGraphIterable getServiceGraphPaginator(GetServiceGraphRequest getServiceGraphRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetServiceGraphIterable(this, applyPaginatorUserAgent(getServiceGraphRequest));
}
/**
*
* Get an aggregation of service statistics defined by a specific time range.
*
*
* @param getTimeSeriesServiceStatisticsRequest
* @return Result of the GetTimeSeriesServiceStatistics operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetTimeSeriesServiceStatistics
* @see AWS API Documentation
*/
@Override
public GetTimeSeriesServiceStatisticsResponse getTimeSeriesServiceStatistics(
GetTimeSeriesServiceStatisticsRequest getTimeSeriesServiceStatisticsRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetTimeSeriesServiceStatisticsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetTimeSeriesServiceStatistics").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getTimeSeriesServiceStatisticsRequest)
.withMarshaller(new GetTimeSeriesServiceStatisticsRequestMarshaller(protocolFactory)));
}
/**
*
* Get an aggregation of service statistics defined by a specific time range.
*
*
*
* This is a variant of
* {@link #getTimeSeriesServiceStatistics(software.amazon.awssdk.services.xray.model.GetTimeSeriesServiceStatisticsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetTimeSeriesServiceStatisticsIterable responses = client.getTimeSeriesServiceStatisticsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetTimeSeriesServiceStatisticsIterable responses = client
* .getTimeSeriesServiceStatisticsPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetTimeSeriesServiceStatisticsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetTimeSeriesServiceStatisticsIterable responses = client.getTimeSeriesServiceStatisticsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getTimeSeriesServiceStatistics(software.amazon.awssdk.services.xray.model.GetTimeSeriesServiceStatisticsRequest)}
* operation.
*
*
* @param getTimeSeriesServiceStatisticsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetTimeSeriesServiceStatistics
* @see AWS API Documentation
*/
@Override
public GetTimeSeriesServiceStatisticsIterable getTimeSeriesServiceStatisticsPaginator(
GetTimeSeriesServiceStatisticsRequest getTimeSeriesServiceStatisticsRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetTimeSeriesServiceStatisticsIterable(this, applyPaginatorUserAgent(getTimeSeriesServiceStatisticsRequest));
}
/**
*
* Retrieves a service graph for one or more specific trace IDs.
*
*
* @param getTraceGraphRequest
* @return Result of the GetTraceGraph operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetTraceGraph
* @see AWS API
* Documentation
*/
@Override
public GetTraceGraphResponse getTraceGraph(GetTraceGraphRequest getTraceGraphRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetTraceGraphResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetTraceGraph").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getTraceGraphRequest)
.withMarshaller(new GetTraceGraphRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves a service graph for one or more specific trace IDs.
*
*
*
* This is a variant of {@link #getTraceGraph(software.amazon.awssdk.services.xray.model.GetTraceGraphRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetTraceGraphIterable responses = client.getTraceGraphPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetTraceGraphIterable responses = client.getTraceGraphPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetTraceGraphResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetTraceGraphIterable responses = client.getTraceGraphPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getTraceGraph(software.amazon.awssdk.services.xray.model.GetTraceGraphRequest)} operation.
*
*
* @param getTraceGraphRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetTraceGraph
* @see AWS API
* Documentation
*/
@Override
public GetTraceGraphIterable getTraceGraphPaginator(GetTraceGraphRequest getTraceGraphRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetTraceGraphIterable(this, applyPaginatorUserAgent(getTraceGraphRequest));
}
/**
*
* Retrieves IDs and annotations for traces available for a specified time frame using an optional filter. To get
* the full traces, pass the trace IDs to BatchGetTraces
.
*
*
* A filter expression can target traced requests that hit specific service nodes or edges, have errors, or come
* from a known user. For example, the following filter expression targets traces that pass through
* api.example.com
:
*
*
* service("api.example.com")
*
*
* This filter expression finds traces that have an annotation named account
with the value
* 12345
:
*
*
* annotation.account = "12345"
*
*
* For a full list of indexed fields and keywords that you can use in filter expressions, see Using Filter Expressions in
* the AWS X-Ray Developer Guide.
*
*
* @param getTraceSummariesRequest
* @return Result of the GetTraceSummaries operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetTraceSummaries
* @see AWS API
* Documentation
*/
@Override
public GetTraceSummariesResponse getTraceSummaries(GetTraceSummariesRequest getTraceSummariesRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetTraceSummariesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetTraceSummaries").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getTraceSummariesRequest)
.withMarshaller(new GetTraceSummariesRequestMarshaller(protocolFactory)));
}
/**
*
* Retrieves IDs and annotations for traces available for a specified time frame using an optional filter. To get
* the full traces, pass the trace IDs to BatchGetTraces
.
*
*
* A filter expression can target traced requests that hit specific service nodes or edges, have errors, or come
* from a known user. For example, the following filter expression targets traces that pass through
* api.example.com
:
*
*
* service("api.example.com")
*
*
* This filter expression finds traces that have an annotation named account
with the value
* 12345
:
*
*
* annotation.account = "12345"
*
*
* For a full list of indexed fields and keywords that you can use in filter expressions, see Using Filter Expressions in
* the AWS X-Ray Developer Guide.
*
*
*
* This is a variant of
* {@link #getTraceSummaries(software.amazon.awssdk.services.xray.model.GetTraceSummariesRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetTraceSummariesIterable responses = client.getTraceSummariesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.xray.paginators.GetTraceSummariesIterable responses = client
* .getTraceSummariesPaginator(request);
* for (software.amazon.awssdk.services.xray.model.GetTraceSummariesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.xray.paginators.GetTraceSummariesIterable responses = client.getTraceSummariesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #getTraceSummaries(software.amazon.awssdk.services.xray.model.GetTraceSummariesRequest)} operation.
*
*
* @param getTraceSummariesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.GetTraceSummaries
* @see AWS API
* Documentation
*/
@Override
public GetTraceSummariesIterable getTraceSummariesPaginator(GetTraceSummariesRequest getTraceSummariesRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
return new GetTraceSummariesIterable(this, applyPaginatorUserAgent(getTraceSummariesRequest));
}
/**
*
* Updates the encryption configuration for X-Ray data.
*
*
* @param putEncryptionConfigRequest
* @return Result of the PutEncryptionConfig operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.PutEncryptionConfig
* @see AWS API
* Documentation
*/
@Override
public PutEncryptionConfigResponse putEncryptionConfig(PutEncryptionConfigRequest putEncryptionConfigRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutEncryptionConfigResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutEncryptionConfig").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(putEncryptionConfigRequest)
.withMarshaller(new PutEncryptionConfigRequestMarshaller(protocolFactory)));
}
/**
*
* Used by the AWS X-Ray daemon to upload telemetry.
*
*
* @param putTelemetryRecordsRequest
* @return Result of the PutTelemetryRecords operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.PutTelemetryRecords
* @see AWS API
* Documentation
*/
@Override
public PutTelemetryRecordsResponse putTelemetryRecords(PutTelemetryRecordsRequest putTelemetryRecordsRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutTelemetryRecordsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutTelemetryRecords").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(putTelemetryRecordsRequest)
.withMarshaller(new PutTelemetryRecordsRequestMarshaller(protocolFactory)));
}
/**
*
* Uploads segment documents to AWS X-Ray. The X-Ray SDK
* generates segment documents and sends them to the X-Ray daemon, which uploads them in batches. A segment document
* can be a completed segment, an in-progress segment, or an array of subsegments.
*
*
* Segments must include the following fields. For the full segment document schema, see AWS X-Ray Segment
* Documents in the AWS X-Ray Developer Guide.
*
*
* Required Segment Document Fields
*
*
* -
*
* name
- The name of the service that handled the request.
*
*
* -
*
* id
- A 64-bit identifier for the segment, unique among segments in the same trace, in 16 hexadecimal
* digits.
*
*
* -
*
* trace_id
- A unique identifier that connects all segments and subsegments originating from a single
* client request.
*
*
* -
*
* start_time
- Time the segment or subsegment was created, in floating point seconds in epoch time,
* accurate to milliseconds. For example, 1480615200.010
or 1.480615200010E9
.
*
*
* -
*
* end_time
- Time the segment or subsegment was closed. For example, 1480615200.090
or
* 1.480615200090E9
. Specify either an end_time
or in_progress
.
*
*
* -
*
* in_progress
- Set to true
instead of specifying an end_time
to record that
* a segment has been started, but is not complete. Send an in progress segment when your application receives a
* request that will take a long time to serve, to trace the fact that the request was received. When the response
* is sent, send the complete segment to overwrite the in-progress segment.
*
*
*
*
* A trace_id
consists of three numbers separated by hyphens. For example,
* 1-58406520-a006649127e371903a2de979. This includes:
*
*
* Trace ID Format
*
*
* -
*
* The version number, i.e. 1
.
*
*
* -
*
* The time of the original request, in Unix epoch time, in 8 hexadecimal digits. For example, 10:00AM December 2nd,
* 2016 PST in epoch time is 1480615200
seconds, or 58406520
in hexadecimal.
*
*
* -
*
* A 96-bit identifier for the trace, globally unique, in 24 hexadecimal digits.
*
*
*
*
* @param putTraceSegmentsRequest
* @return Result of the PutTraceSegments operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.PutTraceSegments
* @see AWS API
* Documentation
*/
@Override
public PutTraceSegmentsResponse putTraceSegments(PutTraceSegmentsRequest putTraceSegmentsRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
PutTraceSegmentsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutTraceSegments").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(putTraceSegmentsRequest)
.withMarshaller(new PutTraceSegmentsRequestMarshaller(protocolFactory)));
}
/**
*
* Updates a group resource.
*
*
* @param updateGroupRequest
* @return Result of the UpdateGroup operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.UpdateGroup
* @see AWS API
* Documentation
*/
@Override
public UpdateGroupResponse updateGroup(UpdateGroupRequest updateGroupRequest) throws InvalidRequestException,
ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateGroupRequest)
.withMarshaller(new UpdateGroupRequestMarshaller(protocolFactory)));
}
/**
*
* Modifies a sampling rule's configuration.
*
*
* @param updateSamplingRuleRequest
* @return Result of the UpdateSamplingRule operation returned by the service.
* @throws InvalidRequestException
* The request is missing required parameters or has invalid parameters.
* @throws ThrottledException
* The request exceeds the maximum number of requests per second.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws XRayException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample XRayClient.UpdateSamplingRule
* @see AWS API
* Documentation
*/
@Override
public UpdateSamplingRuleResponse updateSamplingRule(UpdateSamplingRuleRequest updateSamplingRuleRequest)
throws InvalidRequestException, ThrottledException, AwsServiceException, SdkClientException, XRayException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSamplingRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateSamplingRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateSamplingRuleRequest)
.withMarshaller(new UpdateSamplingRuleRequestMarshaller(protocolFactory)));
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(XRayException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidRequestException")
.exceptionBuilderSupplier(InvalidRequestException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottledException")
.exceptionBuilderSupplier(ThrottledException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("RuleLimitExceededException")
.exceptionBuilderSupplier(RuleLimitExceededException::builder).build());
}
@Override
public void close() {
clientHandler.close();
}
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();
}
}