software.amazon.awssdk.services.codedeploy.model.DeploymentTarget Maven / Gradle / Ivy
Show all versions of codedeploy 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 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.Consumer;
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 the deployment target.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeploymentTarget implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DEPLOYMENT_TARGET_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DeploymentTarget::deploymentTargetTypeAsString)).setter(setter(Builder::deploymentTargetType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentTargetType").build())
.build();
private static final SdkField INSTANCE_TARGET_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(DeploymentTarget::instanceTarget))
.setter(setter(Builder::instanceTarget)).constructor(InstanceTarget::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceTarget").build()).build();
private static final SdkField LAMBDA_TARGET_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(DeploymentTarget::lambdaTarget)).setter(setter(Builder::lambdaTarget))
.constructor(LambdaTarget::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lambdaTarget").build()).build();
private static final SdkField ECS_TARGET_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(DeploymentTarget::ecsTarget)).setter(setter(Builder::ecsTarget)).constructor(ECSTarget::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ecsTarget").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEPLOYMENT_TARGET_TYPE_FIELD,
INSTANCE_TARGET_FIELD, LAMBDA_TARGET_FIELD, ECS_TARGET_FIELD));
private static final long serialVersionUID = 1L;
private final String deploymentTargetType;
private final InstanceTarget instanceTarget;
private final LambdaTarget lambdaTarget;
private final ECSTarget ecsTarget;
private DeploymentTarget(BuilderImpl builder) {
this.deploymentTargetType = builder.deploymentTargetType;
this.instanceTarget = builder.instanceTarget;
this.lambdaTarget = builder.lambdaTarget;
this.ecsTarget = builder.ecsTarget;
}
/**
*
* The deployment type that is specific to the deployment's compute platform.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #deploymentTargetType} will return {@link DeploymentTargetType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #deploymentTargetTypeAsString}.
*
*
* @return The deployment type that is specific to the deployment's compute platform.
* @see DeploymentTargetType
*/
public DeploymentTargetType deploymentTargetType() {
return DeploymentTargetType.fromValue(deploymentTargetType);
}
/**
*
* The deployment type that is specific to the deployment's compute platform.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #deploymentTargetType} will return {@link DeploymentTargetType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #deploymentTargetTypeAsString}.
*
*
* @return The deployment type that is specific to the deployment's compute platform.
* @see DeploymentTargetType
*/
public String deploymentTargetTypeAsString() {
return deploymentTargetType;
}
/**
*
* Information about the target for a deployment that uses the EC2/On-premises compute platform.
*
*
* @return Information about the target for a deployment that uses the EC2/On-premises compute platform.
*/
public InstanceTarget instanceTarget() {
return instanceTarget;
}
/**
*
* Information about the target for a deployment that uses the AWS Lambda compute platform.
*
*
* @return Information about the target for a deployment that uses the AWS Lambda compute platform.
*/
public LambdaTarget lambdaTarget() {
return lambdaTarget;
}
/**
*
* Information about the target for a deployment that uses the Amazon ECS compute platform.
*
*
* @return Information about the target for a deployment that uses the Amazon ECS compute platform.
*/
public ECSTarget ecsTarget() {
return ecsTarget;
}
@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(deploymentTargetTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(instanceTarget());
hashCode = 31 * hashCode + Objects.hashCode(lambdaTarget());
hashCode = 31 * hashCode + Objects.hashCode(ecsTarget());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DeploymentTarget)) {
return false;
}
DeploymentTarget other = (DeploymentTarget) obj;
return Objects.equals(deploymentTargetTypeAsString(), other.deploymentTargetTypeAsString())
&& Objects.equals(instanceTarget(), other.instanceTarget())
&& Objects.equals(lambdaTarget(), other.lambdaTarget()) && Objects.equals(ecsTarget(), other.ecsTarget());
}
/**
* 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("DeploymentTarget").add("DeploymentTargetType", deploymentTargetTypeAsString())
.add("InstanceTarget", instanceTarget()).add("LambdaTarget", lambdaTarget()).add("EcsTarget", ecsTarget())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "deploymentTargetType":
return Optional.ofNullable(clazz.cast(deploymentTargetTypeAsString()));
case "instanceTarget":
return Optional.ofNullable(clazz.cast(instanceTarget()));
case "lambdaTarget":
return Optional.ofNullable(clazz.cast(lambdaTarget()));
case "ecsTarget":
return Optional.ofNullable(clazz.cast(ecsTarget()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function