software.amazon.awssdk.services.sms.model.Server 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.sms.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;
/**
*
* Represents a server.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Server implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SERVER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serverId").getter(getter(Server::serverId)).setter(setter(Builder::serverId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverId").build()).build();
private static final SdkField SERVER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serverType").getter(getter(Server::serverTypeAsString)).setter(setter(Builder::serverType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverType").build()).build();
private static final SdkField VM_SERVER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("vmServer").getter(getter(Server::vmServer)).setter(setter(Builder::vmServer))
.constructor(VmServer::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vmServer").build()).build();
private static final SdkField REPLICATION_JOB_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("replicationJobId").getter(getter(Server::replicationJobId)).setter(setter(Builder::replicationJobId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("replicationJobId").build()).build();
private static final SdkField REPLICATION_JOB_TERMINATED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("replicationJobTerminated").getter(getter(Server::replicationJobTerminated))
.setter(setter(Builder::replicationJobTerminated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("replicationJobTerminated").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVER_ID_FIELD,
SERVER_TYPE_FIELD, VM_SERVER_FIELD, REPLICATION_JOB_ID_FIELD, REPLICATION_JOB_TERMINATED_FIELD));
private static final long serialVersionUID = 1L;
private final String serverId;
private final String serverType;
private final VmServer vmServer;
private final String replicationJobId;
private final Boolean replicationJobTerminated;
private Server(BuilderImpl builder) {
this.serverId = builder.serverId;
this.serverType = builder.serverType;
this.vmServer = builder.vmServer;
this.replicationJobId = builder.replicationJobId;
this.replicationJobTerminated = builder.replicationJobTerminated;
}
/**
*
* The ID of the server.
*
*
* @return The ID of the server.
*/
public final String serverId() {
return serverId;
}
/**
*
* The type of server.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #serverType} will
* return {@link ServerType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #serverTypeAsString}.
*
*
* @return The type of server.
* @see ServerType
*/
public final ServerType serverType() {
return ServerType.fromValue(serverType);
}
/**
*
* The type of server.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #serverType} will
* return {@link ServerType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #serverTypeAsString}.
*
*
* @return The type of server.
* @see ServerType
*/
public final String serverTypeAsString() {
return serverType;
}
/**
*
* Information about the VM server.
*
*
* @return Information about the VM server.
*/
public final VmServer vmServer() {
return vmServer;
}
/**
*
* The ID of the replication job.
*
*
* @return The ID of the replication job.
*/
public final String replicationJobId() {
return replicationJobId;
}
/**
*
* Indicates whether the replication job is deleted or failed.
*
*
* @return Indicates whether the replication job is deleted or failed.
*/
public final Boolean replicationJobTerminated() {
return replicationJobTerminated;
}
@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(serverId());
hashCode = 31 * hashCode + Objects.hashCode(serverTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(vmServer());
hashCode = 31 * hashCode + Objects.hashCode(replicationJobId());
hashCode = 31 * hashCode + Objects.hashCode(replicationJobTerminated());
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 Server)) {
return false;
}
Server other = (Server) obj;
return Objects.equals(serverId(), other.serverId()) && Objects.equals(serverTypeAsString(), other.serverTypeAsString())
&& Objects.equals(vmServer(), other.vmServer()) && Objects.equals(replicationJobId(), other.replicationJobId())
&& Objects.equals(replicationJobTerminated(), other.replicationJobTerminated());
}
/**
* 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("Server").add("ServerId", serverId()).add("ServerType", serverTypeAsString())
.add("VmServer", vmServer()).add("ReplicationJobId", replicationJobId())
.add("ReplicationJobTerminated", replicationJobTerminated()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "serverId":
return Optional.ofNullable(clazz.cast(serverId()));
case "serverType":
return Optional.ofNullable(clazz.cast(serverTypeAsString()));
case "vmServer":
return Optional.ofNullable(clazz.cast(vmServer()));
case "replicationJobId":
return Optional.ofNullable(clazz.cast(replicationJobId()));
case "replicationJobTerminated":
return Optional.ofNullable(clazz.cast(replicationJobTerminated()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function