software.amazon.awssdk.services.alexaforbusiness.model.CreateContactRequest Maven / Gradle / Ivy
Show all versions of alexaforbusiness 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.alexaforbusiness.model;
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.awscore.AwsRequestOverrideConfiguration;
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.DefaultValueTrait;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateContactRequest extends AlexaForBusinessRequest implements
ToCopyableBuilder {
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DisplayName").getter(getter(CreateContactRequest::displayName)).setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisplayName").build()).build();
private static final SdkField FIRST_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FirstName").getter(getter(CreateContactRequest::firstName)).setter(setter(Builder::firstName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FirstName").build()).build();
private static final SdkField LAST_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastName").getter(getter(CreateContactRequest::lastName)).setter(setter(Builder::lastName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastName").build()).build();
private static final SdkField PHONE_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PhoneNumber").getter(getter(CreateContactRequest::phoneNumber)).setter(setter(Builder::phoneNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhoneNumber").build()).build();
private static final SdkField> PHONE_NUMBERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("PhoneNumbers")
.getter(getter(CreateContactRequest::phoneNumbers))
.setter(setter(Builder::phoneNumbers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhoneNumbers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(PhoneNumber::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> SIP_ADDRESSES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SipAddresses")
.getter(getter(CreateContactRequest::sipAddresses))
.setter(setter(Builder::sipAddresses))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SipAddresses").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(SipAddress::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ClientRequestToken")
.getter(getter(CreateContactRequest::clientRequestToken))
.setter(setter(Builder::clientRequestToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientRequestToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateContactRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DISPLAY_NAME_FIELD,
FIRST_NAME_FIELD, LAST_NAME_FIELD, PHONE_NUMBER_FIELD, PHONE_NUMBERS_FIELD, SIP_ADDRESSES_FIELD,
CLIENT_REQUEST_TOKEN_FIELD, TAGS_FIELD));
private final String displayName;
private final String firstName;
private final String lastName;
private final String phoneNumber;
private final List phoneNumbers;
private final List sipAddresses;
private final String clientRequestToken;
private final List tags;
private CreateContactRequest(BuilderImpl builder) {
super(builder);
this.displayName = builder.displayName;
this.firstName = builder.firstName;
this.lastName = builder.lastName;
this.phoneNumber = builder.phoneNumber;
this.phoneNumbers = builder.phoneNumbers;
this.sipAddresses = builder.sipAddresses;
this.clientRequestToken = builder.clientRequestToken;
this.tags = builder.tags;
}
/**
*
* The name of the contact to display on the console.
*
*
* @return The name of the contact to display on the console.
*/
public final String displayName() {
return displayName;
}
/**
*
* The first name of the contact that is used to call the contact on the device.
*
*
* @return The first name of the contact that is used to call the contact on the device.
*/
public final String firstName() {
return firstName;
}
/**
*
* The last name of the contact that is used to call the contact on the device.
*
*
* @return The last name of the contact that is used to call the contact on the device.
*/
public final String lastName() {
return lastName;
}
/**
*
* The phone number of the contact in E.164 format. The phone number type defaults to WORK. You can specify
* PhoneNumber or PhoneNumbers. We recommend that you use PhoneNumbers, which lets you specify the phone number type
* and multiple numbers.
*
*
* @return The phone number of the contact in E.164 format. The phone number type defaults to WORK. You can specify
* PhoneNumber or PhoneNumbers. We recommend that you use PhoneNumbers, which lets you specify the phone
* number type and multiple numbers.
*/
public final String phoneNumber() {
return phoneNumber;
}
/**
* For responses, this returns true if the service returned a value for the PhoneNumbers 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 hasPhoneNumbers() {
return phoneNumbers != null && !(phoneNumbers instanceof SdkAutoConstructList);
}
/**
*
* The list of phone numbers for the contact.
*
*
* 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 #hasPhoneNumbers} method.
*
*
* @return The list of phone numbers for the contact.
*/
public final List phoneNumbers() {
return phoneNumbers;
}
/**
* For responses, this returns true if the service returned a value for the SipAddresses 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 hasSipAddresses() {
return sipAddresses != null && !(sipAddresses instanceof SdkAutoConstructList);
}
/**
*
* The list of SIP addresses for the contact.
*
*
* 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 #hasSipAddresses} method.
*
*
* @return The list of SIP addresses for the contact.
*/
public final List sipAddresses() {
return sipAddresses;
}
/**
*
* A unique, user-specified identifier for this request that ensures idempotency.
*
*
* @return A unique, user-specified identifier for this request that ensures idempotency.
*/
public final String clientRequestToken() {
return clientRequestToken;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* The tags to be added to the specified resource. Do not provide system tags.
*
*
* 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 #hasTags} method.
*
*
* @return The tags to be added to the specified resource. Do not provide system tags.
*/
public final List tags() {
return tags;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(firstName());
hashCode = 31 * hashCode + Objects.hashCode(lastName());
hashCode = 31 * hashCode + Objects.hashCode(phoneNumber());
hashCode = 31 * hashCode + Objects.hashCode(hasPhoneNumbers() ? phoneNumbers() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasSipAddresses() ? sipAddresses() : null);
hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateContactRequest)) {
return false;
}
CreateContactRequest other = (CreateContactRequest) obj;
return Objects.equals(displayName(), other.displayName()) && Objects.equals(firstName(), other.firstName())
&& Objects.equals(lastName(), other.lastName()) && Objects.equals(phoneNumber(), other.phoneNumber())
&& hasPhoneNumbers() == other.hasPhoneNumbers() && Objects.equals(phoneNumbers(), other.phoneNumbers())
&& hasSipAddresses() == other.hasSipAddresses() && Objects.equals(sipAddresses(), other.sipAddresses())
&& Objects.equals(clientRequestToken(), other.clientRequestToken()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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("CreateContactRequest").add("DisplayName", displayName()).add("FirstName", firstName())
.add("LastName", lastName()).add("PhoneNumber", phoneNumber() == null ? null : "*** Sensitive Data Redacted ***")
.add("PhoneNumbers", hasPhoneNumbers() ? phoneNumbers() : null)
.add("SipAddresses", hasSipAddresses() ? sipAddresses() : null).add("ClientRequestToken", clientRequestToken())
.add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "FirstName":
return Optional.ofNullable(clazz.cast(firstName()));
case "LastName":
return Optional.ofNullable(clazz.cast(lastName()));
case "PhoneNumber":
return Optional.ofNullable(clazz.cast(phoneNumber()));
case "PhoneNumbers":
return Optional.ofNullable(clazz.cast(phoneNumbers()));
case "SipAddresses":
return Optional.ofNullable(clazz.cast(sipAddresses()));
case "ClientRequestToken":
return Optional.ofNullable(clazz.cast(clientRequestToken()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function