All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.signer.DefaultSignerClient 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.signer;

import java.util.Collections;
import java.util.List;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
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.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.signer.internal.SignerServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.signer.model.AccessDeniedException;
import software.amazon.awssdk.services.signer.model.AddProfilePermissionRequest;
import software.amazon.awssdk.services.signer.model.AddProfilePermissionResponse;
import software.amazon.awssdk.services.signer.model.BadRequestException;
import software.amazon.awssdk.services.signer.model.CancelSigningProfileRequest;
import software.amazon.awssdk.services.signer.model.CancelSigningProfileResponse;
import software.amazon.awssdk.services.signer.model.ConflictException;
import software.amazon.awssdk.services.signer.model.DescribeSigningJobRequest;
import software.amazon.awssdk.services.signer.model.DescribeSigningJobResponse;
import software.amazon.awssdk.services.signer.model.GetRevocationStatusRequest;
import software.amazon.awssdk.services.signer.model.GetRevocationStatusResponse;
import software.amazon.awssdk.services.signer.model.GetSigningPlatformRequest;
import software.amazon.awssdk.services.signer.model.GetSigningPlatformResponse;
import software.amazon.awssdk.services.signer.model.GetSigningProfileRequest;
import software.amazon.awssdk.services.signer.model.GetSigningProfileResponse;
import software.amazon.awssdk.services.signer.model.InternalServiceErrorException;
import software.amazon.awssdk.services.signer.model.ListProfilePermissionsRequest;
import software.amazon.awssdk.services.signer.model.ListProfilePermissionsResponse;
import software.amazon.awssdk.services.signer.model.ListSigningJobsRequest;
import software.amazon.awssdk.services.signer.model.ListSigningJobsResponse;
import software.amazon.awssdk.services.signer.model.ListSigningPlatformsRequest;
import software.amazon.awssdk.services.signer.model.ListSigningPlatformsResponse;
import software.amazon.awssdk.services.signer.model.ListSigningProfilesRequest;
import software.amazon.awssdk.services.signer.model.ListSigningProfilesResponse;
import software.amazon.awssdk.services.signer.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.signer.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.signer.model.NotFoundException;
import software.amazon.awssdk.services.signer.model.PutSigningProfileRequest;
import software.amazon.awssdk.services.signer.model.PutSigningProfileResponse;
import software.amazon.awssdk.services.signer.model.RemoveProfilePermissionRequest;
import software.amazon.awssdk.services.signer.model.RemoveProfilePermissionResponse;
import software.amazon.awssdk.services.signer.model.ResourceNotFoundException;
import software.amazon.awssdk.services.signer.model.RevokeSignatureRequest;
import software.amazon.awssdk.services.signer.model.RevokeSignatureResponse;
import software.amazon.awssdk.services.signer.model.RevokeSigningProfileRequest;
import software.amazon.awssdk.services.signer.model.RevokeSigningProfileResponse;
import software.amazon.awssdk.services.signer.model.ServiceLimitExceededException;
import software.amazon.awssdk.services.signer.model.SignPayloadRequest;
import software.amazon.awssdk.services.signer.model.SignPayloadResponse;
import software.amazon.awssdk.services.signer.model.SignerException;
import software.amazon.awssdk.services.signer.model.StartSigningJobRequest;
import software.amazon.awssdk.services.signer.model.StartSigningJobResponse;
import software.amazon.awssdk.services.signer.model.TagResourceRequest;
import software.amazon.awssdk.services.signer.model.TagResourceResponse;
import software.amazon.awssdk.services.signer.model.ThrottlingException;
import software.amazon.awssdk.services.signer.model.TooManyRequestsException;
import software.amazon.awssdk.services.signer.model.UntagResourceRequest;
import software.amazon.awssdk.services.signer.model.UntagResourceResponse;
import software.amazon.awssdk.services.signer.model.ValidationException;
import software.amazon.awssdk.services.signer.transform.AddProfilePermissionRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.CancelSigningProfileRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.DescribeSigningJobRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.GetRevocationStatusRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.GetSigningPlatformRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.GetSigningProfileRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.ListProfilePermissionsRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.ListSigningJobsRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.ListSigningPlatformsRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.ListSigningProfilesRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.PutSigningProfileRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.RemoveProfilePermissionRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.RevokeSignatureRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.RevokeSigningProfileRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.SignPayloadRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.StartSigningJobRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.signer.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.signer.waiters.SignerWaiter;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link SignerClient}.
 *
 * @see SignerClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultSignerClient implements SignerClient {
    private static final Logger log = Logger.loggerFor(DefaultSignerClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.REST_JSON).build();

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultSignerClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Adds cross-account permissions to a signing profile. *

* * @param addProfilePermissionRequest * @return Result of the AddProfilePermission operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws ServiceLimitExceededException * The client is making a request that exceeds service limits. * @throws ConflictException * The resource encountered a conflicting state. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.AddProfilePermission * @see AWS * API Documentation */ @Override public AddProfilePermissionResponse addProfilePermission(AddProfilePermissionRequest addProfilePermissionRequest) throws ValidationException, ResourceNotFoundException, AccessDeniedException, ServiceLimitExceededException, ConflictException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AddProfilePermissionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(addProfilePermissionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, addProfilePermissionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddProfilePermission"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AddProfilePermission").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(addProfilePermissionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AddProfilePermissionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Changes the state of an ACTIVE signing profile to CANCELED. A canceled profile is still * viewable with the ListSigningProfiles operation, but it cannot perform new signing jobs, and is * deleted two years after cancelation. *

* * @param cancelSigningProfileRequest * @return Result of the CancelSigningProfile operation returned by the service. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.CancelSigningProfile * @see AWS * API Documentation */ @Override public CancelSigningProfileResponse cancelSigningProfile(CancelSigningProfileRequest cancelSigningProfileRequest) throws ResourceNotFoundException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CancelSigningProfileResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelSigningProfileRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelSigningProfileRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelSigningProfile"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CancelSigningProfile").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(cancelSigningProfileRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CancelSigningProfileRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information about a specific code signing job. You specify the job by using the jobId value * that is returned by the StartSigningJob operation. *

* * @param describeSigningJobRequest * @return Result of the DescribeSigningJob operation returned by the service. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.DescribeSigningJob * @see AWS API * Documentation */ @Override public DescribeSigningJobResponse describeSigningJob(DescribeSigningJobRequest describeSigningJobRequest) throws ResourceNotFoundException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeSigningJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeSigningJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSigningJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSigningJob"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeSigningJob").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeSigningJobRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeSigningJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves the revocation status of one or more of the signing profile, signing job, and signing certificate. *

* * @param getRevocationStatusRequest * @return Result of the GetRevocationStatus operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.GetRevocationStatus * @see AWS * API Documentation */ @Override public GetRevocationStatusResponse getRevocationStatus(GetRevocationStatusRequest getRevocationStatusRequest) throws ValidationException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetRevocationStatusResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRevocationStatusRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRevocationStatusRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRevocationStatus"); String hostPrefix = "verification."; String resolvedHostExpression = "verification."; return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetRevocationStatus").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .hostPrefixExpression(resolvedHostExpression).withRequestConfiguration(clientConfiguration) .withInput(getRevocationStatusRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRevocationStatusRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information on a specific signing platform. *

* * @param getSigningPlatformRequest * @return Result of the GetSigningPlatform operation returned by the service. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.GetSigningPlatform * @see AWS API * Documentation */ @Override public GetSigningPlatformResponse getSigningPlatform(GetSigningPlatformRequest getSigningPlatformRequest) throws ResourceNotFoundException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetSigningPlatformResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSigningPlatformRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getSigningPlatformRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSigningPlatform"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetSigningPlatform").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getSigningPlatformRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetSigningPlatformRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information on a specific signing profile. *

