
software.amazon.awssdk.services.codedeploy.model.LambdaFunctionInfo Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.codedeploy.model;
import java.io.Serializable;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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;
/**
*
* Information about a Lambda function specified in a deployment.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LambdaFunctionInfo implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FUNCTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LambdaFunctionInfo::functionName)).setter(setter(Builder::functionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("functionName").build()).build();
private static final SdkField FUNCTION_ALIAS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LambdaFunctionInfo::functionAlias)).setter(setter(Builder::functionAlias))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("functionAlias").build()).build();
private static final SdkField CURRENT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LambdaFunctionInfo::currentVersion)).setter(setter(Builder::currentVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("currentVersion").build()).build();
private static final SdkField TARGET_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LambdaFunctionInfo::targetVersion)).setter(setter(Builder::targetVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetVersion").build()).build();
private static final SdkField TARGET_VERSION_WEIGHT_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(LambdaFunctionInfo::targetVersionWeight)).setter(setter(Builder::targetVersionWeight))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetVersionWeight").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FUNCTION_NAME_FIELD,
FUNCTION_ALIAS_FIELD, CURRENT_VERSION_FIELD, TARGET_VERSION_FIELD, TARGET_VERSION_WEIGHT_FIELD));
private static final long serialVersionUID = 1L;
private final String functionName;
private final String functionAlias;
private final String currentVersion;
private final String targetVersion;
private final Double targetVersionWeight;
private LambdaFunctionInfo(BuilderImpl builder) {
this.functionName = builder.functionName;
this.functionAlias = builder.functionAlias;
this.currentVersion = builder.currentVersion;
this.targetVersion = builder.targetVersion;
this.targetVersionWeight = builder.targetVersionWeight;
}
/**
*
* The name of a Lambda function.
*
*
* @return The name of a Lambda function.
*/
public String functionName() {
return functionName;
}
/**
*
* The alias of a Lambda function. For more information, see AWS Lambda Function Aliases in the
* AWS Lambda Developer Guide.
*
*
* @return The alias of a Lambda function. For more information, see AWS Lambda Function Aliases in
* the AWS Lambda Developer Guide.
*/
public String functionAlias() {
return functionAlias;
}
/**
*
* The version of a Lambda function that production traffic points to.
*
*
* @return The version of a Lambda function that production traffic points to.
*/
public String currentVersion() {
return currentVersion;
}
/**
*
* The version of a Lambda function that production traffic points to after the Lambda function is deployed.
*
*
* @return The version of a Lambda function that production traffic points to after the Lambda function is deployed.
*/
public String targetVersion() {
return targetVersion;
}
/**
*
* The percentage of production traffic that the target version of a Lambda function receives.
*
*
* @return The percentage of production traffic that the target version of a Lambda function receives.
*/
public Double targetVersionWeight() {
return targetVersionWeight;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(functionName());
hashCode = 31 * hashCode + Objects.hashCode(functionAlias());
hashCode = 31 * hashCode + Objects.hashCode(currentVersion());
hashCode = 31 * hashCode + Objects.hashCode(targetVersion());
hashCode = 31 * hashCode + Objects.hashCode(targetVersionWeight());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof LambdaFunctionInfo)) {
return false;
}
LambdaFunctionInfo other = (LambdaFunctionInfo) obj;
return Objects.equals(functionName(), other.functionName()) && Objects.equals(functionAlias(), other.functionAlias())
&& Objects.equals(currentVersion(), other.currentVersion())
&& Objects.equals(targetVersion(), other.targetVersion())
&& Objects.equals(targetVersionWeight(), other.targetVersionWeight());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public String toString() {
return ToString.builder("LambdaFunctionInfo").add("FunctionName", functionName()).add("FunctionAlias", functionAlias())
.add("CurrentVersion", currentVersion()).add("TargetVersion", targetVersion())
.add("TargetVersionWeight", targetVersionWeight()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "functionName":
return Optional.ofNullable(clazz.cast(functionName()));
case "functionAlias":
return Optional.ofNullable(clazz.cast(functionAlias()));
case "currentVersion":
return Optional.ofNullable(clazz.cast(currentVersion()));
case "targetVersion":
return Optional.ofNullable(clazz.cast(targetVersion()));
case "targetVersionWeight":
return Optional.ofNullable(clazz.cast(targetVersionWeight()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy