software.amazon.awssdk.services.kinesisvideo.DefaultKinesisVideoAsyncClient 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.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.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.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.ListSignalingChannelsPublisher;
import software.amazon.awssdk.services.kinesisvideo.paginators.ListStreamsPublisher;
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;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link KinesisVideoAsyncClient}.
*
* @see KinesisVideoAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultKinesisVideoAsyncClient implements KinesisVideoAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultKinesisVideoAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultKinesisVideoAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(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 A Java Future containing the result of the CreateSignalingChannel operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - AccountChannelLimitExceededException You have reached the maximum limit of active signaling channels
* for this AWS account in this region.
* - ResourceInUseException The stream is currently not available for this operation.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - TagsPerResourceExceededLimitException You have exceeded the limit of tags that you can associate with
* the resource. Kinesis video streams support up to 50 tags.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.CreateSignalingChannel
* @see AWS API Documentation
*/
@Override
public CompletableFuture createSignalingChannel(
CreateSignalingChannelRequest createSignalingChannelRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSignalingChannel")
.withMarshaller(new CreateSignalingChannelRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(createSignalingChannelRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the CreateStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - AccountStreamLimitExceededException The number of streams created for the account is too high.
* - DeviceStreamLimitExceededException Not implemented.
* - ResourceInUseException The stream is currently not available for this operation.
* - InvalidDeviceException Not implemented.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - TagsPerResourceExceededLimitException You have exceeded the limit of tags that you can associate with
* the resource. Kinesis video streams support up to 50 tags.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.CreateStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createStream(CreateStreamRequest createStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateStream").withMarshaller(new CreateStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(createStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the DeleteSignalingChannel operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - VersionMismatchException The stream version that you specified is not the latest version. To get the
* latest version, use the DescribeStream API.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.DeleteSignalingChannel
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteSignalingChannel(
DeleteSignalingChannelRequest deleteSignalingChannelRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSignalingChannel")
.withMarshaller(new DeleteSignalingChannelRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(deleteSignalingChannelRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the DeleteStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - VersionMismatchException The stream version that you specified is not the latest version. To get the
* latest version, use the DescribeStream API.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.DeleteStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteStream(DeleteStreamRequest deleteStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteStream").withMarshaller(new DeleteStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(deleteStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns the most current information about the signaling channel. You must specify either the name or the ARN of
* the channel that you want to describe.
*
*
* @param describeSignalingChannelRequest
* @return A Java Future containing the result of the DescribeSignalingChannel operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.DescribeSignalingChannel
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeSignalingChannel(
DescribeSignalingChannelRequest describeSignalingChannelRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeSignalingChannel")
.withMarshaller(new DescribeSignalingChannelRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(describeSignalingChannelRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns the most current information about the specified stream. You must specify either the
* StreamName
or the StreamARN
.
*
*
* @param describeStreamRequest
* @return A Java Future containing the result of the DescribeStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.DescribeStream
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeStream(DescribeStreamRequest describeStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeStream")
.withMarshaller(new DescribeStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(describeStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the GetDataEndpoint operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.GetDataEndpoint
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getDataEndpoint(GetDataEndpointRequest getDataEndpointRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetDataEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDataEndpoint")
.withMarshaller(new GetDataEndpointRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(getDataEndpointRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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, specifying WSS
* as the protocol, results in this API producing a secure websocket endpoint, and specifying HTTPS
as
* the protocol, results in this API generating 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 A Java Future containing the result of the GetSignalingChannelEndpoint operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - ResourceInUseException The stream is currently not available for this operation.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.GetSignalingChannelEndpoint
* @see AWS API Documentation
*/
@Override
public CompletableFuture getSignalingChannelEndpoint(
GetSignalingChannelEndpointRequest getSignalingChannelEndpointRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSignalingChannelEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetSignalingChannelEndpoint")
.withMarshaller(new GetSignalingChannelEndpointRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(getSignalingChannelEndpointRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the ListSignalingChannels operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.ListSignalingChannels
* @see AWS API Documentation
*/
@Override
public CompletableFuture listSignalingChannels(
ListSignalingChannelsRequest listSignalingChannelsRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSignalingChannelsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListSignalingChannels")
.withMarshaller(new ListSignalingChannelsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(listSignalingChannelsRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListSignalingChannelsPublisher publisher = client.listSignalingChannelsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListSignalingChannelsPublisher publisher = client.listSignalingChannelsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.kinesisvideo.model.ListSignalingChannelsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* 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 publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.ListSignalingChannels
* @see AWS API Documentation
*/
public ListSignalingChannelsPublisher listSignalingChannelsPaginator(ListSignalingChannelsRequest listSignalingChannelsRequest) {
return new ListSignalingChannelsPublisher(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 A Java Future containing the result of the ListStreams operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.ListStreams
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listStreams(ListStreamsRequest listStreamsRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListStreamsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListStreams").withMarshaller(new ListStreamsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(listStreamsRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListStreamsPublisher publisher = client.listStreamsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.kinesisvideo.paginators.ListStreamsPublisher publisher = client.listStreamsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.kinesisvideo.model.ListStreamsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* 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 publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.ListStreams
* @see AWS API
* Documentation
*/
public ListStreamsPublisher listStreamsPaginator(ListStreamsRequest listStreamsRequest) {
return new ListStreamsPublisher(this, applyPaginatorUserAgent(listStreamsRequest));
}
/**
*
* Returns a list of tags associated with the specified signaling channel.
*
*
* @param listTagsForResourceRequest
* @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public CompletableFuture listTagsForResource(
ListTagsForResourceRequest listTagsForResourceRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource")
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(listTagsForResourceRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the ListTagsForStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - InvalidResourceFormatException The format of the
StreamARN
is invalid.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.ListTagsForStream
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listTagsForStream(ListTagsForStreamRequest listTagsForStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListTagsForStream")
.withMarshaller(new ListTagsForStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(listTagsForStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - TagsPerResourceExceededLimitException You have exceeded the limit of tags that you can associate with
* the resource. Kinesis video streams support up to 50 tags.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("TagResource").withMarshaller(new TagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(tagResourceRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the TagStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - InvalidResourceFormatException The format of the
StreamARN
is invalid.
* - TagsPerResourceExceededLimitException You have exceeded the limit of tags that you can associate with
* the resource. Kinesis video streams support up to 50 tags.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.TagStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture tagStream(TagStreamRequest tagStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("TagStream")
.withMarshaller(new TagStreamRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(tagStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.UntagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UntagResource")
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(untagResourceRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the UntagStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - InvalidResourceFormatException The format of the
StreamARN
is invalid.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.UntagStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture untagStream(UntagStreamRequest untagStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UntagStream").withMarshaller(new UntagStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(untagStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the UpdateDataRetention operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - ResourceInUseException The stream is currently not available for this operation.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - VersionMismatchException The stream version that you specified is not the latest version. To get the
* latest version, use the DescribeStream API.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.UpdateDataRetention
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateDataRetention(
UpdateDataRetentionRequest updateDataRetentionRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateDataRetentionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateDataRetention")
.withMarshaller(new UpdateDataRetentionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(updateDataRetentionRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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), then it only applies to new
* messages sent via this channel after it's been updated. Existing messages are still expire as per the previous
* MessageTtlSeconds
value.
*
*
* @param updateSignalingChannelRequest
* @return A Java Future containing the result of the UpdateSignalingChannel operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidArgumentException The value for this input parameter is invalid.
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - ResourceInUseException The stream is currently not available for this operation.
* - AccessDeniedException You do not have required permissions to perform this operation.
* - VersionMismatchException The stream version that you specified is not the latest version. To get the
* latest version, use the DescribeStream API.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.UpdateSignalingChannel
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateSignalingChannel(
UpdateSignalingChannelRequest updateSignalingChannelRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSignalingChannelResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateSignalingChannel")
.withMarshaller(new UpdateSignalingChannelRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(updateSignalingChannelRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* 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 A Java Future containing the result of the UpdateStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ClientLimitExceededException Kinesis Video Streams has throttled the request because you have
* exceeded the limit of allowed client calls. Try making the call later.
* - InvalidArgumentException The value for this input parameter is invalid.
* - ResourceNotFoundException Amazon Kinesis Video Streams can't find the stream that you specified.
* - ResourceInUseException The stream is currently not available for this operation.
* - NotAuthorizedException The caller is not authorized to perform this operation.
* - VersionMismatchException The stream version that you specified is not the latest version. To get the
* latest version, use the DescribeStream API.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - KinesisVideoException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample KinesisVideoAsyncClient.UpdateStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture updateStream(UpdateStreamRequest updateStreamRequest) {
try {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateStream").withMarshaller(new UpdateStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(updateStreamRequest));
return executeFuture;
} catch (Throwable t) {
return CompletableFutureUtils.failedFuture(t);
}
}
@Override
public void close() {
clientHandler.close();
}
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());
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
}