software.amazon.awssdk.services.sms.model.Connector Maven / Gradle / Ivy
Show all versions of sms 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.sms.model;
import java.beans.Transient;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a connector.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Connector implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CONNECTOR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectorId").getter(getter(Connector::connectorId)).setter(setter(Builder::connectorId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectorId").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("version")
.getter(getter(Connector::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(Connector::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField> CAPABILITY_LIST_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("capabilityList")
.getter(getter(Connector::capabilityListAsStrings))
.setter(setter(Builder::capabilityListWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("capabilityList").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField VM_MANAGER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("vmManagerName").getter(getter(Connector::vmManagerName)).setter(setter(Builder::vmManagerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vmManagerName").build()).build();
private static final SdkField VM_MANAGER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("vmManagerType").getter(getter(Connector::vmManagerTypeAsString)).setter(setter(Builder::vmManagerType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vmManagerType").build()).build();
private static final SdkField VM_MANAGER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("vmManagerId").getter(getter(Connector::vmManagerId)).setter(setter(Builder::vmManagerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vmManagerId").build()).build();
private static final SdkField IP_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ipAddress").getter(getter(Connector::ipAddress)).setter(setter(Builder::ipAddress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ipAddress").build()).build();
private static final SdkField MAC_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("macAddress").getter(getter(Connector::macAddress)).setter(setter(Builder::macAddress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("macAddress").build()).build();
private static final SdkField ASSOCIATED_ON_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("associatedOn").getter(getter(Connector::associatedOn)).setter(setter(Builder::associatedOn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("associatedOn").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONNECTOR_ID_FIELD,
VERSION_FIELD, STATUS_FIELD, CAPABILITY_LIST_FIELD, VM_MANAGER_NAME_FIELD, VM_MANAGER_TYPE_FIELD,
VM_MANAGER_ID_FIELD, IP_ADDRESS_FIELD, MAC_ADDRESS_FIELD, ASSOCIATED_ON_FIELD));
private static final long serialVersionUID = 1L;
private final String connectorId;
private final String version;
private final String status;
private final List capabilityList;
private final String vmManagerName;
private final String vmManagerType;
private final String vmManagerId;
private final String ipAddress;
private final String macAddress;
private final Instant associatedOn;
private Connector(BuilderImpl builder) {
this.connectorId = builder.connectorId;
this.version = builder.version;
this.status = builder.status;
this.capabilityList = builder.capabilityList;
this.vmManagerName = builder.vmManagerName;
this.vmManagerType = builder.vmManagerType;
this.vmManagerId = builder.vmManagerId;
this.ipAddress = builder.ipAddress;
this.macAddress = builder.macAddress;
this.associatedOn = builder.associatedOn;
}
/**
*
* The ID of the connector.
*
*
* @return The ID of the connector.
*/
public final String connectorId() {
return connectorId;
}
/**
*
* The connector version.
*
*
* @return The connector version.
*/
public final String version() {
return version;
}
/**
*
* The status of the connector.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ConnectorStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the connector.
* @see ConnectorStatus
*/
public final ConnectorStatus status() {
return ConnectorStatus.fromValue(status);
}
/**
*
* The status of the connector.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ConnectorStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the connector.
* @see ConnectorStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The capabilities of the connector.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasCapabilityList} method.
*
*
* @return The capabilities of the connector.
*/
public final List capabilityList() {
return ConnectorCapabilityListCopier.copyStringToEnum(capabilityList);
}
/**
* For responses, this returns true if the service returned a value for the CapabilityList property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasCapabilityList() {
return capabilityList != null && !(capabilityList instanceof SdkAutoConstructList);
}
/**
*
* The capabilities of the connector.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasCapabilityList} method.
*
*
* @return The capabilities of the connector.
*/
public final List capabilityListAsStrings() {
return capabilityList;
}
/**
*
* The name of the VM manager.
*
*
* @return The name of the VM manager.
*/
public final String vmManagerName() {
return vmManagerName;
}
/**
*
* The VM management product.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #vmManagerType}
* will return {@link VmManagerType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #vmManagerTypeAsString}.
*
*
* @return The VM management product.
* @see VmManagerType
*/
public final VmManagerType vmManagerType() {
return VmManagerType.fromValue(vmManagerType);
}
/**
*
* The VM management product.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #vmManagerType}
* will return {@link VmManagerType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #vmManagerTypeAsString}.
*
*
* @return The VM management product.
* @see VmManagerType
*/
public final String vmManagerTypeAsString() {
return vmManagerType;
}
/**
*
* The ID of the VM manager.
*
*
* @return The ID of the VM manager.
*/
public final String vmManagerId() {
return vmManagerId;
}
/**
*
* The IP address of the connector.
*
*
* @return The IP address of the connector.
*/
public final String ipAddress() {
return ipAddress;
}
/**
*
* The MAC address of the connector.
*
*
* @return The MAC address of the connector.
*/
public final String macAddress() {
return macAddress;
}
/**
*
* The time the connector was associated.
*
*
* @return The time the connector was associated.
*/
public final Instant associatedOn() {
return associatedOn;
}
@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(connectorId());
hashCode = 31 * hashCode + Objects.hashCode(version());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasCapabilityList() ? capabilityListAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(vmManagerName());
hashCode = 31 * hashCode + Objects.hashCode(vmManagerTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(vmManagerId());
hashCode = 31 * hashCode + Objects.hashCode(ipAddress());
hashCode = 31 * hashCode + Objects.hashCode(macAddress());
hashCode = 31 * hashCode + Objects.hashCode(associatedOn());
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 Connector)) {
return false;
}
Connector other = (Connector) obj;
return Objects.equals(connectorId(), other.connectorId()) && Objects.equals(version(), other.version())
&& Objects.equals(statusAsString(), other.statusAsString()) && hasCapabilityList() == other.hasCapabilityList()
&& Objects.equals(capabilityListAsStrings(), other.capabilityListAsStrings())
&& Objects.equals(vmManagerName(), other.vmManagerName())
&& Objects.equals(vmManagerTypeAsString(), other.vmManagerTypeAsString())
&& Objects.equals(vmManagerId(), other.vmManagerId()) && Objects.equals(ipAddress(), other.ipAddress())
&& Objects.equals(macAddress(), other.macAddress()) && Objects.equals(associatedOn(), other.associatedOn());
}
/**
* 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("Connector").add("ConnectorId", connectorId()).add("Version", version())
.add("Status", statusAsString()).add("CapabilityList", hasCapabilityList() ? capabilityListAsStrings() : null)
.add("VmManagerName", vmManagerName()).add("VmManagerType", vmManagerTypeAsString())
.add("VmManagerId", vmManagerId()).add("IpAddress", ipAddress()).add("MacAddress", macAddress())
.add("AssociatedOn", associatedOn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "connectorId":
return Optional.ofNullable(clazz.cast(connectorId()));
case "version":
return Optional.ofNullable(clazz.cast(version()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "capabilityList":
return Optional.ofNullable(clazz.cast(capabilityListAsStrings()));
case "vmManagerName":
return Optional.ofNullable(clazz.cast(vmManagerName()));
case "vmManagerType":
return Optional.ofNullable(clazz.cast(vmManagerTypeAsString()));
case "vmManagerId":
return Optional.ofNullable(clazz.cast(vmManagerId()));
case "ipAddress":
return Optional.ofNullable(clazz.cast(ipAddress()));
case "macAddress":
return Optional.ofNullable(clazz.cast(macAddress()));
case "associatedOn":
return Optional.ofNullable(clazz.cast(associatedOn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function