Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.lexmodelsv2.model.CreateBotResponse 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.lexmodelsv2.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreateBotResponse extends LexModelsV2Response implements
ToCopyableBuilder {
private static final SdkField BOT_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("botId")
.getter(getter(CreateBotResponse::botId)).setter(setter(Builder::botId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("botId").build()).build();
private static final SdkField BOT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("botName").getter(getter(CreateBotResponse::botName)).setter(setter(Builder::botName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("botName").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(CreateBotResponse::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleArn").getter(getter(CreateBotResponse::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();
private static final SdkField DATA_PRIVACY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("dataPrivacy").getter(getter(CreateBotResponse::dataPrivacy)).setter(setter(Builder::dataPrivacy))
.constructor(DataPrivacy::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataPrivacy").build()).build();
private static final SdkField IDLE_SESSION_TTL_IN_SECONDS_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("idleSessionTTLInSeconds")
.getter(getter(CreateBotResponse::idleSessionTTLInSeconds)).setter(setter(Builder::idleSessionTTLInSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("idleSessionTTLInSeconds").build())
.build();
private static final SdkField BOT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("botStatus").getter(getter(CreateBotResponse::botStatusAsString)).setter(setter(Builder::botStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("botStatus").build()).build();
private static final SdkField CREATION_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationDateTime").getter(getter(CreateBotResponse::creationDateTime))
.setter(setter(Builder::creationDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationDateTime").build()).build();
private static final SdkField> BOT_TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("botTags")
.getter(getter(CreateBotResponse::botTags))
.setter(setter(Builder::botTags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("botTags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> TEST_BOT_ALIAS_TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("testBotAliasTags")
.getter(getter(CreateBotResponse::testBotAliasTags))
.setter(setter(Builder::testBotAliasTags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("testBotAliasTags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BOT_ID_FIELD, BOT_NAME_FIELD,
DESCRIPTION_FIELD, ROLE_ARN_FIELD, DATA_PRIVACY_FIELD, IDLE_SESSION_TTL_IN_SECONDS_FIELD, BOT_STATUS_FIELD,
CREATION_DATE_TIME_FIELD, BOT_TAGS_FIELD, TEST_BOT_ALIAS_TAGS_FIELD));
private final String botId;
private final String botName;
private final String description;
private final String roleArn;
private final DataPrivacy dataPrivacy;
private final Integer idleSessionTTLInSeconds;
private final String botStatus;
private final Instant creationDateTime;
private final Map botTags;
private final Map testBotAliasTags;
private CreateBotResponse(BuilderImpl builder) {
super(builder);
this.botId = builder.botId;
this.botName = builder.botName;
this.description = builder.description;
this.roleArn = builder.roleArn;
this.dataPrivacy = builder.dataPrivacy;
this.idleSessionTTLInSeconds = builder.idleSessionTTLInSeconds;
this.botStatus = builder.botStatus;
this.creationDateTime = builder.creationDateTime;
this.botTags = builder.botTags;
this.testBotAliasTags = builder.testBotAliasTags;
}
/**
*
* A unique identifier for a particular bot. You use this to identify the bot when you call other Amazon Lex API
* operations.
*
*
* @return A unique identifier for a particular bot. You use this to identify the bot when you call other Amazon Lex
* API operations.
*/
public final String botId() {
return botId;
}
/**
*
* The name specified for the bot.
*
*
* @return The name specified for the bot.
*/
public final String botName() {
return botName;
}
/**
*
* The description specified for the bot.
*
*
* @return The description specified for the bot.
*/
public final String description() {
return description;
}
/**
*
* The IAM role specified for the bot.
*
*
* @return The IAM role specified for the bot.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* The data privacy settings specified for the bot.
*
*
* @return The data privacy settings specified for the bot.
*/
public final DataPrivacy dataPrivacy() {
return dataPrivacy;
}
/**
*
* The session idle time specified for the bot.
*
*
* @return The session idle time specified for the bot.
*/
public final Integer idleSessionTTLInSeconds() {
return idleSessionTTLInSeconds;
}
/**
*
* Shows the current status of the bot. The bot is first in the Creating
status. Once the bot is read
* for use, it changes to the Available
status. After the bot is created, you can use the
* Draft
version of the bot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #botStatus} will
* return {@link BotStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #botStatusAsString}.
*
*
* @return Shows the current status of the bot. The bot is first in the Creating
status. Once the bot
* is read for use, it changes to the Available
status. After the bot is created, you can use
* the Draft
version of the bot.
* @see BotStatus
*/
public final BotStatus botStatus() {
return BotStatus.fromValue(botStatus);
}
/**
*
* Shows the current status of the bot. The bot is first in the Creating
status. Once the bot is read
* for use, it changes to the Available
status. After the bot is created, you can use the
* Draft
version of the bot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #botStatus} will
* return {@link BotStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #botStatusAsString}.
*
*
* @return Shows the current status of the bot. The bot is first in the Creating
status. Once the bot
* is read for use, it changes to the Available
status. After the bot is created, you can use
* the Draft
version of the bot.
* @see BotStatus
*/
public final String botStatusAsString() {
return botStatus;
}
/**
*
* A timestamp indicating the date and time that the bot was created.
*
*
* @return A timestamp indicating the date and time that the bot was created.
*/
public final Instant creationDateTime() {
return creationDateTime;
}
/**
* For responses, this returns true if the service returned a value for the BotTags 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 hasBotTags() {
return botTags != null && !(botTags instanceof SdkAutoConstructMap);
}
/**
*
* A list of tags associated with the bot.
*
*
* 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 #hasBotTags} method.
*
*
* @return A list of tags associated with the bot.
*/
public final Map botTags() {
return botTags;
}
/**
* For responses, this returns true if the service returned a value for the TestBotAliasTags 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 hasTestBotAliasTags() {
return testBotAliasTags != null && !(testBotAliasTags instanceof SdkAutoConstructMap);
}
/**
*
* A list of tags associated with the test alias for the bot.
*
*
* 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 #hasTestBotAliasTags} method.
*
*
* @return A list of tags associated with the test alias for the bot.
*/
public final Map testBotAliasTags() {
return testBotAliasTags;
}
@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(botId());
hashCode = 31 * hashCode + Objects.hashCode(botName());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(dataPrivacy());
hashCode = 31 * hashCode + Objects.hashCode(idleSessionTTLInSeconds());
hashCode = 31 * hashCode + Objects.hashCode(botStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationDateTime());
hashCode = 31 * hashCode + Objects.hashCode(hasBotTags() ? botTags() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTestBotAliasTags() ? testBotAliasTags() : 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 CreateBotResponse)) {
return false;
}
CreateBotResponse other = (CreateBotResponse) obj;
return Objects.equals(botId(), other.botId()) && Objects.equals(botName(), other.botName())
&& Objects.equals(description(), other.description()) && Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(dataPrivacy(), other.dataPrivacy())
&& Objects.equals(idleSessionTTLInSeconds(), other.idleSessionTTLInSeconds())
&& Objects.equals(botStatusAsString(), other.botStatusAsString())
&& Objects.equals(creationDateTime(), other.creationDateTime()) && hasBotTags() == other.hasBotTags()
&& Objects.equals(botTags(), other.botTags()) && hasTestBotAliasTags() == other.hasTestBotAliasTags()
&& Objects.equals(testBotAliasTags(), other.testBotAliasTags());
}
/**
* 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("CreateBotResponse").add("BotId", botId()).add("BotName", botName())
.add("Description", description()).add("RoleArn", roleArn()).add("DataPrivacy", dataPrivacy())
.add("IdleSessionTTLInSeconds", idleSessionTTLInSeconds()).add("BotStatus", botStatusAsString())
.add("CreationDateTime", creationDateTime()).add("BotTags", hasBotTags() ? botTags() : null)
.add("TestBotAliasTags", hasTestBotAliasTags() ? testBotAliasTags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "botId":
return Optional.ofNullable(clazz.cast(botId()));
case "botName":
return Optional.ofNullable(clazz.cast(botName()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "roleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "dataPrivacy":
return Optional.ofNullable(clazz.cast(dataPrivacy()));
case "idleSessionTTLInSeconds":
return Optional.ofNullable(clazz.cast(idleSessionTTLInSeconds()));
case "botStatus":
return Optional.ofNullable(clazz.cast(botStatusAsString()));
case "creationDateTime":
return Optional.ofNullable(clazz.cast(creationDateTime()));
case "botTags":
return Optional.ofNullable(clazz.cast(botTags()));
case "testBotAliasTags":
return Optional.ofNullable(clazz.cast(testBotAliasTags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((CreateBotResponse) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends LexModelsV2Response.Builder, SdkPojo, CopyableBuilder {
/**
*
* A unique identifier for a particular bot. You use this to identify the bot when you call other Amazon Lex API
* operations.
*
*
* @param botId
* A unique identifier for a particular bot. You use this to identify the bot when you call other Amazon
* Lex API operations.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botId(String botId);
/**
*
* The name specified for the bot.
*
*
* @param botName
* The name specified for the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botName(String botName);
/**
*
* The description specified for the bot.
*
*
* @param description
* The description specified for the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* The IAM role specified for the bot.
*
*
* @param roleArn
* The IAM role specified for the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder roleArn(String roleArn);
/**
*
* The data privacy settings specified for the bot.
*
*
* @param dataPrivacy
* The data privacy settings specified for the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dataPrivacy(DataPrivacy dataPrivacy);
/**
*
* The data privacy settings specified for the bot.
*
* This is a convenience method that creates an instance of the {@link DataPrivacy.Builder} avoiding the need to
* create one manually via {@link DataPrivacy#builder()}.
*
* When the {@link Consumer} completes, {@link DataPrivacy.Builder#build()} is called immediately and its result
* is passed to {@link #dataPrivacy(DataPrivacy)}.
*
* @param dataPrivacy
* a consumer that will call methods on {@link DataPrivacy.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #dataPrivacy(DataPrivacy)
*/
default Builder dataPrivacy(Consumer dataPrivacy) {
return dataPrivacy(DataPrivacy.builder().applyMutation(dataPrivacy).build());
}
/**
*
* The session idle time specified for the bot.
*
*
* @param idleSessionTTLInSeconds
* The session idle time specified for the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder idleSessionTTLInSeconds(Integer idleSessionTTLInSeconds);
/**
*
* Shows the current status of the bot. The bot is first in the Creating
status. Once the bot is
* read for use, it changes to the Available
status. After the bot is created, you can use the
* Draft
version of the bot.
*
*
* @param botStatus
* Shows the current status of the bot. The bot is first in the Creating
status. Once the
* bot is read for use, it changes to the Available
status. After the bot is created, you
* can use the Draft
version of the bot.
* @see BotStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see BotStatus
*/
Builder botStatus(String botStatus);
/**
*
* Shows the current status of the bot. The bot is first in the Creating
status. Once the bot is
* read for use, it changes to the Available
status. After the bot is created, you can use the
* Draft
version of the bot.
*
*
* @param botStatus
* Shows the current status of the bot. The bot is first in the Creating
status. Once the
* bot is read for use, it changes to the Available
status. After the bot is created, you
* can use the Draft
version of the bot.
* @see BotStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see BotStatus
*/
Builder botStatus(BotStatus botStatus);
/**
*
* A timestamp indicating the date and time that the bot was created.
*
*
* @param creationDateTime
* A timestamp indicating the date and time that the bot was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder creationDateTime(Instant creationDateTime);
/**
*
* A list of tags associated with the bot.
*
*
* @param botTags
* A list of tags associated with the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botTags(Map botTags);
/**
*
* A list of tags associated with the test alias for the bot.
*
*
* @param testBotAliasTags
* A list of tags associated with the test alias for the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder testBotAliasTags(Map testBotAliasTags);
}
static final class BuilderImpl extends LexModelsV2Response.BuilderImpl implements Builder {
private String botId;
private String botName;
private String description;
private String roleArn;
private DataPrivacy dataPrivacy;
private Integer idleSessionTTLInSeconds;
private String botStatus;
private Instant creationDateTime;
private Map botTags = DefaultSdkAutoConstructMap.getInstance();
private Map testBotAliasTags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateBotResponse model) {
super(model);
botId(model.botId);
botName(model.botName);
description(model.description);
roleArn(model.roleArn);
dataPrivacy(model.dataPrivacy);
idleSessionTTLInSeconds(model.idleSessionTTLInSeconds);
botStatus(model.botStatus);
creationDateTime(model.creationDateTime);
botTags(model.botTags);
testBotAliasTags(model.testBotAliasTags);
}
public final String getBotId() {
return botId;
}
public final void setBotId(String botId) {
this.botId = botId;
}
@Override
public final Builder botId(String botId) {
this.botId = botId;
return this;
}
public final String getBotName() {
return botName;
}
public final void setBotName(String botName) {
this.botName = botName;
}
@Override
public final Builder botName(String botName) {
this.botName = botName;
return this;
}
public final String getDescription() {
return description;
}
public final void setDescription(String description) {
this.description = description;
}
@Override
public final Builder description(String description) {
this.description = description;
return this;
}
public final String getRoleArn() {
return roleArn;
}
public final void setRoleArn(String roleArn) {
this.roleArn = roleArn;
}
@Override
public final Builder roleArn(String roleArn) {
this.roleArn = roleArn;
return this;
}
public final DataPrivacy.Builder getDataPrivacy() {
return dataPrivacy != null ? dataPrivacy.toBuilder() : null;
}
public final void setDataPrivacy(DataPrivacy.BuilderImpl dataPrivacy) {
this.dataPrivacy = dataPrivacy != null ? dataPrivacy.build() : null;
}
@Override
public final Builder dataPrivacy(DataPrivacy dataPrivacy) {
this.dataPrivacy = dataPrivacy;
return this;
}
public final Integer getIdleSessionTTLInSeconds() {
return idleSessionTTLInSeconds;
}
public final void setIdleSessionTTLInSeconds(Integer idleSessionTTLInSeconds) {
this.idleSessionTTLInSeconds = idleSessionTTLInSeconds;
}
@Override
public final Builder idleSessionTTLInSeconds(Integer idleSessionTTLInSeconds) {
this.idleSessionTTLInSeconds = idleSessionTTLInSeconds;
return this;
}
public final String getBotStatus() {
return botStatus;
}
public final void setBotStatus(String botStatus) {
this.botStatus = botStatus;
}
@Override
public final Builder botStatus(String botStatus) {
this.botStatus = botStatus;
return this;
}
@Override
public final Builder botStatus(BotStatus botStatus) {
this.botStatus(botStatus == null ? null : botStatus.toString());
return this;
}
public final Instant getCreationDateTime() {
return creationDateTime;
}
public final void setCreationDateTime(Instant creationDateTime) {
this.creationDateTime = creationDateTime;
}
@Override
public final Builder creationDateTime(Instant creationDateTime) {
this.creationDateTime = creationDateTime;
return this;
}
public final Map getBotTags() {
if (botTags instanceof SdkAutoConstructMap) {
return null;
}
return botTags;
}
public final void setBotTags(Map botTags) {
this.botTags = TagMapCopier.copy(botTags);
}
@Override
public final Builder botTags(Map botTags) {
this.botTags = TagMapCopier.copy(botTags);
return this;
}
public final Map getTestBotAliasTags() {
if (testBotAliasTags instanceof SdkAutoConstructMap) {
return null;
}
return testBotAliasTags;
}
public final void setTestBotAliasTags(Map testBotAliasTags) {
this.testBotAliasTags = TagMapCopier.copy(testBotAliasTags);
}
@Override
public final Builder testBotAliasTags(Map testBotAliasTags) {
this.testBotAliasTags = TagMapCopier.copy(testBotAliasTags);
return this;
}
@Override
public CreateBotResponse build() {
return new CreateBotResponse(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}