software.amazon.awssdk.services.connect.model.InstanceSummary Maven / Gradle / Ivy
Show all versions of connect 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.connect.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Information about the instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InstanceSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(InstanceSummary::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(InstanceSummary::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField IDENTITY_MANAGEMENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IdentityManagementType").getter(getter(InstanceSummary::identityManagementTypeAsString))
.setter(setter(Builder::identityManagementType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdentityManagementType").build())
.build();
private static final SdkField INSTANCE_ALIAS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceAlias").getter(getter(InstanceSummary::instanceAlias)).setter(setter(Builder::instanceAlias))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceAlias").build()).build();
private static final SdkField CREATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTime").getter(getter(InstanceSummary::createdTime)).setter(setter(Builder::createdTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime").build()).build();
private static final SdkField SERVICE_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServiceRole").getter(getter(InstanceSummary::serviceRole)).setter(setter(Builder::serviceRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceRole").build()).build();
private static final SdkField INSTANCE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceStatus").getter(getter(InstanceSummary::instanceStatusAsString))
.setter(setter(Builder::instanceStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceStatus").build()).build();
private static final SdkField INBOUND_CALLS_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("InboundCallsEnabled").getter(getter(InstanceSummary::inboundCallsEnabled))
.setter(setter(Builder::inboundCallsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InboundCallsEnabled").build())
.build();
private static final SdkField OUTBOUND_CALLS_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("OutboundCallsEnabled").getter(getter(InstanceSummary::outboundCallsEnabled))
.setter(setter(Builder::outboundCallsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutboundCallsEnabled").build())
.build();
private static final SdkField INSTANCE_ACCESS_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceAccessUrl").getter(getter(InstanceSummary::instanceAccessUrl))
.setter(setter(Builder::instanceAccessUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceAccessUrl").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, ARN_FIELD,
IDENTITY_MANAGEMENT_TYPE_FIELD, INSTANCE_ALIAS_FIELD, CREATED_TIME_FIELD, SERVICE_ROLE_FIELD, INSTANCE_STATUS_FIELD,
INBOUND_CALLS_ENABLED_FIELD, OUTBOUND_CALLS_ENABLED_FIELD, INSTANCE_ACCESS_URL_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String arn;
private final String identityManagementType;
private final String instanceAlias;
private final Instant createdTime;
private final String serviceRole;
private final String instanceStatus;
private final Boolean inboundCallsEnabled;
private final Boolean outboundCallsEnabled;
private final String instanceAccessUrl;
private InstanceSummary(BuilderImpl builder) {
this.id = builder.id;
this.arn = builder.arn;
this.identityManagementType = builder.identityManagementType;
this.instanceAlias = builder.instanceAlias;
this.createdTime = builder.createdTime;
this.serviceRole = builder.serviceRole;
this.instanceStatus = builder.instanceStatus;
this.inboundCallsEnabled = builder.inboundCallsEnabled;
this.outboundCallsEnabled = builder.outboundCallsEnabled;
this.instanceAccessUrl = builder.instanceAccessUrl;
}
/**
*
* The identifier of the instance.
*
*
* @return The identifier of the instance.
*/
public final String id() {
return id;
}
/**
*
* The Amazon Resource Name (ARN) of the instance.
*
*
* @return The Amazon Resource Name (ARN) of the instance.
*/
public final String arn() {
return arn;
}
/**
*
* The identity management type of the instance.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #identityManagementType} will return {@link DirectoryType#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #identityManagementTypeAsString}.
*
*
* @return The identity management type of the instance.
* @see DirectoryType
*/
public final DirectoryType identityManagementType() {
return DirectoryType.fromValue(identityManagementType);
}
/**
*
* The identity management type of the instance.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #identityManagementType} will return {@link DirectoryType#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #identityManagementTypeAsString}.
*
*
* @return The identity management type of the instance.
* @see DirectoryType
*/
public final String identityManagementTypeAsString() {
return identityManagementType;
}
/**
*
* The alias of the instance.
*
*
* @return The alias of the instance.
*/
public final String instanceAlias() {
return instanceAlias;
}
/**
*
* When the instance was created.
*
*
* @return When the instance was created.
*/
public final Instant createdTime() {
return createdTime;
}
/**
*
* The service role of the instance.
*
*
* @return The service role of the instance.
*/
public final String serviceRole() {
return serviceRole;
}
/**
*
* The state of the instance.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceStatus}
* will return {@link InstanceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceStatusAsString}.
*
*
* @return The state of the instance.
* @see InstanceStatus
*/
public final InstanceStatus instanceStatus() {
return InstanceStatus.fromValue(instanceStatus);
}
/**
*
* The state of the instance.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceStatus}
* will return {@link InstanceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceStatusAsString}.
*
*
* @return The state of the instance.
* @see InstanceStatus
*/
public final String instanceStatusAsString() {
return instanceStatus;
}
/**
*
* Whether inbound calls are enabled.
*
*
* @return Whether inbound calls are enabled.
*/
public final Boolean inboundCallsEnabled() {
return inboundCallsEnabled;
}
/**
*
* Whether outbound calls are enabled.
*
*
* @return Whether outbound calls are enabled.
*/
public final Boolean outboundCallsEnabled() {
return outboundCallsEnabled;
}
/**
*
* This URL allows contact center users to access the Amazon Connect admin website.
*
*
* @return This URL allows contact center users to access the Amazon Connect admin website.
*/
public final String instanceAccessUrl() {
return instanceAccessUrl;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(identityManagementTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(instanceAlias());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(serviceRole());
hashCode = 31 * hashCode + Objects.hashCode(instanceStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(inboundCallsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(outboundCallsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(instanceAccessUrl());
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 InstanceSummary)) {
return false;
}
InstanceSummary other = (InstanceSummary) obj;
return Objects.equals(id(), other.id()) && Objects.equals(arn(), other.arn())
&& Objects.equals(identityManagementTypeAsString(), other.identityManagementTypeAsString())
&& Objects.equals(instanceAlias(), other.instanceAlias()) && Objects.equals(createdTime(), other.createdTime())
&& Objects.equals(serviceRole(), other.serviceRole())
&& Objects.equals(instanceStatusAsString(), other.instanceStatusAsString())
&& Objects.equals(inboundCallsEnabled(), other.inboundCallsEnabled())
&& Objects.equals(outboundCallsEnabled(), other.outboundCallsEnabled())
&& Objects.equals(instanceAccessUrl(), other.instanceAccessUrl());
}
/**
* 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("InstanceSummary").add("Id", id()).add("Arn", arn())
.add("IdentityManagementType", identityManagementTypeAsString())
.add("InstanceAlias", instanceAlias() == null ? null : "*** Sensitive Data Redacted ***")
.add("CreatedTime", createdTime()).add("ServiceRole", serviceRole())
.add("InstanceStatus", instanceStatusAsString()).add("InboundCallsEnabled", inboundCallsEnabled())
.add("OutboundCallsEnabled", outboundCallsEnabled()).add("InstanceAccessUrl", instanceAccessUrl()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "IdentityManagementType":
return Optional.ofNullable(clazz.cast(identityManagementTypeAsString()));
case "InstanceAlias":
return Optional.ofNullable(clazz.cast(instanceAlias()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "ServiceRole":
return Optional.ofNullable(clazz.cast(serviceRole()));
case "InstanceStatus":
return Optional.ofNullable(clazz.cast(instanceStatusAsString()));
case "InboundCallsEnabled":
return Optional.ofNullable(clazz.cast(inboundCallsEnabled()));
case "OutboundCallsEnabled":
return Optional.ofNullable(clazz.cast(outboundCallsEnabled()));
case "InstanceAccessUrl":
return Optional.ofNullable(clazz.cast(instanceAccessUrl()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function