
software.amazon.awssdk.services.databasemigration.model.ModifyMigrationProjectRequest 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.databasemigration.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.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 ModifyMigrationProjectRequest extends DatabaseMigrationRequest implements
ToCopyableBuilder {
private static final SdkField MIGRATION_PROJECT_IDENTIFIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("MigrationProjectIdentifier")
.getter(getter(ModifyMigrationProjectRequest::migrationProjectIdentifier))
.setter(setter(Builder::migrationProjectIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MigrationProjectIdentifier").build())
.build();
private static final SdkField MIGRATION_PROJECT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MigrationProjectName").getter(getter(ModifyMigrationProjectRequest::migrationProjectName))
.setter(setter(Builder::migrationProjectName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MigrationProjectName").build())
.build();
private static final SdkField> SOURCE_DATA_PROVIDER_DESCRIPTORS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SourceDataProviderDescriptors")
.getter(getter(ModifyMigrationProjectRequest::sourceDataProviderDescriptors))
.setter(setter(Builder::sourceDataProviderDescriptors))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceDataProviderDescriptors")
.build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DataProviderDescriptorDefinition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> TARGET_DATA_PROVIDER_DESCRIPTORS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("TargetDataProviderDescriptors")
.getter(getter(ModifyMigrationProjectRequest::targetDataProviderDescriptors))
.setter(setter(Builder::targetDataProviderDescriptors))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetDataProviderDescriptors")
.build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DataProviderDescriptorDefinition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField INSTANCE_PROFILE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceProfileIdentifier").getter(getter(ModifyMigrationProjectRequest::instanceProfileIdentifier))
.setter(setter(Builder::instanceProfileIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceProfileIdentifier").build())
.build();
private static final SdkField TRANSFORMATION_RULES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TransformationRules").getter(getter(ModifyMigrationProjectRequest::transformationRules))
.setter(setter(Builder::transformationRules))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransformationRules").build())
.build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(ModifyMigrationProjectRequest::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField SCHEMA_CONVERSION_APPLICATION_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("SchemaConversionApplicationAttributes")
.getter(getter(ModifyMigrationProjectRequest::schemaConversionApplicationAttributes))
.setter(setter(Builder::schemaConversionApplicationAttributes))
.constructor(SCApplicationAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("SchemaConversionApplicationAttributes").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
MIGRATION_PROJECT_IDENTIFIER_FIELD, MIGRATION_PROJECT_NAME_FIELD, SOURCE_DATA_PROVIDER_DESCRIPTORS_FIELD,
TARGET_DATA_PROVIDER_DESCRIPTORS_FIELD, INSTANCE_PROFILE_IDENTIFIER_FIELD, TRANSFORMATION_RULES_FIELD,
DESCRIPTION_FIELD, SCHEMA_CONVERSION_APPLICATION_ATTRIBUTES_FIELD));
private final String migrationProjectIdentifier;
private final String migrationProjectName;
private final List sourceDataProviderDescriptors;
private final List targetDataProviderDescriptors;
private final String instanceProfileIdentifier;
private final String transformationRules;
private final String description;
private final SCApplicationAttributes schemaConversionApplicationAttributes;
private ModifyMigrationProjectRequest(BuilderImpl builder) {
super(builder);
this.migrationProjectIdentifier = builder.migrationProjectIdentifier;
this.migrationProjectName = builder.migrationProjectName;
this.sourceDataProviderDescriptors = builder.sourceDataProviderDescriptors;
this.targetDataProviderDescriptors = builder.targetDataProviderDescriptors;
this.instanceProfileIdentifier = builder.instanceProfileIdentifier;
this.transformationRules = builder.transformationRules;
this.description = builder.description;
this.schemaConversionApplicationAttributes = builder.schemaConversionApplicationAttributes;
}
/**
*
* The identifier of the migration project. Identifiers must begin with a letter and must contain only ASCII
* letters, digits, and hyphens. They can't end with a hyphen, or contain two consecutive hyphens.
*
*
* @return The identifier of the migration project. Identifiers must begin with a letter and must contain only ASCII
* letters, digits, and hyphens. They can't end with a hyphen, or contain two consecutive hyphens.
*/
public final String migrationProjectIdentifier() {
return migrationProjectIdentifier;
}
/**
*
* A user-friendly name for the migration project.
*
*
* @return A user-friendly name for the migration project.
*/
public final String migrationProjectName() {
return migrationProjectName;
}
/**
* For responses, this returns true if the service returned a value for the SourceDataProviderDescriptors 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 hasSourceDataProviderDescriptors() {
return sourceDataProviderDescriptors != null && !(sourceDataProviderDescriptors instanceof SdkAutoConstructList);
}
/**
*
* Information about the source data provider, including the name, ARN, and Amazon Web Services Secrets Manager
* parameters.
*
*
* 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 #hasSourceDataProviderDescriptors} method.
*
*
* @return Information about the source data provider, including the name, ARN, and Amazon Web Services Secrets
* Manager parameters.
*/
public final List sourceDataProviderDescriptors() {
return sourceDataProviderDescriptors;
}
/**
* For responses, this returns true if the service returned a value for the TargetDataProviderDescriptors 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 hasTargetDataProviderDescriptors() {
return targetDataProviderDescriptors != null && !(targetDataProviderDescriptors instanceof SdkAutoConstructList);
}
/**
*
* Information about the target data provider, including the name, ARN, and Amazon Web Services Secrets Manager
* parameters.
*
*
* 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 #hasTargetDataProviderDescriptors} method.
*
*
* @return Information about the target data provider, including the name, ARN, and Amazon Web Services Secrets
* Manager parameters.
*/
public final List targetDataProviderDescriptors() {
return targetDataProviderDescriptors;
}
/**
*
* The name or Amazon Resource Name (ARN) for the instance profile.
*
*
* @return The name or Amazon Resource Name (ARN) for the instance profile.
*/
public final String instanceProfileIdentifier() {
return instanceProfileIdentifier;
}
/**
*
* The settings in JSON format for migration rules. Migration rules make it possible for you to change the object
* names according to the rules that you specify. For example, you can change an object name to lowercase or
* uppercase, add or remove a prefix or suffix, or rename objects.
*
*
* @return The settings in JSON format for migration rules. Migration rules make it possible for you to change the
* object names according to the rules that you specify. For example, you can change an object name to
* lowercase or uppercase, add or remove a prefix or suffix, or rename objects.
*/
public final String transformationRules() {
return transformationRules;
}
/**
*
* A user-friendly description of the migration project.
*
*
* @return A user-friendly description of the migration project.
*/
public final String description() {
return description;
}
/**
*
* The schema conversion application attributes, including the Amazon S3 bucket name and Amazon S3 role ARN.
*
*
* @return The schema conversion application attributes, including the Amazon S3 bucket name and Amazon S3 role ARN.
*/
public final SCApplicationAttributes schemaConversionApplicationAttributes() {
return schemaConversionApplicationAttributes;
}
@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(migrationProjectIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(migrationProjectName());
hashCode = 31 * hashCode + Objects.hashCode(hasSourceDataProviderDescriptors() ? sourceDataProviderDescriptors() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTargetDataProviderDescriptors() ? targetDataProviderDescriptors() : null);
hashCode = 31 * hashCode + Objects.hashCode(instanceProfileIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(transformationRules());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(schemaConversionApplicationAttributes());
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 ModifyMigrationProjectRequest)) {
return false;
}
ModifyMigrationProjectRequest other = (ModifyMigrationProjectRequest) obj;
return Objects.equals(migrationProjectIdentifier(), other.migrationProjectIdentifier())
&& Objects.equals(migrationProjectName(), other.migrationProjectName())
&& hasSourceDataProviderDescriptors() == other.hasSourceDataProviderDescriptors()
&& Objects.equals(sourceDataProviderDescriptors(), other.sourceDataProviderDescriptors())
&& hasTargetDataProviderDescriptors() == other.hasTargetDataProviderDescriptors()
&& Objects.equals(targetDataProviderDescriptors(), other.targetDataProviderDescriptors())
&& Objects.equals(instanceProfileIdentifier(), other.instanceProfileIdentifier())
&& Objects.equals(transformationRules(), other.transformationRules())
&& Objects.equals(description(), other.description())
&& Objects.equals(schemaConversionApplicationAttributes(), other.schemaConversionApplicationAttributes());
}
/**
* 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("ModifyMigrationProjectRequest")
.add("MigrationProjectIdentifier", migrationProjectIdentifier())
.add("MigrationProjectName", migrationProjectName())
.add("SourceDataProviderDescriptors", hasSourceDataProviderDescriptors() ? sourceDataProviderDescriptors() : null)
.add("TargetDataProviderDescriptors", hasTargetDataProviderDescriptors() ? targetDataProviderDescriptors() : null)
.add("InstanceProfileIdentifier", instanceProfileIdentifier()).add("TransformationRules", transformationRules())
.add("Description", description())
.add("SchemaConversionApplicationAttributes", schemaConversionApplicationAttributes()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MigrationProjectIdentifier":
return Optional.ofNullable(clazz.cast(migrationProjectIdentifier()));
case "MigrationProjectName":
return Optional.ofNullable(clazz.cast(migrationProjectName()));
case "SourceDataProviderDescriptors":
return Optional.ofNullable(clazz.cast(sourceDataProviderDescriptors()));
case "TargetDataProviderDescriptors":
return Optional.ofNullable(clazz.cast(targetDataProviderDescriptors()));
case "InstanceProfileIdentifier":
return Optional.ofNullable(clazz.cast(instanceProfileIdentifier()));
case "TransformationRules":
return Optional.ofNullable(clazz.cast(transformationRules()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "SchemaConversionApplicationAttributes":
return Optional.ofNullable(clazz.cast(schemaConversionApplicationAttributes()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function