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

software.amazon.awssdk.services.codedeploy.model.DeploymentTarget Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS CodeDeploy module holds the client classes that are used for communicating with AWS CodeDeploy Service

There is a newer version: 2.30.1
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((DeploymentTarget) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The deployment type that is specific to the deployment's compute platform. *

* * @param deploymentTargetType * The deployment type that is specific to the deployment's compute platform. * @see DeploymentTargetType * @return Returns a reference to this object so that method calls can be chained together. * @see DeploymentTargetType */ Builder deploymentTargetType(String deploymentTargetType); /** *

* The deployment type that is specific to the deployment's compute platform. *

* * @param deploymentTargetType * The deployment type that is specific to the deployment's compute platform. * @see DeploymentTargetType * @return Returns a reference to this object so that method calls can be chained together. * @see DeploymentTargetType */ Builder deploymentTargetType(DeploymentTargetType deploymentTargetType); /** *

* Information about the target for a deployment that uses the EC2/On-premises compute platform. *

* * @param instanceTarget * Information about the target for a deployment that uses the EC2/On-premises compute platform. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceTarget(InstanceTarget instanceTarget); /** *

* Information about the target for a deployment that uses the EC2/On-premises compute platform. *

* This is a convenience that creates an instance of the {@link InstanceTarget.Builder} avoiding the need to * create one manually via {@link InstanceTarget#builder()}. * * When the {@link Consumer} completes, {@link InstanceTarget.Builder#build()} is called immediately and its * result is passed to {@link #instanceTarget(InstanceTarget)}. * * @param instanceTarget * a consumer that will call methods on {@link InstanceTarget.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #instanceTarget(InstanceTarget) */ default Builder instanceTarget(Consumer instanceTarget) { return instanceTarget(InstanceTarget.builder().applyMutation(instanceTarget).build()); } /** *

* Information about the target for a deployment that uses the AWS Lambda compute platform. *

* * @param lambdaTarget * Information about the target for a deployment that uses the AWS Lambda compute platform. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lambdaTarget(LambdaTarget lambdaTarget); /** *

* Information about the target for a deployment that uses the AWS Lambda compute platform. *

* This is a convenience that creates an instance of the {@link LambdaTarget.Builder} avoiding the need to * create one manually via {@link LambdaTarget#builder()}. * * When the {@link Consumer} completes, {@link LambdaTarget.Builder#build()} is called immediately and its * result is passed to {@link #lambdaTarget(LambdaTarget)}. * * @param lambdaTarget * a consumer that will call methods on {@link LambdaTarget.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #lambdaTarget(LambdaTarget) */ default Builder lambdaTarget(Consumer lambdaTarget) { return lambdaTarget(LambdaTarget.builder().applyMutation(lambdaTarget).build()); } /** *

* Information about the target for a deployment that uses the Amazon ECS compute platform. *

* * @param ecsTarget * Information about the target for a deployment that uses the Amazon ECS compute platform. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ecsTarget(ECSTarget ecsTarget); /** *

* Information about the target for a deployment that uses the Amazon ECS compute platform. *

* This is a convenience that creates an instance of the {@link ECSTarget.Builder} avoiding the need to create * one manually via {@link ECSTarget#builder()}. * * When the {@link Consumer} completes, {@link ECSTarget.Builder#build()} is called immediately and its result * is passed to {@link #ecsTarget(ECSTarget)}. * * @param ecsTarget * a consumer that will call methods on {@link ECSTarget.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #ecsTarget(ECSTarget) */ default Builder ecsTarget(Consumer ecsTarget) { return ecsTarget(ECSTarget.builder().applyMutation(ecsTarget).build()); } } static final class BuilderImpl implements Builder { private String deploymentTargetType; private InstanceTarget instanceTarget; private LambdaTarget lambdaTarget; private ECSTarget ecsTarget; private BuilderImpl() { } private BuilderImpl(DeploymentTarget model) { deploymentTargetType(model.deploymentTargetType); instanceTarget(model.instanceTarget); lambdaTarget(model.lambdaTarget); ecsTarget(model.ecsTarget); } public final String getDeploymentTargetTypeAsString() { return deploymentTargetType; } @Override public final Builder deploymentTargetType(String deploymentTargetType) { this.deploymentTargetType = deploymentTargetType; return this; } @Override public final Builder deploymentTargetType(DeploymentTargetType deploymentTargetType) { this.deploymentTargetType(deploymentTargetType.toString()); return this; } public final void setDeploymentTargetType(String deploymentTargetType) { this.deploymentTargetType = deploymentTargetType; } public final InstanceTarget.Builder getInstanceTarget() { return instanceTarget != null ? instanceTarget.toBuilder() : null; } @Override public final Builder instanceTarget(InstanceTarget instanceTarget) { this.instanceTarget = instanceTarget; return this; } public final void setInstanceTarget(InstanceTarget.BuilderImpl instanceTarget) { this.instanceTarget = instanceTarget != null ? instanceTarget.build() : null; } public final LambdaTarget.Builder getLambdaTarget() { return lambdaTarget != null ? lambdaTarget.toBuilder() : null; } @Override public final Builder lambdaTarget(LambdaTarget lambdaTarget) { this.lambdaTarget = lambdaTarget; return this; } public final void setLambdaTarget(LambdaTarget.BuilderImpl lambdaTarget) { this.lambdaTarget = lambdaTarget != null ? lambdaTarget.build() : null; } public final ECSTarget.Builder getEcsTarget() { return ecsTarget != null ? ecsTarget.toBuilder() : null; } @Override public final Builder ecsTarget(ECSTarget ecsTarget) { this.ecsTarget = ecsTarget; return this; } public final void setEcsTarget(ECSTarget.BuilderImpl ecsTarget) { this.ecsTarget = ecsTarget != null ? ecsTarget.build() : null; } @Override public DeploymentTarget build() { return new DeploymentTarget(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy