software.amazon.awssdk.services.chime.model.ProxySession 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.chime.model;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.traits.TimestampFormatTrait;
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;
/**
*
* The proxy session for an Amazon Chime Voice Connector.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ProxySession implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField VOICE_CONNECTOR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VoiceConnectorId").getter(getter(ProxySession::voiceConnectorId))
.setter(setter(Builder::voiceConnectorId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VoiceConnectorId").build()).build();
private static final SdkField PROXY_SESSION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProxySessionId").getter(getter(ProxySession::proxySessionId)).setter(setter(Builder::proxySessionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProxySessionId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ProxySession::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ProxySession::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField EXPIRY_MINUTES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ExpiryMinutes").getter(getter(ProxySession::expiryMinutes)).setter(setter(Builder::expiryMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpiryMinutes").build()).build();
private static final SdkField> CAPABILITIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Capabilities")
.getter(getter(ProxySession::capabilitiesAsStrings))
.setter(setter(Builder::capabilitiesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Capabilities").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 CREATED_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("CreatedTimestamp")
.getter(getter(ProxySession::createdTimestamp))
.setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField UPDATED_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("UpdatedTimestamp")
.getter(getter(ProxySession::updatedTimestamp))
.setter(setter(Builder::updatedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedTimestamp").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField ENDED_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("EndedTimestamp")
.getter(getter(ProxySession::endedTimestamp))
.setter(setter(Builder::endedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndedTimestamp").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField> PARTICIPANTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Participants")
.getter(getter(ProxySession::participants))
.setter(setter(Builder::participants))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Participants").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Participant::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField NUMBER_SELECTION_BEHAVIOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NumberSelectionBehavior").getter(getter(ProxySession::numberSelectionBehaviorAsString))
.setter(setter(Builder::numberSelectionBehavior))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NumberSelectionBehavior").build())
.build();
private static final SdkField GEO_MATCH_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GeoMatchLevel").getter(getter(ProxySession::geoMatchLevelAsString))
.setter(setter(Builder::geoMatchLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeoMatchLevel").build()).build();
private static final SdkField GEO_MATCH_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("GeoMatchParams")
.getter(getter(ProxySession::geoMatchParams)).setter(setter(Builder::geoMatchParams))
.constructor(GeoMatchParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeoMatchParams").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(VOICE_CONNECTOR_ID_FIELD,
PROXY_SESSION_ID_FIELD, NAME_FIELD, STATUS_FIELD, EXPIRY_MINUTES_FIELD, CAPABILITIES_FIELD, CREATED_TIMESTAMP_FIELD,
UPDATED_TIMESTAMP_FIELD, ENDED_TIMESTAMP_FIELD, PARTICIPANTS_FIELD, NUMBER_SELECTION_BEHAVIOR_FIELD,
GEO_MATCH_LEVEL_FIELD, GEO_MATCH_PARAMS_FIELD));
private static final long serialVersionUID = 1L;
private final String voiceConnectorId;
private final String proxySessionId;
private final String name;
private final String status;
private final Integer expiryMinutes;
private final List capabilities;
private final Instant createdTimestamp;
private final Instant updatedTimestamp;
private final Instant endedTimestamp;
private final List participants;
private final String numberSelectionBehavior;
private final String geoMatchLevel;
private final GeoMatchParams geoMatchParams;
private ProxySession(BuilderImpl builder) {
this.voiceConnectorId = builder.voiceConnectorId;
this.proxySessionId = builder.proxySessionId;
this.name = builder.name;
this.status = builder.status;
this.expiryMinutes = builder.expiryMinutes;
this.capabilities = builder.capabilities;
this.createdTimestamp = builder.createdTimestamp;
this.updatedTimestamp = builder.updatedTimestamp;
this.endedTimestamp = builder.endedTimestamp;
this.participants = builder.participants;
this.numberSelectionBehavior = builder.numberSelectionBehavior;
this.geoMatchLevel = builder.geoMatchLevel;
this.geoMatchParams = builder.geoMatchParams;
}
/**
*
* The Amazon Chime voice connector ID.
*
*
* @return The Amazon Chime voice connector ID.
*/
public final String voiceConnectorId() {
return voiceConnectorId;
}
/**
*
* The proxy session ID.
*
*
* @return The proxy session ID.
*/
public final String proxySessionId() {
return proxySessionId;
}
/**
*
* The name of the proxy session.
*
*
* @return The name of the proxy session.
*/
public final String name() {
return name;
}
/**
*
* The status of the proxy session.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ProxySessionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the proxy session.
* @see ProxySessionStatus
*/
public final ProxySessionStatus status() {
return ProxySessionStatus.fromValue(status);
}
/**
*
* The status of the proxy session.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ProxySessionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the proxy session.
* @see ProxySessionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The number of minutes allowed for the proxy session.
*
*
* @return The number of minutes allowed for the proxy session.
*/
public final Integer expiryMinutes() {
return expiryMinutes;
}
/**
*
* The proxy session capabilities.
*
*
* 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 #hasCapabilities} method.
*
*
* @return The proxy session capabilities.
*/
public final List capabilities() {
return CapabilityListCopier.copyStringToEnum(capabilities);
}
/**
* For responses, this returns true if the service returned a value for the Capabilities 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 hasCapabilities() {
return capabilities != null && !(capabilities instanceof SdkAutoConstructList);
}
/**
*
* The proxy session capabilities.
*
*
* 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 #hasCapabilities} method.
*
*
* @return The proxy session capabilities.
*/
public final List capabilitiesAsStrings() {
return capabilities;
}
/**
*
* The created time stamp, in ISO 8601 format.
*
*
* @return The created time stamp, in ISO 8601 format.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The updated time stamp, in ISO 8601 format.
*
*
* @return The updated time stamp, in ISO 8601 format.
*/
public final Instant updatedTimestamp() {
return updatedTimestamp;
}
/**
*
* The ended time stamp, in ISO 8601 format.
*
*
* @return The ended time stamp, in ISO 8601 format.
*/
public final Instant endedTimestamp() {
return endedTimestamp;
}
/**
* For responses, this returns true if the service returned a value for the Participants 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 hasParticipants() {
return participants != null && !(participants instanceof SdkAutoConstructList);
}
/**
*
* The proxy session participants.
*
*
* 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 #hasParticipants} method.
*
*
* @return The proxy session participants.
*/
public final List participants() {
return participants;
}
/**
*
* The preference for proxy phone number reuse, or stickiness, between the same participants across sessions.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #numberSelectionBehavior} will return {@link NumberSelectionBehavior#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #numberSelectionBehaviorAsString}.
*
*
* @return The preference for proxy phone number reuse, or stickiness, between the same participants across
* sessions.
* @see NumberSelectionBehavior
*/
public final NumberSelectionBehavior numberSelectionBehavior() {
return NumberSelectionBehavior.fromValue(numberSelectionBehavior);
}
/**
*
* The preference for proxy phone number reuse, or stickiness, between the same participants across sessions.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #numberSelectionBehavior} will return {@link NumberSelectionBehavior#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #numberSelectionBehaviorAsString}.
*
*
* @return The preference for proxy phone number reuse, or stickiness, between the same participants across
* sessions.
* @see NumberSelectionBehavior
*/
public final String numberSelectionBehaviorAsString() {
return numberSelectionBehavior;
}
/**
*
* The preference for matching the country or area code of the proxy phone number with that of the first
* participant.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #geoMatchLevel}
* will return {@link GeoMatchLevel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #geoMatchLevelAsString}.
*
*
* @return The preference for matching the country or area code of the proxy phone number with that of the first
* participant.
* @see GeoMatchLevel
*/
public final GeoMatchLevel geoMatchLevel() {
return GeoMatchLevel.fromValue(geoMatchLevel);
}
/**
*
* The preference for matching the country or area code of the proxy phone number with that of the first
* participant.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #geoMatchLevel}
* will return {@link GeoMatchLevel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #geoMatchLevelAsString}.
*
*
* @return The preference for matching the country or area code of the proxy phone number with that of the first
* participant.
* @see GeoMatchLevel
*/
public final String geoMatchLevelAsString() {
return geoMatchLevel;
}
/**
*
* The country and area code for the proxy phone number.
*
*
* @return The country and area code for the proxy phone number.
*/
public final GeoMatchParams geoMatchParams() {
return geoMatchParams;
}
@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(voiceConnectorId());
hashCode = 31 * hashCode + Objects.hashCode(proxySessionId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(expiryMinutes());
hashCode = 31 * hashCode + Objects.hashCode(hasCapabilities() ? capabilitiesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(updatedTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(endedTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(hasParticipants() ? participants() : null);
hashCode = 31 * hashCode + Objects.hashCode(numberSelectionBehaviorAsString());
hashCode = 31 * hashCode + Objects.hashCode(geoMatchLevelAsString());
hashCode = 31 * hashCode + Objects.hashCode(geoMatchParams());
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 ProxySession)) {
return false;
}
ProxySession other = (ProxySession) obj;
return Objects.equals(voiceConnectorId(), other.voiceConnectorId())
&& Objects.equals(proxySessionId(), other.proxySessionId()) && Objects.equals(name(), other.name())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(expiryMinutes(), other.expiryMinutes()) && hasCapabilities() == other.hasCapabilities()
&& Objects.equals(capabilitiesAsStrings(), other.capabilitiesAsStrings())
&& Objects.equals(createdTimestamp(), other.createdTimestamp())
&& Objects.equals(updatedTimestamp(), other.updatedTimestamp())
&& Objects.equals(endedTimestamp(), other.endedTimestamp()) && hasParticipants() == other.hasParticipants()
&& Objects.equals(participants(), other.participants())
&& Objects.equals(numberSelectionBehaviorAsString(), other.numberSelectionBehaviorAsString())
&& Objects.equals(geoMatchLevelAsString(), other.geoMatchLevelAsString())
&& Objects.equals(geoMatchParams(), other.geoMatchParams());
}
/**
* 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("ProxySession").add("VoiceConnectorId", voiceConnectorId())
.add("ProxySessionId", proxySessionId()).add("Name", name()).add("Status", statusAsString())
.add("ExpiryMinutes", expiryMinutes()).add("Capabilities", hasCapabilities() ? capabilitiesAsStrings() : null)
.add("CreatedTimestamp", createdTimestamp()).add("UpdatedTimestamp", updatedTimestamp())
.add("EndedTimestamp", endedTimestamp()).add("Participants", hasParticipants() ? participants() : null)
.add("NumberSelectionBehavior", numberSelectionBehaviorAsString()).add("GeoMatchLevel", geoMatchLevelAsString())
.add("GeoMatchParams", geoMatchParams()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "VoiceConnectorId":
return Optional.ofNullable(clazz.cast(voiceConnectorId()));
case "ProxySessionId":
return Optional.ofNullable(clazz.cast(proxySessionId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "ExpiryMinutes":
return Optional.ofNullable(clazz.cast(expiryMinutes()));
case "Capabilities":
return Optional.ofNullable(clazz.cast(capabilitiesAsStrings()));
case "CreatedTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "UpdatedTimestamp":
return Optional.ofNullable(clazz.cast(updatedTimestamp()));
case "EndedTimestamp":
return Optional.ofNullable(clazz.cast(endedTimestamp()));
case "Participants":
return Optional.ofNullable(clazz.cast(participants()));
case "NumberSelectionBehavior":
return Optional.ofNullable(clazz.cast(numberSelectionBehaviorAsString()));
case "GeoMatchLevel":
return Optional.ofNullable(clazz.cast(geoMatchLevelAsString()));
case "GeoMatchParams":
return Optional.ofNullable(clazz.cast(geoMatchParams()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function