com.amazonaws.services.lambda.AWSLambdaClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-lambda Show documentation
/*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.lambda;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.lambda.AWSLambdaClientBuilder;
import com.amazonaws.services.lambda.waiters.AWSLambdaWaiters;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.lambda.model.*;
import com.amazonaws.services.lambda.model.transform.*;
/**
* Client for accessing AWS Lambda. All service calls made using this client are blocking, and will not return until the
* service call completes.
*
* AWS Lambda
*
* Overview
*
*
* This is the AWS Lambda API Reference. The AWS Lambda Developer Guide provides additional information. For the
* service overview, see What is AWS Lambda, and
* for information about how the service works, see AWS Lambda: How it Works in the
* AWS Lambda Developer Guide.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSLambdaClient extends AmazonWebServiceClient implements AWSLambda {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AWSLambda.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "lambda";
private volatile AWSLambdaWaiters waiters;
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.withContentTypeOverride("")
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidParameterValueException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.InvalidParameterValueExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceInUseException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.ResourceInUseExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("EC2AccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.EC2AccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("PolicyLengthExceededException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.PolicyLengthExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("KMSAccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.KMSAccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ServiceException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.ServiceExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("EC2ThrottledException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.EC2ThrottledExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("KMSInvalidStateException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.KMSInvalidStateExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidZipFileException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.InvalidZipFileExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("KMSDisabledException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.KMSDisabledExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidRequestContentException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.InvalidRequestContentExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidRuntimeException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.InvalidRuntimeExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("EC2UnexpectedException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.EC2UnexpectedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidSecurityGroupIDException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.InvalidSecurityGroupIDExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceConflictException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.ResourceConflictExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("CodeStorageExceededException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.CodeStorageExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ENILimitReachedException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.ENILimitReachedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("SubnetIPAddressLimitReachedException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.SubnetIPAddressLimitReachedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("KMSNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.KMSNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidSubnetIDException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.InvalidSubnetIDExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("PreconditionFailedException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.PreconditionFailedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("RequestTooLargeException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.RequestTooLargeExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("TooManyRequestsException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.TooManyRequestsExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("UnsupportedMediaTypeException").withExceptionUnmarshaller(
com.amazonaws.services.lambda.model.transform.UnsupportedMediaTypeExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.lambda.model.AWSLambdaException.class));
/**
* Constructs a new client to invoke service methods on AWS Lambda. A credentials provider chain will be used that
* searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @see DefaultAWSCredentialsProviderChain
* @deprecated use {@link AWSLambdaClientBuilder#defaultClient()}
*/
@Deprecated
public AWSLambdaClient() {
this(DefaultAWSCredentialsProviderChain.getInstance(), configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Lambda. A credentials provider chain will be used that
* searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Lambda (ex: proxy settings,
* retry counts, etc.).
*
* @see DefaultAWSCredentialsProviderChain
* @deprecated use {@link AWSLambdaClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSLambdaClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified AWS account credentials.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @deprecated use {@link AWSLambdaClientBuilder#withCredentials(AWSCredentialsProvider)} for example:
* {@code AWSLambdaClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();}
*/
@Deprecated
public AWSLambdaClient(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified AWS account credentials and
* client configuration options.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Lambda (ex: proxy settings,
* retry counts, etc.).
* @deprecated use {@link AWSLambdaClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSLambdaClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSLambdaClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials);
this.advancedConfig = AdvancedConfig.EMPTY;
init();
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified AWS account credentials
* provider.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @deprecated use {@link AWSLambdaClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSLambdaClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified AWS account credentials
* provider and client configuration options.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Lambda (ex: proxy settings,
* retry counts, etc.).
* @deprecated use {@link AWSLambdaClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSLambdaClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSLambdaClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified AWS account credentials
* provider, client configuration options, and request metric collector.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Lambda (ex: proxy settings,
* retry counts, etc.).
* @param requestMetricCollector
* optional request metric collector
* @deprecated use {@link AWSLambdaClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSLambdaClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSLambdaClientBuilder#withMetricsCollector(RequestMetricCollector)}
*/
@Deprecated
public AWSLambdaClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
this.advancedConfig = AdvancedConfig.EMPTY;
init();
}
public static AWSLambdaClientBuilder builder() {
return AWSLambdaClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSLambdaClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on AWS Lambda using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSLambdaClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("lambda.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/lambda/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/lambda/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
*
* Adds permissions to the resource-based policy of a version of an AWS Lambda layer. Use this
* action to grant layer usage permission to other accounts. You can grant permission to a single account, all AWS
* accounts, or all accounts in an organization.
*
*
* To revoke permission, call RemoveLayerVersionPermission with the statement ID that you specified when you
* added it.
*
*
* @param addLayerVersionPermissionRequest
* @return Result of the AddLayerVersionPermission operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws ResourceConflictException
* The resource already exists.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws PolicyLengthExceededException
* The permissions policy for the resource is too large. Learn more
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.AddLayerVersionPermission
* @see AWS API Documentation
*/
@Override
public AddLayerVersionPermissionResult addLayerVersionPermission(AddLayerVersionPermissionRequest request) {
request = beforeClientExecution(request);
return executeAddLayerVersionPermission(request);
}
@SdkInternalApi
final AddLayerVersionPermissionResult executeAddLayerVersionPermission(AddLayerVersionPermissionRequest addLayerVersionPermissionRequest) {
ExecutionContext executionContext = createExecutionContext(addLayerVersionPermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AddLayerVersionPermissionRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(addLayerVersionPermissionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AddLayerVersionPermission");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new AddLayerVersionPermissionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Grants an AWS service or another account permission to use a function. You can apply the policy at the function
* level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the
* invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function.
*
*
* To grant permission to another account, specify the account ID as the Principal
. For AWS services,
* the principal is a domain-style identifier defined by the service, like s3.amazonaws.com
or
* sns.amazonaws.com
. For AWS services, you can also specify the ARN or owning account of the
* associated resource as the SourceArn
or SourceAccount
. If you grant permission to a
* service principal without specifying the source, other accounts could potentially configure resources in their
* account to invoke your Lambda function.
*
*
* This action adds a statement to a resource-based permission policy for the function. For more information about
* function policies, see Lambda Function
* Policies.
*
*
* @param addPermissionRequest
* @return Result of the AddPermission operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws ResourceConflictException
* The resource already exists.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws PolicyLengthExceededException
* The permissions policy for the resource is too large. Learn more
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.AddPermission
* @see AWS API
* Documentation
*/
@Override
public AddPermissionResult addPermission(AddPermissionRequest request) {
request = beforeClientExecution(request);
return executeAddPermission(request);
}
@SdkInternalApi
final AddPermissionResult executeAddPermission(AddPermissionRequest addPermissionRequest) {
ExecutionContext executionContext = createExecutionContext(addPermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AddPermissionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(addPermissionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AddPermission");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AddPermissionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an alias for a Lambda
* function version. Use aliases to provide clients with a function identifier that you can update to invoke a
* different version.
*
*
* You can also map an alias to split invocation requests between two versions. Use the RoutingConfig
* parameter to specify a second version and the percentage of invocation requests that it receives.
*
*
* @param createAliasRequest
* @return Result of the CreateAlias operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws ResourceConflictException
* The resource already exists.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.CreateAlias
* @see AWS API
* Documentation
*/
@Override
public CreateAliasResult createAlias(CreateAliasRequest request) {
request = beforeClientExecution(request);
return executeCreateAlias(request);
}
@SdkInternalApi
final CreateAliasResult executeCreateAlias(CreateAliasRequest createAliasRequest) {
ExecutionContext executionContext = createExecutionContext(createAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a mapping between an event source and an AWS Lambda function. Lambda reads items from the event source
* and triggers the function.
*
*
* For details about each event source type, see the following topics.
*
*
* -
*
*
* -
*
*
* -
*
*
*
*
* @param createEventSourceMappingRequest
* @return Result of the CreateEventSourceMapping operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws ResourceConflictException
* The resource already exists.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @sample AWSLambda.CreateEventSourceMapping
* @see AWS API Documentation
*/
@Override
public CreateEventSourceMappingResult createEventSourceMapping(CreateEventSourceMappingRequest request) {
request = beforeClientExecution(request);
return executeCreateEventSourceMapping(request);
}
@SdkInternalApi
final CreateEventSourceMappingResult executeCreateEventSourceMapping(CreateEventSourceMappingRequest createEventSourceMappingRequest) {
ExecutionContext executionContext = createExecutionContext(createEventSourceMappingRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateEventSourceMappingRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(createEventSourceMappingRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateEventSourceMapping");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateEventSourceMappingResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a Lambda function. To create a function, you need a deployment package and an
* execution role. The deployment package contains your function code. The execution role grants the function
* permission to use AWS services, such as Amazon CloudWatch Logs for log streaming and AWS X-Ray for request
* tracing.
*
*
* A function has an unpublished version, and can have published versions and aliases. The unpublished version
* changes when you update your function's code and configuration. A published version is a snapshot of your
* function code and configuration that can't be changed. An alias is a named resource that maps to a version, and
* can be changed to map to a different version. Use the Publish
parameter to create version
* 1
of your function from its initial configuration.
*
*
* The other parameters let you configure version-specific and function-level settings. You can modify
* version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both
* the unpublished and published versions of the function, and include tags (TagResource) and per-function
* concurrency limits (PutFunctionConcurrency).
*
*
* If another account or an AWS service invokes your function, use AddPermission to grant permission by
* creating a resource-based IAM policy. You can grant permissions at the function level, on a version, or on an
* alias.
*
*
* To invoke your function directly, use Invoke. To invoke your function in response to events in other AWS
* services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in
* the other service. For more information, see Invoking Functions.
*
*
* @param createFunctionRequest
* @return Result of the CreateFunction operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws ResourceConflictException
* The resource already exists.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws CodeStorageExceededException
* You have exceeded your maximum total code size per account. Learn more
* @sample AWSLambda.CreateFunction
* @see AWS API
* Documentation
*/
@Override
public CreateFunctionResult createFunction(CreateFunctionRequest request) {
request = beforeClientExecution(request);
return executeCreateFunction(request);
}
@SdkInternalApi
final CreateFunctionResult executeCreateFunction(CreateFunctionRequest createFunctionRequest) {
ExecutionContext executionContext = createExecutionContext(createFunctionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateFunctionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createFunctionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateFunction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateFunctionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a Lambda function alias.
*
*
* @param deleteAliasRequest
* @return Result of the DeleteAlias operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.DeleteAlias
* @see AWS API
* Documentation
*/
@Override
public DeleteAliasResult deleteAlias(DeleteAliasRequest request) {
request = beforeClientExecution(request);
return executeDeleteAlias(request);
}
@SdkInternalApi
final DeleteAliasResult executeDeleteAlias(DeleteAliasRequest deleteAliasRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an event source
* mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.
*
*
* @param deleteEventSourceMappingRequest
* @return Result of the DeleteEventSourceMapping operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ResourceInUseException
* The operation conflicts with the resource's availability. For example, you attempted to update an
* EventSource Mapping in CREATING, or tried to delete a EventSource mapping currently in the UPDATING
* state.
* @sample AWSLambda.DeleteEventSourceMapping
* @see AWS API Documentation
*/
@Override
public DeleteEventSourceMappingResult deleteEventSourceMapping(DeleteEventSourceMappingRequest request) {
request = beforeClientExecution(request);
return executeDeleteEventSourceMapping(request);
}
@SdkInternalApi
final DeleteEventSourceMappingResult executeDeleteEventSourceMapping(DeleteEventSourceMappingRequest deleteEventSourceMappingRequest) {
ExecutionContext executionContext = createExecutionContext(deleteEventSourceMappingRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteEventSourceMappingRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteEventSourceMappingRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteEventSourceMapping");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteEventSourceMappingResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a Lambda function. To delete a specific function version, use the Qualifier
parameter.
* Otherwise, all versions and aliases are deleted.
*
*
* To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For AWS
* services and resources that invoke your function directly, delete the trigger in the service where you originally
* configured it.
*
*
* @param deleteFunctionRequest
* @return Result of the DeleteFunction operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws ResourceConflictException
* The resource already exists.
* @sample AWSLambda.DeleteFunction
* @see AWS API
* Documentation
*/
@Override
public DeleteFunctionResult deleteFunction(DeleteFunctionRequest request) {
request = beforeClientExecution(request);
return executeDeleteFunction(request);
}
@SdkInternalApi
final DeleteFunctionResult executeDeleteFunction(DeleteFunctionRequest deleteFunctionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteFunctionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteFunctionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFunctionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFunction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteFunctionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Removes a concurrent execution limit from a function.
*
*
* @param deleteFunctionConcurrencyRequest
* @return Result of the DeleteFunctionConcurrency operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @sample AWSLambda.DeleteFunctionConcurrency
* @see AWS API Documentation
*/
@Override
public DeleteFunctionConcurrencyResult deleteFunctionConcurrency(DeleteFunctionConcurrencyRequest request) {
request = beforeClientExecution(request);
return executeDeleteFunctionConcurrency(request);
}
@SdkInternalApi
final DeleteFunctionConcurrencyResult executeDeleteFunctionConcurrency(DeleteFunctionConcurrencyRequest deleteFunctionConcurrencyRequest) {
ExecutionContext executionContext = createExecutionContext(deleteFunctionConcurrencyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteFunctionConcurrencyRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteFunctionConcurrencyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFunctionConcurrency");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteFunctionConcurrencyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a version of an AWS
* Lambda layer. Deleted versions can no longer be viewed or added to functions. To avoid breaking functions, a
* copy of the version remains in Lambda until no functions refer to it.
*
*
* @param deleteLayerVersionRequest
* @return Result of the DeleteLayerVersion operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.DeleteLayerVersion
* @see AWS API
* Documentation
*/
@Override
public DeleteLayerVersionResult deleteLayerVersion(DeleteLayerVersionRequest request) {
request = beforeClientExecution(request);
return executeDeleteLayerVersion(request);
}
@SdkInternalApi
final DeleteLayerVersionResult executeDeleteLayerVersion(DeleteLayerVersionRequest deleteLayerVersionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteLayerVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteLayerVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteLayerVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteLayerVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteLayerVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves details about your account's limits and usage in an AWS Region.
*
*
* @param getAccountSettingsRequest
* @return Result of the GetAccountSettings operation returned by the service.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @sample AWSLambda.GetAccountSettings
* @see AWS API
* Documentation
*/
@Override
public GetAccountSettingsResult getAccountSettings(GetAccountSettingsRequest request) {
request = beforeClientExecution(request);
return executeGetAccountSettings(request);
}
@SdkInternalApi
final GetAccountSettingsResult executeGetAccountSettings(GetAccountSettingsRequest getAccountSettingsRequest) {
ExecutionContext executionContext = createExecutionContext(getAccountSettingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAccountSettingsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAccountSettingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAccountSettings");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAccountSettingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns details about a Lambda function alias.
*
*
* @param getAliasRequest
* @return Result of the GetAlias operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.GetAlias
* @see AWS API
* Documentation
*/
@Override
public GetAliasResult getAlias(GetAliasRequest request) {
request = beforeClientExecution(request);
return executeGetAlias(request);
}
@SdkInternalApi
final GetAliasResult executeGetAlias(GetAliasRequest getAliasRequest) {
ExecutionContext executionContext = createExecutionContext(getAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns details about an event source mapping. You can get the identifier of a mapping from the output of
* ListEventSourceMappings.
*
*
* @param getEventSourceMappingRequest
* @return Result of the GetEventSourceMapping operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.GetEventSourceMapping
* @see AWS
* API Documentation
*/
@Override
public GetEventSourceMappingResult getEventSourceMapping(GetEventSourceMappingRequest request) {
request = beforeClientExecution(request);
return executeGetEventSourceMapping(request);
}
@SdkInternalApi
final GetEventSourceMappingResult executeGetEventSourceMapping(GetEventSourceMappingRequest getEventSourceMappingRequest) {
ExecutionContext executionContext = createExecutionContext(getEventSourceMappingRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetEventSourceMappingRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getEventSourceMappingRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetEventSourceMapping");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new GetEventSourceMappingResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns information about the function or function version, with a link to download the deployment package that's
* valid for 10 minutes. If you specify a function version, only details that are specific to that version are
* returned.
*
*
* @param getFunctionRequest
* @return Result of the GetFunction operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @sample AWSLambda.GetFunction
* @see AWS API
* Documentation
*/
@Override
public GetFunctionResult getFunction(GetFunctionRequest request) {
request = beforeClientExecution(request);
return executeGetFunction(request);
}
@SdkInternalApi
final GetFunctionResult executeGetFunction(GetFunctionRequest getFunctionRequest) {
ExecutionContext executionContext = createExecutionContext(getFunctionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetFunctionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getFunctionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetFunction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetFunctionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the version-specific settings of a Lambda function or version. The output includes only options that can
* vary between versions of a function. To modify these settings, use UpdateFunctionConfiguration.
*
*
* To get all of a function's details, including function-level settings, use GetFunction.
*
*
* @param getFunctionConfigurationRequest
* @return Result of the GetFunctionConfiguration operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @sample AWSLambda.GetFunctionConfiguration
* @see AWS API Documentation
*/
@Override
public GetFunctionConfigurationResult getFunctionConfiguration(GetFunctionConfigurationRequest request) {
request = beforeClientExecution(request);
return executeGetFunctionConfiguration(request);
}
@SdkInternalApi
final GetFunctionConfigurationResult executeGetFunctionConfiguration(GetFunctionConfigurationRequest getFunctionConfigurationRequest) {
ExecutionContext executionContext = createExecutionContext(getFunctionConfigurationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetFunctionConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(getFunctionConfigurationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetFunctionConfiguration");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new GetFunctionConfigurationResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns information about a version of an AWS Lambda layer, with a link
* to download the layer archive that's valid for 10 minutes.
*
*
* @param getLayerVersionRequest
* @return Result of the GetLayerVersion operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @sample AWSLambda.GetLayerVersion
* @see AWS API
* Documentation
*/
@Override
public GetLayerVersionResult getLayerVersion(GetLayerVersionRequest request) {
request = beforeClientExecution(request);
return executeGetLayerVersion(request);
}
@SdkInternalApi
final GetLayerVersionResult executeGetLayerVersion(GetLayerVersionRequest getLayerVersionRequest) {
ExecutionContext executionContext = createExecutionContext(getLayerVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetLayerVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getLayerVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetLayerVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetLayerVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns information about a version of an AWS Lambda layer, with a link
* to download the layer archive that's valid for 10 minutes.
*
*
* @param getLayerVersionByArnRequest
* @return Result of the GetLayerVersionByArn operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @sample AWSLambda.GetLayerVersionByArn
* @see AWS
* API Documentation
*/
@Override
public GetLayerVersionByArnResult getLayerVersionByArn(GetLayerVersionByArnRequest request) {
request = beforeClientExecution(request);
return executeGetLayerVersionByArn(request);
}
@SdkInternalApi
final GetLayerVersionByArnResult executeGetLayerVersionByArn(GetLayerVersionByArnRequest getLayerVersionByArnRequest) {
ExecutionContext executionContext = createExecutionContext(getLayerVersionByArnRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetLayerVersionByArnRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getLayerVersionByArnRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetLayerVersionByArn");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetLayerVersionByArnResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the permission policy for a version of an AWS Lambda layer. For more
* information, see AddLayerVersionPermission.
*
*
* @param getLayerVersionPolicyRequest
* @return Result of the GetLayerVersionPolicy operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @sample AWSLambda.GetLayerVersionPolicy
* @see AWS
* API Documentation
*/
@Override
public GetLayerVersionPolicyResult getLayerVersionPolicy(GetLayerVersionPolicyRequest request) {
request = beforeClientExecution(request);
return executeGetLayerVersionPolicy(request);
}
@SdkInternalApi
final GetLayerVersionPolicyResult executeGetLayerVersionPolicy(GetLayerVersionPolicyRequest getLayerVersionPolicyRequest) {
ExecutionContext executionContext = createExecutionContext(getLayerVersionPolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetLayerVersionPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getLayerVersionPolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetLayerVersionPolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new GetLayerVersionPolicyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns the resource-based IAM
* policy for a function, version, or alias.
*
*
* @param getPolicyRequest
* @return Result of the GetPolicy operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @sample AWSLambda.GetPolicy
* @see AWS API
* Documentation
*/
@Override
public GetPolicyResult getPolicy(GetPolicyRequest request) {
request = beforeClientExecution(request);
return executeGetPolicy(request);
}
@SdkInternalApi
final GetPolicyResult executeGetPolicy(GetPolicyRequest getPolicyRequest) {
ExecutionContext executionContext = createExecutionContext(getPolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getPolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPolicyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or
* asynchronously. To invoke a function asynchronously, set InvocationType
to Event
.
*
*
* For synchronous invocation, details about the function response, including errors, are included in the response
* body and headers. For either invocation type, you can find more information in the execution log and trace. To record function errors for
* asynchronous invocations, configure your function with a dead letter queue.
*
*
* When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client,
* event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error,
* Lambda executes the function up to two more times. For more information, see Retry Behavior.
*
*
* The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that
* prevent your function from executing, such as permissions errors, limit errors, or issues with your function's
* code and configuration. For example, Lambda returns TooManyRequestsException
if executing the
* function would cause you to exceed a concurrency limit at either the account level (
* ConcurrentInvocationLimitExceeded
) or function level (
* ReservedFunctionConcurrentInvocationLimitExceeded
).
*
*
* For functions with a long timeout, your client might be disconnected during synchronous invocation while it waits
* for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long
* connections with timeout or keep-alive settings.
*
*
* This operation requires permission for the lambda:InvokeFunction
action.
*
*
* @param invokeRequest
* @return Result of the Invoke operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidRequestContentException
* The request body could not be parsed as JSON.
* @throws RequestTooLargeException
* The request payload exceeded the Invoke
request body JSON input limit. For more information,
* see Limits.
* @throws UnsupportedMediaTypeException
* The content type of the Invoke
request body is not JSON.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws EC2UnexpectedException
* AWS Lambda received an unexpected EC2 client exception while setting up for the Lambda function.
* @throws SubnetIPAddressLimitReachedException
* AWS Lambda was not able to set up VPC access for the Lambda function because one or more configured
* subnets has no available IP addresses.
* @throws ENILimitReachedException
* AWS Lambda was not able to create an Elastic Network Interface (ENI) in the VPC, specified as part of
* Lambda function configuration, because the limit for network interfaces has been reached.
* @throws EC2ThrottledException
* AWS Lambda was throttled by Amazon EC2 during Lambda function initialization using the execution role
* provided for the Lambda function.
* @throws EC2AccessDeniedException
* Need additional permissions to configure VPC settings.
* @throws InvalidSubnetIDException
* The Subnet ID provided in the Lambda function VPC configuration is invalid.
* @throws InvalidSecurityGroupIDException
* The Security Group ID provided in the Lambda function VPC configuration is invalid.
* @throws InvalidZipFileException
* AWS Lambda could not unzip the deployment package.
* @throws KMSDisabledException
* Lambda was unable to decrypt the environment variables because the KMS key used is disabled. Check the
* Lambda function's KMS key settings.
* @throws KMSInvalidStateException
* Lambda was unable to decrypt the environment variables because the KMS key used is in an invalid state
* for Decrypt. Check the function's KMS key settings.
* @throws KMSAccessDeniedException
* Lambda was unable to decrypt the environment variables because KMS access was denied. Check the Lambda
* function's KMS permissions.
* @throws KMSNotFoundException
* Lambda was unable to decrypt the environment variables because the KMS key was not found. Check the
* function's KMS key settings.
* @throws InvalidRuntimeException
* The runtime or runtime version specified is not supported.
* @sample AWSLambda.Invoke
* @see AWS API
* Documentation
*/
@Override
public InvokeResult invoke(InvokeRequest request) {
request = beforeClientExecution(request);
return executeInvoke(request);
}
@SdkInternalApi
final InvokeResult executeInvoke(InvokeRequest invokeRequest) {
ExecutionContext executionContext = createExecutionContext(invokeRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new InvokeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(invokeRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "Invoke");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(false).withHasStreamingSuccessResponse(false), new InvokeResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
*
* For asynchronous function invocation, use Invoke.
*
*
*
* Invokes a function asynchronously.
*
*
* @param invokeAsyncRequest
* @return Result of the InvokeAsync operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidRequestContentException
* The request body could not be parsed as JSON.
* @throws InvalidRuntimeException
* The runtime or runtime version specified is not supported.
* @sample AWSLambda.InvokeAsync
* @see AWS API
* Documentation
*/
@Override
@Deprecated
public InvokeAsyncResult invokeAsync(InvokeAsyncRequest request) {
request = beforeClientExecution(request);
return executeInvokeAsync(request);
}
@SdkInternalApi
final InvokeAsyncResult executeInvokeAsync(InvokeAsyncRequest invokeAsyncRequest) {
ExecutionContext executionContext = createExecutionContext(invokeAsyncRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new InvokeAsyncRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(invokeAsyncRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "InvokeAsync");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
request.addHandlerContext(HandlerContextKey.HAS_STREAMING_INPUT, Boolean.TRUE);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new InvokeAsyncResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of aliases for
* a Lambda function.
*
*
* @param listAliasesRequest
* @return Result of the ListAliases operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.ListAliases
* @see AWS API
* Documentation
*/
@Override
public ListAliasesResult listAliases(ListAliasesRequest request) {
request = beforeClientExecution(request);
return executeListAliases(request);
}
@SdkInternalApi
final ListAliasesResult executeListAliases(ListAliasesRequest listAliasesRequest) {
ExecutionContext executionContext = createExecutionContext(listAliasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAliasesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAliasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAliases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListAliasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists event source mappings. Specify an EventSourceArn
to only show event source mappings for a
* single event source.
*
*
* @param listEventSourceMappingsRequest
* @return Result of the ListEventSourceMappings operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.ListEventSourceMappings
* @see AWS
* API Documentation
*/
@Override
public ListEventSourceMappingsResult listEventSourceMappings(ListEventSourceMappingsRequest request) {
request = beforeClientExecution(request);
return executeListEventSourceMappings(request);
}
@SdkInternalApi
final ListEventSourceMappingsResult executeListEventSourceMappings(ListEventSourceMappingsRequest listEventSourceMappingsRequest) {
ExecutionContext executionContext = createExecutionContext(listEventSourceMappingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEventSourceMappingsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listEventSourceMappingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEventSourceMappings");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListEventSourceMappingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ListEventSourceMappingsResult listEventSourceMappings() {
return listEventSourceMappings(new ListEventSourceMappingsRequest());
}
/**
*
* Returns a list of Lambda functions, with the version-specific configuration of each.
*
*
* Set FunctionVersion
to ALL
to include all published versions of each function in
* addition to the unpublished version. To get more information about a function or version, use GetFunction.
*
*
* @param listFunctionsRequest
* @return Result of the ListFunctions operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @sample AWSLambda.ListFunctions
* @see AWS API
* Documentation
*/
@Override
public ListFunctionsResult listFunctions(ListFunctionsRequest request) {
request = beforeClientExecution(request);
return executeListFunctions(request);
}
@SdkInternalApi
final ListFunctionsResult executeListFunctions(ListFunctionsRequest listFunctionsRequest) {
ExecutionContext executionContext = createExecutionContext(listFunctionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFunctionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFunctionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFunctions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFunctionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
@Override
public ListFunctionsResult listFunctions() {
return listFunctions(new ListFunctionsRequest());
}
/**
*
* Lists the versions of an AWS
* Lambda layer. Versions that have been deleted aren't listed. Specify a runtime identifier to list only
* versions that indicate that they're compatible with that runtime.
*
*
* @param listLayerVersionsRequest
* @return Result of the ListLayerVersions operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.ListLayerVersions
* @see AWS API
* Documentation
*/
@Override
public ListLayerVersionsResult listLayerVersions(ListLayerVersionsRequest request) {
request = beforeClientExecution(request);
return executeListLayerVersions(request);
}
@SdkInternalApi
final ListLayerVersionsResult executeListLayerVersions(ListLayerVersionsRequest listLayerVersionsRequest) {
ExecutionContext executionContext = createExecutionContext(listLayerVersionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListLayerVersionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLayerVersionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListLayerVersions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListLayerVersionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists AWS Lambda layers and
* shows information about the latest version of each. Specify a runtime identifier to list only
* layers that indicate that they're compatible with that runtime.
*
*
* @param listLayersRequest
* @return Result of the ListLayers operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.ListLayers
* @see AWS API
* Documentation
*/
@Override
public ListLayersResult listLayers(ListLayersRequest request) {
request = beforeClientExecution(request);
return executeListLayers(request);
}
@SdkInternalApi
final ListLayersResult executeListLayers(ListLayersRequest listLayersRequest) {
ExecutionContext executionContext = createExecutionContext(listLayersRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListLayersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLayersRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListLayers");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListLayersResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a function's tags. You can also
* view tags with GetFunction.
*
*
* @param listTagsRequest
* @return Result of the ListTags operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.ListTags
* @see AWS API
* Documentation
*/
@Override
public ListTagsResult listTags(ListTagsRequest request) {
request = beforeClientExecution(request);
return executeListTags(request);
}
@SdkInternalApi
final ListTagsResult executeListTags(ListTagsRequest listTagsRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTags");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of versions,
* with the version-specific configuration of each.
*
*
* @param listVersionsByFunctionRequest
* @return Result of the ListVersionsByFunction operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.ListVersionsByFunction
* @see AWS
* API Documentation
*/
@Override
public ListVersionsByFunctionResult listVersionsByFunction(ListVersionsByFunctionRequest request) {
request = beforeClientExecution(request);
return executeListVersionsByFunction(request);
}
@SdkInternalApi
final ListVersionsByFunctionResult executeListVersionsByFunction(ListVersionsByFunctionRequest listVersionsByFunctionRequest) {
ExecutionContext executionContext = createExecutionContext(listVersionsByFunctionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListVersionsByFunctionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listVersionsByFunctionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListVersionsByFunction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListVersionsByFunctionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an AWS Lambda layer
* from a ZIP archive. Each time you call PublishLayerVersion
with the same version name, a new version
* is created.
*
*
* Add layers to your function with CreateFunction or UpdateFunctionConfiguration.
*
*
* @param publishLayerVersionRequest
* @return Result of the PublishLayerVersion operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws CodeStorageExceededException
* You have exceeded your maximum total code size per account. Learn more
* @sample AWSLambda.PublishLayerVersion
* @see AWS API
* Documentation
*/
@Override
public PublishLayerVersionResult publishLayerVersion(PublishLayerVersionRequest request) {
request = beforeClientExecution(request);
return executePublishLayerVersion(request);
}
@SdkInternalApi
final PublishLayerVersionResult executePublishLayerVersion(PublishLayerVersionRequest publishLayerVersionRequest) {
ExecutionContext executionContext = createExecutionContext(publishLayerVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PublishLayerVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(publishLayerVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PublishLayerVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PublishLayerVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a version from the
* current code and configuration of a function. Use versions to create a snapshot of your function code and
* configuration that doesn't change.
*
*
* AWS Lambda doesn't publish a version if the function's configuration and code haven't changed since the last
* version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before
* publishing a version.
*
*
* Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias.
*
*
* @param publishVersionRequest
* @return Result of the PublishVersion operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws CodeStorageExceededException
* You have exceeded your maximum total code size per account. Learn more
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.PublishVersion
* @see AWS API
* Documentation
*/
@Override
public PublishVersionResult publishVersion(PublishVersionRequest request) {
request = beforeClientExecution(request);
return executePublishVersion(request);
}
@SdkInternalApi
final PublishVersionResult executePublishVersion(PublishVersionRequest publishVersionRequest) {
ExecutionContext executionContext = createExecutionContext(publishVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PublishVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(publishVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PublishVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PublishVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Sets the maximum number of simultaneous executions for a function, and reserves capacity for that concurrency
* level.
*
*
* Concurrency settings apply to the function as a whole, including all published versions and the unpublished
* version. Reserving concurrency both ensures that your function has capacity to process the specified number of
* events simultaneously, and prevents it from scaling beyond that level. Use GetFunction to see the current
* setting for a function.
*
*
* Use GetAccountSettings to see your regional concurrency limit. You can reserve concurrency for as many
* functions as you like, as long as you leave at least 100 simultaneous executions unreserved for functions that
* aren't configured with a per-function limit. For more information, see Managing Concurrency.
*
*
* @param putFunctionConcurrencyRequest
* @return Result of the PutFunctionConcurrency operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.PutFunctionConcurrency
* @see AWS
* API Documentation
*/
@Override
public PutFunctionConcurrencyResult putFunctionConcurrency(PutFunctionConcurrencyRequest request) {
request = beforeClientExecution(request);
return executePutFunctionConcurrency(request);
}
@SdkInternalApi
final PutFunctionConcurrencyResult executePutFunctionConcurrency(PutFunctionConcurrencyRequest putFunctionConcurrencyRequest) {
ExecutionContext executionContext = createExecutionContext(putFunctionConcurrencyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PutFunctionConcurrencyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putFunctionConcurrencyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutFunctionConcurrency");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new PutFunctionConcurrencyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Removes a statement from the permissions policy for a version of an AWS Lambda layer. For more
* information, see AddLayerVersionPermission.
*
*
* @param removeLayerVersionPermissionRequest
* @return Result of the RemoveLayerVersionPermission operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.RemoveLayerVersionPermission
* @see AWS API Documentation
*/
@Override
public RemoveLayerVersionPermissionResult removeLayerVersionPermission(RemoveLayerVersionPermissionRequest request) {
request = beforeClientExecution(request);
return executeRemoveLayerVersionPermission(request);
}
@SdkInternalApi
final RemoveLayerVersionPermissionResult executeRemoveLayerVersionPermission(RemoveLayerVersionPermissionRequest removeLayerVersionPermissionRequest) {
ExecutionContext executionContext = createExecutionContext(removeLayerVersionPermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RemoveLayerVersionPermissionRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(removeLayerVersionPermissionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemoveLayerVersionPermission");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new RemoveLayerVersionPermissionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Revokes function-use permission from an AWS service or another account. You can get the ID of the statement from
* the output of GetPolicy.
*
*
* @param removePermissionRequest
* @return Result of the RemovePermission operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.RemovePermission
* @see AWS API
* Documentation
*/
@Override
public RemovePermissionResult removePermission(RemovePermissionRequest request) {
request = beforeClientExecution(request);
return executeRemovePermission(request);
}
@SdkInternalApi
final RemovePermissionResult executeRemovePermission(RemovePermissionRequest removePermissionRequest) {
ExecutionContext executionContext = createExecutionContext(removePermissionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RemovePermissionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(removePermissionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemovePermission");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RemovePermissionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Adds tags to a function.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Removes tags from a function.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @sample AWSLambda.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the configuration of a Lambda function alias.
*
*
* @param updateAliasRequest
* @return Result of the UpdateAlias operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.UpdateAlias
* @see AWS API
* Documentation
*/
@Override
public UpdateAliasResult updateAlias(UpdateAliasRequest request) {
request = beforeClientExecution(request);
return executeUpdateAlias(request);
}
@SdkInternalApi
final UpdateAliasResult executeUpdateAlias(UpdateAliasRequest updateAliasRequest) {
ExecutionContext executionContext = createExecutionContext(updateAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates an event source mapping. You can change the function that AWS Lambda invokes, or pause invocation and
* resume later from the same location.
*
*
* @param updateEventSourceMappingRequest
* @return Result of the UpdateEventSourceMapping operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ResourceConflictException
* The resource already exists.
* @throws ResourceInUseException
* The operation conflicts with the resource's availability. For example, you attempted to update an
* EventSource Mapping in CREATING, or tried to delete a EventSource mapping currently in the UPDATING
* state.
* @sample AWSLambda.UpdateEventSourceMapping
* @see AWS API Documentation
*/
@Override
public UpdateEventSourceMappingResult updateEventSourceMapping(UpdateEventSourceMappingRequest request) {
request = beforeClientExecution(request);
return executeUpdateEventSourceMapping(request);
}
@SdkInternalApi
final UpdateEventSourceMappingResult executeUpdateEventSourceMapping(UpdateEventSourceMappingRequest updateEventSourceMappingRequest) {
ExecutionContext executionContext = createExecutionContext(updateEventSourceMappingRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateEventSourceMappingRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateEventSourceMappingRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateEventSourceMapping");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateEventSourceMappingResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates a Lambda function's code.
*
*
* The function's code is locked when you publish a version. You can't modify the code of a published version, only
* the unpublished version.
*
*
* @param updateFunctionCodeRequest
* @return Result of the UpdateFunctionCode operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws CodeStorageExceededException
* You have exceeded your maximum total code size per account. Learn more
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.UpdateFunctionCode
* @see AWS API
* Documentation
*/
@Override
public UpdateFunctionCodeResult updateFunctionCode(UpdateFunctionCodeRequest request) {
request = beforeClientExecution(request);
return executeUpdateFunctionCode(request);
}
@SdkInternalApi
final UpdateFunctionCodeResult executeUpdateFunctionCode(UpdateFunctionCodeRequest updateFunctionCodeRequest) {
ExecutionContext executionContext = createExecutionContext(updateFunctionCodeRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateFunctionCodeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateFunctionCodeRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateFunctionCode");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateFunctionCodeResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Modify the version-specific settings of a Lambda function.
*
*
* These settings can vary between versions of a function and are locked when you publish a version. You can't
* modify the configuration of a published version, only the unpublished version.
*
*
* To configure function concurrency, use PutFunctionConcurrency. To grant invoke permissions to an account
* or AWS service, use AddPermission.
*
*
* @param updateFunctionConfigurationRequest
* @return Result of the UpdateFunctionConfiguration operation returned by the service.
* @throws ServiceException
* The AWS Lambda service encountered an internal error.
* @throws ResourceNotFoundException
* The resource (for example, a Lambda function or access policy statement) specified in the request does
* not exist.
* @throws InvalidParameterValueException
* One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda
* to assume in the CreateFunction
or the UpdateFunctionConfiguration
API, that
* AWS Lambda is unable to assume you will get this exception.
* @throws TooManyRequestsException
* Request throughput limit exceeded.
* @throws ResourceConflictException
* The resource already exists.
* @throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the
* GetFunction
or the GetAlias
API to retrieve the latest RevisionId for your
* resource.
* @sample AWSLambda.UpdateFunctionConfiguration
* @see AWS API Documentation
*/
@Override
public UpdateFunctionConfigurationResult updateFunctionConfiguration(UpdateFunctionConfigurationRequest request) {
request = beforeClientExecution(request);
return executeUpdateFunctionConfiguration(request);
}
@SdkInternalApi
final UpdateFunctionConfigurationResult executeUpdateFunctionConfiguration(UpdateFunctionConfigurationRequest updateFunctionConfigurationRequest) {
ExecutionContext executionContext = createExecutionContext(updateFunctionConfigurationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateFunctionConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateFunctionConfigurationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lambda");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateFunctionConfiguration");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateFunctionConfigurationResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
*
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private Response anonymousInvoke(Request request,
HttpResponseHandler> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private Response doInvoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public AWSLambdaWaiters waiters() {
if (waiters == null) {
synchronized (this) {
if (waiters == null) {
waiters = new AWSLambdaWaiters(this);
}
}
}
return waiters;
}
@Override
public void shutdown() {
super.shutdown();
if (waiters != null) {
waiters.shutdown();
}
}
}