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

software.amazon.awssdk.services.costexplorer.model.DimensionValues Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.costexplorer.model;

import java.beans.Transient;
import java.io.Serializable;
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.Function;
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;

/**
 * 

* The metadata that you can use to filter and group your results. You can use GetDimensionValues to find * specific values. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DimensionValues implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key") .getter(getter(DimensionValues::keyAsString)).setter(setter(Builder::key)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Key").build()).build(); private static final SdkField> VALUES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Values") .getter(getter(DimensionValues::values)) .setter(setter(Builder::values)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Values").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> MATCH_OPTIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("MatchOptions") .getter(getter(DimensionValues::matchOptionsAsStrings)) .setter(setter(Builder::matchOptionsWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchOptions").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(KEY_FIELD, VALUES_FIELD, MATCH_OPTIONS_FIELD)); private static final long serialVersionUID = 1L; private final String key; private final List values; private final List matchOptions; private DimensionValues(BuilderImpl builder) { this.key = builder.key; this.values = builder.values; this.matchOptions = builder.matchOptions; } /** *

* The names of the metadata types that you can use to filter and group your results. For example, AZ * returns a list of Availability Zones. *

*

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

* * @return The names of the metadata types that you can use to filter and group your results. For example, * AZ returns a list of Availability Zones. * @see Dimension */ public final Dimension key() { return Dimension.fromValue(key); } /** *

* The names of the metadata types that you can use to filter and group your results. For example, AZ * returns a list of Availability Zones. *

*

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

* * @return The names of the metadata types that you can use to filter and group your results. For example, * AZ returns a list of Availability Zones. * @see Dimension */ public final String keyAsString() { return key; } /** * Returns true if the Values 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 final boolean hasValues() { return values != null && !(values instanceof SdkAutoConstructList); } /** *

* The metadata values that you can use to filter and group your results. You can use * GetDimensionValues to find specific values. *

*

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

*

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

* * @return The metadata values that you can use to filter and group your results. You can use * GetDimensionValues to find specific values. */ public final List values() { return values; } /** *

* The match options that you can use to filter your results. MatchOptions is only applicable for * actions related to Cost Category. The default values for MatchOptions are EQUALS and * CASE_SENSITIVE. *

*

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

*

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

* * @return The match options that you can use to filter your results. MatchOptions is only applicable * for actions related to Cost Category. The default values for MatchOptions are * EQUALS and CASE_SENSITIVE. */ public final List matchOptions() { return MatchOptionsCopier.copyStringToEnum(matchOptions); } /** * Returns true if the MatchOptions 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 final boolean hasMatchOptions() { return matchOptions != null && !(matchOptions instanceof SdkAutoConstructList); } /** *

* The match options that you can use to filter your results. MatchOptions is only applicable for * actions related to Cost Category. The default values for MatchOptions are EQUALS and * CASE_SENSITIVE. *

*

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

*

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

* * @return The match options that you can use to filter your results. MatchOptions is only applicable * for actions related to Cost Category. The default values for MatchOptions are * EQUALS and CASE_SENSITIVE. */ public final List matchOptionsAsStrings() { return matchOptions; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(keyAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasValues() ? values() : null); hashCode = 31 * hashCode + Objects.hashCode(hasMatchOptions() ? matchOptionsAsStrings() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DimensionValues)) { return false; } DimensionValues other = (DimensionValues) obj; return Objects.equals(keyAsString(), other.keyAsString()) && hasValues() == other.hasValues() && Objects.equals(values(), other.values()) && hasMatchOptions() == other.hasMatchOptions() && Objects.equals(matchOptionsAsStrings(), other.matchOptionsAsStrings()); } /** * 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("DimensionValues").add("Key", keyAsString()).add("Values", hasValues() ? values() : null) .add("MatchOptions", hasMatchOptions() ? matchOptionsAsStrings() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Key": return Optional.ofNullable(clazz.cast(keyAsString())); case "Values": return Optional.ofNullable(clazz.cast(values())); case "MatchOptions": return Optional.ofNullable(clazz.cast(matchOptionsAsStrings())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DimensionValues) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The names of the metadata types that you can use to filter and group your results. For example, * AZ returns a list of Availability Zones. *

* * @param key * The names of the metadata types that you can use to filter and group your results. For example, * AZ returns a list of Availability Zones. * @see Dimension * @return Returns a reference to this object so that method calls can be chained together. * @see Dimension */ Builder key(String key); /** *

* The names of the metadata types that you can use to filter and group your results. For example, * AZ returns a list of Availability Zones. *

* * @param key * The names of the metadata types that you can use to filter and group your results. For example, * AZ returns a list of Availability Zones. * @see Dimension * @return Returns a reference to this object so that method calls can be chained together. * @see Dimension */ Builder key(Dimension key); /** *

* The metadata values that you can use to filter and group your results. You can use * GetDimensionValues to find specific values. *

* * @param values * The metadata values that you can use to filter and group your results. You can use * GetDimensionValues to find specific values. * @return Returns a reference to this object so that method calls can be chained together. */ Builder values(Collection values); /** *

* The metadata values that you can use to filter and group your results. You can use * GetDimensionValues to find specific values. *

* * @param values * The metadata values that you can use to filter and group your results. You can use * GetDimensionValues to find specific values. * @return Returns a reference to this object so that method calls can be chained together. */ Builder values(String... values); /** *

* The match options that you can use to filter your results. MatchOptions is only applicable for * actions related to Cost Category. The default values for MatchOptions are EQUALS * and CASE_SENSITIVE. *

* * @param matchOptions * The match options that you can use to filter your results. MatchOptions is only * applicable for actions related to Cost Category. The default values for MatchOptions are * EQUALS and CASE_SENSITIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchOptionsWithStrings(Collection matchOptions); /** *

* The match options that you can use to filter your results. MatchOptions is only applicable for * actions related to Cost Category. The default values for MatchOptions are EQUALS * and CASE_SENSITIVE. *

* * @param matchOptions * The match options that you can use to filter your results. MatchOptions is only * applicable for actions related to Cost Category. The default values for MatchOptions are * EQUALS and CASE_SENSITIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchOptionsWithStrings(String... matchOptions); /** *

* The match options that you can use to filter your results. MatchOptions is only applicable for * actions related to Cost Category. The default values for MatchOptions are EQUALS * and CASE_SENSITIVE. *

* * @param matchOptions * The match options that you can use to filter your results. MatchOptions is only * applicable for actions related to Cost Category. The default values for MatchOptions are * EQUALS and CASE_SENSITIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchOptions(Collection matchOptions); /** *

* The match options that you can use to filter your results. MatchOptions is only applicable for * actions related to Cost Category. The default values for MatchOptions are EQUALS * and CASE_SENSITIVE. *

* * @param matchOptions * The match options that you can use to filter your results. MatchOptions is only * applicable for actions related to Cost Category. The default values for MatchOptions are * EQUALS and CASE_SENSITIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchOptions(MatchOption... matchOptions); } static final class BuilderImpl implements Builder { private String key; private List values = DefaultSdkAutoConstructList.getInstance(); private List matchOptions = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(DimensionValues model) { key(model.key); values(model.values); matchOptionsWithStrings(model.matchOptions); } public final String getKey() { return key; } public final void setKey(String key) { this.key = key; } @Override @Transient public final Builder key(String key) { this.key = key; return this; } @Override @Transient public final Builder key(Dimension key) { this.key(key == null ? null : key.toString()); return this; } public final Collection getValues() { if (values instanceof SdkAutoConstructList) { return null; } return values; } public final void setValues(Collection values) { this.values = ValuesCopier.copy(values); } @Override @Transient public final Builder values(Collection values) { this.values = ValuesCopier.copy(values); return this; } @Override @Transient @SafeVarargs public final Builder values(String... values) { values(Arrays.asList(values)); return this; } public final Collection getMatchOptions() { if (matchOptions instanceof SdkAutoConstructList) { return null; } return matchOptions; } public final void setMatchOptions(Collection matchOptions) { this.matchOptions = MatchOptionsCopier.copy(matchOptions); } @Override @Transient public final Builder matchOptionsWithStrings(Collection matchOptions) { this.matchOptions = MatchOptionsCopier.copy(matchOptions); return this; } @Override @Transient @SafeVarargs public final Builder matchOptionsWithStrings(String... matchOptions) { matchOptionsWithStrings(Arrays.asList(matchOptions)); return this; } @Override @Transient public final Builder matchOptions(Collection matchOptions) { this.matchOptions = MatchOptionsCopier.copyEnumToString(matchOptions); return this; } @Override @Transient @SafeVarargs public final Builder matchOptions(MatchOption... matchOptions) { matchOptions(Arrays.asList(matchOptions)); return this; } @Override public DimensionValues build() { return new DimensionValues(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy