
software.amazon.awssdk.services.workmail.DefaultWorkMailClient Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.workmail;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
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.workmail.model.AssociateDelegateToResourceRequest;
import software.amazon.awssdk.services.workmail.model.AssociateDelegateToResourceResponse;
import software.amazon.awssdk.services.workmail.model.AssociateMemberToGroupRequest;
import software.amazon.awssdk.services.workmail.model.AssociateMemberToGroupResponse;
import software.amazon.awssdk.services.workmail.model.CancelMailboxExportJobRequest;
import software.amazon.awssdk.services.workmail.model.CancelMailboxExportJobResponse;
import software.amazon.awssdk.services.workmail.model.CreateAliasRequest;
import software.amazon.awssdk.services.workmail.model.CreateAliasResponse;
import software.amazon.awssdk.services.workmail.model.CreateGroupRequest;
import software.amazon.awssdk.services.workmail.model.CreateGroupResponse;
import software.amazon.awssdk.services.workmail.model.CreateMobileDeviceAccessRuleRequest;
import software.amazon.awssdk.services.workmail.model.CreateMobileDeviceAccessRuleResponse;
import software.amazon.awssdk.services.workmail.model.CreateOrganizationRequest;
import software.amazon.awssdk.services.workmail.model.CreateOrganizationResponse;
import software.amazon.awssdk.services.workmail.model.CreateResourceRequest;
import software.amazon.awssdk.services.workmail.model.CreateResourceResponse;
import software.amazon.awssdk.services.workmail.model.CreateUserRequest;
import software.amazon.awssdk.services.workmail.model.CreateUserResponse;
import software.amazon.awssdk.services.workmail.model.DeleteAccessControlRuleRequest;
import software.amazon.awssdk.services.workmail.model.DeleteAccessControlRuleResponse;
import software.amazon.awssdk.services.workmail.model.DeleteAliasRequest;
import software.amazon.awssdk.services.workmail.model.DeleteAliasResponse;
import software.amazon.awssdk.services.workmail.model.DeleteGroupRequest;
import software.amazon.awssdk.services.workmail.model.DeleteGroupResponse;
import software.amazon.awssdk.services.workmail.model.DeleteMailboxPermissionsRequest;
import software.amazon.awssdk.services.workmail.model.DeleteMailboxPermissionsResponse;
import software.amazon.awssdk.services.workmail.model.DeleteMobileDeviceAccessRuleRequest;
import software.amazon.awssdk.services.workmail.model.DeleteMobileDeviceAccessRuleResponse;
import software.amazon.awssdk.services.workmail.model.DeleteOrganizationRequest;
import software.amazon.awssdk.services.workmail.model.DeleteOrganizationResponse;
import software.amazon.awssdk.services.workmail.model.DeleteResourceRequest;
import software.amazon.awssdk.services.workmail.model.DeleteResourceResponse;
import software.amazon.awssdk.services.workmail.model.DeleteRetentionPolicyRequest;
import software.amazon.awssdk.services.workmail.model.DeleteRetentionPolicyResponse;
import software.amazon.awssdk.services.workmail.model.DeleteUserRequest;
import software.amazon.awssdk.services.workmail.model.DeleteUserResponse;
import software.amazon.awssdk.services.workmail.model.DeregisterFromWorkMailRequest;
import software.amazon.awssdk.services.workmail.model.DeregisterFromWorkMailResponse;
import software.amazon.awssdk.services.workmail.model.DescribeGroupRequest;
import software.amazon.awssdk.services.workmail.model.DescribeGroupResponse;
import software.amazon.awssdk.services.workmail.model.DescribeMailboxExportJobRequest;
import software.amazon.awssdk.services.workmail.model.DescribeMailboxExportJobResponse;
import software.amazon.awssdk.services.workmail.model.DescribeOrganizationRequest;
import software.amazon.awssdk.services.workmail.model.DescribeOrganizationResponse;
import software.amazon.awssdk.services.workmail.model.DescribeResourceRequest;
import software.amazon.awssdk.services.workmail.model.DescribeResourceResponse;
import software.amazon.awssdk.services.workmail.model.DescribeUserRequest;
import software.amazon.awssdk.services.workmail.model.DescribeUserResponse;
import software.amazon.awssdk.services.workmail.model.DirectoryInUseException;
import software.amazon.awssdk.services.workmail.model.DirectoryServiceAuthenticationFailedException;
import software.amazon.awssdk.services.workmail.model.DirectoryUnavailableException;
import software.amazon.awssdk.services.workmail.model.DisassociateDelegateFromResourceRequest;
import software.amazon.awssdk.services.workmail.model.DisassociateDelegateFromResourceResponse;
import software.amazon.awssdk.services.workmail.model.DisassociateMemberFromGroupRequest;
import software.amazon.awssdk.services.workmail.model.DisassociateMemberFromGroupResponse;
import software.amazon.awssdk.services.workmail.model.EmailAddressInUseException;
import software.amazon.awssdk.services.workmail.model.EntityAlreadyRegisteredException;
import software.amazon.awssdk.services.workmail.model.EntityNotFoundException;
import software.amazon.awssdk.services.workmail.model.EntityStateException;
import software.amazon.awssdk.services.workmail.model.GetAccessControlEffectRequest;
import software.amazon.awssdk.services.workmail.model.GetAccessControlEffectResponse;
import software.amazon.awssdk.services.workmail.model.GetDefaultRetentionPolicyRequest;
import software.amazon.awssdk.services.workmail.model.GetDefaultRetentionPolicyResponse;
import software.amazon.awssdk.services.workmail.model.GetMailboxDetailsRequest;
import software.amazon.awssdk.services.workmail.model.GetMailboxDetailsResponse;
import software.amazon.awssdk.services.workmail.model.GetMobileDeviceAccessEffectRequest;
import software.amazon.awssdk.services.workmail.model.GetMobileDeviceAccessEffectResponse;
import software.amazon.awssdk.services.workmail.model.InvalidConfigurationException;
import software.amazon.awssdk.services.workmail.model.InvalidParameterException;
import software.amazon.awssdk.services.workmail.model.InvalidPasswordException;
import software.amazon.awssdk.services.workmail.model.LimitExceededException;
import software.amazon.awssdk.services.workmail.model.ListAccessControlRulesRequest;
import software.amazon.awssdk.services.workmail.model.ListAccessControlRulesResponse;
import software.amazon.awssdk.services.workmail.model.ListAliasesRequest;
import software.amazon.awssdk.services.workmail.model.ListAliasesResponse;
import software.amazon.awssdk.services.workmail.model.ListGroupMembersRequest;
import software.amazon.awssdk.services.workmail.model.ListGroupMembersResponse;
import software.amazon.awssdk.services.workmail.model.ListGroupsRequest;
import software.amazon.awssdk.services.workmail.model.ListGroupsResponse;
import software.amazon.awssdk.services.workmail.model.ListMailboxExportJobsRequest;
import software.amazon.awssdk.services.workmail.model.ListMailboxExportJobsResponse;
import software.amazon.awssdk.services.workmail.model.ListMailboxPermissionsRequest;
import software.amazon.awssdk.services.workmail.model.ListMailboxPermissionsResponse;
import software.amazon.awssdk.services.workmail.model.ListMobileDeviceAccessRulesRequest;
import software.amazon.awssdk.services.workmail.model.ListMobileDeviceAccessRulesResponse;
import software.amazon.awssdk.services.workmail.model.ListOrganizationsRequest;
import software.amazon.awssdk.services.workmail.model.ListOrganizationsResponse;
import software.amazon.awssdk.services.workmail.model.ListResourceDelegatesRequest;
import software.amazon.awssdk.services.workmail.model.ListResourceDelegatesResponse;
import software.amazon.awssdk.services.workmail.model.ListResourcesRequest;
import software.amazon.awssdk.services.workmail.model.ListResourcesResponse;
import software.amazon.awssdk.services.workmail.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.workmail.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.workmail.model.ListUsersRequest;
import software.amazon.awssdk.services.workmail.model.ListUsersResponse;
import software.amazon.awssdk.services.workmail.model.MailDomainNotFoundException;
import software.amazon.awssdk.services.workmail.model.MailDomainStateException;
import software.amazon.awssdk.services.workmail.model.NameAvailabilityException;
import software.amazon.awssdk.services.workmail.model.OrganizationNotFoundException;
import software.amazon.awssdk.services.workmail.model.OrganizationStateException;
import software.amazon.awssdk.services.workmail.model.PutAccessControlRuleRequest;
import software.amazon.awssdk.services.workmail.model.PutAccessControlRuleResponse;
import software.amazon.awssdk.services.workmail.model.PutMailboxPermissionsRequest;
import software.amazon.awssdk.services.workmail.model.PutMailboxPermissionsResponse;
import software.amazon.awssdk.services.workmail.model.PutRetentionPolicyRequest;
import software.amazon.awssdk.services.workmail.model.PutRetentionPolicyResponse;
import software.amazon.awssdk.services.workmail.model.RegisterToWorkMailRequest;
import software.amazon.awssdk.services.workmail.model.RegisterToWorkMailResponse;
import software.amazon.awssdk.services.workmail.model.ReservedNameException;
import software.amazon.awssdk.services.workmail.model.ResetPasswordRequest;
import software.amazon.awssdk.services.workmail.model.ResetPasswordResponse;
import software.amazon.awssdk.services.workmail.model.ResourceNotFoundException;
import software.amazon.awssdk.services.workmail.model.StartMailboxExportJobRequest;
import software.amazon.awssdk.services.workmail.model.StartMailboxExportJobResponse;
import software.amazon.awssdk.services.workmail.model.TagResourceRequest;
import software.amazon.awssdk.services.workmail.model.TagResourceResponse;
import software.amazon.awssdk.services.workmail.model.TooManyTagsException;
import software.amazon.awssdk.services.workmail.model.UnsupportedOperationException;
import software.amazon.awssdk.services.workmail.model.UntagResourceRequest;
import software.amazon.awssdk.services.workmail.model.UntagResourceResponse;
import software.amazon.awssdk.services.workmail.model.UpdateMailboxQuotaRequest;
import software.amazon.awssdk.services.workmail.model.UpdateMailboxQuotaResponse;
import software.amazon.awssdk.services.workmail.model.UpdateMobileDeviceAccessRuleRequest;
import software.amazon.awssdk.services.workmail.model.UpdateMobileDeviceAccessRuleResponse;
import software.amazon.awssdk.services.workmail.model.UpdatePrimaryEmailAddressRequest;
import software.amazon.awssdk.services.workmail.model.UpdatePrimaryEmailAddressResponse;
import software.amazon.awssdk.services.workmail.model.UpdateResourceRequest;
import software.amazon.awssdk.services.workmail.model.UpdateResourceResponse;
import software.amazon.awssdk.services.workmail.model.WorkMailException;
import software.amazon.awssdk.services.workmail.model.WorkMailRequest;
import software.amazon.awssdk.services.workmail.paginators.ListAliasesIterable;
import software.amazon.awssdk.services.workmail.paginators.ListGroupMembersIterable;
import software.amazon.awssdk.services.workmail.paginators.ListGroupsIterable;
import software.amazon.awssdk.services.workmail.paginators.ListMailboxExportJobsIterable;
import software.amazon.awssdk.services.workmail.paginators.ListMailboxPermissionsIterable;
import software.amazon.awssdk.services.workmail.paginators.ListOrganizationsIterable;
import software.amazon.awssdk.services.workmail.paginators.ListResourceDelegatesIterable;
import software.amazon.awssdk.services.workmail.paginators.ListResourcesIterable;
import software.amazon.awssdk.services.workmail.paginators.ListUsersIterable;
import software.amazon.awssdk.services.workmail.transform.AssociateDelegateToResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.AssociateMemberToGroupRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CancelMailboxExportJobRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CreateAliasRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CreateGroupRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CreateMobileDeviceAccessRuleRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CreateOrganizationRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CreateResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.CreateUserRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteAccessControlRuleRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteAliasRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteGroupRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteMailboxPermissionsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteMobileDeviceAccessRuleRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteOrganizationRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteRetentionPolicyRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeleteUserRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DeregisterFromWorkMailRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DescribeGroupRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DescribeMailboxExportJobRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DescribeOrganizationRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DescribeResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DescribeUserRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DisassociateDelegateFromResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.DisassociateMemberFromGroupRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.GetAccessControlEffectRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.GetDefaultRetentionPolicyRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.GetMailboxDetailsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.GetMobileDeviceAccessEffectRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListAccessControlRulesRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListAliasesRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListGroupMembersRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListGroupsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListMailboxExportJobsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListMailboxPermissionsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListMobileDeviceAccessRulesRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListOrganizationsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListResourceDelegatesRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListResourcesRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ListUsersRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.PutAccessControlRuleRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.PutMailboxPermissionsRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.PutRetentionPolicyRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.RegisterToWorkMailRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.ResetPasswordRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.StartMailboxExportJobRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.UpdateMailboxQuotaRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.UpdateMobileDeviceAccessRuleRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.UpdatePrimaryEmailAddressRequestMarshaller;
import software.amazon.awssdk.services.workmail.transform.UpdateResourceRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link WorkMailClient}.
*
* @see WorkMailClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultWorkMailClient implements WorkMailClient {
private static final Logger log = Logger.loggerFor(DefaultWorkMailClient.class);
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultWorkMailClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Adds a member (user or group) to the resource's set of delegates.
*
*
* @param associateDelegateToResourceRequest
* @return Result of the AssociateDelegateToResource operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.AssociateDelegateToResource
* @see AWS API Documentation
*/
@Override
public AssociateDelegateToResourceResponse associateDelegateToResource(
AssociateDelegateToResourceRequest associateDelegateToResourceRequest) throws EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateDelegateToResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, associateDelegateToResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateDelegateToResource");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AssociateDelegateToResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(associateDelegateToResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new AssociateDelegateToResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds a member (user or group) to the group's set.
*
*
* @param associateMemberToGroupRequest
* @return Result of the AssociateMemberToGroup operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.AssociateMemberToGroup
* @see AWS API Documentation
*/
@Override
public AssociateMemberToGroupResponse associateMemberToGroup(AssociateMemberToGroupRequest associateMemberToGroupRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
UnsupportedOperationException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateMemberToGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, associateMemberToGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateMemberToGroup");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AssociateMemberToGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(associateMemberToGroupRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new AssociateMemberToGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Cancels a mailbox export job.
*
*
*
* If the mailbox export job is near completion, it might not be possible to cancel it.
*
*
*
* @param cancelMailboxExportJobRequest
* @return Result of the CancelMailboxExportJob operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CancelMailboxExportJob
* @see AWS API Documentation
*/
@Override
public CancelMailboxExportJobResponse cancelMailboxExportJob(CancelMailboxExportJobRequest cancelMailboxExportJobRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, EntityNotFoundException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CancelMailboxExportJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelMailboxExportJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelMailboxExportJob");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CancelMailboxExportJob").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(cancelMailboxExportJobRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CancelMailboxExportJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds an alias to the set of a given member (user or group) of Amazon WorkMail.
*
*
* @param createAliasRequest
* @return Result of the CreateAlias operation returned by the service.
* @throws EmailAddressInUseException
* The email address that you're trying to assign is already created for a different user, group, or
* resource.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws MailDomainNotFoundException
* For an email or alias to be created in Amazon WorkMail, the included domain must be defined in the
* organization.
* @throws MailDomainStateException
* After a domain has been added to the organization, it must be verified. The domain is not yet verified.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws LimitExceededException
* The request exceeds the limit of the resource.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CreateAlias
* @see AWS API
* Documentation
*/
@Override
public CreateAliasResponse createAlias(CreateAliasRequest createAliasRequest) throws EmailAddressInUseException,
EntityNotFoundException, EntityStateException, InvalidParameterException, MailDomainNotFoundException,
MailDomainStateException, OrganizationNotFoundException, OrganizationStateException, LimitExceededException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateAliasResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAliasRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAlias");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateAlias").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createAliasRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateAliasRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a group that can be used in Amazon WorkMail by calling the RegisterToWorkMail operation.
*
*
* @param createGroupRequest
* @return Result of the CreateGroup operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws NameAvailabilityException
* The user, group, or resource name isn't unique in Amazon WorkMail.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws ReservedNameException
* This user, group, or resource name is not allowed in Amazon WorkMail.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CreateGroup
* @see AWS API
* Documentation
*/
@Override
public CreateGroupResponse createGroup(CreateGroupRequest createGroupRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, InvalidParameterException,
NameAvailabilityException, OrganizationNotFoundException, OrganizationStateException, ReservedNameException,
UnsupportedOperationException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createGroupRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new mobile device access rule for the specified Amazon WorkMail organization.
*
*
* @param createMobileDeviceAccessRuleRequest
* @return Result of the CreateMobileDeviceAccessRule operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws LimitExceededException
* The request exceeds the limit of the resource.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CreateMobileDeviceAccessRule
* @see AWS API Documentation
*/
@Override
public CreateMobileDeviceAccessRuleResponse createMobileDeviceAccessRule(
CreateMobileDeviceAccessRuleRequest createMobileDeviceAccessRuleRequest) throws InvalidParameterException,
LimitExceededException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateMobileDeviceAccessRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createMobileDeviceAccessRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateMobileDeviceAccessRule");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateMobileDeviceAccessRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createMobileDeviceAccessRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateMobileDeviceAccessRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new Amazon WorkMail organization. Optionally, you can choose to associate an existing AWS Directory
* Service directory with your organization. If an AWS Directory Service directory ID is specified, the organization
* alias must match the directory alias. If you choose not to associate an existing directory with your
* organization, then we create a new Amazon WorkMail directory for you. For more information, see Adding an
* organization in the Amazon WorkMail Administrator Guide.
*
*
* You can associate multiple email domains with an organization, then set your default email domain from the Amazon
* WorkMail console. You can also associate a domain that is managed in an Amazon Route 53 public hosted zone. For
* more information, see Adding a
* domain and Choosing the
* default domain in the Amazon WorkMail Administrator Guide.
*
*
* Optionally, you can use a customer managed master key from AWS Key Management Service (AWS KMS) to encrypt email
* for your organization. If you don't associate an AWS KMS key, Amazon WorkMail creates a default AWS managed
* master key for you.
*
*
* @param createOrganizationRequest
* @return Result of the CreateOrganization operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws DirectoryInUseException
* The directory is already in use by another WorkMail organization in the same account and Region.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws LimitExceededException
* The request exceeds the limit of the resource.
* @throws NameAvailabilityException
* The user, group, or resource name isn't unique in Amazon WorkMail.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CreateOrganization
* @see AWS
* API Documentation
*/
@Override
public CreateOrganizationResponse createOrganization(CreateOrganizationRequest createOrganizationRequest)
throws InvalidParameterException, DirectoryInUseException, DirectoryUnavailableException, LimitExceededException,
NameAvailabilityException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateOrganizationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createOrganizationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateOrganization");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateOrganization").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createOrganizationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateOrganizationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new Amazon WorkMail resource.
*
*
* @param createResourceRequest
* @return Result of the CreateResource operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws NameAvailabilityException
* The user, group, or resource name isn't unique in Amazon WorkMail.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws ReservedNameException
* This user, group, or resource name is not allowed in Amazon WorkMail.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CreateResource
* @see AWS API
* Documentation
*/
@Override
public CreateResourceResponse createResource(CreateResourceRequest createResourceRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, InvalidParameterException,
NameAvailabilityException, OrganizationNotFoundException, OrganizationStateException, ReservedNameException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a user who can be used in Amazon WorkMail by calling the RegisterToWorkMail operation.
*
*
* @param createUserRequest
* @return Result of the CreateUser operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws InvalidPasswordException
* The supplied password doesn't match the minimum security constraints, such as length or use of special
* characters.
* @throws NameAvailabilityException
* The user, group, or resource name isn't unique in Amazon WorkMail.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws ReservedNameException
* This user, group, or resource name is not allowed in Amazon WorkMail.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.CreateUser
* @see AWS API
* Documentation
*/
@Override
public CreateUserResponse createUser(CreateUserRequest createUserRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, InvalidParameterException,
InvalidPasswordException, NameAvailabilityException, OrganizationNotFoundException, OrganizationStateException,
ReservedNameException, UnsupportedOperationException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateUser");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("CreateUser")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(createUserRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateUserRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an access control rule for the specified WorkMail organization.
*
*
* @param deleteAccessControlRuleRequest
* @return Result of the DeleteAccessControlRule operation returned by the service.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteAccessControlRule
* @see AWS API Documentation
*/
@Override
public DeleteAccessControlRuleResponse deleteAccessControlRule(DeleteAccessControlRuleRequest deleteAccessControlRuleRequest)
throws OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException,
WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAccessControlRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAccessControlRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAccessControlRule");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAccessControlRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteAccessControlRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteAccessControlRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Remove one or more specified aliases from a set of aliases for a given user.
*
*
* @param deleteAliasRequest
* @return Result of the DeleteAlias operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteAlias
* @see AWS API
* Documentation
*/
@Override
public DeleteAliasResponse deleteAlias(DeleteAliasRequest deleteAliasRequest) throws EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteAliasResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAliasRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAlias");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteAlias").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteAliasRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteAliasRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a group from Amazon WorkMail.
*
*
* @param deleteGroupRequest
* @return Result of the DeleteGroup operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteGroup
* @see AWS API
* Documentation
*/
@Override
public DeleteGroupResponse deleteGroup(DeleteGroupRequest deleteGroupRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EntityStateException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, UnsupportedOperationException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteGroupRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes permissions granted to a member (user or group).
*
*
* @param deleteMailboxPermissionsRequest
* @return Result of the DeleteMailboxPermissions operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteMailboxPermissions
* @see AWS API Documentation
*/
@Override
public DeleteMailboxPermissionsResponse deleteMailboxPermissions(
DeleteMailboxPermissionsRequest deleteMailboxPermissionsRequest) throws EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteMailboxPermissionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteMailboxPermissionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteMailboxPermissions");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteMailboxPermissions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteMailboxPermissionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteMailboxPermissionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a mobile device access rule for the specified Amazon WorkMail organization.
*
*
* @param deleteMobileDeviceAccessRuleRequest
* @return Result of the DeleteMobileDeviceAccessRule operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteMobileDeviceAccessRule
* @see AWS API Documentation
*/
@Override
public DeleteMobileDeviceAccessRuleResponse deleteMobileDeviceAccessRule(
DeleteMobileDeviceAccessRuleRequest deleteMobileDeviceAccessRuleRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteMobileDeviceAccessRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteMobileDeviceAccessRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteMobileDeviceAccessRule");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteMobileDeviceAccessRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteMobileDeviceAccessRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteMobileDeviceAccessRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an Amazon WorkMail organization and all underlying AWS resources managed by Amazon WorkMail as part of
* the organization. You can choose whether to delete the associated directory. For more information, see Removing an
* organization in the Amazon WorkMail Administrator Guide.
*
*
* @param deleteOrganizationRequest
* @return Result of the DeleteOrganization operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteOrganization
* @see AWS
* API Documentation
*/
@Override
public DeleteOrganizationResponse deleteOrganization(DeleteOrganizationRequest deleteOrganizationRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteOrganizationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteOrganizationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteOrganization");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteOrganization").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteOrganizationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteOrganizationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified resource.
*
*
* @param deleteResourceRequest
* @return Result of the DeleteResource operation returned by the service.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteResource
* @see AWS API
* Documentation
*/
@Override
public DeleteResourceResponse deleteResource(DeleteResourceRequest deleteResourceRequest) throws EntityStateException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified retention policy from the specified organization.
*
*
* @param deleteRetentionPolicyRequest
* @return Result of the DeleteRetentionPolicy operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteRetentionPolicy
* @see AWS API Documentation
*/
@Override
public DeleteRetentionPolicyResponse deleteRetentionPolicy(DeleteRetentionPolicyRequest deleteRetentionPolicyRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRetentionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRetentionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRetentionPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteRetentionPolicy").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteRetentionPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteRetentionPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a user from Amazon WorkMail and all subsequent systems. Before you can delete a user, the user state must
* be DISABLED
. Use the DescribeUser action to confirm the user state.
*
*
* Deleting a user is permanent and cannot be undone. WorkMail archives user mailboxes for 30 days before they are
* permanently removed.
*
*
* @param deleteUserRequest
* @return Result of the DeleteUser operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeleteUser
* @see AWS API
* Documentation
*/
@Override
public DeleteUserResponse deleteUser(DeleteUserRequest deleteUserRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EntityStateException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, UnsupportedOperationException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteUser");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("DeleteUser")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(deleteUserRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteUserRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Mark a user, group, or resource as no longer used in Amazon WorkMail. This action disassociates the mailbox and
* schedules it for clean-up. WorkMail keeps mailboxes for 30 days before they are permanently removed. The
* functionality in the console is Disable.
*
*
* @param deregisterFromWorkMailRequest
* @return Result of the DeregisterFromWorkMail operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DeregisterFromWorkMail
* @see AWS API Documentation
*/
@Override
public DeregisterFromWorkMailResponse deregisterFromWorkMail(DeregisterFromWorkMailRequest deregisterFromWorkMailRequest)
throws EntityNotFoundException, EntityStateException, InvalidParameterException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeregisterFromWorkMailResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deregisterFromWorkMailRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeregisterFromWorkMail");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeregisterFromWorkMail").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deregisterFromWorkMailRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeregisterFromWorkMailRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the data available for the group.
*
*
* @param describeGroupRequest
* @return Result of the DescribeGroup operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DescribeGroup
* @see AWS API
* Documentation
*/
@Override
public DescribeGroupResponse describeGroup(DescribeGroupRequest describeGroupRequest) throws EntityNotFoundException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeGroupRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Describes the current status of a mailbox export job.
*
*
* @param describeMailboxExportJobRequest
* @return Result of the DescribeMailboxExportJob operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DescribeMailboxExportJob
* @see AWS API Documentation
*/
@Override
public DescribeMailboxExportJobResponse describeMailboxExportJob(
DescribeMailboxExportJobRequest describeMailboxExportJobRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, EntityNotFoundException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeMailboxExportJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeMailboxExportJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeMailboxExportJob");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeMailboxExportJob").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeMailboxExportJobRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeMailboxExportJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Provides more information regarding a given organization based on its identifier.
*
*
* @param describeOrganizationRequest
* @return Result of the DescribeOrganization operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DescribeOrganization
* @see AWS
* API Documentation
*/
@Override
public DescribeOrganizationResponse describeOrganization(DescribeOrganizationRequest describeOrganizationRequest)
throws InvalidParameterException, OrganizationNotFoundException, AwsServiceException, SdkClientException,
WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeOrganizationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeOrganizationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeOrganization");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeOrganization").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeOrganizationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeOrganizationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the data available for the resource.
*
*
* @param describeResourceRequest
* @return Result of the DescribeResource operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DescribeResource
* @see AWS API
* Documentation
*/
@Override
public DescribeResourceResponse describeResource(DescribeResourceRequest describeResourceRequest)
throws EntityNotFoundException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Provides information regarding the user.
*
*
* @param describeUserRequest
* @return Result of the DescribeUser operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DescribeUser
* @see AWS API
* Documentation
*/
@Override
public DescribeUserResponse describeUser(DescribeUserRequest describeUserRequest) throws EntityNotFoundException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeUserResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeUserRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeUser");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeUser").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeUserRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeUserRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes a member from the resource's set of delegates.
*
*
* @param disassociateDelegateFromResourceRequest
* @return Result of the DisassociateDelegateFromResource operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DisassociateDelegateFromResource
* @see AWS API Documentation
*/
@Override
public DisassociateDelegateFromResourceResponse disassociateDelegateFromResource(
DisassociateDelegateFromResourceRequest disassociateDelegateFromResourceRequest) throws EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateDelegateFromResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
disassociateDelegateFromResourceRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateDelegateFromResource");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateDelegateFromResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(disassociateDelegateFromResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DisassociateDelegateFromResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes a member from a group.
*
*
* @param disassociateMemberFromGroupRequest
* @return Result of the DisassociateMemberFromGroup operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.DisassociateMemberFromGroup
* @see AWS API Documentation
*/
@Override
public DisassociateMemberFromGroupResponse disassociateMemberFromGroup(
DisassociateMemberFromGroupRequest disassociateMemberFromGroupRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
UnsupportedOperationException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateMemberFromGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateMemberFromGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateMemberFromGroup");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateMemberFromGroup").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(disassociateMemberFromGroupRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DisassociateMemberFromGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets the effects of an organization's access control rules as they apply to a specified IPv4 address, access
* protocol action, or user ID.
*
*
* @param getAccessControlEffectRequest
* @return Result of the GetAccessControlEffect operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.GetAccessControlEffect
* @see AWS API Documentation
*/
@Override
public GetAccessControlEffectResponse getAccessControlEffect(GetAccessControlEffectRequest getAccessControlEffectRequest)
throws EntityNotFoundException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetAccessControlEffectResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccessControlEffectRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccessControlEffect");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetAccessControlEffect").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getAccessControlEffectRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetAccessControlEffectRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets the default retention policy details for the specified organization.
*
*
* @param getDefaultRetentionPolicyRequest
* @return Result of the GetDefaultRetentionPolicy operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.GetDefaultRetentionPolicy
* @see AWS API Documentation
*/
@Override
public GetDefaultRetentionPolicyResponse getDefaultRetentionPolicy(
GetDefaultRetentionPolicyRequest getDefaultRetentionPolicyRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, EntityNotFoundException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetDefaultRetentionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDefaultRetentionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDefaultRetentionPolicy");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDefaultRetentionPolicy").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getDefaultRetentionPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetDefaultRetentionPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Requests a user's mailbox details for a specified organization and user.
*
*
* @param getMailboxDetailsRequest
* @return Result of the GetMailboxDetails operation returned by the service.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.GetMailboxDetails
* @see AWS
* API Documentation
*/
@Override
public GetMailboxDetailsResponse getMailboxDetails(GetMailboxDetailsRequest getMailboxDetailsRequest)
throws OrganizationNotFoundException, OrganizationStateException, EntityNotFoundException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetMailboxDetailsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getMailboxDetailsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMailboxDetails");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetMailboxDetails").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getMailboxDetailsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetMailboxDetailsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Simulates the effect of the mobile device access rules for the given attributes of a sample access event. Use
* this method to test the effects of the current set of mobile device access rules for the Amazon WorkMail
* organization for a particular user's attributes.
*
*
* @param getMobileDeviceAccessEffectRequest
* @return Result of the GetMobileDeviceAccessEffect operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.GetMobileDeviceAccessEffect
* @see AWS API Documentation
*/
@Override
public GetMobileDeviceAccessEffectResponse getMobileDeviceAccessEffect(
GetMobileDeviceAccessEffectRequest getMobileDeviceAccessEffectRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetMobileDeviceAccessEffectResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getMobileDeviceAccessEffectRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMobileDeviceAccessEffect");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetMobileDeviceAccessEffect").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getMobileDeviceAccessEffectRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetMobileDeviceAccessEffectRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the access control rules for the specified organization.
*
*
* @param listAccessControlRulesRequest
* @return Result of the ListAccessControlRules operation returned by the service.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListAccessControlRules
* @see AWS API Documentation
*/
@Override
public ListAccessControlRulesResponse listAccessControlRules(ListAccessControlRulesRequest listAccessControlRulesRequest)
throws OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException,
WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListAccessControlRulesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listAccessControlRulesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAccessControlRules");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListAccessControlRules").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listAccessControlRulesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListAccessControlRulesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a paginated call to list the aliases associated with a given entity.
*
*
* @param listAliasesRequest
* @return Result of the ListAliases operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListAliases
* @see AWS API
* Documentation
*/
@Override
public ListAliasesResponse listAliases(ListAliasesRequest listAliasesRequest) throws EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListAliasesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listAliasesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAliases");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListAliases").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listAliasesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListAliasesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a paginated call to list the aliases associated with a given entity.
*
*
*
* This is a variant of {@link #listAliases(software.amazon.awssdk.services.workmail.model.ListAliasesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListAliasesIterable responses = client.listAliasesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListAliasesIterable responses = client.listAliasesPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListAliasesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListAliasesIterable responses = client.listAliasesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listAliases(software.amazon.awssdk.services.workmail.model.ListAliasesRequest)} operation.
*
*
* @param listAliasesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListAliases
* @see AWS API
* Documentation
*/
@Override
public ListAliasesIterable listAliasesPaginator(ListAliasesRequest listAliasesRequest) throws EntityNotFoundException,
EntityStateException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
return new ListAliasesIterable(this, applyPaginatorUserAgent(listAliasesRequest));
}
/**
*
* Returns an overview of the members of a group. Users and groups can be members of a group.
*
*
* @param listGroupMembersRequest
* @return Result of the ListGroupMembers operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListGroupMembers
* @see AWS API
* Documentation
*/
@Override
public ListGroupMembersResponse listGroupMembers(ListGroupMembersRequest listGroupMembersRequest)
throws EntityNotFoundException, EntityStateException, InvalidParameterException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListGroupMembersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listGroupMembersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListGroupMembers");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListGroupMembers").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listGroupMembersRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListGroupMembersRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an overview of the members of a group. Users and groups can be members of a group.
*
*
*
* This is a variant of
* {@link #listGroupMembers(software.amazon.awssdk.services.workmail.model.ListGroupMembersRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListGroupMembersIterable responses = client.listGroupMembersPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListGroupMembersIterable responses = client
* .listGroupMembersPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListGroupMembersResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListGroupMembersIterable responses = client.listGroupMembersPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listGroupMembers(software.amazon.awssdk.services.workmail.model.ListGroupMembersRequest)} operation.
*
*
* @param listGroupMembersRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListGroupMembers
* @see AWS API
* Documentation
*/
@Override
public ListGroupMembersIterable listGroupMembersPaginator(ListGroupMembersRequest listGroupMembersRequest)
throws EntityNotFoundException, EntityStateException, InvalidParameterException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
return new ListGroupMembersIterable(this, applyPaginatorUserAgent(listGroupMembersRequest));
}
/**
*
* Returns summaries of the organization's groups.
*
*
* @param listGroupsRequest
* @return Result of the ListGroups operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListGroups
* @see AWS API
* Documentation
*/
@Override
public ListGroupsResponse listGroups(ListGroupsRequest listGroupsRequest) throws EntityNotFoundException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListGroups");
return clientHandler
.execute(new ClientExecutionParams().withOperationName("ListGroups")
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withInput(listGroupsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListGroupsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns summaries of the organization's groups.
*
*
*
* This is a variant of {@link #listGroups(software.amazon.awssdk.services.workmail.model.ListGroupsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListGroupsIterable responses = client.listGroupsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListGroupsIterable responses = client.listGroupsPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListGroupsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListGroupsIterable responses = client.listGroupsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listGroups(software.amazon.awssdk.services.workmail.model.ListGroupsRequest)} operation.
*
*
* @param listGroupsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListGroups
* @see AWS API
* Documentation
*/
@Override
public ListGroupsIterable listGroupsPaginator(ListGroupsRequest listGroupsRequest) throws EntityNotFoundException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
return new ListGroupsIterable(this, applyPaginatorUserAgent(listGroupsRequest));
}
/**
*
* Lists the mailbox export jobs started for the specified organization within the last seven days.
*
*
* @param listMailboxExportJobsRequest
* @return Result of the ListMailboxExportJobs operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListMailboxExportJobs
* @see AWS API Documentation
*/
@Override
public ListMailboxExportJobsResponse listMailboxExportJobs(ListMailboxExportJobsRequest listMailboxExportJobsRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListMailboxExportJobsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listMailboxExportJobsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListMailboxExportJobs");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListMailboxExportJobs").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listMailboxExportJobsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListMailboxExportJobsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the mailbox export jobs started for the specified organization within the last seven days.
*
*
*
* This is a variant of
* {@link #listMailboxExportJobs(software.amazon.awssdk.services.workmail.model.ListMailboxExportJobsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListMailboxExportJobsIterable responses = client.listMailboxExportJobsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListMailboxExportJobsIterable responses = client
* .listMailboxExportJobsPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListMailboxExportJobsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListMailboxExportJobsIterable responses = client.listMailboxExportJobsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listMailboxExportJobs(software.amazon.awssdk.services.workmail.model.ListMailboxExportJobsRequest)}
* operation.
*
*
* @param listMailboxExportJobsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListMailboxExportJobs
* @see AWS API Documentation
*/
@Override
public ListMailboxExportJobsIterable listMailboxExportJobsPaginator(ListMailboxExportJobsRequest listMailboxExportJobsRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
return new ListMailboxExportJobsIterable(this, applyPaginatorUserAgent(listMailboxExportJobsRequest));
}
/**
*
* Lists the mailbox permissions associated with a user, group, or resource mailbox.
*
*
* @param listMailboxPermissionsRequest
* @return Result of the ListMailboxPermissions operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListMailboxPermissions
* @see AWS API Documentation
*/
@Override
public ListMailboxPermissionsResponse listMailboxPermissions(ListMailboxPermissionsRequest listMailboxPermissionsRequest)
throws EntityNotFoundException, InvalidParameterException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListMailboxPermissionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listMailboxPermissionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListMailboxPermissions");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListMailboxPermissions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listMailboxPermissionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListMailboxPermissionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the mailbox permissions associated with a user, group, or resource mailbox.
*
*
*
* This is a variant of
* {@link #listMailboxPermissions(software.amazon.awssdk.services.workmail.model.ListMailboxPermissionsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListMailboxPermissionsIterable responses = client.listMailboxPermissionsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListMailboxPermissionsIterable responses = client
* .listMailboxPermissionsPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListMailboxPermissionsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListMailboxPermissionsIterable responses = client.listMailboxPermissionsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listMailboxPermissions(software.amazon.awssdk.services.workmail.model.ListMailboxPermissionsRequest)}
* operation.
*
*
* @param listMailboxPermissionsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListMailboxPermissions
* @see AWS API Documentation
*/
@Override
public ListMailboxPermissionsIterable listMailboxPermissionsPaginator(
ListMailboxPermissionsRequest listMailboxPermissionsRequest) throws EntityNotFoundException,
InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
return new ListMailboxPermissionsIterable(this, applyPaginatorUserAgent(listMailboxPermissionsRequest));
}
/**
*
* Lists the mobile device access rules for the specified Amazon WorkMail organization.
*
*
* @param listMobileDeviceAccessRulesRequest
* @return Result of the ListMobileDeviceAccessRules operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListMobileDeviceAccessRules
* @see AWS API Documentation
*/
@Override
public ListMobileDeviceAccessRulesResponse listMobileDeviceAccessRules(
ListMobileDeviceAccessRulesRequest listMobileDeviceAccessRulesRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListMobileDeviceAccessRulesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listMobileDeviceAccessRulesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListMobileDeviceAccessRules");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListMobileDeviceAccessRules").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listMobileDeviceAccessRulesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListMobileDeviceAccessRulesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns summaries of the customer's organizations.
*
*
* @param listOrganizationsRequest
* @return Result of the ListOrganizations operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListOrganizations
* @see AWS
* API Documentation
*/
@Override
public ListOrganizationsResponse listOrganizations(ListOrganizationsRequest listOrganizationsRequest)
throws InvalidParameterException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListOrganizationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listOrganizationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListOrganizations");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListOrganizations").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listOrganizationsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListOrganizationsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns summaries of the customer's organizations.
*
*
*
* This is a variant of
* {@link #listOrganizations(software.amazon.awssdk.services.workmail.model.ListOrganizationsRequest)} operation.
* The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally
* handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListOrganizationsIterable responses = client.listOrganizationsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListOrganizationsIterable responses = client
* .listOrganizationsPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListOrganizationsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListOrganizationsIterable responses = client.listOrganizationsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listOrganizations(software.amazon.awssdk.services.workmail.model.ListOrganizationsRequest)}
* operation.
*
*
* @param listOrganizationsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListOrganizations
* @see AWS
* API Documentation
*/
@Override
public ListOrganizationsIterable listOrganizationsPaginator(ListOrganizationsRequest listOrganizationsRequest)
throws InvalidParameterException, AwsServiceException, SdkClientException, WorkMailException {
return new ListOrganizationsIterable(this, applyPaginatorUserAgent(listOrganizationsRequest));
}
/**
*
* Lists the delegates associated with a resource. Users and groups can be resource delegates and answer requests on
* behalf of the resource.
*
*
* @param listResourceDelegatesRequest
* @return Result of the ListResourceDelegates operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListResourceDelegates
* @see AWS API Documentation
*/
@Override
public ListResourceDelegatesResponse listResourceDelegates(ListResourceDelegatesRequest listResourceDelegatesRequest)
throws EntityNotFoundException, EntityStateException, InvalidParameterException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListResourceDelegatesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listResourceDelegatesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListResourceDelegates");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListResourceDelegates").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listResourceDelegatesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListResourceDelegatesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the delegates associated with a resource. Users and groups can be resource delegates and answer requests on
* behalf of the resource.
*
*
*
* This is a variant of
* {@link #listResourceDelegates(software.amazon.awssdk.services.workmail.model.ListResourceDelegatesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListResourceDelegatesIterable responses = client.listResourceDelegatesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListResourceDelegatesIterable responses = client
* .listResourceDelegatesPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListResourceDelegatesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListResourceDelegatesIterable responses = client.listResourceDelegatesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listResourceDelegates(software.amazon.awssdk.services.workmail.model.ListResourceDelegatesRequest)}
* operation.
*
*
* @param listResourceDelegatesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListResourceDelegates
* @see AWS API Documentation
*/
@Override
public ListResourceDelegatesIterable listResourceDelegatesPaginator(ListResourceDelegatesRequest listResourceDelegatesRequest)
throws EntityNotFoundException, EntityStateException, InvalidParameterException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
return new ListResourceDelegatesIterable(this, applyPaginatorUserAgent(listResourceDelegatesRequest));
}
/**
*
* Returns summaries of the organization's resources.
*
*
* @param listResourcesRequest
* @return Result of the ListResources operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListResources
* @see AWS API
* Documentation
*/
@Override
public ListResourcesResponse listResources(ListResourcesRequest listResourcesRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListResources");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListResources").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listResourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListResourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns summaries of the organization's resources.
*
*
*
* This is a variant of {@link #listResources(software.amazon.awssdk.services.workmail.model.ListResourcesRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListResourcesIterable responses = client.listResourcesPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListResourcesIterable responses = client.listResourcesPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListResourcesResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListResourcesIterable responses = client.listResourcesPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listResources(software.amazon.awssdk.services.workmail.model.ListResourcesRequest)} operation.
*
*
* @param listResourcesRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListResources
* @see AWS API
* Documentation
*/
@Override
public ListResourcesIterable listResourcesPaginator(ListResourcesRequest listResourcesRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
return new ListResourcesIterable(this, applyPaginatorUserAgent(listResourcesRequest));
}
/**
*
* Lists the tags applied to an Amazon WorkMail organization resource.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ResourceNotFoundException
* The resource cannot be found.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListTagsForResource
* @see AWS
* API Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws ResourceNotFoundException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns summaries of the organization's users.
*
*
* @param listUsersRequest
* @return Result of the ListUsers operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListUsers
* @see AWS API
* Documentation
*/
@Override
public ListUsersResponse listUsers(ListUsersRequest listUsersRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListUsersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listUsersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListUsers");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListUsers").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listUsersRequest)
.withMetricCollector(apiCallMetricCollector).withMarshaller(new ListUsersRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns summaries of the organization's users.
*
*
*
* This is a variant of {@link #listUsers(software.amazon.awssdk.services.workmail.model.ListUsersRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListUsersIterable responses = client.listUsersPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.workmail.paginators.ListUsersIterable responses = client.listUsersPaginator(request);
* for (software.amazon.awssdk.services.workmail.model.ListUsersResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.workmail.paginators.ListUsersIterable responses = client.listUsersPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of MaxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listUsers(software.amazon.awssdk.services.workmail.model.ListUsersRequest)} operation.
*
*
* @param listUsersRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ListUsers
* @see AWS API
* Documentation
*/
@Override
public ListUsersIterable listUsersPaginator(ListUsersRequest listUsersRequest) throws InvalidParameterException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
return new ListUsersIterable(this, applyPaginatorUserAgent(listUsersRequest));
}
/**
*
* Adds a new access control rule for the specified organization. The rule allows or denies access to the
* organization for the specified IPv4 addresses, access protocol actions, and user IDs. Adding a new rule with the
* same name as an existing rule replaces the older rule.
*
*
* @param putAccessControlRuleRequest
* @return Result of the PutAccessControlRule operation returned by the service.
* @throws LimitExceededException
* The request exceeds the limit of the resource.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.PutAccessControlRule
* @see AWS
* API Documentation
*/
@Override
public PutAccessControlRuleResponse putAccessControlRule(PutAccessControlRuleRequest putAccessControlRuleRequest)
throws LimitExceededException, InvalidParameterException, EntityNotFoundException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutAccessControlRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putAccessControlRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutAccessControlRule");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutAccessControlRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(putAccessControlRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutAccessControlRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Sets permissions for a user, group, or resource. This replaces any pre-existing permissions.
*
*
* @param putMailboxPermissionsRequest
* @return Result of the PutMailboxPermissions operation returned by the service.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.PutMailboxPermissions
* @see AWS API Documentation
*/
@Override
public PutMailboxPermissionsResponse putMailboxPermissions(PutMailboxPermissionsRequest putMailboxPermissionsRequest)
throws EntityNotFoundException, EntityStateException, InvalidParameterException, OrganizationNotFoundException,
OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutMailboxPermissionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putMailboxPermissionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutMailboxPermissions");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutMailboxPermissions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(putMailboxPermissionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutMailboxPermissionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Puts a retention policy to the specified organization.
*
*
* @param putRetentionPolicyRequest
* @return Result of the PutRetentionPolicy operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws LimitExceededException
* The request exceeds the limit of the resource.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.PutRetentionPolicy
* @see AWS
* API Documentation
*/
@Override
public PutRetentionPolicyResponse putRetentionPolicy(PutRetentionPolicyRequest putRetentionPolicyRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, LimitExceededException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutRetentionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putRetentionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutRetentionPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutRetentionPolicy").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(putRetentionPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutRetentionPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Registers an existing and disabled user, group, or resource for Amazon WorkMail use by associating a mailbox and
* calendaring capabilities. It performs no change if the user, group, or resource is enabled and fails if the user,
* group, or resource is deleted. This operation results in the accumulation of costs. For more information, see Pricing. The equivalent console functionality for this
* operation is Enable.
*
*
* Users can either be created by calling the CreateUser API operation or they can be synchronized from your
* directory. For more information, see DeregisterFromWorkMail.
*
*
* @param registerToWorkMailRequest
* @return Result of the RegisterToWorkMail operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EmailAddressInUseException
* The email address that you're trying to assign is already created for a different user, group, or
* resource.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws EntityAlreadyRegisteredException
* The user, group, or resource that you're trying to register is already registered.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws MailDomainNotFoundException
* For an email or alias to be created in Amazon WorkMail, the included domain must be defined in the
* organization.
* @throws MailDomainStateException
* After a domain has been added to the organization, it must be verified. The domain is not yet verified.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.RegisterToWorkMail
* @see AWS
* API Documentation
*/
@Override
public RegisterToWorkMailResponse registerToWorkMail(RegisterToWorkMailRequest registerToWorkMailRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EmailAddressInUseException,
EntityNotFoundException, EntityStateException, EntityAlreadyRegisteredException, InvalidParameterException,
MailDomainNotFoundException, MailDomainStateException, OrganizationNotFoundException, OrganizationStateException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, RegisterToWorkMailResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, registerToWorkMailRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RegisterToWorkMail");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("RegisterToWorkMail").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(registerToWorkMailRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new RegisterToWorkMailRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Allows the administrator to reset the password for a user.
*
*
* @param resetPasswordRequest
* @return Result of the ResetPassword operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws InvalidPasswordException
* The supplied password doesn't match the minimum security constraints, such as length or use of special
* characters.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.ResetPassword
* @see AWS API
* Documentation
*/
@Override
public ResetPasswordResponse resetPassword(ResetPasswordRequest resetPasswordRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EntityNotFoundException,
EntityStateException, InvalidParameterException, InvalidPasswordException, OrganizationNotFoundException,
OrganizationStateException, UnsupportedOperationException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ResetPasswordResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, resetPasswordRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ResetPassword");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ResetPassword").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(resetPasswordRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ResetPasswordRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Starts a mailbox export job to export MIME-format email messages and calendar items from the specified mailbox to
* the specified Amazon Simple Storage Service (Amazon S3) bucket. For more information, see Exporting mailbox content in
* the Amazon WorkMail Administrator Guide.
*
*
* @param startMailboxExportJobRequest
* @return Result of the StartMailboxExportJob operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws LimitExceededException
* The request exceeds the limit of the resource.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.StartMailboxExportJob
* @see AWS API Documentation
*/
@Override
public StartMailboxExportJobResponse startMailboxExportJob(StartMailboxExportJobRequest startMailboxExportJobRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, EntityNotFoundException,
LimitExceededException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, StartMailboxExportJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, startMailboxExportJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartMailboxExportJob");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("StartMailboxExportJob").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(startMailboxExportJobRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new StartMailboxExportJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Applies the specified tags to the specified Amazon WorkMail organization resource.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ResourceNotFoundException
* The resource cannot be found.
* @throws TooManyTagsException
* The resource can have up to 50 user-applied tags.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException,
TooManyTagsException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(tagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Untags the specified tags from the specified Amazon WorkMail organization resource.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ResourceNotFoundException
* The resource cannot be found.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates a user's current mailbox quota for a specified organization and user.
*
*
* @param updateMailboxQuotaRequest
* @return Result of the UpdateMailboxQuota operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.UpdateMailboxQuota
* @see AWS
* API Documentation
*/
@Override
public UpdateMailboxQuotaResponse updateMailboxQuota(UpdateMailboxQuotaRequest updateMailboxQuotaRequest)
throws InvalidParameterException, OrganizationNotFoundException, OrganizationStateException, EntityNotFoundException,
EntityStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateMailboxQuotaResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateMailboxQuotaRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateMailboxQuota");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateMailboxQuota").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateMailboxQuotaRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateMailboxQuotaRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates a mobile device access rule for the specified Amazon WorkMail organization.
*
*
* @param updateMobileDeviceAccessRuleRequest
* @return Result of the UpdateMobileDeviceAccessRule operation returned by the service.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.UpdateMobileDeviceAccessRule
* @see AWS API Documentation
*/
@Override
public UpdateMobileDeviceAccessRuleResponse updateMobileDeviceAccessRule(
UpdateMobileDeviceAccessRuleRequest updateMobileDeviceAccessRuleRequest) throws InvalidParameterException,
EntityNotFoundException, OrganizationNotFoundException, OrganizationStateException, AwsServiceException,
SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateMobileDeviceAccessRuleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateMobileDeviceAccessRuleRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateMobileDeviceAccessRule");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateMobileDeviceAccessRule").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateMobileDeviceAccessRuleRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateMobileDeviceAccessRuleRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the primary email for a user, group, or resource. The current email is moved into the list of aliases (or
* swapped between an existing alias and the current primary email), and the email provided in the input is promoted
* as the primary.
*
*
* @param updatePrimaryEmailAddressRequest
* @return Result of the UpdatePrimaryEmailAddress operation returned by the service.
* @throws DirectoryServiceAuthenticationFailedException
* The directory service doesn't recognize the credentials supplied by WorkMail.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EmailAddressInUseException
* The email address that you're trying to assign is already created for a different user, group, or
* resource.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws MailDomainNotFoundException
* For an email or alias to be created in Amazon WorkMail, the included domain must be defined in the
* organization.
* @throws MailDomainStateException
* After a domain has been added to the organization, it must be verified. The domain is not yet verified.
* @throws InvalidParameterException
* One or more of the input parameters don't match the service's restrictions.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws UnsupportedOperationException
* You can't perform a write operation against a read-only directory.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.UpdatePrimaryEmailAddress
* @see AWS API Documentation
*/
@Override
public UpdatePrimaryEmailAddressResponse updatePrimaryEmailAddress(
UpdatePrimaryEmailAddressRequest updatePrimaryEmailAddressRequest)
throws DirectoryServiceAuthenticationFailedException, DirectoryUnavailableException, EmailAddressInUseException,
EntityNotFoundException, EntityStateException, InvalidParameterException, MailDomainNotFoundException,
MailDomainStateException, OrganizationNotFoundException, OrganizationStateException, UnsupportedOperationException,
AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdatePrimaryEmailAddressResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updatePrimaryEmailAddressRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdatePrimaryEmailAddress");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdatePrimaryEmailAddress").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updatePrimaryEmailAddressRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdatePrimaryEmailAddressRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates data for the resource. To have the latest information, it must be preceded by a DescribeResource
* call. The dataset in the request should be the one expected when performing another DescribeResource
* call.
*
*
* @param updateResourceRequest
* @return Result of the UpdateResource operation returned by the service.
* @throws DirectoryUnavailableException
* The directory is unavailable. It might be located in another Region or deleted.
* @throws EntityNotFoundException
* The identifier supplied for the user, group, or resource does not exist in your organization.
* @throws EntityStateException
* You are performing an operation on a user, group, or resource that isn't in the expected state, such as
* trying to delete an active user.
* @throws InvalidConfigurationException
* The configuration for a resource isn't valid. A resource must either be able to auto-respond to requests
* or have at least one delegate associated that can do so on its behalf.
* @throws EmailAddressInUseException
* The email address that you're trying to assign is already created for a different user, group, or
* resource.
* @throws MailDomainNotFoundException
* For an email or alias to be created in Amazon WorkMail, the included domain must be defined in the
* organization.
* @throws MailDomainStateException
* After a domain has been added to the organization, it must be verified. The domain is not yet verified.
* @throws NameAvailabilityException
* The user, group, or resource name isn't unique in Amazon WorkMail.
* @throws OrganizationNotFoundException
* An operation received a valid organization identifier that either doesn't belong or exist in the system.
* @throws OrganizationStateException
* The organization must have a valid state to perform certain operations on the organization or its
* members.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws WorkMailException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample WorkMailClient.UpdateResource
* @see AWS API
* Documentation
*/
@Override
public UpdateResourceResponse updateResource(UpdateResourceRequest updateResourceRequest)
throws DirectoryUnavailableException, EntityNotFoundException, EntityStateException, InvalidConfigurationException,
EmailAddressInUseException, MailDomainNotFoundException, MailDomainStateException, NameAvailabilityException,
OrganizationNotFoundException, OrganizationStateException, AwsServiceException, SdkClientException, WorkMailException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WorkMail");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(WorkMailException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("DirectoryUnavailableException")
.exceptionBuilderSupplier(DirectoryUnavailableException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidConfigurationException")
.exceptionBuilderSupplier(InvalidConfigurationException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidParameterException")
.exceptionBuilderSupplier(InvalidParameterException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("MailDomainStateException")
.exceptionBuilderSupplier(MailDomainStateException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("MailDomainNotFoundException")
.exceptionBuilderSupplier(MailDomainNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("DirectoryServiceAuthenticationFailedException")
.exceptionBuilderSupplier(DirectoryServiceAuthenticationFailedException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NameAvailabilityException")
.exceptionBuilderSupplier(NameAvailabilityException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("EmailAddressInUseException")
.exceptionBuilderSupplier(EmailAddressInUseException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitExceededException")
.exceptionBuilderSupplier(LimitExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("EntityAlreadyRegisteredException")
.exceptionBuilderSupplier(EntityAlreadyRegisteredException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TooManyTagsException")
.exceptionBuilderSupplier(TooManyTagsException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidPasswordException")
.exceptionBuilderSupplier(InvalidPasswordException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("UnsupportedOperationException")
.exceptionBuilderSupplier(UnsupportedOperationException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("EntityNotFoundException")
.exceptionBuilderSupplier(EntityNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("DirectoryInUseException")
.exceptionBuilderSupplier(DirectoryInUseException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ReservedNameException")
.exceptionBuilderSupplier(ReservedNameException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("OrganizationStateException")
.exceptionBuilderSupplier(OrganizationStateException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("OrganizationNotFoundException")
.exceptionBuilderSupplier(OrganizationNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("EntityStateException")
.exceptionBuilderSupplier(EntityStateException::builder).build());
}
@Override
public void close() {
clientHandler.close();
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
}