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

software.amazon.awssdk.services.marketplaceentitlement.model.GetEntitlementsRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Marketplace Entitlement module holds the client classes that are used for communicating with AWS Marketplace Entitlement 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.marketplaceentitlement.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 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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The GetEntitlementsRequest contains parameters for the GetEntitlements operation. *

*/ @Generated("software.amazon.awssdk:codegen") public final class GetEntitlementsRequest extends MarketplaceEntitlementRequest implements ToCopyableBuilder { private static final SdkField PRODUCT_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ProductCode").getter(getter(GetEntitlementsRequest::productCode)).setter(setter(Builder::productCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProductCode").build()).build(); private static final SdkField>> FILTER_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("Filter") .getter(getter(GetEntitlementsRequest::filterAsStrings)) .setter(setter(Builder::filterWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Filter").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("NextToken").getter(getter(GetEntitlementsRequest::nextToken)).setter(setter(Builder::nextToken)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextToken").build()).build(); private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("MaxResults").getter(getter(GetEntitlementsRequest::maxResults)).setter(setter(Builder::maxResults)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PRODUCT_CODE_FIELD, FILTER_FIELD, NEXT_TOKEN_FIELD, MAX_RESULTS_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("ProductCode", PRODUCT_CODE_FIELD); put("Filter", FILTER_FIELD); put("NextToken", NEXT_TOKEN_FIELD); put("MaxResults", MAX_RESULTS_FIELD); } }); private final String productCode; private final Map> filter; private final String nextToken; private final Integer maxResults; private GetEntitlementsRequest(BuilderImpl builder) { super(builder); this.productCode = builder.productCode; this.filter = builder.filter; this.nextToken = builder.nextToken; this.maxResults = builder.maxResults; } /** *

* Product code is used to uniquely identify a product in AWS Marketplace. The product code will be provided by AWS * Marketplace when the product listing is created. *

* * @return Product code is used to uniquely identify a product in AWS Marketplace. The product code will be provided * by AWS Marketplace when the product listing is created. */ public final String productCode() { return productCode; } /** *

* Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described * as keys mapped to a lists of values. Filtered requests are unioned for each value in the value list, and * then intersected for each filter key. *

*

* 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 #hasFilter} method. *

* * @return Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are * described as keys mapped to a lists of values. Filtered requests are unioned for each value in the * value list, and then intersected for each filter key. */ public final Map> filter() { return GetEntitlementFiltersCopier.copyStringToEnum(filter); } /** * For responses, this returns true if the service returned a value for the Filter 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 hasFilter() { return filter != null && !(filter instanceof SdkAutoConstructMap); } /** *

* Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described * as keys mapped to a lists of values. Filtered requests are unioned for each value in the value list, and * then intersected for each filter key. *

*

* 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 #hasFilter} method. *

* * @return Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are * described as keys mapped to a lists of values. Filtered requests are unioned for each value in the * value list, and then intersected for each filter key. */ public final Map> filterAsStrings() { return filter; } /** *

* For paginated calls to GetEntitlements, pass the NextToken from the previous GetEntitlementsResult. *

* * @return For paginated calls to GetEntitlements, pass the NextToken from the previous GetEntitlementsResult. */ public final String nextToken() { return nextToken; } /** *

* The maximum number of items to retrieve from the GetEntitlements operation. For pagination, use the NextToken * field in subsequent calls to GetEntitlements. *

* * @return The maximum number of items to retrieve from the GetEntitlements operation. For pagination, use the * NextToken field in subsequent calls to GetEntitlements. */ public final Integer maxResults() { return maxResults; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(productCode()); hashCode = 31 * hashCode + Objects.hashCode(hasFilter() ? filterAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(nextToken()); hashCode = 31 * hashCode + Objects.hashCode(maxResults()); 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 GetEntitlementsRequest)) { return false; } GetEntitlementsRequest other = (GetEntitlementsRequest) obj; return Objects.equals(productCode(), other.productCode()) && hasFilter() == other.hasFilter() && Objects.equals(filterAsStrings(), other.filterAsStrings()) && Objects.equals(nextToken(), other.nextToken()) && Objects.equals(maxResults(), other.maxResults()); } /** * 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("GetEntitlementsRequest").add("ProductCode", productCode()) .add("Filter", hasFilter() ? filterAsStrings() : null).add("NextToken", nextToken()) .add("MaxResults", maxResults()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ProductCode": return Optional.ofNullable(clazz.cast(productCode())); case "Filter": return Optional.ofNullable(clazz.cast(filterAsStrings())); case "NextToken": return Optional.ofNullable(clazz.cast(nextToken())); case "MaxResults": return Optional.ofNullable(clazz.cast(maxResults())); 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 getter(Function g) { return obj -> g.apply((GetEntitlementsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MarketplaceEntitlementRequest.Builder, SdkPojo, CopyableBuilder { /** *

* Product code is used to uniquely identify a product in AWS Marketplace. The product code will be provided by * AWS Marketplace when the product listing is created. *

* * @param productCode * Product code is used to uniquely identify a product in AWS Marketplace. The product code will be * provided by AWS Marketplace when the product listing is created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder productCode(String productCode); /** *

* Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are * described as keys mapped to a lists of values. Filtered requests are unioned for each value in the * value list, and then intersected for each filter key. *

* * @param filter * Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are * described as keys mapped to a lists of values. Filtered requests are unioned for each value in * the value list, and then intersected for each filter key. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filterWithStrings(Map> filter); /** *

* Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are * described as keys mapped to a lists of values. Filtered requests are unioned for each value in the * value list, and then intersected for each filter key. *

* * @param filter * Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are * described as keys mapped to a lists of values. Filtered requests are unioned for each value in * the value list, and then intersected for each filter key. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filter(Map> filter); /** *

* For paginated calls to GetEntitlements, pass the NextToken from the previous GetEntitlementsResult. *

* * @param nextToken * For paginated calls to GetEntitlements, pass the NextToken from the previous GetEntitlementsResult. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nextToken(String nextToken); /** *

* The maximum number of items to retrieve from the GetEntitlements operation. For pagination, use the NextToken * field in subsequent calls to GetEntitlements. *

* * @param maxResults * The maximum number of items to retrieve from the GetEntitlements operation. For pagination, use the * NextToken field in subsequent calls to GetEntitlements. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxResults(Integer maxResults); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends MarketplaceEntitlementRequest.BuilderImpl implements Builder { private String productCode; private Map> filter = DefaultSdkAutoConstructMap.getInstance(); private String nextToken; private Integer maxResults; private BuilderImpl() { } private BuilderImpl(GetEntitlementsRequest model) { super(model); productCode(model.productCode); filterWithStrings(model.filter); nextToken(model.nextToken); maxResults(model.maxResults); } public final String getProductCode() { return productCode; } public final void setProductCode(String productCode) { this.productCode = productCode; } @Override public final Builder productCode(String productCode) { this.productCode = productCode; return this; } public final Map> getFilter() { if (filter instanceof SdkAutoConstructMap) { return null; } return filter; } public final void setFilter(Map> filter) { this.filter = GetEntitlementFiltersCopier.copy(filter); } @Override public final Builder filterWithStrings(Map> filter) { this.filter = GetEntitlementFiltersCopier.copy(filter); return this; } @Override public final Builder filter(Map> filter) { this.filter = GetEntitlementFiltersCopier.copyEnumToString(filter); return this; } public final String getNextToken() { return nextToken; } public final void setNextToken(String nextToken) { this.nextToken = nextToken; } @Override public final Builder nextToken(String nextToken) { this.nextToken = nextToken; return this; } public final Integer getMaxResults() { return maxResults; } public final void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } @Override public final Builder maxResults(Integer maxResults) { this.maxResults = maxResults; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetEntitlementsRequest build() { return new GetEntitlementsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy