com.amazonaws.services.mediapackagev2.AWSMediaPackageV2AsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-mediapackagev2 Show documentation
/*
* Copyright 2019-2024 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 com.amazonaws.services.mediapackagev2;
import javax.annotation.Generated;
import com.amazonaws.services.mediapackagev2.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing mediapackagev2 asynchronously. Each asynchronous method will return a Java Future object
* representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
* notification when an asynchronous operation completes.
*
*
*
* This guide is intended for creating AWS Elemental MediaPackage resources in MediaPackage Version 2 (v2) starting from
* May 2023. To get started with MediaPackage v2, create your MediaPackage resources. There isn't an automated process
* to migrate your resources from MediaPackage v1 to MediaPackage v2.
*
*
* The names of the entities that you use to access this API, like URLs and ARNs, all have the versioning information
* added, like "v2", to distinguish from the prior version. If you used MediaPackage prior to this release, you can't
* use the MediaPackage v2 CLI or the MediaPackage v2 API to access any MediaPackage v1 resources.
*
*
* If you created resources in MediaPackage v1, use video on demand (VOD) workflows, and aren't looking to migrate to
* MediaPackage v2 yet, see the MediaPackage v1 Live API
* Reference.
*
*
*
* This is the AWS Elemental MediaPackage v2 Live REST API Reference. It describes all the MediaPackage API operations
* for live content in detail, and provides sample requests, responses, and errors for the supported web services
* protocols.
*
*
* We assume that you have the IAM permissions that you need to use MediaPackage via the REST API. We also assume that
* you are familiar with the features and operations of MediaPackage, as described in the AWS Elemental MediaPackage
* User Guide.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSMediaPackageV2AsyncClient extends AWSMediaPackageV2Client implements AWSMediaPackageV2Async {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSMediaPackageV2AsyncClientBuilder asyncBuilder() {
return AWSMediaPackageV2AsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on mediapackagev2 using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSMediaPackageV2AsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on mediapackagev2 using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSMediaPackageV2AsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) {
super(asyncClientParams, endpointDiscoveryEnabled);
this.executorService = asyncClientParams.getExecutor();
}
/**
* Returns the executor service used by this client to execute async requests.
*
* @return The executor service used by this client to execute async requests.
*/
public ExecutorService getExecutorService() {
return executorService;
}
@Override
public java.util.concurrent.Future createChannelAsync(CreateChannelRequest request) {
return createChannelAsync(request, null);
}
@Override
public java.util.concurrent.Future createChannelAsync(final CreateChannelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateChannelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateChannelResult call() throws Exception {
CreateChannelResult result = null;
try {
result = executeCreateChannel(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future createChannelGroupAsync(CreateChannelGroupRequest request) {
return createChannelGroupAsync(request, null);
}
@Override
public java.util.concurrent.Future createChannelGroupAsync(final CreateChannelGroupRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateChannelGroupRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateChannelGroupResult call() throws Exception {
CreateChannelGroupResult result = null;
try {
result = executeCreateChannelGroup(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future createOriginEndpointAsync(CreateOriginEndpointRequest request) {
return createOriginEndpointAsync(request, null);
}
@Override
public java.util.concurrent.Future createOriginEndpointAsync(final CreateOriginEndpointRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateOriginEndpointRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateOriginEndpointResult call() throws Exception {
CreateOriginEndpointResult result = null;
try {
result = executeCreateOriginEndpoint(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteChannelAsync(DeleteChannelRequest request) {
return deleteChannelAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteChannelAsync(final DeleteChannelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteChannelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteChannelResult call() throws Exception {
DeleteChannelResult result = null;
try {
result = executeDeleteChannel(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteChannelGroupAsync(DeleteChannelGroupRequest request) {
return deleteChannelGroupAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteChannelGroupAsync(final DeleteChannelGroupRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteChannelGroupRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteChannelGroupResult call() throws Exception {
DeleteChannelGroupResult result = null;
try {
result = executeDeleteChannelGroup(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteChannelPolicyAsync(DeleteChannelPolicyRequest request) {
return deleteChannelPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteChannelPolicyAsync(final DeleteChannelPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteChannelPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteChannelPolicyResult call() throws Exception {
DeleteChannelPolicyResult result = null;
try {
result = executeDeleteChannelPolicy(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteOriginEndpointAsync(DeleteOriginEndpointRequest request) {
return deleteOriginEndpointAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteOriginEndpointAsync(final DeleteOriginEndpointRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteOriginEndpointRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteOriginEndpointResult call() throws Exception {
DeleteOriginEndpointResult result = null;
try {
result = executeDeleteOriginEndpoint(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteOriginEndpointPolicyAsync(DeleteOriginEndpointPolicyRequest request) {
return deleteOriginEndpointPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteOriginEndpointPolicyAsync(final DeleteOriginEndpointPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteOriginEndpointPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteOriginEndpointPolicyResult call() throws Exception {
DeleteOriginEndpointPolicyResult result = null;
try {
result = executeDeleteOriginEndpointPolicy(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getChannelAsync(GetChannelRequest request) {
return getChannelAsync(request, null);
}
@Override
public java.util.concurrent.Future getChannelAsync(final GetChannelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetChannelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetChannelResult call() throws Exception {
GetChannelResult result = null;
try {
result = executeGetChannel(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getChannelGroupAsync(GetChannelGroupRequest request) {
return getChannelGroupAsync(request, null);
}
@Override
public java.util.concurrent.Future getChannelGroupAsync(final GetChannelGroupRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetChannelGroupRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetChannelGroupResult call() throws Exception {
GetChannelGroupResult result = null;
try {
result = executeGetChannelGroup(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getChannelPolicyAsync(GetChannelPolicyRequest request) {
return getChannelPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future getChannelPolicyAsync(final GetChannelPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetChannelPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetChannelPolicyResult call() throws Exception {
GetChannelPolicyResult result = null;
try {
result = executeGetChannelPolicy(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getOriginEndpointAsync(GetOriginEndpointRequest request) {
return getOriginEndpointAsync(request, null);
}
@Override
public java.util.concurrent.Future getOriginEndpointAsync(final GetOriginEndpointRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetOriginEndpointRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetOriginEndpointResult call() throws Exception {
GetOriginEndpointResult result = null;
try {
result = executeGetOriginEndpoint(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getOriginEndpointPolicyAsync(GetOriginEndpointPolicyRequest request) {
return getOriginEndpointPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future getOriginEndpointPolicyAsync(final GetOriginEndpointPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetOriginEndpointPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetOriginEndpointPolicyResult call() throws Exception {
GetOriginEndpointPolicyResult result = null;
try {
result = executeGetOriginEndpointPolicy(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listChannelGroupsAsync(ListChannelGroupsRequest request) {
return listChannelGroupsAsync(request, null);
}
@Override
public java.util.concurrent.Future listChannelGroupsAsync(final ListChannelGroupsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListChannelGroupsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListChannelGroupsResult call() throws Exception {
ListChannelGroupsResult result = null;
try {
result = executeListChannelGroups(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listChannelsAsync(ListChannelsRequest request) {
return listChannelsAsync(request, null);
}
@Override
public java.util.concurrent.Future listChannelsAsync(final ListChannelsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListChannelsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListChannelsResult call() throws Exception {
ListChannelsResult result = null;
try {
result = executeListChannels(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listOriginEndpointsAsync(ListOriginEndpointsRequest request) {
return listOriginEndpointsAsync(request, null);
}
@Override
public java.util.concurrent.Future listOriginEndpointsAsync(final ListOriginEndpointsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListOriginEndpointsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListOriginEndpointsResult call() throws Exception {
ListOriginEndpointsResult result = null;
try {
result = executeListOriginEndpoints(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(ListTagsForResourceRequest request) {
return listTagsForResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForResourceResult call() throws Exception {
ListTagsForResourceResult result = null;
try {
result = executeListTagsForResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future putChannelPolicyAsync(PutChannelPolicyRequest request) {
return putChannelPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future putChannelPolicyAsync(final PutChannelPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutChannelPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutChannelPolicyResult call() throws Exception {
PutChannelPolicyResult result = null;
try {
result = executePutChannelPolicy(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future putOriginEndpointPolicyAsync(PutOriginEndpointPolicyRequest request) {
return putOriginEndpointPolicyAsync(request, null);
}
@Override
public java.util.concurrent.Future putOriginEndpointPolicyAsync(final PutOriginEndpointPolicyRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutOriginEndpointPolicyRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutOriginEndpointPolicyResult call() throws Exception {
PutOriginEndpointPolicyResult result = null;
try {
result = executePutOriginEndpointPolicy(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future tagResourceAsync(TagResourceRequest request) {
return tagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagResourceResult call() throws Exception {
TagResourceResult result = null;
try {
result = executeTagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) {
return untagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagResourceResult call() throws Exception {
UntagResourceResult result = null;
try {
result = executeUntagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateChannelAsync(UpdateChannelRequest request) {
return updateChannelAsync(request, null);
}
@Override
public java.util.concurrent.Future updateChannelAsync(final UpdateChannelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateChannelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateChannelResult call() throws Exception {
UpdateChannelResult result = null;
try {
result = executeUpdateChannel(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateChannelGroupAsync(UpdateChannelGroupRequest request) {
return updateChannelGroupAsync(request, null);
}
@Override
public java.util.concurrent.Future updateChannelGroupAsync(final UpdateChannelGroupRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateChannelGroupRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateChannelGroupResult call() throws Exception {
UpdateChannelGroupResult result = null;
try {
result = executeUpdateChannelGroup(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateOriginEndpointAsync(UpdateOriginEndpointRequest request) {
return updateOriginEndpointAsync(request, null);
}
@Override
public java.util.concurrent.Future updateOriginEndpointAsync(final UpdateOriginEndpointRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateOriginEndpointRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateOriginEndpointResult call() throws Exception {
UpdateOriginEndpointResult result = null;
try {
result = executeUpdateOriginEndpoint(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending
* asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should
* call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to
* calling this method.
*/
@Override
public void shutdown() {
super.shutdown();
executorService.shutdownNow();
}
}