software.amazon.awssdk.services.ssmsap.model.Host Maven / Gradle / Ivy
Show all versions of ssmsap Show documentation
/*
* 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.ssmsap.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;
/**
*
* Describes the properties of the Dedicated Host.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Host implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField HOST_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HostName").getter(getter(Host::hostName)).setter(setter(Builder::hostName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostName").build()).build();
private static final SdkField HOST_IP_FIELD = SdkField. builder(MarshallingType.STRING).memberName("HostIp")
.getter(getter(Host::hostIp)).setter(setter(Builder::hostIp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostIp").build()).build();
private static final SdkField EC2_INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EC2InstanceId").getter(getter(Host::ec2InstanceId)).setter(setter(Builder::ec2InstanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EC2InstanceId").build()).build();
private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceId").getter(getter(Host::instanceId)).setter(setter(Builder::instanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceId").build()).build();
private static final SdkField HOST_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HostRole").getter(getter(Host::hostRoleAsString)).setter(setter(Builder::hostRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostRole").build()).build();
private static final SdkField OS_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OsVersion").getter(getter(Host::osVersion)).setter(setter(Builder::osVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OsVersion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HOST_NAME_FIELD,
HOST_IP_FIELD, EC2_INSTANCE_ID_FIELD, INSTANCE_ID_FIELD, HOST_ROLE_FIELD, OS_VERSION_FIELD));
private static final long serialVersionUID = 1L;
private final String hostName;
private final String hostIp;
private final String ec2InstanceId;
private final String instanceId;
private final String hostRole;
private final String osVersion;
private Host(BuilderImpl builder) {
this.hostName = builder.hostName;
this.hostIp = builder.hostIp;
this.ec2InstanceId = builder.ec2InstanceId;
this.instanceId = builder.instanceId;
this.hostRole = builder.hostRole;
this.osVersion = builder.osVersion;
}
/**
*
* The name of the Dedicated Host.
*
*
* @return The name of the Dedicated Host.
*/
public final String hostName() {
return hostName;
}
/**
*
* The IP address of the Dedicated Host.
*
*
* @return The IP address of the Dedicated Host.
*/
public final String hostIp() {
return hostIp;
}
/**
*
* The ID of Amazon EC2 instance.
*
*
* @return The ID of Amazon EC2 instance.
*/
public final String ec2InstanceId() {
return ec2InstanceId;
}
/**
*
* The instance ID of the instance on the Dedicated Host.
*
*
* @return The instance ID of the instance on the Dedicated Host.
*/
public final String instanceId() {
return instanceId;
}
/**
*
* The role of the Dedicated Host.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #hostRole} will
* return {@link HostRole#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #hostRoleAsString}.
*
*
* @return The role of the Dedicated Host.
* @see HostRole
*/
public final HostRole hostRole() {
return HostRole.fromValue(hostRole);
}
/**
*
* The role of the Dedicated Host.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #hostRole} will
* return {@link HostRole#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #hostRoleAsString}.
*
*
* @return The role of the Dedicated Host.
* @see HostRole
*/
public final String hostRoleAsString() {
return hostRole;
}
/**
*
* The version of the operating system.
*
*
* @return The version of the operating system.
*/
public final String osVersion() {
return osVersion;
}
@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(hostName());
hashCode = 31 * hashCode + Objects.hashCode(hostIp());
hashCode = 31 * hashCode + Objects.hashCode(ec2InstanceId());
hashCode = 31 * hashCode + Objects.hashCode(instanceId());
hashCode = 31 * hashCode + Objects.hashCode(hostRoleAsString());
hashCode = 31 * hashCode + Objects.hashCode(osVersion());
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 Host)) {
return false;
}
Host other = (Host) obj;
return Objects.equals(hostName(), other.hostName()) && Objects.equals(hostIp(), other.hostIp())
&& Objects.equals(ec2InstanceId(), other.ec2InstanceId()) && Objects.equals(instanceId(), other.instanceId())
&& Objects.equals(hostRoleAsString(), other.hostRoleAsString()) && Objects.equals(osVersion(), other.osVersion());
}
/**
* 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("Host").add("HostName", hostName()).add("HostIp", hostIp()).add("EC2InstanceId", ec2InstanceId())
.add("InstanceId", instanceId()).add("HostRole", hostRoleAsString()).add("OsVersion", osVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "HostName":
return Optional.ofNullable(clazz.cast(hostName()));
case "HostIp":
return Optional.ofNullable(clazz.cast(hostIp()));
case "EC2InstanceId":
return Optional.ofNullable(clazz.cast(ec2InstanceId()));
case "InstanceId":
return Optional.ofNullable(clazz.cast(instanceId()));
case "HostRole":
return Optional.ofNullable(clazz.cast(hostRoleAsString()));
case "OsVersion":
return Optional.ofNullable(clazz.cast(osVersion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function