* * @param getSigningProfileRequest * @return Result of the GetSigningProfile operation returned by the service. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.GetSigningProfile * @see AWS API * Documentation */ @Override public GetSigningProfileResponse getSigningProfile(GetSigningProfileRequest getSigningProfileRequest) throws ResourceNotFoundException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetSigningProfileResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSigningProfileRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getSigningProfileRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSigningProfile"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetSigningProfile").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getSigningProfileRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetSigningProfileRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the cross-account permissions associated with a signing profile. *

* * @param listProfilePermissionsRequest * @return Result of the ListProfilePermissions operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.ListProfilePermissions * @see AWS * API Documentation */ @Override public ListProfilePermissionsResponse listProfilePermissions(ListProfilePermissionsRequest listProfilePermissionsRequest) throws ValidationException, ResourceNotFoundException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListProfilePermissionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listProfilePermissionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listProfilePermissionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListProfilePermissions"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListProfilePermissions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listProfilePermissionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListProfilePermissionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all your signing jobs. You can use the maxResults parameter to limit the number of signing * jobs that are returned in the response. If additional jobs remain to be listed, AWS Signer returns a * nextToken value. Use this value in subsequent calls to ListSigningJobs to fetch the * remaining values. You can continue calling ListSigningJobs with your maxResults * parameter and with new values that Signer returns in the nextToken parameter until all of your * signing jobs have been returned. *

* * @param listSigningJobsRequest * @return Result of the ListSigningJobs operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.ListSigningJobs * @see AWS API * Documentation */ @Override public ListSigningJobsResponse listSigningJobs(ListSigningJobsRequest listSigningJobsRequest) throws ValidationException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListSigningJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSigningJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSigningJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSigningJobs"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListSigningJobs").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listSigningJobsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListSigningJobsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all signing platforms available in AWS Signer that match the request parameters. If additional jobs remain * to be listed, Signer returns a nextToken value. Use this value in subsequent calls to * ListSigningJobs to fetch the remaining values. You can continue calling ListSigningJobs * with your maxResults parameter and with new values that Signer returns in the nextToken * parameter until all of your signing jobs have been returned. *

* * @param listSigningPlatformsRequest * @return Result of the ListSigningPlatforms operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.ListSigningPlatforms * @see AWS * API Documentation */ @Override public ListSigningPlatformsResponse listSigningPlatforms(ListSigningPlatformsRequest listSigningPlatformsRequest) throws ValidationException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListSigningPlatformsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSigningPlatformsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSigningPlatformsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSigningPlatforms"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListSigningPlatforms").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listSigningPlatformsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListSigningPlatformsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all available signing profiles in your AWS account. Returns only profiles with an ACTIVE * status unless the includeCanceled request field is set to true. If additional jobs * remain to be listed, AWS Signer returns a nextToken value. Use this value in subsequent calls to * ListSigningJobs to fetch the remaining values. You can continue calling ListSigningJobs * with your maxResults parameter and with new values that Signer returns in the nextToken * parameter until all of your signing jobs have been returned. *

* * @param listSigningProfilesRequest * @return Result of the ListSigningProfiles operation returned by the service. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.ListSigningProfiles * @see AWS * API Documentation */ @Override public ListSigningProfilesResponse listSigningProfiles(ListSigningProfilesRequest listSigningProfilesRequest) throws AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListSigningProfilesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSigningProfilesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSigningProfilesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSigningProfiles"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListSigningProfiles").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listSigningProfilesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListSigningProfilesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of the tags associated with a signing profile resource. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws InternalServiceErrorException * An internal error occurred. * @throws BadRequestException * The request contains invalid parameters for the ARN or tags. This exception also occurs when you call a * tagging API on a cancelled signing profile. * @throws NotFoundException * The signing profile was not found. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.ListTagsForResource * @see AWS * API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws InternalServiceErrorException, BadRequestException, NotFoundException, TooManyRequestsException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a signing profile. A signing profile is a code-signing template that can be used to carry out a * pre-defined signing job. *

* * @param putSigningProfileRequest * @return Result of the PutSigningProfile operation returned by the service. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws ValidationException * You signing certificate could not be validated. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.PutSigningProfile * @see AWS API * Documentation */ @Override public PutSigningProfileResponse putSigningProfile(PutSigningProfileRequest putSigningProfileRequest) throws ResourceNotFoundException, AccessDeniedException, ValidationException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, PutSigningProfileResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putSigningProfileRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putSigningProfileRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutSigningProfile"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("PutSigningProfile").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(putSigningProfileRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutSigningProfileRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes cross-account permissions from a signing profile. *

