software.amazon.awssdk.services.ecs.model.VersionInfo 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.ecs.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;
/**
*
* The Docker and Amazon ECS container agent version information about a container instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class VersionInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField AGENT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("agentVersion").getter(getter(VersionInfo::agentVersion)).setter(setter(Builder::agentVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentVersion").build()).build();
private static final SdkField AGENT_HASH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("agentHash").getter(getter(VersionInfo::agentHash)).setter(setter(Builder::agentHash))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentHash").build()).build();
private static final SdkField DOCKER_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("dockerVersion").getter(getter(VersionInfo::dockerVersion)).setter(setter(Builder::dockerVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dockerVersion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGENT_VERSION_FIELD,
AGENT_HASH_FIELD, DOCKER_VERSION_FIELD));
private static final long serialVersionUID = 1L;
private final String agentVersion;
private final String agentHash;
private final String dockerVersion;
private VersionInfo(BuilderImpl builder) {
this.agentVersion = builder.agentVersion;
this.agentHash = builder.agentHash;
this.dockerVersion = builder.dockerVersion;
}
/**
*
* The version number of the Amazon ECS container agent.
*
*
* @return The version number of the Amazon ECS container agent.
*/
public final String agentVersion() {
return agentVersion;
}
/**
*
* The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
*
*
* @return The Git commit hash for the Amazon ECS container agent build on the amazon-ecs-agent GitHub repository.
*/
public final String agentHash() {
return agentHash;
}
/**
*
* The Docker version running on the container instance.
*
*
* @return The Docker version running on the container instance.
*/
public final String dockerVersion() {
return dockerVersion;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(agentVersion());
hashCode = 31 * hashCode + Objects.hashCode(agentHash());
hashCode = 31 * hashCode + Objects.hashCode(dockerVersion());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof VersionInfo)) {
return false;
}
VersionInfo other = (VersionInfo) obj;
return Objects.equals(agentVersion(), other.agentVersion()) && Objects.equals(agentHash(), other.agentHash())
&& Objects.equals(dockerVersion(), other.dockerVersion());
}
/**
* 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 final String toString() {
return ToString.builder("VersionInfo").add("AgentVersion", agentVersion()).add("AgentHash", agentHash())
.add("DockerVersion", dockerVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "agentVersion":
return Optional.ofNullable(clazz.cast(agentVersion()));
case "agentHash":
return Optional.ofNullable(clazz.cast(agentHash()));
case "dockerVersion":
return Optional.ofNullable(clazz.cast(dockerVersion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy