com.amazonaws.services.codestar.AWSCodeStarAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-codestar 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.codestar;
import javax.annotation.Generated;
import com.amazonaws.services.codestar.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing CodeStar 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.
*
* AWS CodeStar
*
* This is the API reference for AWS CodeStar. This reference provides descriptions of the operations and data types for
* the AWS CodeStar API along with usage examples.
*
*
* You can use the AWS CodeStar API to work with:
*
*
* Projects and their resources, by calling the following:
*
*
* -
*
* DeleteProject
, which deletes a project.
*
*
* -
*
* DescribeProject
, which lists the attributes of a project.
*
*
* -
*
* ListProjects
, which lists all projects associated with your AWS account.
*
*
* -
*
* ListResources
, which lists the resources associated with a project.
*
*
* -
*
* ListTagsForProject
, which lists the tags associated with a project.
*
*
* -
*
* TagProject
, which adds tags to a project.
*
*
* -
*
* UntagProject
, which removes tags from a project.
*
*
* -
*
* UpdateProject
, which updates the attributes of a project.
*
*
*
*
* Teams and team members, by calling the following:
*
*
* -
*
* AssociateTeamMember
, which adds an IAM user to the team for a project.
*
*
* -
*
* DisassociateTeamMember
, which removes an IAM user from the team for a project.
*
*
* -
*
* ListTeamMembers
, which lists all the IAM users in the team for a project, including their roles and
* attributes.
*
*
* -
*
* UpdateTeamMember
, which updates a team member's attributes in a project.
*
*
*
*
* Users, by calling the following:
*
*
* -
*
* CreateUserProfile
, which creates a user profile that contains data associated with the user across all
* projects.
*
*
* -
*
* DeleteUserProfile
, which deletes all user profile information across all projects.
*
*
* -
*
* DescribeUserProfile
, which describes the profile of a user.
*
*
* -
*
* ListUserProfiles
, which lists all user profiles.
*
*
* -
*
* UpdateUserProfile
, which updates the profile for a user.
*
*
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSCodeStarAsyncClient extends AWSCodeStarClient implements AWSCodeStarAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSCodeStarAsyncClientBuilder asyncBuilder() {
return AWSCodeStarAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on CodeStar using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSCodeStarAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on CodeStar using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSCodeStarAsyncClient(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 associateTeamMemberAsync(AssociateTeamMemberRequest request) {
return associateTeamMemberAsync(request, null);
}
@Override
public java.util.concurrent.Future associateTeamMemberAsync(final AssociateTeamMemberRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final AssociateTeamMemberRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public AssociateTeamMemberResult call() throws Exception {
AssociateTeamMemberResult result = null;
try {
result = executeAssociateTeamMember(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 createProjectAsync(CreateProjectRequest request) {
return createProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future createProjectAsync(final CreateProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateProjectResult call() throws Exception {
CreateProjectResult result = null;
try {
result = executeCreateProject(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 createUserProfileAsync(CreateUserProfileRequest request) {
return createUserProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future createUserProfileAsync(final CreateUserProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateUserProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateUserProfileResult call() throws Exception {
CreateUserProfileResult result = null;
try {
result = executeCreateUserProfile(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 deleteProjectAsync(DeleteProjectRequest request) {
return deleteProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteProjectAsync(final DeleteProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteProjectResult call() throws Exception {
DeleteProjectResult result = null;
try {
result = executeDeleteProject(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 deleteUserProfileAsync(DeleteUserProfileRequest request) {
return deleteUserProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteUserProfileAsync(final DeleteUserProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteUserProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteUserProfileResult call() throws Exception {
DeleteUserProfileResult result = null;
try {
result = executeDeleteUserProfile(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 describeProjectAsync(DescribeProjectRequest request) {
return describeProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future describeProjectAsync(final DescribeProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeProjectResult call() throws Exception {
DescribeProjectResult result = null;
try {
result = executeDescribeProject(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 describeUserProfileAsync(DescribeUserProfileRequest request) {
return describeUserProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future describeUserProfileAsync(final DescribeUserProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeUserProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeUserProfileResult call() throws Exception {
DescribeUserProfileResult result = null;
try {
result = executeDescribeUserProfile(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 disassociateTeamMemberAsync(DisassociateTeamMemberRequest request) {
return disassociateTeamMemberAsync(request, null);
}
@Override
public java.util.concurrent.Future disassociateTeamMemberAsync(final DisassociateTeamMemberRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisassociateTeamMemberRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisassociateTeamMemberResult call() throws Exception {
DisassociateTeamMemberResult result = null;
try {
result = executeDisassociateTeamMember(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 listProjectsAsync(ListProjectsRequest request) {
return listProjectsAsync(request, null);
}
@Override
public java.util.concurrent.Future listProjectsAsync(final ListProjectsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListProjectsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListProjectsResult call() throws Exception {
ListProjectsResult result = null;
try {
result = executeListProjects(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 listResourcesAsync(ListResourcesRequest request) {
return listResourcesAsync(request, null);
}
@Override
public java.util.concurrent.Future listResourcesAsync(final ListResourcesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListResourcesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListResourcesResult call() throws Exception {
ListResourcesResult result = null;
try {
result = executeListResources(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 listTagsForProjectAsync(ListTagsForProjectRequest request) {
return listTagsForProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForProjectAsync(final ListTagsForProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForProjectResult call() throws Exception {
ListTagsForProjectResult result = null;
try {
result = executeListTagsForProject(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 listTeamMembersAsync(ListTeamMembersRequest request) {
return listTeamMembersAsync(request, null);
}
@Override
public java.util.concurrent.Future listTeamMembersAsync(final ListTeamMembersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTeamMembersRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTeamMembersResult call() throws Exception {
ListTeamMembersResult result = null;
try {
result = executeListTeamMembers(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 listUserProfilesAsync(ListUserProfilesRequest request) {
return listUserProfilesAsync(request, null);
}
@Override
public java.util.concurrent.Future listUserProfilesAsync(final ListUserProfilesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListUserProfilesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListUserProfilesResult call() throws Exception {
ListUserProfilesResult result = null;
try {
result = executeListUserProfiles(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 tagProjectAsync(TagProjectRequest request) {
return tagProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future tagProjectAsync(final TagProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagProjectResult call() throws Exception {
TagProjectResult result = null;
try {
result = executeTagProject(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 untagProjectAsync(UntagProjectRequest request) {
return untagProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future untagProjectAsync(final UntagProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagProjectResult call() throws Exception {
UntagProjectResult result = null;
try {
result = executeUntagProject(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 updateProjectAsync(UpdateProjectRequest request) {
return updateProjectAsync(request, null);
}
@Override
public java.util.concurrent.Future updateProjectAsync(final UpdateProjectRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateProjectRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateProjectResult call() throws Exception {
UpdateProjectResult result = null;
try {
result = executeUpdateProject(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 updateTeamMemberAsync(UpdateTeamMemberRequest request) {
return updateTeamMemberAsync(request, null);
}
@Override
public java.util.concurrent.Future updateTeamMemberAsync(final UpdateTeamMemberRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateTeamMemberRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateTeamMemberResult call() throws Exception {
UpdateTeamMemberResult result = null;
try {
result = executeUpdateTeamMember(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 updateUserProfileAsync(UpdateUserProfileRequest request) {
return updateUserProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future updateUserProfileAsync(final UpdateUserProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateUserProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateUserProfileResult call() throws Exception {
UpdateUserProfileResult result = null;
try {
result = executeUpdateUserProfile(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();
}
}