
software.amazon.awssdk.services.codedeploy.model.DeploymentConfigInfo 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.time.Instant;
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 a deployment configuration.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeploymentConfigInfo implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DEPLOYMENT_CONFIG_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentConfigId").getter(getter(DeploymentConfigInfo::deploymentConfigId))
.setter(setter(Builder::deploymentConfigId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentConfigId").build())
.build();
private static final SdkField DEPLOYMENT_CONFIG_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentConfigName").getter(getter(DeploymentConfigInfo::deploymentConfigName))
.setter(setter(Builder::deploymentConfigName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentConfigName").build())
.build();
private static final SdkField MINIMUM_HEALTHY_HOSTS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("minimumHealthyHosts")
.getter(getter(DeploymentConfigInfo::minimumHealthyHosts)).setter(setter(Builder::minimumHealthyHosts))
.constructor(MinimumHealthyHosts::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minimumHealthyHosts").build())
.build();
private static final SdkField CREATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createTime").getter(getter(DeploymentConfigInfo::createTime)).setter(setter(Builder::createTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createTime").build()).build();
private static final SdkField COMPUTE_PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("computePlatform").getter(getter(DeploymentConfigInfo::computePlatformAsString))
.setter(setter(Builder::computePlatform))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("computePlatform").build()).build();
private static final SdkField TRAFFIC_ROUTING_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("trafficRoutingConfig")
.getter(getter(DeploymentConfigInfo::trafficRoutingConfig)).setter(setter(Builder::trafficRoutingConfig))
.constructor(TrafficRoutingConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("trafficRoutingConfig").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEPLOYMENT_CONFIG_ID_FIELD,
DEPLOYMENT_CONFIG_NAME_FIELD, MINIMUM_HEALTHY_HOSTS_FIELD, CREATE_TIME_FIELD, COMPUTE_PLATFORM_FIELD,
TRAFFIC_ROUTING_CONFIG_FIELD));
private static final long serialVersionUID = 1L;
private final String deploymentConfigId;
private final String deploymentConfigName;
private final MinimumHealthyHosts minimumHealthyHosts;
private final Instant createTime;
private final String computePlatform;
private final TrafficRoutingConfig trafficRoutingConfig;
private DeploymentConfigInfo(BuilderImpl builder) {
this.deploymentConfigId = builder.deploymentConfigId;
this.deploymentConfigName = builder.deploymentConfigName;
this.minimumHealthyHosts = builder.minimumHealthyHosts;
this.createTime = builder.createTime;
this.computePlatform = builder.computePlatform;
this.trafficRoutingConfig = builder.trafficRoutingConfig;
}
/**
*
* The deployment configuration ID.
*
*
* @return The deployment configuration ID.
*/
public String deploymentConfigId() {
return deploymentConfigId;
}
/**
*
* The deployment configuration name.
*
*
* @return The deployment configuration name.
*/
public String deploymentConfigName() {
return deploymentConfigName;
}
/**
*
* Information about the number or percentage of minimum healthy instance.
*
*
* @return Information about the number or percentage of minimum healthy instance.
*/
public MinimumHealthyHosts minimumHealthyHosts() {
return minimumHealthyHosts;
}
/**
*
* The time at which the deployment configuration was created.
*
*
* @return The time at which the deployment configuration was created.
*/
public Instant createTime() {
return createTime;
}
/**
*
* The destination platform type for the deployment (Lambda
, Server
, or ECS
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #computePlatform}
* will return {@link ComputePlatform#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #computePlatformAsString}.
*
*
* @return The destination platform type for the deployment (Lambda
, Server
, or
* ECS
).
* @see ComputePlatform
*/
public ComputePlatform computePlatform() {
return ComputePlatform.fromValue(computePlatform);
}
/**
*
* The destination platform type for the deployment (Lambda
, Server
, or ECS
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #computePlatform}
* will return {@link ComputePlatform#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #computePlatformAsString}.
*
*
* @return The destination platform type for the deployment (Lambda
, Server
, or
* ECS
).
* @see ComputePlatform
*/
public String computePlatformAsString() {
return computePlatform;
}
/**
*
* The configuration that specifies how the deployment traffic is routed. Used for deployments with a Lambda or ECS
* compute platform only.
*
*
* @return The configuration that specifies how the deployment traffic is routed. Used for deployments with a Lambda
* or ECS compute platform only.
*/
public TrafficRoutingConfig trafficRoutingConfig() {
return trafficRoutingConfig;
}
@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(deploymentConfigId());
hashCode = 31 * hashCode + Objects.hashCode(deploymentConfigName());
hashCode = 31 * hashCode + Objects.hashCode(minimumHealthyHosts());
hashCode = 31 * hashCode + Objects.hashCode(createTime());
hashCode = 31 * hashCode + Objects.hashCode(computePlatformAsString());
hashCode = 31 * hashCode + Objects.hashCode(trafficRoutingConfig());
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 DeploymentConfigInfo)) {
return false;
}
DeploymentConfigInfo other = (DeploymentConfigInfo) obj;
return Objects.equals(deploymentConfigId(), other.deploymentConfigId())
&& Objects.equals(deploymentConfigName(), other.deploymentConfigName())
&& Objects.equals(minimumHealthyHosts(), other.minimumHealthyHosts())
&& Objects.equals(createTime(), other.createTime())
&& Objects.equals(computePlatformAsString(), other.computePlatformAsString())
&& Objects.equals(trafficRoutingConfig(), other.trafficRoutingConfig());
}
/**
* 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("DeploymentConfigInfo").add("DeploymentConfigId", deploymentConfigId())
.add("DeploymentConfigName", deploymentConfigName()).add("MinimumHealthyHosts", minimumHealthyHosts())
.add("CreateTime", createTime()).add("ComputePlatform", computePlatformAsString())
.add("TrafficRoutingConfig", trafficRoutingConfig()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "deploymentConfigId":
return Optional.ofNullable(clazz.cast(deploymentConfigId()));
case "deploymentConfigName":
return Optional.ofNullable(clazz.cast(deploymentConfigName()));
case "minimumHealthyHosts":
return Optional.ofNullable(clazz.cast(minimumHealthyHosts()));
case "createTime":
return Optional.ofNullable(clazz.cast(createTime()));
case "computePlatform":
return Optional.ofNullable(clazz.cast(computePlatformAsString()));
case "trafficRoutingConfig":
return Optional.ofNullable(clazz.cast(trafficRoutingConfig()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function