
software.amazon.awssdk.services.databasemigration.model.CreateReplicationConfigRequest 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.HashMap;
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 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 CreateReplicationConfigRequest extends DatabaseMigrationRequest implements
ToCopyableBuilder {
private static final SdkField REPLICATION_CONFIG_IDENTIFIER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ReplicationConfigIdentifier")
.getter(getter(CreateReplicationConfigRequest::replicationConfigIdentifier))
.setter(setter(Builder::replicationConfigIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicationConfigIdentifier")
.build()).build();
private static final SdkField SOURCE_ENDPOINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceEndpointArn").getter(getter(CreateReplicationConfigRequest::sourceEndpointArn))
.setter(setter(Builder::sourceEndpointArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceEndpointArn").build()).build();
private static final SdkField TARGET_ENDPOINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetEndpointArn").getter(getter(CreateReplicationConfigRequest::targetEndpointArn))
.setter(setter(Builder::targetEndpointArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetEndpointArn").build()).build();
private static final SdkField COMPUTE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ComputeConfig")
.getter(getter(CreateReplicationConfigRequest::computeConfig)).setter(setter(Builder::computeConfig))
.constructor(ComputeConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComputeConfig").build()).build();
private static final SdkField REPLICATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReplicationType").getter(getter(CreateReplicationConfigRequest::replicationTypeAsString))
.setter(setter(Builder::replicationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicationType").build()).build();
private static final SdkField TABLE_MAPPINGS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableMappings").getter(getter(CreateReplicationConfigRequest::tableMappings))
.setter(setter(Builder::tableMappings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableMappings").build()).build();
private static final SdkField REPLICATION_SETTINGS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReplicationSettings").getter(getter(CreateReplicationConfigRequest::replicationSettings))
.setter(setter(Builder::replicationSettings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicationSettings").build())
.build();
private static final SdkField SUPPLEMENTAL_SETTINGS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SupplementalSettings").getter(getter(CreateReplicationConfigRequest::supplementalSettings))
.setter(setter(Builder::supplementalSettings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SupplementalSettings").build())
.build();
private static final SdkField RESOURCE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceIdentifier").getter(getter(CreateReplicationConfigRequest::resourceIdentifier))
.setter(setter(Builder::resourceIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceIdentifier").build())
.build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateReplicationConfigRequest::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(
REPLICATION_CONFIG_IDENTIFIER_FIELD, SOURCE_ENDPOINT_ARN_FIELD, TARGET_ENDPOINT_ARN_FIELD, COMPUTE_CONFIG_FIELD,
REPLICATION_TYPE_FIELD, TABLE_MAPPINGS_FIELD, REPLICATION_SETTINGS_FIELD, SUPPLEMENTAL_SETTINGS_FIELD,
RESOURCE_IDENTIFIER_FIELD, TAGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("ReplicationConfigIdentifier", REPLICATION_CONFIG_IDENTIFIER_FIELD);
put("SourceEndpointArn", SOURCE_ENDPOINT_ARN_FIELD);
put("TargetEndpointArn", TARGET_ENDPOINT_ARN_FIELD);
put("ComputeConfig", COMPUTE_CONFIG_FIELD);
put("ReplicationType", REPLICATION_TYPE_FIELD);
put("TableMappings", TABLE_MAPPINGS_FIELD);
put("ReplicationSettings", REPLICATION_SETTINGS_FIELD);
put("SupplementalSettings", SUPPLEMENTAL_SETTINGS_FIELD);
put("ResourceIdentifier", RESOURCE_IDENTIFIER_FIELD);
put("Tags", TAGS_FIELD);
}
});
private final String replicationConfigIdentifier;
private final String sourceEndpointArn;
private final String targetEndpointArn;
private final ComputeConfig computeConfig;
private final String replicationType;
private final String tableMappings;
private final String replicationSettings;
private final String supplementalSettings;
private final String resourceIdentifier;
private final List tags;
private CreateReplicationConfigRequest(BuilderImpl builder) {
super(builder);
this.replicationConfigIdentifier = builder.replicationConfigIdentifier;
this.sourceEndpointArn = builder.sourceEndpointArn;
this.targetEndpointArn = builder.targetEndpointArn;
this.computeConfig = builder.computeConfig;
this.replicationType = builder.replicationType;
this.tableMappings = builder.tableMappings;
this.replicationSettings = builder.replicationSettings;
this.supplementalSettings = builder.supplementalSettings;
this.resourceIdentifier = builder.resourceIdentifier;
this.tags = builder.tags;
}
/**
*
* A unique identifier that you want to use to create a ReplicationConfigArn
that is returned as part
* of the output from this action. You can then pass this output ReplicationConfigArn
as the value of
* the ReplicationConfigArn
option for other actions to identify both DMS Serverless replications and
* replication configurations that you want those actions to operate on. For some actions, you can also use either
* this unique identifier or a corresponding ARN in action filters to identify the specific replication and
* replication configuration to operate on.
*
*
* @return A unique identifier that you want to use to create a ReplicationConfigArn
that is returned
* as part of the output from this action. You can then pass this output ReplicationConfigArn
* as the value of the ReplicationConfigArn
option for other actions to identify both DMS
* Serverless replications and replication configurations that you want those actions to operate on. For
* some actions, you can also use either this unique identifier or a corresponding ARN in action filters to
* identify the specific replication and replication configuration to operate on.
*/
public final String replicationConfigIdentifier() {
return replicationConfigIdentifier;
}
/**
*
* The Amazon Resource Name (ARN) of the source endpoint for this DMS Serverless replication configuration.
*
*
* @return The Amazon Resource Name (ARN) of the source endpoint for this DMS Serverless replication configuration.
*/
public final String sourceEndpointArn() {
return sourceEndpointArn;
}
/**
*
* The Amazon Resource Name (ARN) of the target endpoint for this DMS serverless replication configuration.
*
*
* @return The Amazon Resource Name (ARN) of the target endpoint for this DMS serverless replication configuration.
*/
public final String targetEndpointArn() {
return targetEndpointArn;
}
/**
*
* Configuration parameters for provisioning an DMS Serverless replication.
*
*
* @return Configuration parameters for provisioning an DMS Serverless replication.
*/
public final ComputeConfig computeConfig() {
return computeConfig;
}
/**
*
* The type of DMS Serverless replication to provision using this replication configuration.
*
*
* Possible values:
*
*
* -
*
* "full-load"
*
*
* -
*
* "cdc"
*
*
* -
*
* "full-load-and-cdc"
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #replicationType}
* will return {@link MigrationTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #replicationTypeAsString}.
*
*
* @return The type of DMS Serverless replication to provision using this replication configuration.
*
* Possible values:
*
*
* -
*
* "full-load"
*
*
* -
*
* "cdc"
*
*
* -
*
* "full-load-and-cdc"
*
*
* @see MigrationTypeValue
*/
public final MigrationTypeValue replicationType() {
return MigrationTypeValue.fromValue(replicationType);
}
/**
*
* The type of DMS Serverless replication to provision using this replication configuration.
*
*
* Possible values:
*
*
* -
*
* "full-load"
*
*
* -
*
* "cdc"
*
*
* -
*
* "full-load-and-cdc"
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #replicationType}
* will return {@link MigrationTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #replicationTypeAsString}.
*
*
* @return The type of DMS Serverless replication to provision using this replication configuration.
*
* Possible values:
*
*
* -
*
* "full-load"
*
*
* -
*
* "cdc"
*
*
* -
*
* "full-load-and-cdc"
*
*
* @see MigrationTypeValue
*/
public final String replicationTypeAsString() {
return replicationType;
}
/**
*
* JSON table mappings for DMS Serverless replications that are provisioned using this replication configuration.
* For more information, see Specifying table selection and transformations rules using JSON.
*
*
* @return JSON table mappings for DMS Serverless replications that are provisioned using this replication
* configuration. For more information, see Specifying table selection and transformations rules using JSON.
*/
public final String tableMappings() {
return tableMappings;
}
/**
*
* Optional JSON settings for DMS Serverless replications that are provisioned using this replication configuration.
* For example, see Change processing tuning settings.
*
*
* @return Optional JSON settings for DMS Serverless replications that are provisioned using this replication
* configuration. For example, see Change processing tuning settings.
*/
public final String replicationSettings() {
return replicationSettings;
}
/**
*
* Optional JSON settings for specifying supplemental data. For more information, see Specifying supplemental data
* for task settings.
*
*
* @return Optional JSON settings for specifying supplemental data. For more information, see Specifying supplemental
* data for task settings.
*/
public final String supplementalSettings() {
return supplementalSettings;
}
/**
*
* Optional unique value or name that you set for a given resource that can be used to construct an Amazon Resource
* Name (ARN) for that resource. For more information, see
* Fine-grained access control using resource names and tags.
*
*
* @return Optional unique value or name that you set for a given resource that can be used to construct an Amazon
* Resource Name (ARN) for that resource. For more information, see
* Fine-grained access control using resource names and tags.
*/
public final String resourceIdentifier() {
return resourceIdentifier;
}
/**
* 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);
}
/**
*
* One or more optional tags associated with resources used by the DMS Serverless replication. For more information,
* see Tagging resources in Database
* Migration Service.
*
*
* 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 One or more optional tags associated with resources used by the DMS Serverless replication. For more
* information, see Tagging
* resources in Database Migration Service.
*/
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(replicationConfigIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(sourceEndpointArn());
hashCode = 31 * hashCode + Objects.hashCode(targetEndpointArn());
hashCode = 31 * hashCode + Objects.hashCode(computeConfig());
hashCode = 31 * hashCode + Objects.hashCode(replicationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(tableMappings());
hashCode = 31 * hashCode + Objects.hashCode(replicationSettings());
hashCode = 31 * hashCode + Objects.hashCode(supplementalSettings());
hashCode = 31 * hashCode + Objects.hashCode(resourceIdentifier());
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 CreateReplicationConfigRequest)) {
return false;
}
CreateReplicationConfigRequest other = (CreateReplicationConfigRequest) obj;
return Objects.equals(replicationConfigIdentifier(), other.replicationConfigIdentifier())
&& Objects.equals(sourceEndpointArn(), other.sourceEndpointArn())
&& Objects.equals(targetEndpointArn(), other.targetEndpointArn())
&& Objects.equals(computeConfig(), other.computeConfig())
&& Objects.equals(replicationTypeAsString(), other.replicationTypeAsString())
&& Objects.equals(tableMappings(), other.tableMappings())
&& Objects.equals(replicationSettings(), other.replicationSettings())
&& Objects.equals(supplementalSettings(), other.supplementalSettings())
&& Objects.equals(resourceIdentifier(), other.resourceIdentifier()) && 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("CreateReplicationConfigRequest")
.add("ReplicationConfigIdentifier", replicationConfigIdentifier()).add("SourceEndpointArn", sourceEndpointArn())
.add("TargetEndpointArn", targetEndpointArn()).add("ComputeConfig", computeConfig())
.add("ReplicationType", replicationTypeAsString()).add("TableMappings", tableMappings())
.add("ReplicationSettings", replicationSettings()).add("SupplementalSettings", supplementalSettings())
.add("ResourceIdentifier", resourceIdentifier()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReplicationConfigIdentifier":
return Optional.ofNullable(clazz.cast(replicationConfigIdentifier()));
case "SourceEndpointArn":
return Optional.ofNullable(clazz.cast(sourceEndpointArn()));
case "TargetEndpointArn":
return Optional.ofNullable(clazz.cast(targetEndpointArn()));
case "ComputeConfig":
return Optional.ofNullable(clazz.cast(computeConfig()));
case "ReplicationType":
return Optional.ofNullable(clazz.cast(replicationTypeAsString()));
case "TableMappings":
return Optional.ofNullable(clazz.cast(tableMappings()));
case "ReplicationSettings":
return Optional.ofNullable(clazz.cast(replicationSettings()));
case "SupplementalSettings":
return Optional.ofNullable(clazz.cast(supplementalSettings()));
case "ResourceIdentifier":
return Optional.ofNullable(clazz.cast(resourceIdentifier()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function