software.amazon.awssdk.services.codegurureviewer.model.ListRecommendationFeedbackRequest Maven / Gradle / Ivy
Show all versions of codegurureviewer Show documentation
/*
* 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.codegurureviewer.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 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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListRecommendationFeedbackRequest extends CodeGuruReviewerRequest implements
ToCopyableBuilder {
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NextToken").getter(getter(ListRecommendationFeedbackRequest::nextToken))
.setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("NextToken").build()).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxResults").getter(getter(ListRecommendationFeedbackRequest::maxResults))
.setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("MaxResults").build()).build();
private static final SdkField CODE_REVIEW_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CodeReviewArn").getter(getter(ListRecommendationFeedbackRequest::codeReviewArn))
.setter(setter(Builder::codeReviewArn))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("CodeReviewArn").build()).build();
private static final SdkField> USER_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("UserIds")
.getter(getter(ListRecommendationFeedbackRequest::userIds))
.setter(setter(Builder::userIds))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("UserIds").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> RECOMMENDATION_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("RecommendationIds")
.getter(getter(ListRecommendationFeedbackRequest::recommendationIds))
.setter(setter(Builder::recommendationIds))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("RecommendationIds").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(NEXT_TOKEN_FIELD,
MAX_RESULTS_FIELD, CODE_REVIEW_ARN_FIELD, USER_IDS_FIELD, RECOMMENDATION_IDS_FIELD));
private final String nextToken;
private final Integer maxResults;
private final String codeReviewArn;
private final List userIds;
private final List recommendationIds;
private ListRecommendationFeedbackRequest(BuilderImpl builder) {
super(builder);
this.nextToken = builder.nextToken;
this.maxResults = builder.maxResults;
this.codeReviewArn = builder.codeReviewArn;
this.userIds = builder.userIds;
this.recommendationIds = builder.recommendationIds;
}
/**
*
* If nextToken
is returned, there are more results available. The value of nextToken
is a
* unique pagination token for each page. Make the call again using the returned token to retrieve the next page.
* Keep all other arguments unchanged.
*
*
* @return If nextToken
is returned, there are more results available. The value of
* nextToken
is a unique pagination token for each page. Make the call again using the returned
* token to retrieve the next page. Keep all other arguments unchanged.
*/
public final String nextToken() {
return nextToken;
}
/**
*
* The maximum number of results that are returned per call. The default is 100.
*
*
* @return The maximum number of results that are returned per call. The default is 100.
*/
public final Integer maxResults() {
return maxResults;
}
/**
*
* The Amazon Resource Name (ARN) of the CodeReview object.
*
*
* @return The Amazon Resource Name (ARN) of the CodeReview
* object.
*/
public final String codeReviewArn() {
return codeReviewArn;
}
/**
* For responses, this returns true if the service returned a value for the UserIds 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 hasUserIds() {
return userIds != null && !(userIds instanceof SdkAutoConstructList);
}
/**
*
* An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the recommendation
* feedback for a code review from that user.
*
*
* The UserId
is an IAM principal that can be specified as an Amazon Web Services account ID or an
* Amazon Resource Name (ARN). For more information, see Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
*
*
* 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 #hasUserIds} method.
*
*
* @return An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the
* recommendation feedback for a code review from that user.
*
* The UserId
is an IAM principal that can be specified as an Amazon Web Services account ID or
* an Amazon Resource Name (ARN). For more information, see Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
*/
public final List userIds() {
return userIds;
}
/**
* For responses, this returns true if the service returned a value for the RecommendationIds 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 hasRecommendationIds() {
return recommendationIds != null && !(recommendationIds instanceof SdkAutoConstructList);
}
/**
*
* Used to query the recommendation feedback for a given recommendation.
*
*
* 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 #hasRecommendationIds} method.
*
*
* @return Used to query the recommendation feedback for a given recommendation.
*/
public final List recommendationIds() {
return recommendationIds;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(codeReviewArn());
hashCode = 31 * hashCode + Objects.hashCode(hasUserIds() ? userIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasRecommendationIds() ? recommendationIds() : 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 ListRecommendationFeedbackRequest)) {
return false;
}
ListRecommendationFeedbackRequest other = (ListRecommendationFeedbackRequest) obj;
return Objects.equals(nextToken(), other.nextToken()) && Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(codeReviewArn(), other.codeReviewArn()) && hasUserIds() == other.hasUserIds()
&& Objects.equals(userIds(), other.userIds()) && hasRecommendationIds() == other.hasRecommendationIds()
&& Objects.equals(recommendationIds(), other.recommendationIds());
}
/**
* 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("ListRecommendationFeedbackRequest").add("NextToken", nextToken())
.add("MaxResults", maxResults()).add("CodeReviewArn", codeReviewArn())
.add("UserIds", hasUserIds() ? userIds() : null)
.add("RecommendationIds", hasRecommendationIds() ? recommendationIds() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "MaxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
case "CodeReviewArn":
return Optional.ofNullable(clazz.cast(codeReviewArn()));
case "UserIds":
return Optional.ofNullable(clazz.cast(userIds()));
case "RecommendationIds":
return Optional.ofNullable(clazz.cast(recommendationIds()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* The UserId
is an IAM principal that can be specified as an Amazon Web Services account ID
* or an Amazon Resource Name (ARN). For more information, see Specifying a Principal in the Amazon Web Services Identity and Access Management User
* Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userIds(Collection userIds);
/**
*
* An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the
* recommendation feedback for a code review from that user.
*
*
* The UserId
is an IAM principal that can be specified as an Amazon Web Services account ID or an
* Amazon Resource Name (ARN). For more information, see Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
*
*
* @param userIds
* An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the
* recommendation feedback for a code review from that user.
*
* The UserId
is an IAM principal that can be specified as an Amazon Web Services account ID
* or an Amazon Resource Name (ARN). For more information, see Specifying a Principal in the Amazon Web Services Identity and Access Management User
* Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userIds(String... userIds);
/**
*
* Used to query the recommendation feedback for a given recommendation.
*
*
* @param recommendationIds
* Used to query the recommendation feedback for a given recommendation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder recommendationIds(Collection recommendationIds);
/**
*
* Used to query the recommendation feedback for a given recommendation.
*
*
* @param recommendationIds
* Used to query the recommendation feedback for a given recommendation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder recommendationIds(String... recommendationIds);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends CodeGuruReviewerRequest.BuilderImpl implements Builder {
private String nextToken;
private Integer maxResults;
private String codeReviewArn;
private List userIds = DefaultSdkAutoConstructList.getInstance();
private List recommendationIds = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(ListRecommendationFeedbackRequest model) {
super(model);
nextToken(model.nextToken);
maxResults(model.maxResults);
codeReviewArn(model.codeReviewArn);
userIds(model.userIds);
recommendationIds(model.recommendationIds);
}
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;
}
public final String getCodeReviewArn() {
return codeReviewArn;
}
public final void setCodeReviewArn(String codeReviewArn) {
this.codeReviewArn = codeReviewArn;
}
@Override
public final Builder codeReviewArn(String codeReviewArn) {
this.codeReviewArn = codeReviewArn;
return this;
}
public final Collection getUserIds() {
if (userIds instanceof SdkAutoConstructList) {
return null;
}
return userIds;
}
public final void setUserIds(Collection userIds) {
this.userIds = UserIdsCopier.copy(userIds);
}
@Override
public final Builder userIds(Collection userIds) {
this.userIds = UserIdsCopier.copy(userIds);
return this;
}
@Override
@SafeVarargs
public final Builder userIds(String... userIds) {
userIds(Arrays.asList(userIds));
return this;
}
public final Collection getRecommendationIds() {
if (recommendationIds instanceof SdkAutoConstructList) {
return null;
}
return recommendationIds;
}
public final void setRecommendationIds(Collection recommendationIds) {
this.recommendationIds = RecommendationIdsCopier.copy(recommendationIds);
}
@Override
public final Builder recommendationIds(Collection recommendationIds) {
this.recommendationIds = RecommendationIdsCopier.copy(recommendationIds);
return this;
}
@Override
@SafeVarargs
public final Builder recommendationIds(String... recommendationIds) {
recommendationIds(Arrays.asList(recommendationIds));
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 ListRecommendationFeedbackRequest build() {
return new ListRecommendationFeedbackRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}