All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.dynamodb.model.UpdateTableReplicaAutoScalingRequest 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.dynamodb.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 UpdateTableReplicaAutoScalingRequest extends DynamoDbRequest implements
        ToCopyableBuilder {
    private static final SdkField> GLOBAL_SECONDARY_INDEX_UPDATES_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("GlobalSecondaryIndexUpdates")
            .getter(getter(UpdateTableReplicaAutoScalingRequest::globalSecondaryIndexUpdates))
            .setter(setter(Builder::globalSecondaryIndexUpdates))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalSecondaryIndexUpdates")
                    .build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(GlobalSecondaryIndexAutoScalingUpdate::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("TableName").getter(getter(UpdateTableReplicaAutoScalingRequest::tableName))
            .setter(setter(Builder::tableName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableName").build()).build();

    private static final SdkField PROVISIONED_WRITE_CAPACITY_AUTO_SCALING_UPDATE_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO)
            .memberName("ProvisionedWriteCapacityAutoScalingUpdate")
            .getter(getter(UpdateTableReplicaAutoScalingRequest::provisionedWriteCapacityAutoScalingUpdate))
            .setter(setter(Builder::provisionedWriteCapacityAutoScalingUpdate))
            .constructor(AutoScalingSettingsUpdate::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                    .locationName("ProvisionedWriteCapacityAutoScalingUpdate").build()).build();

    private static final SdkField> REPLICA_UPDATES_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("ReplicaUpdates")
            .getter(getter(UpdateTableReplicaAutoScalingRequest::replicaUpdates))
            .setter(setter(Builder::replicaUpdates))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicaUpdates").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(ReplicaAutoScalingUpdate::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
            GLOBAL_SECONDARY_INDEX_UPDATES_FIELD, TABLE_NAME_FIELD, PROVISIONED_WRITE_CAPACITY_AUTO_SCALING_UPDATE_FIELD,
            REPLICA_UPDATES_FIELD));

    private final List globalSecondaryIndexUpdates;

    private final String tableName;

    private final AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate;

    private final List replicaUpdates;

    private UpdateTableReplicaAutoScalingRequest(BuilderImpl builder) {
        super(builder);
        this.globalSecondaryIndexUpdates = builder.globalSecondaryIndexUpdates;
        this.tableName = builder.tableName;
        this.provisionedWriteCapacityAutoScalingUpdate = builder.provisionedWriteCapacityAutoScalingUpdate;
        this.replicaUpdates = builder.replicaUpdates;
    }

    /**
     * Returns true if the GlobalSecondaryIndexUpdates property was specified by the sender (it may be empty), or false
     * if the sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the
     * AWS service.
     */
    public boolean hasGlobalSecondaryIndexUpdates() {
        return globalSecondaryIndexUpdates != null && !(globalSecondaryIndexUpdates instanceof SdkAutoConstructList);
    }

    /**
     * 

* Represents the auto scaling settings of the global secondary indexes of the replica to be updated. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasGlobalSecondaryIndexUpdates()} to see if a value was sent in this field. *

* * @return Represents the auto scaling settings of the global secondary indexes of the replica to be updated. */ public List globalSecondaryIndexUpdates() { return globalSecondaryIndexUpdates; } /** *

* The name of the global table to be updated. *

* * @return The name of the global table to be updated. */ public String tableName() { return tableName; } /** * Returns the value of the ProvisionedWriteCapacityAutoScalingUpdate property for this object. * * @return The value of the ProvisionedWriteCapacityAutoScalingUpdate property for this object. */ public AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate() { return provisionedWriteCapacityAutoScalingUpdate; } /** * Returns true if the ReplicaUpdates property was specified by the sender (it may be empty), or false if the sender * did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasReplicaUpdates() { return replicaUpdates != null && !(replicaUpdates instanceof SdkAutoConstructList); } /** *

* Represents the auto scaling settings of replicas of the table that will be modified. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasReplicaUpdates()} to see if a value was sent in this field. *

* * @return Represents the auto scaling settings of replicas of the table that will be modified. */ public List replicaUpdates() { return replicaUpdates; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(hasGlobalSecondaryIndexUpdates() ? globalSecondaryIndexUpdates() : null); hashCode = 31 * hashCode + Objects.hashCode(tableName()); hashCode = 31 * hashCode + Objects.hashCode(provisionedWriteCapacityAutoScalingUpdate()); hashCode = 31 * hashCode + Objects.hashCode(hasReplicaUpdates() ? replicaUpdates() : null); return hashCode; } @Override public boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof UpdateTableReplicaAutoScalingRequest)) { return false; } UpdateTableReplicaAutoScalingRequest other = (UpdateTableReplicaAutoScalingRequest) obj; return hasGlobalSecondaryIndexUpdates() == other.hasGlobalSecondaryIndexUpdates() && Objects.equals(globalSecondaryIndexUpdates(), other.globalSecondaryIndexUpdates()) && Objects.equals(tableName(), other.tableName()) && Objects.equals(provisionedWriteCapacityAutoScalingUpdate(), other.provisionedWriteCapacityAutoScalingUpdate()) && hasReplicaUpdates() == other.hasReplicaUpdates() && Objects.equals(replicaUpdates(), other.replicaUpdates()); } /** * 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 String toString() { return ToString.builder("UpdateTableReplicaAutoScalingRequest") .add("GlobalSecondaryIndexUpdates", hasGlobalSecondaryIndexUpdates() ? globalSecondaryIndexUpdates() : null) .add("TableName", tableName()) .add("ProvisionedWriteCapacityAutoScalingUpdate", provisionedWriteCapacityAutoScalingUpdate()) .add("ReplicaUpdates", hasReplicaUpdates() ? replicaUpdates() : null).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "GlobalSecondaryIndexUpdates": return Optional.ofNullable(clazz.cast(globalSecondaryIndexUpdates())); case "TableName": return Optional.ofNullable(clazz.cast(tableName())); case "ProvisionedWriteCapacityAutoScalingUpdate": return Optional.ofNullable(clazz.cast(provisionedWriteCapacityAutoScalingUpdate())); case "ReplicaUpdates": return Optional.ofNullable(clazz.cast(replicaUpdates())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((UpdateTableReplicaAutoScalingRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends DynamoDbRequest.Builder, SdkPojo, CopyableBuilder { /** *

* Represents the auto scaling settings of the global secondary indexes of the replica to be updated. *

* * @param globalSecondaryIndexUpdates * Represents the auto scaling settings of the global secondary indexes of the replica to be updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder globalSecondaryIndexUpdates(Collection globalSecondaryIndexUpdates); /** *

* Represents the auto scaling settings of the global secondary indexes of the replica to be updated. *

* * @param globalSecondaryIndexUpdates * Represents the auto scaling settings of the global secondary indexes of the replica to be updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder globalSecondaryIndexUpdates(GlobalSecondaryIndexAutoScalingUpdate... globalSecondaryIndexUpdates); /** *

* Represents the auto scaling settings of the global secondary indexes of the replica to be updated. *

* This is a convenience that creates an instance of the {@link List * .Builder} avoiding the need to create one manually via {@link List * #builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is * called immediately and its result is passed to {@link * #globalSecondaryIndexUpdates(List)}. * * @param globalSecondaryIndexUpdates * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #globalSecondaryIndexUpdates(List) */ Builder globalSecondaryIndexUpdates( Consumer... globalSecondaryIndexUpdates); /** *

* The name of the global table to be updated. *

* * @param tableName * The name of the global table to be updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tableName(String tableName); /** * Sets the value of the ProvisionedWriteCapacityAutoScalingUpdate property for this object. * * @param provisionedWriteCapacityAutoScalingUpdate * The new value for the ProvisionedWriteCapacityAutoScalingUpdate property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder provisionedWriteCapacityAutoScalingUpdate(AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate); /** * Sets the value of the ProvisionedWriteCapacityAutoScalingUpdate property for this object. * * This is a convenience that creates an instance of the {@link AutoScalingSettingsUpdate.Builder} avoiding the * need to create one manually via {@link AutoScalingSettingsUpdate#builder()}. * * When the {@link Consumer} completes, {@link AutoScalingSettingsUpdate.Builder#build()} is called immediately * and its result is passed to {@link #provisionedWriteCapacityAutoScalingUpdate(AutoScalingSettingsUpdate)}. * * @param provisionedWriteCapacityAutoScalingUpdate * a consumer that will call methods on {@link AutoScalingSettingsUpdate.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #provisionedWriteCapacityAutoScalingUpdate(AutoScalingSettingsUpdate) */ default Builder provisionedWriteCapacityAutoScalingUpdate( Consumer provisionedWriteCapacityAutoScalingUpdate) { return provisionedWriteCapacityAutoScalingUpdate(AutoScalingSettingsUpdate.builder() .applyMutation(provisionedWriteCapacityAutoScalingUpdate).build()); } /** *

* Represents the auto scaling settings of replicas of the table that will be modified. *

* * @param replicaUpdates * Represents the auto scaling settings of replicas of the table that will be modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaUpdates(Collection replicaUpdates); /** *

* Represents the auto scaling settings of replicas of the table that will be modified. *

* * @param replicaUpdates * Represents the auto scaling settings of replicas of the table that will be modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaUpdates(ReplicaAutoScalingUpdate... replicaUpdates); /** *

* Represents the auto scaling settings of replicas of the table that will be modified. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding * the need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called * immediately and its result is passed to {@link #replicaUpdates(List)}. * * @param replicaUpdates * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #replicaUpdates(List) */ Builder replicaUpdates(Consumer... replicaUpdates); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends DynamoDbRequest.BuilderImpl implements Builder { private List globalSecondaryIndexUpdates = DefaultSdkAutoConstructList .getInstance(); private String tableName; private AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate; private List replicaUpdates = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(UpdateTableReplicaAutoScalingRequest model) { super(model); globalSecondaryIndexUpdates(model.globalSecondaryIndexUpdates); tableName(model.tableName); provisionedWriteCapacityAutoScalingUpdate(model.provisionedWriteCapacityAutoScalingUpdate); replicaUpdates(model.replicaUpdates); } public final Collection getGlobalSecondaryIndexUpdates() { if (globalSecondaryIndexUpdates instanceof SdkAutoConstructList) { return null; } return globalSecondaryIndexUpdates != null ? globalSecondaryIndexUpdates.stream() .map(GlobalSecondaryIndexAutoScalingUpdate::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder globalSecondaryIndexUpdates( Collection globalSecondaryIndexUpdates) { this.globalSecondaryIndexUpdates = GlobalSecondaryIndexAutoScalingUpdateListCopier.copy(globalSecondaryIndexUpdates); return this; } @Override @SafeVarargs public final Builder globalSecondaryIndexUpdates(GlobalSecondaryIndexAutoScalingUpdate... globalSecondaryIndexUpdates) { globalSecondaryIndexUpdates(Arrays.asList(globalSecondaryIndexUpdates)); return this; } @Override @SafeVarargs public final Builder globalSecondaryIndexUpdates( Consumer... globalSecondaryIndexUpdates) { globalSecondaryIndexUpdates(Stream.of(globalSecondaryIndexUpdates) .map(c -> GlobalSecondaryIndexAutoScalingUpdate.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setGlobalSecondaryIndexUpdates( Collection globalSecondaryIndexUpdates) { this.globalSecondaryIndexUpdates = GlobalSecondaryIndexAutoScalingUpdateListCopier .copyFromBuilder(globalSecondaryIndexUpdates); } public final String getTableName() { return tableName; } @Override public final Builder tableName(String tableName) { this.tableName = tableName; return this; } public final void setTableName(String tableName) { this.tableName = tableName; } public final AutoScalingSettingsUpdate.Builder getProvisionedWriteCapacityAutoScalingUpdate() { return provisionedWriteCapacityAutoScalingUpdate != null ? provisionedWriteCapacityAutoScalingUpdate.toBuilder() : null; } @Override public final Builder provisionedWriteCapacityAutoScalingUpdate( AutoScalingSettingsUpdate provisionedWriteCapacityAutoScalingUpdate) { this.provisionedWriteCapacityAutoScalingUpdate = provisionedWriteCapacityAutoScalingUpdate; return this; } public final void setProvisionedWriteCapacityAutoScalingUpdate( AutoScalingSettingsUpdate.BuilderImpl provisionedWriteCapacityAutoScalingUpdate) { this.provisionedWriteCapacityAutoScalingUpdate = provisionedWriteCapacityAutoScalingUpdate != null ? provisionedWriteCapacityAutoScalingUpdate .build() : null; } public final Collection getReplicaUpdates() { if (replicaUpdates instanceof SdkAutoConstructList) { return null; } return replicaUpdates != null ? replicaUpdates.stream().map(ReplicaAutoScalingUpdate::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder replicaUpdates(Collection replicaUpdates) { this.replicaUpdates = ReplicaAutoScalingUpdateListCopier.copy(replicaUpdates); return this; } @Override @SafeVarargs public final Builder replicaUpdates(ReplicaAutoScalingUpdate... replicaUpdates) { replicaUpdates(Arrays.asList(replicaUpdates)); return this; } @Override @SafeVarargs public final Builder replicaUpdates(Consumer... replicaUpdates) { replicaUpdates(Stream.of(replicaUpdates).map(c -> ReplicaAutoScalingUpdate.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setReplicaUpdates(Collection replicaUpdates) { this.replicaUpdates = ReplicaAutoScalingUpdateListCopier.copyFromBuilder(replicaUpdates); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public UpdateTableReplicaAutoScalingRequest build() { return new UpdateTableReplicaAutoScalingRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy