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.CreateBotRequest 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.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.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.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 CreateBotRequest extends LexModelsV2Request implements
ToCopyableBuilder {
private static final SdkField BOT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("botName").getter(getter(CreateBotRequest::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(CreateBotRequest::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(CreateBotRequest::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(CreateBotRequest::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(CreateBotRequest::idleSessionTTLInSeconds)).setter(setter(Builder::idleSessionTTLInSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("idleSessionTTLInSeconds").build())
.build();
private static final SdkField> BOT_TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("botTags")
.getter(getter(CreateBotRequest::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(CreateBotRequest::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_NAME_FIELD,
DESCRIPTION_FIELD, ROLE_ARN_FIELD, DATA_PRIVACY_FIELD, IDLE_SESSION_TTL_IN_SECONDS_FIELD, BOT_TAGS_FIELD,
TEST_BOT_ALIAS_TAGS_FIELD));
private final String botName;
private final String description;
private final String roleArn;
private final DataPrivacy dataPrivacy;
private final Integer idleSessionTTLInSeconds;
private final Map botTags;
private final Map testBotAliasTags;
private CreateBotRequest(BuilderImpl builder) {
super(builder);
this.botName = builder.botName;
this.description = builder.description;
this.roleArn = builder.roleArn;
this.dataPrivacy = builder.dataPrivacy;
this.idleSessionTTLInSeconds = builder.idleSessionTTLInSeconds;
this.botTags = builder.botTags;
this.testBotAliasTags = builder.testBotAliasTags;
}
/**
*
* The name of the bot. The bot name must be unique in the account that creates the bot.
*
*
* @return The name of the bot. The bot name must be unique in the account that creates the bot.
*/
public final String botName() {
return botName;
}
/**
*
* A description of the bot. It appears in lists to help you identify a particular bot.
*
*
* @return A description of the bot. It appears in lists to help you identify a particular bot.
*/
public final String description() {
return description;
}
/**
*
* The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.
*
*
* @return The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* Provides information on additional privacy protections Amazon Lex should use with the bot's data.
*
*
* @return Provides information on additional privacy protections Amazon Lex should use with the bot's data.
*/
public final DataPrivacy dataPrivacy() {
return dataPrivacy;
}
/**
*
* The time, in seconds, that Amazon Lex should keep information about a user's conversation with the bot.
*
*
* A user interaction remains active for the amount of time specified. If no conversation occurs during this time,
* the session expires and Amazon Lex deletes any data provided before the timeout.
*
*
* You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
*
*
* @return The time, in seconds, that Amazon Lex should keep information about a user's conversation with the bot.
*
*
* A user interaction remains active for the amount of time specified. If no conversation occurs during this
* time, the session expires and Amazon Lex deletes any data provided before the timeout.
*
*
* You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
*/
public final Integer idleSessionTTLInSeconds() {
return idleSessionTTLInSeconds;
}
/**
* 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 to add to the bot. You can only add tags when you create a bot. You can't use the
* UpdateBot
operation to update tags. To update tags, use the TagResource
operation.
*
*
* 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 to add to the bot. You can only add tags when you create a bot. You can't use the
* UpdateBot
operation to update tags. To update tags, use the TagResource
* operation.
*/
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 to add to the test alias for a bot. You can only add tags when you create a bot. You can't use the
* UpdateAlias
operation to update tags. To update tags on the test alias, use the
* TagResource
operation.
*
*
* 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 to add to the test alias for a bot. You can only add tags when you create a bot. You can't
* use the UpdateAlias
operation to update tags. To update tags on the test alias, use the
* TagResource
operation.
*/
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(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(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 CreateBotRequest)) {
return false;
}
CreateBotRequest other = (CreateBotRequest) obj;
return 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())
&& 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("CreateBotRequest").add("BotName", botName()).add("Description", description())
.add("RoleArn", roleArn()).add("DataPrivacy", dataPrivacy())
.add("IdleSessionTTLInSeconds", idleSessionTTLInSeconds()).add("BotTags", hasBotTags() ? botTags() : null)
.add("TestBotAliasTags", hasTestBotAliasTags() ? testBotAliasTags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
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 "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((CreateBotRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends LexModelsV2Request.Builder, SdkPojo, CopyableBuilder {
/**
*
* The name of the bot. The bot name must be unique in the account that creates the bot.
*
*
* @param botName
* The name of the bot. The bot name must be unique in the account that creates the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botName(String botName);
/**
*
* A description of the bot. It appears in lists to help you identify a particular bot.
*
*
* @param description
* A description of the bot. It appears in lists to help you identify a particular bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.
*
*
* @param roleArn
* The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder roleArn(String roleArn);
/**
*
* Provides information on additional privacy protections Amazon Lex should use with the bot's data.
*
*
* @param dataPrivacy
* Provides information on additional privacy protections Amazon Lex should use with the bot's data.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dataPrivacy(DataPrivacy dataPrivacy);
/**
*
* Provides information on additional privacy protections Amazon Lex should use with the bot's data.
*
* 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 time, in seconds, that Amazon Lex should keep information about a user's conversation with the bot.
*
*
* A user interaction remains active for the amount of time specified. If no conversation occurs during this
* time, the session expires and Amazon Lex deletes any data provided before the timeout.
*
*
* You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
*
*
* @param idleSessionTTLInSeconds
* The time, in seconds, that Amazon Lex should keep information about a user's conversation with the
* bot.
*
* A user interaction remains active for the amount of time specified. If no conversation occurs during
* this time, the session expires and Amazon Lex deletes any data provided before the timeout.
*
*
* You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder idleSessionTTLInSeconds(Integer idleSessionTTLInSeconds);
/**
*
* A list of tags to add to the bot. You can only add tags when you create a bot. You can't use the
* UpdateBot
operation to update tags. To update tags, use the TagResource
operation.
*
*
* @param botTags
* A list of tags to add to the bot. You can only add tags when you create a bot. You can't use the
* UpdateBot
operation to update tags. To update tags, use the TagResource
* operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botTags(Map botTags);
/**
*
* A list of tags to add to the test alias for a bot. You can only add tags when you create a bot. You can't use
* the UpdateAlias
operation to update tags. To update tags on the test alias, use the
* TagResource
operation.
*
*
* @param testBotAliasTags
* A list of tags to add to the test alias for a bot. You can only add tags when you create a bot. You
* can't use the UpdateAlias
operation to update tags. To update tags on the test alias, use
* the TagResource
operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder testBotAliasTags(Map testBotAliasTags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends LexModelsV2Request.BuilderImpl implements Builder {
private String botName;
private String description;
private String roleArn;
private DataPrivacy dataPrivacy;
private Integer idleSessionTTLInSeconds;
private Map botTags = DefaultSdkAutoConstructMap.getInstance();
private Map testBotAliasTags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateBotRequest model) {
super(model);
botName(model.botName);
description(model.description);
roleArn(model.roleArn);
dataPrivacy(model.dataPrivacy);
idleSessionTTLInSeconds(model.idleSessionTTLInSeconds);
botTags(model.botTags);
testBotAliasTags(model.testBotAliasTags);
}
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 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 Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateBotRequest build() {
return new CreateBotRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}