
software.amazon.awssdk.services.backupgateway.model.Hypervisor 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.backupgateway.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;
/**
*
* Represents the hypervisor's permissions to which the gateway will connect.
*
*
* A hypervisor is hardware, software, or firmware that creates and manages virtual machines, and allocates resources to
* them.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Hypervisor implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField HOST_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Host")
.getter(getter(Hypervisor::host)).setter(setter(Builder::host))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Host").build()).build();
private static final SdkField HYPERVISOR_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HypervisorArn").getter(getter(Hypervisor::hypervisorArn)).setter(setter(Builder::hypervisorArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HypervisorArn").build()).build();
private static final SdkField KMS_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyArn").getter(getter(Hypervisor::kmsKeyArn)).setter(setter(Builder::kmsKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyArn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(Hypervisor::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(Hypervisor::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HOST_FIELD,
HYPERVISOR_ARN_FIELD, KMS_KEY_ARN_FIELD, NAME_FIELD, STATE_FIELD));
private static final long serialVersionUID = 1L;
private final String host;
private final String hypervisorArn;
private final String kmsKeyArn;
private final String name;
private final String state;
private Hypervisor(BuilderImpl builder) {
this.host = builder.host;
this.hypervisorArn = builder.hypervisorArn;
this.kmsKeyArn = builder.kmsKeyArn;
this.name = builder.name;
this.state = builder.state;
}
/**
*
* The server host of the hypervisor. This can be either an IP address or a fully-qualified domain name (FQDN).
*
*
* @return The server host of the hypervisor. This can be either an IP address or a fully-qualified domain name
* (FQDN).
*/
public final String host() {
return host;
}
/**
*
* The Amazon Resource Name (ARN) of the hypervisor.
*
*
* @return The Amazon Resource Name (ARN) of the hypervisor.
*/
public final String hypervisorArn() {
return hypervisorArn;
}
/**
*
* The Amazon Resource Name (ARN) of the Key Management Service used to encrypt the hypervisor.
*
*
* @return The Amazon Resource Name (ARN) of the Key Management Service used to encrypt the hypervisor.
*/
public final String kmsKeyArn() {
return kmsKeyArn;
}
/**
*
* The name of the hypervisor.
*
*
* @return The name of the hypervisor.
*/
public final String name() {
return name;
}
/**
*
* The state of the hypervisor.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link HypervisorState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the hypervisor.
* @see HypervisorState
*/
public final HypervisorState state() {
return HypervisorState.fromValue(state);
}
/**
*
* The state of the hypervisor.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link HypervisorState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the hypervisor.
* @see HypervisorState
*/
public final String stateAsString() {
return state;
}
@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(host());
hashCode = 31 * hashCode + Objects.hashCode(hypervisorArn());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyArn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
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 Hypervisor)) {
return false;
}
Hypervisor other = (Hypervisor) obj;
return Objects.equals(host(), other.host()) && Objects.equals(hypervisorArn(), other.hypervisorArn())
&& Objects.equals(kmsKeyArn(), other.kmsKeyArn()) && Objects.equals(name(), other.name())
&& Objects.equals(stateAsString(), other.stateAsString());
}
/**
* 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("Hypervisor").add("Host", host()).add("HypervisorArn", hypervisorArn())
.add("KmsKeyArn", kmsKeyArn()).add("Name", name()).add("State", stateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Host":
return Optional.ofNullable(clazz.cast(host()));
case "HypervisorArn":
return Optional.ofNullable(clazz.cast(hypervisorArn()));
case "KmsKeyArn":
return Optional.ofNullable(clazz.cast(kmsKeyArn()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function