software.amazon.awssdk.services.sms.model.Server Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of servermigration Show documentation
Show all versions of servermigration Show documentation
The AWS Java SDK for AWS Server Migration module holds the client classes that are used for
communicating with AWS Server Migration Service
/*
* Copyright 2013-2018 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.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.sms.transform.ServerMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
* Object representing a server
*/
@Generated("software.amazon.awssdk:codegen")
public class Server implements StructuredPojo, ToCopyableBuilder {
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;
}
/**
* Returns the value of the ServerId property for this object.
*
* @return The value of the ServerId property for this object.
*/
public String serverId() {
return serverId;
}
/**
* Returns the value of the ServerType property for this object.
*
* 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 value of the ServerType property for this object.
* @see ServerType
*/
public ServerType serverType() {
return ServerType.fromValue(serverType);
}
/**
* Returns the value of the ServerType property for this object.
*
* 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 value of the ServerType property for this object.
* @see ServerType
*/
public String serverTypeAsString() {
return serverType;
}
/**
* Returns the value of the VmServer property for this object.
*
* @return The value of the VmServer property for this object.
*/
public VmServer vmServer() {
return vmServer;
}
/**
* Returns the value of the ReplicationJobId property for this object.
*
* @return The value of the ReplicationJobId property for this object.
*/
public String replicationJobId() {
return replicationJobId;
}
/**
* Returns the value of the ReplicationJobTerminated property for this object.
*
* @return The value of the ReplicationJobTerminated property for this object.
*/
public 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 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 boolean equals(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());
}
@Override
public String toString() {
return ToString.builder("Server").add("ServerId", serverId()).add("ServerType", serverTypeAsString())
.add("VmServer", vmServer()).add("ReplicationJobId", replicationJobId())
.add("ReplicationJobTerminated", replicationJobTerminated()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "serverId":
return Optional.of(clazz.cast(serverId()));
case "serverType":
return Optional.of(clazz.cast(serverTypeAsString()));
case "vmServer":
return Optional.of(clazz.cast(vmServer()));
case "replicationJobId":
return Optional.of(clazz.cast(replicationJobId()));
case "replicationJobTerminated":
return Optional.of(clazz.cast(replicationJobTerminated()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
ServerMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
* Sets the value of the ServerId property for this object.
*
* @param serverId
* The new value for the ServerId property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serverId(String serverId);
/**
* Sets the value of the ServerType property for this object.
*
* @param serverType
* The new value for the ServerType property for this object.
* @see ServerType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ServerType
*/
Builder serverType(String serverType);
/**
* Sets the value of the ServerType property for this object.
*
* @param serverType
* The new value for the ServerType property for this object.
* @see ServerType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ServerType
*/
Builder serverType(ServerType serverType);
/**
* Sets the value of the VmServer property for this object.
*
* @param vmServer
* The new value for the VmServer property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder vmServer(VmServer vmServer);
/**
* Sets the value of the VmServer property for this object.
*
* This is a convenience that creates an instance of the {@link VmServer.Builder} avoiding the need to create
* one manually via {@link VmServer#builder()}.
*
* When the {@link Consumer} completes, {@link VmServer.Builder#build()} is called immediately and its result is
* passed to {@link #vmServer(VmServer)}.
*
* @param vmServer
* a consumer that will call methods on {@link VmServer.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #vmServer(VmServer)
*/
default Builder vmServer(Consumer vmServer) {
return vmServer(VmServer.builder().apply(vmServer).build());
}
/**
* Sets the value of the ReplicationJobId property for this object.
*
* @param replicationJobId
* The new value for the ReplicationJobId property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationJobId(String replicationJobId);
/**
* Sets the value of the ReplicationJobTerminated property for this object.
*
* @param replicationJobTerminated
* The new value for the ReplicationJobTerminated property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder replicationJobTerminated(Boolean replicationJobTerminated);
}
static final class BuilderImpl implements Builder {
private String serverId;
private String serverType;
private VmServer vmServer;
private String replicationJobId;
private Boolean replicationJobTerminated;
private BuilderImpl() {
}
private BuilderImpl(Server model) {
serverId(model.serverId);
serverType(model.serverType);
vmServer(model.vmServer);
replicationJobId(model.replicationJobId);
replicationJobTerminated(model.replicationJobTerminated);
}
public final String getServerId() {
return serverId;
}
@Override
public final Builder serverId(String serverId) {
this.serverId = serverId;
return this;
}
public final void setServerId(String serverId) {
this.serverId = serverId;
}
public final String getServerType() {
return serverType;
}
@Override
public final Builder serverType(String serverType) {
this.serverType = serverType;
return this;
}
@Override
public final Builder serverType(ServerType serverType) {
this.serverType(serverType.toString());
return this;
}
public final void setServerType(String serverType) {
this.serverType = serverType;
}
public final VmServer.Builder getVmServer() {
return vmServer != null ? vmServer.toBuilder() : null;
}
@Override
public final Builder vmServer(VmServer vmServer) {
this.vmServer = vmServer;
return this;
}
public final void setVmServer(VmServer.BuilderImpl vmServer) {
this.vmServer = vmServer != null ? vmServer.build() : null;
}
public final String getReplicationJobId() {
return replicationJobId;
}
@Override
public final Builder replicationJobId(String replicationJobId) {
this.replicationJobId = replicationJobId;
return this;
}
public final void setReplicationJobId(String replicationJobId) {
this.replicationJobId = replicationJobId;
}
public final Boolean getReplicationJobTerminated() {
return replicationJobTerminated;
}
@Override
public final Builder replicationJobTerminated(Boolean replicationJobTerminated) {
this.replicationJobTerminated = replicationJobTerminated;
return this;
}
public final void setReplicationJobTerminated(Boolean replicationJobTerminated) {
this.replicationJobTerminated = replicationJobTerminated;
}
@Override
public Server build() {
return new Server(this);
}
}
}