software.amazon.awssdk.services.lambda.model.UpdateFunctionConfigurationRequest Maven / Gradle / Ivy
Show all versions of lambda Show documentation
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.lambda.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateFunctionConfigurationRequest extends LambdaRequest implements
ToCopyableBuilder {
private static final SdkField FUNCTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::functionName)).setter(setter(Builder::functionName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("FunctionName").build()).build();
private static final SdkField ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::role)).setter(setter(Builder::role))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Role").build()).build();
private static final SdkField HANDLER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::handler)).setter(setter(Builder::handler))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Handler").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField TIMEOUT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(UpdateFunctionConfigurationRequest::timeout)).setter(setter(Builder::timeout))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Timeout").build()).build();
private static final SdkField MEMORY_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(UpdateFunctionConfigurationRequest::memorySize)).setter(setter(Builder::memorySize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MemorySize").build()).build();
private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(UpdateFunctionConfigurationRequest::vpcConfig)).setter(setter(Builder::vpcConfig))
.constructor(VpcConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfig").build()).build();
private static final SdkField ENVIRONMENT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(UpdateFunctionConfigurationRequest::environment)).setter(setter(Builder::environment))
.constructor(Environment::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Environment").build()).build();
private static final SdkField RUNTIME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::runtimeAsString)).setter(setter(Builder::runtime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Runtime").build()).build();
private static final SdkField DEAD_LETTER_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(UpdateFunctionConfigurationRequest::deadLetterConfig)).setter(setter(Builder::deadLetterConfig))
.constructor(DeadLetterConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeadLetterConfig").build()).build();
private static final SdkField KMS_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::kmsKeyArn)).setter(setter(Builder::kmsKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSKeyArn").build()).build();
private static final SdkField TRACING_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(UpdateFunctionConfigurationRequest::tracingConfig))
.setter(setter(Builder::tracingConfig)).constructor(TracingConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TracingConfig").build()).build();
private static final SdkField REVISION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateFunctionConfigurationRequest::revisionId)).setter(setter(Builder::revisionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RevisionId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FUNCTION_NAME_FIELD,
ROLE_FIELD, HANDLER_FIELD, DESCRIPTION_FIELD, TIMEOUT_FIELD, MEMORY_SIZE_FIELD, VPC_CONFIG_FIELD, ENVIRONMENT_FIELD,
RUNTIME_FIELD, DEAD_LETTER_CONFIG_FIELD, KMS_KEY_ARN_FIELD, TRACING_CONFIG_FIELD, REVISION_ID_FIELD));
private final String functionName;
private final String role;
private final String handler;
private final String description;
private final Integer timeout;
private final Integer memorySize;
private final VpcConfig vpcConfig;
private final Environment environment;
private final String runtime;
private final DeadLetterConfig deadLetterConfig;
private final String kmsKeyArn;
private final TracingConfig tracingConfig;
private final String revisionId;
private UpdateFunctionConfigurationRequest(BuilderImpl builder) {
super(builder);
this.functionName = builder.functionName;
this.role = builder.role;
this.handler = builder.handler;
this.description = builder.description;
this.timeout = builder.timeout;
this.memorySize = builder.memorySize;
this.vpcConfig = builder.vpcConfig;
this.environment = builder.environment;
this.runtime = builder.runtime;
this.deadLetterConfig = builder.deadLetterConfig;
this.kmsKeyArn = builder.kmsKeyArn;
this.tracingConfig = builder.tracingConfig;
this.revisionId = builder.revisionId;
}
/**
*
* The name of the lambda function.
*
*
* Name formats
*
*
* -
*
* Function name - MyFunction
.
*
*
* -
*
* Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
*
*
* -
*
* Partial ARN - 123456789012:function:MyFunction
.
*
*
*
*
* The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64
* characters in length.
*
*
* @return The name of the lambda function.
*
* Name formats
*
*
* -
*
* Function name - MyFunction
.
*
*
* -
*
* Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
*
*
* -
*
* Partial ARN - 123456789012:function:MyFunction
.
*
*
*
*
* The length constraint applies only to the full ARN. If you specify only the function name, it is limited
* to 64 characters in length.
*/
public String functionName() {
return functionName;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when it executes your function.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when it executes your function.
*/
public String role() {
return role;
}
/**
*
* The function that Lambda calls to begin executing your function. For Node.js, it is the
* module-name.export
value in your function.
*
*
* @return The function that Lambda calls to begin executing your function. For Node.js, it is the
* module-name.export
value in your function.
*/
public String handler() {
return handler;
}
/**
*
* A short user-defined function description. AWS Lambda does not use this value. Assign a meaningful description as
* you see fit.
*
*
* @return A short user-defined function description. AWS Lambda does not use this value. Assign a meaningful
* description as you see fit.
*/
public String description() {
return description;
}
/**
*
* The amount of time that Lambda allows a function to run before terminating it. The default is 3 seconds. The
* maximum allowed value is 900 seconds.
*
*
* @return The amount of time that Lambda allows a function to run before terminating it. The default is 3 seconds.
* The maximum allowed value is 900 seconds.
*/
public Integer timeout() {
return timeout;
}
/**
*
* The amount of memory, in MB, your Lambda function is given. AWS Lambda uses this memory size to infer the amount
* of CPU allocated to your function. Your function use-case determines your CPU and memory requirements. For
* example, a database operation might need less memory compared to an image processing function. The default value
* is 128 MB. The value must be a multiple of 64 MB.
*
*
* @return The amount of memory, in MB, your Lambda function is given. AWS Lambda uses this memory size to infer the
* amount of CPU allocated to your function. Your function use-case determines your CPU and memory
* requirements. For example, a database operation might need less memory compared to an image processing
* function. The default value is 128 MB. The value must be a multiple of 64 MB.
*/
public Integer memorySize() {
return memorySize;
}
/**
*
* Specify security groups and subnets in a VPC to which your Lambda function needs access.
*
*
* @return Specify security groups and subnets in a VPC to which your Lambda function needs access.
*/
public VpcConfig vpcConfig() {
return vpcConfig;
}
/**
*
* The parent object that contains your environment's configuration settings.
*
*
* @return The parent object that contains your environment's configuration settings.
*/
public Environment environment() {
return environment;
}
/**
*
* The runtime version for the function.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #runtime} will
* return {@link Runtime#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #runtimeAsString}.
*
*
* @return The runtime version for the function.
* @see Runtime
*/
public Runtime runtime() {
return Runtime.fromValue(runtime);
}
/**
*
* The runtime version for the function.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #runtime} will
* return {@link Runtime#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #runtimeAsString}.
*
*
* @return The runtime version for the function.
* @see Runtime
*/
public String runtimeAsString() {
return runtime;
}
/**
*
* A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when
* they fail processing. For more information, see Dead Letter Queues.
*
*
* @return A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous
* events when they fail processing. For more information, see Dead Letter Queues.
*/
public DeadLetterConfig deadLetterConfig() {
return deadLetterConfig;
}
/**
*
* The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's environment variables. If you elect
* to use the AWS Lambda default service key, pass in an empty string ("") for this parameter.
*
*
* @return The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's environment variables. If
* you elect to use the AWS Lambda default service key, pass in an empty string ("") for this parameter.
*/
public String kmsKeyArn() {
return kmsKeyArn;
}
/**
*
* Set Mode
to Active
to sample and trace a subset of incoming requests with AWS X-Ray.
*
*
* @return Set Mode
to Active
to sample and trace a subset of incoming requests with AWS
* X-Ray.
*/
public TracingConfig tracingConfig() {
return tracingConfig;
}
/**
*
* An optional value you can use to ensure you are updating the latest update of the function version or alias. If
* the RevisionID
you pass doesn't match the latest RevisionId
of the function or alias,
* it will fail with an error message, advising you to retrieve the latest function version or alias
* RevisionID
using either GetFunction or GetAlias.
*
*
* @return An optional value you can use to ensure you are updating the latest update of the function version or
* alias. If the RevisionID
you pass doesn't match the latest RevisionId
of the
* function or alias, it will fail with an error message, advising you to retrieve the latest function
* version or alias RevisionID
using either GetFunction or GetAlias.
*/
public String revisionId() {
return revisionId;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(functionName());
hashCode = 31 * hashCode + Objects.hashCode(role());
hashCode = 31 * hashCode + Objects.hashCode(handler());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(timeout());
hashCode = 31 * hashCode + Objects.hashCode(memorySize());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfig());
hashCode = 31 * hashCode + Objects.hashCode(environment());
hashCode = 31 * hashCode + Objects.hashCode(runtimeAsString());
hashCode = 31 * hashCode + Objects.hashCode(deadLetterConfig());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyArn());
hashCode = 31 * hashCode + Objects.hashCode(tracingConfig());
hashCode = 31 * hashCode + Objects.hashCode(revisionId());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateFunctionConfigurationRequest)) {
return false;
}
UpdateFunctionConfigurationRequest other = (UpdateFunctionConfigurationRequest) obj;
return Objects.equals(functionName(), other.functionName()) && Objects.equals(role(), other.role())
&& Objects.equals(handler(), other.handler()) && Objects.equals(description(), other.description())
&& Objects.equals(timeout(), other.timeout()) && Objects.equals(memorySize(), other.memorySize())
&& Objects.equals(vpcConfig(), other.vpcConfig()) && Objects.equals(environment(), other.environment())
&& Objects.equals(runtimeAsString(), other.runtimeAsString())
&& Objects.equals(deadLetterConfig(), other.deadLetterConfig()) && Objects.equals(kmsKeyArn(), other.kmsKeyArn())
&& Objects.equals(tracingConfig(), other.tracingConfig()) && Objects.equals(revisionId(), other.revisionId());
}
@Override
public String toString() {
return ToString.builder("UpdateFunctionConfigurationRequest").add("FunctionName", functionName()).add("Role", role())
.add("Handler", handler()).add("Description", description()).add("Timeout", timeout())
.add("MemorySize", memorySize()).add("VpcConfig", vpcConfig()).add("Environment", environment())
.add("Runtime", runtimeAsString()).add("DeadLetterConfig", deadLetterConfig()).add("KMSKeyArn", kmsKeyArn())
.add("TracingConfig", tracingConfig()).add("RevisionId", revisionId()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FunctionName":
return Optional.ofNullable(clazz.cast(functionName()));
case "Role":
return Optional.ofNullable(clazz.cast(role()));
case "Handler":
return Optional.ofNullable(clazz.cast(handler()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Timeout":
return Optional.ofNullable(clazz.cast(timeout()));
case "MemorySize":
return Optional.ofNullable(clazz.cast(memorySize()));
case "VpcConfig":
return Optional.ofNullable(clazz.cast(vpcConfig()));
case "Environment":
return Optional.ofNullable(clazz.cast(environment()));
case "Runtime":
return Optional.ofNullable(clazz.cast(runtimeAsString()));
case "DeadLetterConfig":
return Optional.ofNullable(clazz.cast(deadLetterConfig()));
case "KMSKeyArn":
return Optional.ofNullable(clazz.cast(kmsKeyArn()));
case "TracingConfig":
return Optional.ofNullable(clazz.cast(tracingConfig()));
case "RevisionId":
return Optional.ofNullable(clazz.cast(revisionId()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function