
software.amazon.awssdk.services.lexmodelbuilding.model.StartMigrationResponse 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.lexmodelbuilding.model;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class StartMigrationResponse extends LexModelBuildingResponse implements
ToCopyableBuilder {
private static final SdkField V1_BOT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("v1BotName").getter(getter(StartMigrationResponse::v1BotName)).setter(setter(Builder::v1BotName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("v1BotName").build()).build();
private static final SdkField V1_BOT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("v1BotVersion").getter(getter(StartMigrationResponse::v1BotVersion))
.setter(setter(Builder::v1BotVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("v1BotVersion").build()).build();
private static final SdkField V1_BOT_LOCALE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("v1BotLocale").getter(getter(StartMigrationResponse::v1BotLocaleAsString))
.setter(setter(Builder::v1BotLocale))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("v1BotLocale").build()).build();
private static final SdkField V2_BOT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("v2BotId").getter(getter(StartMigrationResponse::v2BotId)).setter(setter(Builder::v2BotId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("v2BotId").build()).build();
private static final SdkField V2_BOT_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("v2BotRole").getter(getter(StartMigrationResponse::v2BotRole)).setter(setter(Builder::v2BotRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("v2BotRole").build()).build();
private static final SdkField MIGRATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("migrationId").getter(getter(StartMigrationResponse::migrationId)).setter(setter(Builder::migrationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("migrationId").build()).build();
private static final SdkField MIGRATION_STRATEGY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("migrationStrategy").getter(getter(StartMigrationResponse::migrationStrategyAsString))
.setter(setter(Builder::migrationStrategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("migrationStrategy").build()).build();
private static final SdkField MIGRATION_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("migrationTimestamp").getter(getter(StartMigrationResponse::migrationTimestamp))
.setter(setter(Builder::migrationTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("migrationTimestamp").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(V1_BOT_NAME_FIELD,
V1_BOT_VERSION_FIELD, V1_BOT_LOCALE_FIELD, V2_BOT_ID_FIELD, V2_BOT_ROLE_FIELD, MIGRATION_ID_FIELD,
MIGRATION_STRATEGY_FIELD, MIGRATION_TIMESTAMP_FIELD));
private final String v1BotName;
private final String v1BotVersion;
private final String v1BotLocale;
private final String v2BotId;
private final String v2BotRole;
private final String migrationId;
private final String migrationStrategy;
private final Instant migrationTimestamp;
private StartMigrationResponse(BuilderImpl builder) {
super(builder);
this.v1BotName = builder.v1BotName;
this.v1BotVersion = builder.v1BotVersion;
this.v1BotLocale = builder.v1BotLocale;
this.v2BotId = builder.v2BotId;
this.v2BotRole = builder.v2BotRole;
this.migrationId = builder.migrationId;
this.migrationStrategy = builder.migrationStrategy;
this.migrationTimestamp = builder.migrationTimestamp;
}
/**
*
* The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex V2.
*
*
* @return The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex V2.
*/
public final String v1BotName() {
return v1BotName;
}
/**
*
* The version of the bot to migrate to Amazon Lex V2.
*
*
* @return The version of the bot to migrate to Amazon Lex V2.
*/
public final String v1BotVersion() {
return v1BotVersion;
}
/**
*
* The locale used for the Amazon Lex V1 bot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #v1BotLocale} will
* return {@link Locale#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #v1BotLocaleAsString}.
*
*
* @return The locale used for the Amazon Lex V1 bot.
* @see Locale
*/
public final Locale v1BotLocale() {
return Locale.fromValue(v1BotLocale);
}
/**
*
* The locale used for the Amazon Lex V1 bot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #v1BotLocale} will
* return {@link Locale#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #v1BotLocaleAsString}.
*
*
* @return The locale used for the Amazon Lex V1 bot.
* @see Locale
*/
public final String v1BotLocaleAsString() {
return v1BotLocale;
}
/**
*
* The unique identifier for the Amazon Lex V2 bot.
*
*
* @return The unique identifier for the Amazon Lex V2 bot.
*/
public final String v2BotId() {
return v2BotId;
}
/**
*
* The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
*
*
* @return The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
*/
public final String v2BotRole() {
return v2BotRole;
}
/**
*
* The unique identifier that Amazon Lex assigned to the migration.
*
*
* @return The unique identifier that Amazon Lex assigned to the migration.
*/
public final String migrationId() {
return migrationId;
}
/**
*
* The strategy used to conduct the migration.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #migrationStrategy}
* will return {@link MigrationStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #migrationStrategyAsString}.
*
*
* @return The strategy used to conduct the migration.
* @see MigrationStrategy
*/
public final MigrationStrategy migrationStrategy() {
return MigrationStrategy.fromValue(migrationStrategy);
}
/**
*
* The strategy used to conduct the migration.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #migrationStrategy}
* will return {@link MigrationStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #migrationStrategyAsString}.
*
*
* @return The strategy used to conduct the migration.
* @see MigrationStrategy
*/
public final String migrationStrategyAsString() {
return migrationStrategy;
}
/**
*
* The date and time that the migration started.
*
*
* @return The date and time that the migration started.
*/
public final Instant migrationTimestamp() {
return migrationTimestamp;
}
@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(v1BotName());
hashCode = 31 * hashCode + Objects.hashCode(v1BotVersion());
hashCode = 31 * hashCode + Objects.hashCode(v1BotLocaleAsString());
hashCode = 31 * hashCode + Objects.hashCode(v2BotId());
hashCode = 31 * hashCode + Objects.hashCode(v2BotRole());
hashCode = 31 * hashCode + Objects.hashCode(migrationId());
hashCode = 31 * hashCode + Objects.hashCode(migrationStrategyAsString());
hashCode = 31 * hashCode + Objects.hashCode(migrationTimestamp());
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 StartMigrationResponse)) {
return false;
}
StartMigrationResponse other = (StartMigrationResponse) obj;
return Objects.equals(v1BotName(), other.v1BotName()) && Objects.equals(v1BotVersion(), other.v1BotVersion())
&& Objects.equals(v1BotLocaleAsString(), other.v1BotLocaleAsString())
&& Objects.equals(v2BotId(), other.v2BotId()) && Objects.equals(v2BotRole(), other.v2BotRole())
&& Objects.equals(migrationId(), other.migrationId())
&& Objects.equals(migrationStrategyAsString(), other.migrationStrategyAsString())
&& Objects.equals(migrationTimestamp(), other.migrationTimestamp());
}
/**
* 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("StartMigrationResponse").add("V1BotName", v1BotName()).add("V1BotVersion", v1BotVersion())
.add("V1BotLocale", v1BotLocaleAsString()).add("V2BotId", v2BotId()).add("V2BotRole", v2BotRole())
.add("MigrationId", migrationId()).add("MigrationStrategy", migrationStrategyAsString())
.add("MigrationTimestamp", migrationTimestamp()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "v1BotName":
return Optional.ofNullable(clazz.cast(v1BotName()));
case "v1BotVersion":
return Optional.ofNullable(clazz.cast(v1BotVersion()));
case "v1BotLocale":
return Optional.ofNullable(clazz.cast(v1BotLocaleAsString()));
case "v2BotId":
return Optional.ofNullable(clazz.cast(v2BotId()));
case "v2BotRole":
return Optional.ofNullable(clazz.cast(v2BotRole()));
case "migrationId":
return Optional.ofNullable(clazz.cast(migrationId()));
case "migrationStrategy":
return Optional.ofNullable(clazz.cast(migrationStrategyAsString()));
case "migrationTimestamp":
return Optional.ofNullable(clazz.cast(migrationTimestamp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function