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

software.amazon.awssdk.services.personalizeruntime.model.GetActionRecommendationsRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Personalize Runtime module holds the client classes that are used for communicating with Personalize Runtime.

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.personalizeruntime.model;

import java.util.Arrays;
import java.util.Collections;
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.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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class GetActionRecommendationsRequest extends PersonalizeRuntimeRequest implements
        ToCopyableBuilder {
    private static final SdkField CAMPAIGN_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("campaignArn").getter(getter(GetActionRecommendationsRequest::campaignArn))
            .setter(setter(Builder::campaignArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("campaignArn").build()).build();

    private static final SdkField USER_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("userId")
            .getter(getter(GetActionRecommendationsRequest::userId)).setter(setter(Builder::userId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userId").build()).build();

    private static final SdkField NUM_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("numResults").getter(getter(GetActionRecommendationsRequest::numResults))
            .setter(setter(Builder::numResults))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numResults").build()).build();

    private static final SdkField FILTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("filterArn").getter(getter(GetActionRecommendationsRequest::filterArn))
            .setter(setter(Builder::filterArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("filterArn").build()).build();

    private static final SdkField> FILTER_VALUES_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("filterValues")
            .getter(getter(GetActionRecommendationsRequest::filterValues))
            .setter(setter(Builder::filterValues))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("filterValues").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CAMPAIGN_ARN_FIELD,
            USER_ID_FIELD, NUM_RESULTS_FIELD, FILTER_ARN_FIELD, FILTER_VALUES_FIELD));

    private final String campaignArn;

    private final String userId;

    private final Integer numResults;

    private final String filterArn;

    private final Map filterValues;

    private GetActionRecommendationsRequest(BuilderImpl builder) {
        super(builder);
        this.campaignArn = builder.campaignArn;
        this.userId = builder.userId;
        this.numResults = builder.numResults;
        this.filterArn = builder.filterArn;
        this.filterValues = builder.filterValues;
    }

    /**
     * 

* The Amazon Resource Name (ARN) of the campaign to use for getting action recommendations. This campaign must * deploy a solution version trained with a PERSONALIZED_ACTIONS recipe. *

* * @return The Amazon Resource Name (ARN) of the campaign to use for getting action recommendations. This campaign * must deploy a solution version trained with a PERSONALIZED_ACTIONS recipe. */ public final String campaignArn() { return campaignArn; } /** *

* The user ID of the user to provide action recommendations for. *

* * @return The user ID of the user to provide action recommendations for. */ public final String userId() { return userId; } /** *

* The number of results to return. The default is 5. The maximum is 100. *

* * @return The number of results to return. The default is 5. The maximum is 100. */ public final Integer numResults() { return numResults; } /** *

* The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations. *

*

* When using this parameter, be sure the filter resource is ACTIVE. *

* * @return The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations.

*

* When using this parameter, be sure the filter resource is ACTIVE. */ public final String filterArn() { return filterArn; } /** * For responses, this returns true if the service returned a value for the FilterValues 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 hasFilterValues() { return filterValues != null && !(filterValues instanceof SdkAutoConstructMap); } /** *

* The values to use when filtering recommendations. For each placeholder parameter in your filter expression, * provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. * Separate multiple values for one parameter with a comma. *

*

* For filter expressions that use an INCLUDE element to include actions, you must provide values for * all parameters that are defined in the expression. For filters with expressions that use an EXCLUDE * element to exclude actions, you can omit the filter-values. In this case, Amazon Personalize doesn't * use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering * recommendations and user segments. *

*

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

* * @return The values to use when filtering recommendations. For each placeholder parameter in your filter * expression, provide the parameter name (in matching case) as a key and the filter value(s) as the * corresponding value. Separate multiple values for one parameter with a comma.

*

* For filter expressions that use an INCLUDE element to include actions, you must provide * values for all parameters that are defined in the expression. For filters with expressions that use an * EXCLUDE element to exclude actions, you can omit the filter-values. In this * case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering recommendations and user * segments. */ public final Map filterValues() { return filterValues; } @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(campaignArn()); hashCode = 31 * hashCode + Objects.hashCode(userId()); hashCode = 31 * hashCode + Objects.hashCode(numResults()); hashCode = 31 * hashCode + Objects.hashCode(filterArn()); hashCode = 31 * hashCode + Objects.hashCode(hasFilterValues() ? filterValues() : null); 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 GetActionRecommendationsRequest)) { return false; } GetActionRecommendationsRequest other = (GetActionRecommendationsRequest) obj; return Objects.equals(campaignArn(), other.campaignArn()) && Objects.equals(userId(), other.userId()) && Objects.equals(numResults(), other.numResults()) && Objects.equals(filterArn(), other.filterArn()) && hasFilterValues() == other.hasFilterValues() && Objects.equals(filterValues(), other.filterValues()); } /** * 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("GetActionRecommendationsRequest").add("CampaignArn", campaignArn()).add("UserId", userId()) .add("NumResults", numResults()).add("FilterArn", filterArn()) .add("FilterValues", filterValues() == null ? null : "*** Sensitive Data Redacted ***").build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "campaignArn": return Optional.ofNullable(clazz.cast(campaignArn())); case "userId": return Optional.ofNullable(clazz.cast(userId())); case "numResults": return Optional.ofNullable(clazz.cast(numResults())); case "filterArn": return Optional.ofNullable(clazz.cast(filterArn())); case "filterValues": return Optional.ofNullable(clazz.cast(filterValues())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetActionRecommendationsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends PersonalizeRuntimeRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the campaign to use for getting action recommendations. This campaign must * deploy a solution version trained with a PERSONALIZED_ACTIONS recipe. *

* * @param campaignArn * The Amazon Resource Name (ARN) of the campaign to use for getting action recommendations. This * campaign must deploy a solution version trained with a PERSONALIZED_ACTIONS recipe. * @return Returns a reference to this object so that method calls can be chained together. */ Builder campaignArn(String campaignArn); /** *

* The user ID of the user to provide action recommendations for. *

* * @param userId * The user ID of the user to provide action recommendations for. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userId(String userId); /** *

* The number of results to return. The default is 5. The maximum is 100. *

* * @param numResults * The number of results to return. The default is 5. The maximum is 100. * @return Returns a reference to this object so that method calls can be chained together. */ Builder numResults(Integer numResults); /** *

* The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations. *

*

* When using this parameter, be sure the filter resource is ACTIVE. *

* * @param filterArn * The ARN of the filter to apply to the returned recommendations. For more information, see Filtering * Recommendations.

*

* When using this parameter, be sure the filter resource is ACTIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filterArn(String filterArn); /** *

* The values to use when filtering recommendations. For each placeholder parameter in your filter expression, * provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. * Separate multiple values for one parameter with a comma. *

*

* For filter expressions that use an INCLUDE element to include actions, you must provide values * for all parameters that are defined in the expression. For filters with expressions that use an * EXCLUDE element to exclude actions, you can omit the filter-values. In this case, * Amazon Personalize doesn't use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering * recommendations and user segments. *

* * @param filterValues * The values to use when filtering recommendations. For each placeholder parameter in your filter * expression, provide the parameter name (in matching case) as a key and the filter value(s) as the * corresponding value. Separate multiple values for one parameter with a comma.

*

* For filter expressions that use an INCLUDE element to include actions, you must provide * values for all parameters that are defined in the expression. For filters with expressions that use an * EXCLUDE element to exclude actions, you can omit the filter-values. In this * case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. *

*

* For more information, see Filtering recommendations and * user segments. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filterValues(Map filterValues); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends PersonalizeRuntimeRequest.BuilderImpl implements Builder { private String campaignArn; private String userId; private Integer numResults; private String filterArn; private Map filterValues = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(GetActionRecommendationsRequest model) { super(model); campaignArn(model.campaignArn); userId(model.userId); numResults(model.numResults); filterArn(model.filterArn); filterValues(model.filterValues); } public final String getCampaignArn() { return campaignArn; } public final void setCampaignArn(String campaignArn) { this.campaignArn = campaignArn; } @Override public final Builder campaignArn(String campaignArn) { this.campaignArn = campaignArn; return this; } public final String getUserId() { return userId; } public final void setUserId(String userId) { this.userId = userId; } @Override public final Builder userId(String userId) { this.userId = userId; return this; } public final Integer getNumResults() { return numResults; } public final void setNumResults(Integer numResults) { this.numResults = numResults; } @Override public final Builder numResults(Integer numResults) { this.numResults = numResults; return this; } public final String getFilterArn() { return filterArn; } public final void setFilterArn(String filterArn) { this.filterArn = filterArn; } @Override public final Builder filterArn(String filterArn) { this.filterArn = filterArn; return this; } public final Map getFilterValues() { if (filterValues instanceof SdkAutoConstructMap) { return null; } return filterValues; } public final void setFilterValues(Map filterValues) { this.filterValues = FilterValuesCopier.copy(filterValues); } @Override public final Builder filterValues(Map filterValues) { this.filterValues = FilterValuesCopier.copy(filterValues); 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 GetActionRecommendationsRequest build() { return new GetActionRecommendationsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy