software.amazon.awssdk.services.kinesisvideo.DefaultKinesisVideoClient Maven / Gradle / Ivy
Show all versions of kinesisvideo 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.kinesisvideo;
import java.util.Collections;
import java.util.List;
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.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
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.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.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.kinesisvideo.model.AccessDeniedException;
import software.amazon.awssdk.services.kinesisvideo.model.AccountChannelLimitExceededException;
import software.amazon.awssdk.services.kinesisvideo.model.AccountStreamLimitExceededException;
import software.amazon.awssdk.services.kinesisvideo.model.ClientLimitExceededException;
import software.amazon.awssdk.services.kinesisvideo.model.CreateSignalingChannelRequest;
import software.amazon.awssdk.services.kinesisvideo.model.CreateSignalingChannelResponse;
import software.amazon.awssdk.services.kinesisvideo.model.CreateStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.CreateStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.DeleteSignalingChannelRequest;
import software.amazon.awssdk.services.kinesisvideo.model.DeleteSignalingChannelResponse;
import software.amazon.awssdk.services.kinesisvideo.model.DeleteStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.DeleteStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.DescribeSignalingChannelRequest;
import software.amazon.awssdk.services.kinesisvideo.model.DescribeSignalingChannelResponse;
import software.amazon.awssdk.services.kinesisvideo.model.DescribeStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.DescribeStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.DeviceStreamLimitExceededException;
import software.amazon.awssdk.services.kinesisvideo.model.GetDataEndpointRequest;
import software.amazon.awssdk.services.kinesisvideo.model.GetDataEndpointResponse;
import software.amazon.awssdk.services.kinesisvideo.model.GetSignalingChannelEndpointRequest;
import software.amazon.awssdk.services.kinesisvideo.model.GetSignalingChannelEndpointResponse;
import software.amazon.awssdk.services.kinesisvideo.model.InvalidArgumentException;
import software.amazon.awssdk.services.kinesisvideo.model.InvalidDeviceException;
import software.amazon.awssdk.services.kinesisvideo.model.InvalidResourceFormatException;
import software.amazon.awssdk.services.kinesisvideo.model.KinesisVideoException;
import software.amazon.awssdk.services.kinesisvideo.model.KinesisVideoRequest;
import software.amazon.awssdk.services.kinesisvideo.model.ListSignalingChannelsRequest;
import software.amazon.awssdk.services.kinesisvideo.model.ListSignalingChannelsResponse;
import software.amazon.awssdk.services.kinesisvideo.model.ListStreamsRequest;
import software.amazon.awssdk.services.kinesisvideo.model.ListStreamsResponse;
import software.amazon.awssdk.services.kinesisvideo.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.kinesisvideo.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.kinesisvideo.model.ListTagsForStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.ListTagsForStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.NotAuthorizedException;
import software.amazon.awssdk.services.kinesisvideo.model.ResourceInUseException;
import software.amazon.awssdk.services.kinesisvideo.model.ResourceNotFoundException;
import software.amazon.awssdk.services.kinesisvideo.model.TagResourceRequest;
import software.amazon.awssdk.services.kinesisvideo.model.TagResourceResponse;
import software.amazon.awssdk.services.kinesisvideo.model.TagStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.TagStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.TagsPerResourceExceededLimitException;
import software.amazon.awssdk.services.kinesisvideo.model.UntagResourceRequest;
import software.amazon.awssdk.services.kinesisvideo.model.UntagResourceResponse;
import software.amazon.awssdk.services.kinesisvideo.model.UntagStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.UntagStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.UpdateDataRetentionRequest;
import software.amazon.awssdk.services.kinesisvideo.model.UpdateDataRetentionResponse;
import software.amazon.awssdk.services.kinesisvideo.model.UpdateSignalingChannelRequest;
import software.amazon.awssdk.services.kinesisvideo.model.UpdateSignalingChannelResponse;
import software.amazon.awssdk.services.kinesisvideo.model.UpdateStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.UpdateStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.VersionMismatchException;
import software.amazon.awssdk.services.kinesisvideo.paginators.ListSignalingChannelsIterable;
import software.amazon.awssdk.services.kinesisvideo.paginators.ListStreamsIterable;
import software.amazon.awssdk.services.kinesisvideo.transform.CreateSignalingChannelRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.CreateStreamRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.DeleteSignalingChannelRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.DeleteStreamRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.DescribeSignalingChannelRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.DescribeStreamRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.GetDataEndpointRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.GetSignalingChannelEndpointRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.ListSignalingChannelsRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.ListStreamsRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.ListTagsForStreamRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.TagStreamRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.UntagStreamRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.UpdateDataRetentionRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.UpdateSignalingChannelRequestMarshaller;
import software.amazon.awssdk.services.kinesisvideo.transform.UpdateStreamRequestMarshaller;
/**
* Internal implementation of {@link KinesisVideoClient}.
*
* @see KinesisVideoClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultKinesisVideoClient implements KinesisVideoClient {
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultKinesisVideoClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Creates a signaling channel.
*
*
* CreateSignalingChannel
is an asynchronous operation.
*
*
* @param createSignalingChannelRequest
* @return Result of the CreateSignalingChannel operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws AccountChannelLimitExceededException
* You have reached the maximum limit of active signaling channels for this AWS account in this region.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @throws TagsPerResourceExceededLimitException
* You have exceeded the limit of tags that you can associate with the resource. Kinesis video streams
* support up to 50 tags.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.CreateSignalingChannel
* @see AWS API Documentation
*/
@Override
public CreateSignalingChannelResponse createSignalingChannel(CreateSignalingChannelRequest createSignalingChannelRequest)
throws InvalidArgumentException, ClientLimitExceededException, AccountChannelLimitExceededException,
ResourceInUseException, AccessDeniedException, TagsPerResourceExceededLimitException, AwsServiceException,
SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSignalingChannel");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSignalingChannel").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createSignalingChannelRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateSignalingChannelRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSignalingChannelRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new Kinesis video stream.
*
*
* When you create a new stream, Kinesis Video Streams assigns it a version number. When you change the stream's
* metadata, Kinesis Video Streams updates the version.
*
*
* CreateStream
is an asynchronous operation.
*
*
* For information about how the service works, see How it Works.
*
*
* You must have permissions for the KinesisVideo:CreateStream
action.
*
*
* @param createStreamRequest
* @return Result of the CreateStream operation returned by the service.
* @throws AccountStreamLimitExceededException
* The number of streams created for the account is too high.
* @throws DeviceStreamLimitExceededException
* Not implemented.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @throws InvalidDeviceException
* Not implemented.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws TagsPerResourceExceededLimitException
* You have exceeded the limit of tags that you can associate with the resource. Kinesis video streams
* support up to 50 tags.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.CreateStream
* @see AWS API
* Documentation
*/
@Override
public CreateStreamResponse createStream(CreateStreamRequest createStreamRequest) throws AccountStreamLimitExceededException,
DeviceStreamLimitExceededException, ResourceInUseException, InvalidDeviceException, InvalidArgumentException,
ClientLimitExceededException, TagsPerResourceExceededLimitException, AwsServiceException, SdkClientException,
KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createStreamRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a specified signaling channel. DeleteSignalingChannel
is an asynchronous operation. If you
* don't specify the channel's current version, the most recent version is deleted.
*
*
* @param deleteSignalingChannelRequest
* @return Result of the DeleteSignalingChannel operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @throws VersionMismatchException
* The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream
* API.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.DeleteSignalingChannel
* @see AWS API Documentation
*/
@Override
public DeleteSignalingChannelResponse deleteSignalingChannel(DeleteSignalingChannelRequest deleteSignalingChannelRequest)
throws InvalidArgumentException, ClientLimitExceededException, ResourceNotFoundException, AccessDeniedException,
VersionMismatchException, ResourceInUseException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSignalingChannel");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSignalingChannel").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteSignalingChannelRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteSignalingChannelRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSignalingChannelRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a Kinesis video stream and the data contained in the stream.
*
*
* This method marks the stream for deletion, and makes the data in the stream inaccessible immediately.
*
*
*
*
* To ensure that you have the latest version of the stream before deleting it, you can specify the stream version.
* Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams assigns a
* new version number. To get the latest stream version, use the DescribeStream
API.
*
*
* This operation requires permission for the KinesisVideo:DeleteStream
action.
*
*
* @param deleteStreamRequest
* @return Result of the DeleteStream operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @throws VersionMismatchException
* The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream
* API.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.DeleteStream
* @see AWS API
* Documentation
*/
@Override
public DeleteStreamResponse deleteStream(DeleteStreamRequest deleteStreamRequest) throws ClientLimitExceededException,
InvalidArgumentException, ResourceNotFoundException, NotAuthorizedException, VersionMismatchException,
ResourceInUseException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteStreamRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the most current information about the signaling channel. You must specify either the name or the Amazon
* Resource Name (ARN) of the channel that you want to describe.
*
*
* @param describeSignalingChannelRequest
* @return Result of the DescribeSignalingChannel operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.DescribeSignalingChannel
* @see AWS API Documentation
*/
@Override
public DescribeSignalingChannelResponse describeSignalingChannel(
DescribeSignalingChannelRequest describeSignalingChannelRequest) throws InvalidArgumentException,
ClientLimitExceededException, ResourceNotFoundException, AccessDeniedException, AwsServiceException,
SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSignalingChannel");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeSignalingChannel").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeSignalingChannelRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeSignalingChannelRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSignalingChannelRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the most current information about the specified stream. You must specify either the
* StreamName
or the StreamARN
.
*
*
* @param describeStreamRequest
* @return Result of the DescribeStream operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.DescribeStream
* @see AWS
* API Documentation
*/
@Override
public DescribeStreamResponse describeStream(DescribeStreamRequest describeStreamRequest) throws InvalidArgumentException,
ResourceNotFoundException, ClientLimitExceededException, NotAuthorizedException, AwsServiceException,
SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeStreamRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets an endpoint for a specified stream for either reading or writing. Use this endpoint in your application to
* read from the specified stream (using the GetMedia
or GetMediaForFragmentList
* operations) or write to it (using the PutMedia
operation).
*
*
*
* The returned endpoint does not have the API name appended. The client needs to add the API name to the returned
* endpoint.
*
*
*
* In the request, specify the stream either by StreamName
or StreamARN
.
*
*
* @param getDataEndpointRequest
* @return Result of the GetDataEndpoint operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.GetDataEndpoint
* @see AWS
* API Documentation
*/
@Override
public GetDataEndpointResponse getDataEndpoint(GetDataEndpointRequest getDataEndpointRequest)
throws InvalidArgumentException, ResourceNotFoundException, ClientLimitExceededException, NotAuthorizedException,
AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetDataEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataEndpoint");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetDataEndpoint").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getDataEndpointRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetDataEndpointRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDataEndpointRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Provides an endpoint for the specified signaling channel to send and receive messages. This API uses the
* SingleMasterChannelEndpointConfiguration
input parameter, which consists of the
* Protocols
and Role
properties.
*
*
* Protocols
is used to determine the communication mechanism. For example, if you specify
* WSS
as the protocol, this API produces a secure websocket endpoint. If you specify
* HTTPS
as the protocol, this API generates an HTTPS endpoint.
*
*
* Role
determines the messaging permissions. A MASTER
role results in this API generating
* an endpoint that a client can use to communicate with any of the viewers on the channel. A VIEWER
* role results in this API generating an endpoint that a client can use to communicate only with a
* MASTER
.
*
*
* @param getSignalingChannelEndpointRequest
* @return Result of the GetSignalingChannelEndpoint operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.GetSignalingChannelEndpoint
* @see AWS API Documentation
*/
@Override
public GetSignalingChannelEndpointResponse getSignalingChannelEndpoint(
GetSignalingChannelEndpointRequest getSignalingChannelEndpointRequest) throws InvalidArgumentException,
ClientLimitExceededException, ResourceNotFoundException, ResourceInUseException, AccessDeniedException,
AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSignalingChannelEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSignalingChannelEndpoint");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetSignalingChannelEndpoint").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getSignalingChannelEndpointRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSignalingChannelEndpointRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getSignalingChannelEndpointRequest.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an array of ChannelInfo
objects. Each object describes a signaling channel. To retrieve only
* those channels that satisfy a specific condition, you can specify a ChannelNameCondition
.
*
*
* @param listSignalingChannelsRequest
* @return Result of the ListSignalingChannels operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.ListSignalingChannels
* @see AWS API Documentation
*/
@Override
public ListSignalingChannelsResponse listSignalingChannels(ListSignalingChannelsRequest listSignalingChannelsRequest)
throws InvalidArgumentException, ClientLimitExceededException, AccessDeniedException, AwsServiceException,
SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSignalingChannelsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSignalingChannels");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListSignalingChannels").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listSignalingChannelsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListSignalingChannelsRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSignalingChannelsRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an array of ChannelInfo
objects. Each object describes a signaling channel. To retrieve only
* those channels that satisfy a specific condition, you can specify a ChannelNameCondition
.
*
*
*
* This is a variant of
* {@link #listSignalingChannels(software.amazon.awssdk.services.kinesisvideo.model.ListSignalingChannelsRequest)}
* 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.kinesisvideo.paginators.ListSignalingChannelsIterable responses = client.listSignalingChannelsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListSignalingChannelsIterable responses = client
* .listSignalingChannelsPaginator(request);
* for (software.amazon.awssdk.services.kinesisvideo.model.ListSignalingChannelsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListSignalingChannelsIterable responses = client.listSignalingChannelsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* 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 #listSignalingChannels(software.amazon.awssdk.services.kinesisvideo.model.ListSignalingChannelsRequest)}
* operation.
*
*
* @param listSignalingChannelsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.ListSignalingChannels
* @see AWS API Documentation
*/
@Override
public ListSignalingChannelsIterable listSignalingChannelsPaginator(ListSignalingChannelsRequest listSignalingChannelsRequest)
throws InvalidArgumentException, ClientLimitExceededException, AccessDeniedException, AwsServiceException,
SdkClientException, KinesisVideoException {
return new ListSignalingChannelsIterable(this, applyPaginatorUserAgent(listSignalingChannelsRequest));
}
/**
*
* Returns an array of StreamInfo
objects. Each object describes a stream. To retrieve only streams
* that satisfy a specific condition, you can specify a StreamNameCondition
.
*
*
* @param listStreamsRequest
* @return Result of the ListStreams operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.ListStreams
* @see AWS API
* Documentation
*/
@Override
public ListStreamsResponse listStreams(ListStreamsRequest listStreamsRequest) throws ClientLimitExceededException,
InvalidArgumentException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListStreamsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListStreams");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListStreams").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listStreamsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListStreamsRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listStreamsRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an array of StreamInfo
objects. Each object describes a stream. To retrieve only streams
* that satisfy a specific condition, you can specify a StreamNameCondition
.
*
*
*
* This is a variant of {@link #listStreams(software.amazon.awssdk.services.kinesisvideo.model.ListStreamsRequest)}
* 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.kinesisvideo.paginators.ListStreamsIterable responses = client.listStreamsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListStreamsIterable responses = client.listStreamsPaginator(request);
* for (software.amazon.awssdk.services.kinesisvideo.model.ListStreamsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListStreamsIterable responses = client.listStreamsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* 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 #listStreams(software.amazon.awssdk.services.kinesisvideo.model.ListStreamsRequest)} operation.
*
*
* @param listStreamsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.ListStreams
* @see AWS API
* Documentation
*/
@Override
public ListStreamsIterable listStreamsPaginator(ListStreamsRequest listStreamsRequest) throws ClientLimitExceededException,
InvalidArgumentException, AwsServiceException, SdkClientException, KinesisVideoException {
return new ListStreamsIterable(this, applyPaginatorUserAgent(listStreamsRequest));
}
/**
*
* Returns a list of tags associated with the specified signaling channel.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws InvalidArgumentException, ClientLimitExceededException, ResourceNotFoundException, AccessDeniedException,
AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of tags associated with the specified stream.
*
*
* In the request, you must specify either the StreamName
or the StreamARN
.
*
*
* @param listTagsForStreamRequest
* @return Result of the ListTagsForStream operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @throws InvalidResourceFormatException
* The format of the StreamARN
is invalid.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.ListTagsForStream
* @see AWS
* API Documentation
*/
@Override
public ListTagsForStreamResponse listTagsForStream(ListTagsForStreamRequest listTagsForStreamRequest)
throws ClientLimitExceededException, InvalidArgumentException, ResourceNotFoundException, NotAuthorizedException,
InvalidResourceFormatException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListTagsForStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listTagsForStreamRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds one or more tags to a signaling channel. A tag is a key-value pair (the value is optional) that you
* can define and assign to AWS resources. If you specify a tag that already exists, the tag value is replaced with
* the value that you specify in the request. For more information, see Using Cost Allocation
* Tags in the AWS Billing and Cost Management User Guide.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @throws TagsPerResourceExceededLimitException
* You have exceeded the limit of tags that you can associate with the resource. Kinesis video streams
* support up to 50 tags.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws InvalidArgumentException,
ClientLimitExceededException, ResourceNotFoundException, AccessDeniedException,
TagsPerResourceExceededLimitException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(tagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds one or more tags to a stream. A tag is a key-value pair (the value is optional) that you can define
* and assign to AWS resources. If you specify a tag that already exists, the tag value is replaced with the value
* that you specify in the request. For more information, see Using Cost Allocation
* Tags in the AWS Billing and Cost Management User Guide.
*
*
* You must provide either the StreamName
or the StreamARN
.
*
*
* This operation requires permission for the KinesisVideo:TagStream
action.
*
*
* Kinesis video streams support up to 50 tags.
*
*
* @param tagStreamRequest
* @return Result of the TagStream operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @throws InvalidResourceFormatException
* The format of the StreamARN
is invalid.
* @throws TagsPerResourceExceededLimitException
* You have exceeded the limit of tags that you can associate with the resource. Kinesis video streams
* support up to 50 tags.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.TagStream
* @see AWS API
* Documentation
*/
@Override
public TagStreamResponse tagStream(TagStreamRequest tagStreamRequest) throws ClientLimitExceededException,
InvalidArgumentException, ResourceNotFoundException, NotAuthorizedException, InvalidResourceFormatException,
TagsPerResourceExceededLimitException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(tagStreamRequest)
.withMetricCollector(apiCallMetricCollector).withMarshaller(new TagStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes one or more tags from a signaling channel. In the request, specify only a tag key or keys; don't specify
* the value. If you specify a tag key that does not exist, it's ignored.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws InvalidArgumentException,
ClientLimitExceededException, ResourceNotFoundException, AccessDeniedException, AwsServiceException,
SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes one or more tags from a stream. In the request, specify only a tag key or keys; don't specify the value.
* If you specify a tag key that does not exist, it's ignored.
*
*
* In the request, you must provide the StreamName
or StreamARN
.
*
*
* @param untagStreamRequest
* @return Result of the UntagStream operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @throws InvalidResourceFormatException
* The format of the StreamARN
is invalid.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.UntagStream
* @see AWS API
* Documentation
*/
@Override
public UntagStreamResponse untagStream(UntagStreamRequest untagStreamRequest) throws ClientLimitExceededException,
InvalidArgumentException, ResourceNotFoundException, NotAuthorizedException, InvalidResourceFormatException,
AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(untagStreamRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Increases or decreases the stream's data retention period by the value that you specify. To indicate whether you
* want to increase or decrease the data retention period, specify the Operation
parameter in the
* request body. In the request, you must specify either the StreamName
or the StreamARN
.
*
*
*
* The retention period that you specify replaces the current value.
*
*
*
* This operation requires permission for the KinesisVideo:UpdateDataRetention
action.
*
*
* Changing the data retention period affects the data in the stream as follows:
*
*
* -
*
* If the data retention period is increased, existing data is retained for the new retention period. For example,
* if the data retention period is increased from one hour to seven hours, all existing data is retained for seven
* hours.
*
*
* -
*
* If the data retention period is decreased, existing data is retained for the new retention period. For example,
* if the data retention period is decreased from seven hours to one hour, all existing data is retained for one
* hour, and any data older than one hour is deleted immediately.
*
*
*
*
* @param updateDataRetentionRequest
* @return Result of the UpdateDataRetention operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @throws VersionMismatchException
* The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream
* API.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.UpdateDataRetention
* @see AWS API Documentation
*/
@Override
public UpdateDataRetentionResponse updateDataRetention(UpdateDataRetentionRequest updateDataRetentionRequest)
throws ClientLimitExceededException, InvalidArgumentException, ResourceNotFoundException, ResourceInUseException,
NotAuthorizedException, VersionMismatchException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateDataRetentionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDataRetention");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateDataRetention").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateDataRetentionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateDataRetentionRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDataRetentionRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the existing signaling channel. This is an asynchronous operation and takes time to complete.
*
*
* If the MessageTtlSeconds
value is updated (either increased or reduced), it only applies to new
* messages sent via this channel after it's been updated. Existing messages are still expired as per the previous
* MessageTtlSeconds
value.
*
*
* @param updateSignalingChannelRequest
* @return Result of the UpdateSignalingChannel operation returned by the service.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @throws AccessDeniedException
* You do not have required permissions to perform this operation.
* @throws VersionMismatchException
* The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream
* API.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.UpdateSignalingChannel
* @see AWS API Documentation
*/
@Override
public UpdateSignalingChannelResponse updateSignalingChannel(UpdateSignalingChannelRequest updateSignalingChannelRequest)
throws InvalidArgumentException, ClientLimitExceededException, ResourceNotFoundException, ResourceInUseException,
AccessDeniedException, VersionMismatchException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSignalingChannel");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateSignalingChannel").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateSignalingChannelRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateSignalingChannelRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSignalingChannelRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates stream metadata, such as the device name and media type.
*
*
* You must provide the stream name or the Amazon Resource Name (ARN) of the stream.
*
*
* To make sure that you have the latest version of the stream before updating it, you can specify the stream
* version. Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams
* assigns a new version number. To get the latest stream version, use the DescribeStream
API.
*
*
* UpdateStream
is an asynchronous operation, and takes time to complete.
*
*
* @param updateStreamRequest
* @return Result of the UpdateStream operation returned by the service.
* @throws ClientLimitExceededException
* Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client
* calls. Try making the call later.
* @throws InvalidArgumentException
* The value for this input parameter is invalid.
* @throws ResourceNotFoundException
* Amazon Kinesis Video Streams can't find the stream that you specified.
* @throws ResourceInUseException
* The signaling channel is currently not available for this operation.
* @throws NotAuthorizedException
* The caller is not authorized to perform this operation.
* @throws VersionMismatchException
* The stream version that you specified is not the latest version. To get the latest version, use the DescribeStream
* API.
* @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 KinesisVideoException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample KinesisVideoClient.UpdateStream
* @see AWS API
* Documentation
*/
@Override
public UpdateStreamResponse updateStream(UpdateStreamRequest updateStreamRequest) throws ClientLimitExceededException,
InvalidArgumentException, ResourceNotFoundException, ResourceInUseException, NotAuthorizedException,
VersionMismatchException, AwsServiceException, SdkClientException, KinesisVideoException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
MetricCollector apiCallMetricCollector = MetricCollector.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Kinesis Video");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateStream");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateStream").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateStreamRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateStreamRequestMarshaller(protocolFactory)));
} finally {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateStreamRequest
.overrideConfiguration().orElse(null));
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
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 HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(KinesisVideoException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(401).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidArgumentException")
.exceptionBuilderSupplier(InvalidArgumentException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccountStreamLimitExceededException")
.exceptionBuilderSupplier(AccountStreamLimitExceededException::builder).httpStatusCode(400)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceInUseException")
.exceptionBuilderSupplier(ResourceInUseException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("VersionMismatchException")
.exceptionBuilderSupplier(VersionMismatchException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidDeviceException")
.exceptionBuilderSupplier(InvalidDeviceException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TagsPerResourceExceededLimitException")
.exceptionBuilderSupplier(TagsPerResourceExceededLimitException::builder).httpStatusCode(400)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccountChannelLimitExceededException")
.exceptionBuilderSupplier(AccountChannelLimitExceededException::builder).httpStatusCode(400)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("DeviceStreamLimitExceededException")
.exceptionBuilderSupplier(DeviceStreamLimitExceededException::builder).httpStatusCode(400)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NotAuthorizedException")
.exceptionBuilderSupplier(NotAuthorizedException::builder).httpStatusCode(401).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ClientLimitExceededException")
.exceptionBuilderSupplier(ClientLimitExceededException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidResourceFormatException")
.exceptionBuilderSupplier(InvalidResourceFormatException::builder).httpStatusCode(400).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();
}
}