* * @param removeProfilePermissionRequest * @return Result of the RemoveProfilePermission operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws ConflictException * The resource encountered a conflicting state. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.RemoveProfilePermission * @see AWS API Documentation */ @Override public RemoveProfilePermissionResponse removeProfilePermission(RemoveProfilePermissionRequest removeProfilePermissionRequest) throws ValidationException, ResourceNotFoundException, AccessDeniedException, ConflictException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RemoveProfilePermissionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(removeProfilePermissionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, removeProfilePermissionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveProfilePermission"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("RemoveProfilePermission").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(removeProfilePermissionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RemoveProfilePermissionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Changes the state of a signing job to REVOKED. This indicates that the signature is no longer valid. *

* * @param revokeSignatureRequest * @return Result of the RevokeSignature operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.RevokeSignature * @see AWS API * Documentation */ @Override public RevokeSignatureResponse revokeSignature(RevokeSignatureRequest revokeSignatureRequest) throws ValidationException, AccessDeniedException, ResourceNotFoundException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, RevokeSignatureResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(revokeSignatureRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, revokeSignatureRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RevokeSignature"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("RevokeSignature").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(revokeSignatureRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RevokeSignatureRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Changes the state of a signing profile to REVOKED. This indicates that signatures generated using the signing * profile after an effective start date are no longer valid. *

* * @param revokeSigningProfileRequest * @return Result of the RevokeSigningProfile operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.RevokeSigningProfile * @see AWS * API Documentation */ @Override public RevokeSigningProfileResponse revokeSigningProfile(RevokeSigningProfileRequest revokeSigningProfileRequest) throws ValidationException, AccessDeniedException, ResourceNotFoundException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RevokeSigningProfileResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(revokeSigningProfileRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, revokeSigningProfileRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RevokeSigningProfile"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("RevokeSigningProfile").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(revokeSigningProfileRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RevokeSigningProfileRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Signs a binary payload and returns a signature envelope. *

* * @param signPayloadRequest * @return Result of the SignPayload operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.SignPayload * @see AWS API * Documentation */ @Override public SignPayloadResponse signPayload(SignPayloadRequest signPayloadRequest) throws ValidationException, ResourceNotFoundException, AccessDeniedException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, SignPayloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(signPayloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, signPayloadRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SignPayload"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("SignPayload").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(signPayloadRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new SignPayloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Initiates a signing job to be performed on the code provided. Signing jobs are viewable by the * ListSigningJobs operation for two years after they are performed. Note the following requirements: *

*
    *
  • *

    * You must create an Amazon S3 source bucket. For more information, see Creating a Bucket in the Amazon * S3 Getting Started Guide. *

    *
  • *
  • *

    * Your S3 source bucket must be version enabled. *

    *
  • *
  • *

    * You must create an S3 destination bucket. AWS Signer uses your S3 destination bucket to write your signed code. *

    *
  • *
  • *

    * You specify the name of the source and destination buckets when calling the StartSigningJob * operation. *

    *
  • *
  • *

    * You must ensure the S3 buckets are from the same Region as the signing profile. Cross-Region signing isn't * supported. *

    *
  • *
  • *

    * You must also specify a request token that identifies your request to Signer. *

    *
  • *
*

* You can call the DescribeSigningJob and the ListSigningJobs actions after you call * StartSigningJob. *

*

* For a Java example that shows how to use this action, see StartSigningJob. *

* * @param startSigningJobRequest * @return Result of the StartSigningJob operation returned by the service. * @throws ValidationException * You signing certificate could not be validated. * @throws ResourceNotFoundException * A specified resource could not be found. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws ThrottlingException * The request was denied due to request throttling.

*

* Instead of this error, TooManyRequestsException should be used. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded. *

*

* This error supersedes the error ThrottlingException. * @throws InternalServiceErrorException * An internal error occurred. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.StartSigningJob * @see AWS API * Documentation */ @Override public StartSigningJobResponse startSigningJob(StartSigningJobRequest startSigningJobRequest) throws ValidationException, ResourceNotFoundException, AccessDeniedException, ThrottlingException, TooManyRequestsException, InternalServiceErrorException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StartSigningJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startSigningJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startSigningJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartSigningJob"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StartSigningJob").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(startSigningJobRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartSigningJobRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds one or more tags to a signing profile. Tags are labels that you can use to identify and organize your AWS * resources. Each tag consists of a key and an optional value. To specify the signing profile, use its Amazon * Resource Name (ARN). To specify the tag, use a key-value pair. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws InternalServiceErrorException * An internal error occurred. * @throws BadRequestException * The request contains invalid parameters for the ARN or tags. This exception also occurs when you call a * tagging API on a cancelled signing profile. * @throws NotFoundException * The signing profile was not found. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.TagResource * @see AWS API * Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws InternalServiceErrorException, BadRequestException, NotFoundException, TooManyRequestsException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes one or more tags from a signing profile. To remove the tags, specify a list of tag keys. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws InternalServiceErrorException * An internal error occurred. * @throws BadRequestException * The request contains invalid parameters for the ARN or tags. This exception also occurs when you call a * tagging API on a cancelled signing profile. * @throws NotFoundException * The signing profile was not found. * @throws TooManyRequestsException * The allowed number of job-signing requests has been exceeded.

*

* This error supersedes the error ThrottlingException. * @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 SignerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample SignerClient.UntagResource * @see AWS API * Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws InternalServiceErrorException, BadRequestException, NotFoundException, TooManyRequestsException, AwsServiceException, SdkClientException, SignerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "signer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** * Create an instance of {@link SignerWaiter} using this client. *

* Waiters created via this method are managed by the SDK and resources will be released when the service client is * closed. * * @return an instance of {@link SignerWaiter} */ @Override public SignerWaiter waiter() { return SignerWaiter.builder().client(this).build(); } @Override public final String serviceName() { return SERVICE_NAME; } 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 SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } SignerServiceClientConfigurationBuilder serviceConfigBuilder = new SignerServiceClientConfigurationBuilder(configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(SignerException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceLimitExceededException") .exceptionBuilderSupplier(ServiceLimitExceededException::builder).httpStatusCode(402).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("NotFoundException") .exceptionBuilderSupplier(NotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServiceErrorException") .exceptionBuilderSupplier(InternalServiceErrorException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("TooManyRequestsException") .exceptionBuilderSupplier(TooManyRequestsException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("BadRequestException") .exceptionBuilderSupplier(BadRequestException::builder).httpStatusCode(400).build()); } @Override public final SignerServiceClientConfiguration serviceClientConfiguration() { return new SignerServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy