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

software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndexUpdate Maven / Gradle / Ivy

Go to download

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 2.5.20
Show newest version
/*
 * Copyright 2013-2018 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.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.dynamodb.transform.GlobalSecondaryIndexUpdateMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents one of the following: *

*
    *
  • *

    * A new global secondary index to be added to an existing table. *

    *
  • *
  • *

    * New provisioned throughput parameters for an existing global secondary index. *

    *
  • *
  • *

    * An existing global secondary index to be removed from an existing table. *

    *
  • *
*/ @Generated("software.amazon.awssdk:codegen") public final class GlobalSecondaryIndexUpdate implements StructuredPojo, ToCopyableBuilder { private final UpdateGlobalSecondaryIndexAction update; private final CreateGlobalSecondaryIndexAction create; private final DeleteGlobalSecondaryIndexAction delete; private GlobalSecondaryIndexUpdate(BuilderImpl builder) { this.update = builder.update; this.create = builder.create; this.delete = builder.delete; } /** *

* The name of an existing global secondary index, along with new provisioned throughput settings to be applied to * that index. *

* * @return The name of an existing global secondary index, along with new provisioned throughput settings to be * applied to that index. */ public UpdateGlobalSecondaryIndexAction update() { return update; } /** *

* The parameters required for creating a global secondary index on an existing table: *

*
    *
  • *

    * IndexName *

    *
  • *
  • *

    * KeySchema *

    *
  • *
  • *

    * AttributeDefinitions *

    *
  • *
  • *

    * Projection *

    *
  • *
  • *

    * ProvisionedThroughput *

    *
  • *
* * @return The parameters required for creating a global secondary index on an existing table:

*
    *
  • *

    * IndexName *

    *
  • *
  • *

    * KeySchema *

    *
  • *
  • *

    * AttributeDefinitions *

    *
  • *
  • *

    * Projection *

    *
  • *
  • *

    * ProvisionedThroughput *

    *
  • */ public CreateGlobalSecondaryIndexAction create() { return create; } /** *

    * The name of an existing global secondary index to be removed. *

    * * @return The name of an existing global secondary index to be removed. */ public DeleteGlobalSecondaryIndexAction delete() { return delete; } @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 + Objects.hashCode(update()); hashCode = 31 * hashCode + Objects.hashCode(create()); hashCode = 31 * hashCode + Objects.hashCode(delete()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GlobalSecondaryIndexUpdate)) { return false; } GlobalSecondaryIndexUpdate other = (GlobalSecondaryIndexUpdate) obj; return Objects.equals(update(), other.update()) && Objects.equals(create(), other.create()) && Objects.equals(delete(), other.delete()); } @Override public String toString() { return ToString.builder("GlobalSecondaryIndexUpdate").add("Update", update()).add("Create", create()) .add("Delete", delete()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Update": return Optional.ofNullable(clazz.cast(update())); case "Create": return Optional.ofNullable(clazz.cast(create())); case "Delete": return Optional.ofNullable(clazz.cast(delete())); default: return Optional.empty(); } } @SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { GlobalSecondaryIndexUpdateMarshaller.getInstance().marshall(this, protocolMarshaller); } public interface Builder extends CopyableBuilder { /** *

    * The name of an existing global secondary index, along with new provisioned throughput settings to be applied * to that index. *

    * * @param update * The name of an existing global secondary index, along with new provisioned throughput settings to be * applied to that index. * @return Returns a reference to this object so that method calls can be chained together. */ Builder update(UpdateGlobalSecondaryIndexAction update); /** *

    * The name of an existing global secondary index, along with new provisioned throughput settings to be applied * to that index. *

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

    * The parameters required for creating a global secondary index on an existing table: *

    *
      *
    • *

      * IndexName *

      *
    • *
    • *

      * KeySchema *

      *
    • *
    • *

      * AttributeDefinitions *

      *
    • *
    • *

      * Projection *

      *
    • *
    • *

      * ProvisionedThroughput *

      *
    • *
    * * @param create * The parameters required for creating a global secondary index on an existing table:

    *
      *
    • *

      * IndexName *

      *
    • *
    • *

      * KeySchema *

      *
    • *
    • *

      * AttributeDefinitions *

      *
    • *
    • *

      * Projection *

      *
    • *
    • *

      * ProvisionedThroughput *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder create(CreateGlobalSecondaryIndexAction create); /** *

      * The parameters required for creating a global secondary index on an existing table: *

      *
        *
      • *

        * IndexName *

        *
      • *
      • *

        * KeySchema *

        *
      • *
      • *

        * AttributeDefinitions *

        *
      • *
      • *

        * Projection *

        *
      • *
      • *

        * ProvisionedThroughput *

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

      * The name of an existing global secondary index to be removed. *

      * * @param delete * The name of an existing global secondary index to be removed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder delete(DeleteGlobalSecondaryIndexAction delete); /** *

      * The name of an existing global secondary index to be removed. *

      * This is a convenience that creates an instance of the {@link DeleteGlobalSecondaryIndexAction.Builder} * avoiding the need to create one manually via {@link DeleteGlobalSecondaryIndexAction#builder()}. * * When the {@link Consumer} completes, {@link DeleteGlobalSecondaryIndexAction.Builder#build()} is called * immediately and its result is passed to {@link #delete(DeleteGlobalSecondaryIndexAction)}. * * @param delete * a consumer that will call methods on {@link DeleteGlobalSecondaryIndexAction.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #delete(DeleteGlobalSecondaryIndexAction) */ default Builder delete(Consumer delete) { return delete(DeleteGlobalSecondaryIndexAction.builder().applyMutation(delete).build()); } } static final class BuilderImpl implements Builder { private UpdateGlobalSecondaryIndexAction update; private CreateGlobalSecondaryIndexAction create; private DeleteGlobalSecondaryIndexAction delete; private BuilderImpl() { } private BuilderImpl(GlobalSecondaryIndexUpdate model) { update(model.update); create(model.create); delete(model.delete); } public final UpdateGlobalSecondaryIndexAction.Builder getUpdate() { return update != null ? update.toBuilder() : null; } @Override public final Builder update(UpdateGlobalSecondaryIndexAction update) { this.update = update; return this; } public final void setUpdate(UpdateGlobalSecondaryIndexAction.BuilderImpl update) { this.update = update != null ? update.build() : null; } public final CreateGlobalSecondaryIndexAction.Builder getCreate() { return create != null ? create.toBuilder() : null; } @Override public final Builder create(CreateGlobalSecondaryIndexAction create) { this.create = create; return this; } public final void setCreate(CreateGlobalSecondaryIndexAction.BuilderImpl create) { this.create = create != null ? create.build() : null; } public final DeleteGlobalSecondaryIndexAction.Builder getDelete() { return delete != null ? delete.toBuilder() : null; } @Override public final Builder delete(DeleteGlobalSecondaryIndexAction delete) { this.delete = delete; return this; } public final void setDelete(DeleteGlobalSecondaryIndexAction.BuilderImpl delete) { this.delete = delete != null ? delete.build() : null; } @Override public GlobalSecondaryIndexUpdate build() { return new GlobalSecondaryIndexUpdate(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy