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

software.amazon.awssdk.services.redshift.model.ModifyUsageLimitResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Redshift module holds the client classes that are used for communicating with Amazon Redshift Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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.redshift.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.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;

/**
 * 

* Describes a usage limit object for a cluster. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ModifyUsageLimitResponse extends RedshiftResponse implements ToCopyableBuilder { private static final SdkField USAGE_LIMIT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ModifyUsageLimitResponse::usageLimitId)).setter(setter(Builder::usageLimitId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UsageLimitId").build()).build(); private static final SdkField CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ModifyUsageLimitResponse::clusterIdentifier)).setter(setter(Builder::clusterIdentifier)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterIdentifier").build()).build(); private static final SdkField FEATURE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ModifyUsageLimitResponse::featureTypeAsString)).setter(setter(Builder::featureType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FeatureType").build()).build(); private static final SdkField LIMIT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ModifyUsageLimitResponse::limitTypeAsString)).setter(setter(Builder::limitType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LimitType").build()).build(); private static final SdkField AMOUNT_FIELD = SdkField. builder(MarshallingType.LONG) .getter(getter(ModifyUsageLimitResponse::amount)).setter(setter(Builder::amount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Amount").build()).build(); private static final SdkField PERIOD_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ModifyUsageLimitResponse::periodAsString)).setter(setter(Builder::period)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Period").build()).build(); private static final SdkField BREACH_ACTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ModifyUsageLimitResponse::breachActionAsString)).setter(setter(Builder::breachAction)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BreachAction").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ModifyUsageLimitResponse::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(), ListTrait .builder() .memberLocationName("Tag") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Tag").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(USAGE_LIMIT_ID_FIELD, CLUSTER_IDENTIFIER_FIELD, FEATURE_TYPE_FIELD, LIMIT_TYPE_FIELD, AMOUNT_FIELD, PERIOD_FIELD, BREACH_ACTION_FIELD, TAGS_FIELD)); private final String usageLimitId; private final String clusterIdentifier; private final String featureType; private final String limitType; private final Long amount; private final String period; private final String breachAction; private final List tags; private ModifyUsageLimitResponse(BuilderImpl builder) { super(builder); this.usageLimitId = builder.usageLimitId; this.clusterIdentifier = builder.clusterIdentifier; this.featureType = builder.featureType; this.limitType = builder.limitType; this.amount = builder.amount; this.period = builder.period; this.breachAction = builder.breachAction; this.tags = builder.tags; } /** *

* The identifier of the usage limit. *

* * @return The identifier of the usage limit. */ public String usageLimitId() { return usageLimitId; } /** *

* The identifier of the cluster with a usage limit. *

* * @return The identifier of the cluster with a usage limit. */ public String clusterIdentifier() { return clusterIdentifier; } /** *

* The Amazon Redshift feature to which the limit applies. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #featureType} will * return {@link UsageLimitFeatureType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #featureTypeAsString}. *

* * @return The Amazon Redshift feature to which the limit applies. * @see UsageLimitFeatureType */ public UsageLimitFeatureType featureType() { return UsageLimitFeatureType.fromValue(featureType); } /** *

* The Amazon Redshift feature to which the limit applies. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #featureType} will * return {@link UsageLimitFeatureType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #featureTypeAsString}. *

* * @return The Amazon Redshift feature to which the limit applies. * @see UsageLimitFeatureType */ public String featureTypeAsString() { return featureType; } /** *

* The type of limit. Depending on the feature type, this can be based on a time duration or data size. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #limitType} will * return {@link UsageLimitLimitType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #limitTypeAsString}. *

* * @return The type of limit. Depending on the feature type, this can be based on a time duration or data size. * @see UsageLimitLimitType */ public UsageLimitLimitType limitType() { return UsageLimitLimitType.fromValue(limitType); } /** *

* The type of limit. Depending on the feature type, this can be based on a time duration or data size. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #limitType} will * return {@link UsageLimitLimitType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #limitTypeAsString}. *

* * @return The type of limit. Depending on the feature type, this can be based on a time duration or data size. * @see UsageLimitLimitType */ public String limitTypeAsString() { return limitType; } /** *

* The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). *

* * @return The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes * (TB). */ public Long amount() { return amount; } /** *

* The time period that the amount applies to. A weekly period begins on Sunday. The default is * monthly. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #period} will * return {@link UsageLimitPeriod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #periodAsString}. *

* * @return The time period that the amount applies to. A weekly period begins on Sunday. The default is * monthly. * @see UsageLimitPeriod */ public UsageLimitPeriod period() { return UsageLimitPeriod.fromValue(period); } /** *

* The time period that the amount applies to. A weekly period begins on Sunday. The default is * monthly. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #period} will * return {@link UsageLimitPeriod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #periodAsString}. *

* * @return The time period that the amount applies to. A weekly period begins on Sunday. The default is * monthly. * @see UsageLimitPeriod */ public String periodAsString() { return period; } /** *

* The action that Amazon Redshift takes when the limit is reached. Possible values are: *

*
    *
  • *

    * log - To log an event in a system table. The default is log. *

    *
  • *
  • *

    * emit-metric - To emit CloudWatch metrics. *

    *
  • *
  • *

    * disable - To disable the feature until the next usage period begins. *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, {@link #breachAction} will * return {@link UsageLimitBreachAction#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #breachActionAsString}. *

* * @return The action that Amazon Redshift takes when the limit is reached. Possible values are:

*
    *
  • *

    * log - To log an event in a system table. The default is log. *

    *
  • *
  • *

    * emit-metric - To emit CloudWatch metrics. *

    *
  • *
  • *

    * disable - To disable the feature until the next usage period begins. *

    *
  • * @see UsageLimitBreachAction */ public UsageLimitBreachAction breachAction() { return UsageLimitBreachAction.fromValue(breachAction); } /** *

    * The action that Amazon Redshift takes when the limit is reached. Possible values are: *

    *
      *
    • *

      * log - To log an event in a system table. The default is log. *

      *
    • *
    • *

      * emit-metric - To emit CloudWatch metrics. *

      *
    • *
    • *

      * disable - To disable the feature until the next usage period begins. *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #breachAction} will * return {@link UsageLimitBreachAction#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #breachActionAsString}. *

    * * @return The action that Amazon Redshift takes when the limit is reached. Possible values are:

    *
      *
    • *

      * log - To log an event in a system table. The default is log. *

      *
    • *
    • *

      * emit-metric - To emit CloudWatch metrics. *

      *
    • *
    • *

      * disable - To disable the feature until the next usage period begins. *

      *
    • * @see UsageLimitBreachAction */ public String breachActionAsString() { return breachAction; } /** * Returns true if the Tags 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 hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

      * A list of tag instances. *

      *

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

      *

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

      * * @return A list of tag instances. */ public List tags() { return tags; } @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(usageLimitId()); hashCode = 31 * hashCode + Objects.hashCode(clusterIdentifier()); hashCode = 31 * hashCode + Objects.hashCode(featureTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(limitTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(amount()); hashCode = 31 * hashCode + Objects.hashCode(periodAsString()); hashCode = 31 * hashCode + Objects.hashCode(breachActionAsString()); hashCode = 31 * hashCode + Objects.hashCode(tags()); 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 ModifyUsageLimitResponse)) { return false; } ModifyUsageLimitResponse other = (ModifyUsageLimitResponse) obj; return Objects.equals(usageLimitId(), other.usageLimitId()) && Objects.equals(clusterIdentifier(), other.clusterIdentifier()) && Objects.equals(featureTypeAsString(), other.featureTypeAsString()) && Objects.equals(limitTypeAsString(), other.limitTypeAsString()) && Objects.equals(amount(), other.amount()) && Objects.equals(periodAsString(), other.periodAsString()) && Objects.equals(breachActionAsString(), other.breachActionAsString()) && 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 String toString() { return ToString.builder("ModifyUsageLimitResponse").add("UsageLimitId", usageLimitId()) .add("ClusterIdentifier", clusterIdentifier()).add("FeatureType", featureTypeAsString()) .add("LimitType", limitTypeAsString()).add("Amount", amount()).add("Period", periodAsString()) .add("BreachAction", breachActionAsString()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "UsageLimitId": return Optional.ofNullable(clazz.cast(usageLimitId())); case "ClusterIdentifier": return Optional.ofNullable(clazz.cast(clusterIdentifier())); case "FeatureType": return Optional.ofNullable(clazz.cast(featureTypeAsString())); case "LimitType": return Optional.ofNullable(clazz.cast(limitTypeAsString())); case "Amount": return Optional.ofNullable(clazz.cast(amount())); case "Period": return Optional.ofNullable(clazz.cast(periodAsString())); case "BreachAction": return Optional.ofNullable(clazz.cast(breachActionAsString())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ModifyUsageLimitResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends RedshiftResponse.Builder, SdkPojo, CopyableBuilder { /** *

      * The identifier of the usage limit. *

      * * @param usageLimitId * The identifier of the usage limit. * @return Returns a reference to this object so that method calls can be chained together. */ Builder usageLimitId(String usageLimitId); /** *

      * The identifier of the cluster with a usage limit. *

      * * @param clusterIdentifier * The identifier of the cluster with a usage limit. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clusterIdentifier(String clusterIdentifier); /** *

      * The Amazon Redshift feature to which the limit applies. *

      * * @param featureType * The Amazon Redshift feature to which the limit applies. * @see UsageLimitFeatureType * @return Returns a reference to this object so that method calls can be chained together. * @see UsageLimitFeatureType */ Builder featureType(String featureType); /** *

      * The Amazon Redshift feature to which the limit applies. *

      * * @param featureType * The Amazon Redshift feature to which the limit applies. * @see UsageLimitFeatureType * @return Returns a reference to this object so that method calls can be chained together. * @see UsageLimitFeatureType */ Builder featureType(UsageLimitFeatureType featureType); /** *

      * The type of limit. Depending on the feature type, this can be based on a time duration or data size. *

      * * @param limitType * The type of limit. Depending on the feature type, this can be based on a time duration or data size. * @see UsageLimitLimitType * @return Returns a reference to this object so that method calls can be chained together. * @see UsageLimitLimitType */ Builder limitType(String limitType); /** *

      * The type of limit. Depending on the feature type, this can be based on a time duration or data size. *

      * * @param limitType * The type of limit. Depending on the feature type, this can be based on a time duration or data size. * @see UsageLimitLimitType * @return Returns a reference to this object so that method calls can be chained together. * @see UsageLimitLimitType */ Builder limitType(UsageLimitLimitType limitType); /** *

      * The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). *

      * * @param amount * The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes * (TB). * @return Returns a reference to this object so that method calls can be chained together. */ Builder amount(Long amount); /** *

      * The time period that the amount applies to. A weekly period begins on Sunday. The default is * monthly. *

      * * @param period * The time period that the amount applies to. A weekly period begins on Sunday. The default * is monthly. * @see UsageLimitPeriod * @return Returns a reference to this object so that method calls can be chained together. * @see UsageLimitPeriod */ Builder period(String period); /** *

      * The time period that the amount applies to. A weekly period begins on Sunday. The default is * monthly. *

      * * @param period * The time period that the amount applies to. A weekly period begins on Sunday. The default * is monthly. * @see UsageLimitPeriod * @return Returns a reference to this object so that method calls can be chained together. * @see UsageLimitPeriod */ Builder period(UsageLimitPeriod period); /** *

      * The action that Amazon Redshift takes when the limit is reached. Possible values are: *

      *
        *
      • *

        * log - To log an event in a system table. The default is log. *

        *
      • *
      • *

        * emit-metric - To emit CloudWatch metrics. *

        *
      • *
      • *

        * disable - To disable the feature until the next usage period begins. *

        *
      • *
      * * @param breachAction * The action that Amazon Redshift takes when the limit is reached. Possible values are:

      *
        *
      • *

        * log - To log an event in a system table. The default is log. *

        *
      • *
      • *

        * emit-metric - To emit CloudWatch metrics. *

        *
      • *
      • *

        * disable - To disable the feature until the next usage period begins. *

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

        * The action that Amazon Redshift takes when the limit is reached. Possible values are: *

        *
          *
        • *

          * log - To log an event in a system table. The default is log. *

          *
        • *
        • *

          * emit-metric - To emit CloudWatch metrics. *

          *
        • *
        • *

          * disable - To disable the feature until the next usage period begins. *

          *
        • *
        * * @param breachAction * The action that Amazon Redshift takes when the limit is reached. Possible values are:

        *
          *
        • *

          * log - To log an event in a system table. The default is log. *

          *
        • *
        • *

          * emit-metric - To emit CloudWatch metrics. *

          *
        • *
        • *

          * disable - To disable the feature until the next usage period begins. *

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

          * A list of tag instances. *

          * * @param tags * A list of tag instances. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

          * A list of tag instances. *

          * * @param tags * A list of tag instances. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

          * A list of tag instances. *

          * 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 #tags(List)}. * * @param tags * 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 #tags(List) */ Builder tags(Consumer... tags); } static final class BuilderImpl extends RedshiftResponse.BuilderImpl implements Builder { private String usageLimitId; private String clusterIdentifier; private String featureType; private String limitType; private Long amount; private String period; private String breachAction; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ModifyUsageLimitResponse model) { super(model); usageLimitId(model.usageLimitId); clusterIdentifier(model.clusterIdentifier); featureType(model.featureType); limitType(model.limitType); amount(model.amount); period(model.period); breachAction(model.breachAction); tags(model.tags); } public final String getUsageLimitId() { return usageLimitId; } @Override public final Builder usageLimitId(String usageLimitId) { this.usageLimitId = usageLimitId; return this; } public final void setUsageLimitId(String usageLimitId) { this.usageLimitId = usageLimitId; } public final String getClusterIdentifier() { return clusterIdentifier; } @Override public final Builder clusterIdentifier(String clusterIdentifier) { this.clusterIdentifier = clusterIdentifier; return this; } public final void setClusterIdentifier(String clusterIdentifier) { this.clusterIdentifier = clusterIdentifier; } public final String getFeatureType() { return featureType; } @Override public final Builder featureType(String featureType) { this.featureType = featureType; return this; } @Override public final Builder featureType(UsageLimitFeatureType featureType) { this.featureType(featureType == null ? null : featureType.toString()); return this; } public final void setFeatureType(String featureType) { this.featureType = featureType; } public final String getLimitType() { return limitType; } @Override public final Builder limitType(String limitType) { this.limitType = limitType; return this; } @Override public final Builder limitType(UsageLimitLimitType limitType) { this.limitType(limitType == null ? null : limitType.toString()); return this; } public final void setLimitType(String limitType) { this.limitType = limitType; } public final Long getAmount() { return amount; } @Override public final Builder amount(Long amount) { this.amount = amount; return this; } public final void setAmount(Long amount) { this.amount = amount; } public final String getPeriod() { return period; } @Override public final Builder period(String period) { this.period = period; return this; } @Override public final Builder period(UsageLimitPeriod period) { this.period(period == null ? null : period.toString()); return this; } public final void setPeriod(String period) { this.period = period; } public final String getBreachAction() { return breachAction; } @Override public final Builder breachAction(String breachAction) { this.breachAction = breachAction; return this; } @Override public final Builder breachAction(UsageLimitBreachAction breachAction) { this.breachAction(breachAction == null ? null : breachAction.toString()); return this; } public final void setBreachAction(String breachAction) { this.breachAction = breachAction; } public final Collection getTags() { return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public ModifyUsageLimitResponse build() { return new ModifyUsageLimitResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy