software.amazon.awssdk.services.trustedadvisor.model.UpdateRecommendationLifecycleRequest Maven / Gradle / Ivy
Show all versions of trustedadvisor 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.trustedadvisor.model;
import java.util.Arrays;
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.LocationTrait;
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 UpdateRecommendationLifecycleRequest extends TrustedAdvisorRequest implements
ToCopyableBuilder {
private static final SdkField LIFECYCLE_STAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("lifecycleStage").getter(getter(UpdateRecommendationLifecycleRequest::lifecycleStageAsString))
.setter(setter(Builder::lifecycleStage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lifecycleStage").build()).build();
private static final SdkField RECOMMENDATION_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("recommendationIdentifier")
.getter(getter(UpdateRecommendationLifecycleRequest::recommendationIdentifier))
.setter(setter(Builder::recommendationIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("recommendationIdentifier").build())
.build();
private static final SdkField UPDATE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("updateReason").getter(getter(UpdateRecommendationLifecycleRequest::updateReason))
.setter(setter(Builder::updateReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateReason").build()).build();
private static final SdkField UPDATE_REASON_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("updateReasonCode").getter(getter(UpdateRecommendationLifecycleRequest::updateReasonCodeAsString))
.setter(setter(Builder::updateReasonCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateReasonCode").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LIFECYCLE_STAGE_FIELD,
RECOMMENDATION_IDENTIFIER_FIELD, UPDATE_REASON_FIELD, UPDATE_REASON_CODE_FIELD));
private final String lifecycleStage;
private final String recommendationIdentifier;
private final String updateReason;
private final String updateReasonCode;
private UpdateRecommendationLifecycleRequest(BuilderImpl builder) {
super(builder);
this.lifecycleStage = builder.lifecycleStage;
this.recommendationIdentifier = builder.recommendationIdentifier;
this.updateReason = builder.updateReason;
this.updateReasonCode = builder.updateReasonCode;
}
/**
*
* The new lifecycle stage
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #lifecycleStage}
* will return {@link UpdateRecommendationLifecycleStage#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #lifecycleStageAsString}.
*
*
* @return The new lifecycle stage
* @see UpdateRecommendationLifecycleStage
*/
public final UpdateRecommendationLifecycleStage lifecycleStage() {
return UpdateRecommendationLifecycleStage.fromValue(lifecycleStage);
}
/**
*
* The new lifecycle stage
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #lifecycleStage}
* will return {@link UpdateRecommendationLifecycleStage#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #lifecycleStageAsString}.
*
*
* @return The new lifecycle stage
* @see UpdateRecommendationLifecycleStage
*/
public final String lifecycleStageAsString() {
return lifecycleStage;
}
/**
*
* The Recommendation identifier for AWS Trusted Advisor Priority recommendations
*
*
* @return The Recommendation identifier for AWS Trusted Advisor Priority recommendations
*/
public final String recommendationIdentifier() {
return recommendationIdentifier;
}
/**
*
* Reason for the lifecycle stage change
*
*
* @return Reason for the lifecycle stage change
*/
public final String updateReason() {
return updateReason;
}
/**
*
* Reason code for the lifecycle state change
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #updateReasonCode}
* will return {@link UpdateRecommendationLifecycleStageReasonCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #updateReasonCodeAsString}.
*
*
* @return Reason code for the lifecycle state change
* @see UpdateRecommendationLifecycleStageReasonCode
*/
public final UpdateRecommendationLifecycleStageReasonCode updateReasonCode() {
return UpdateRecommendationLifecycleStageReasonCode.fromValue(updateReasonCode);
}
/**
*
* Reason code for the lifecycle state change
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #updateReasonCode}
* will return {@link UpdateRecommendationLifecycleStageReasonCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #updateReasonCodeAsString}.
*
*
* @return Reason code for the lifecycle state change
* @see UpdateRecommendationLifecycleStageReasonCode
*/
public final String updateReasonCodeAsString() {
return updateReasonCode;
}
@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(lifecycleStageAsString());
hashCode = 31 * hashCode + Objects.hashCode(recommendationIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(updateReason());
hashCode = 31 * hashCode + Objects.hashCode(updateReasonCodeAsString());
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 UpdateRecommendationLifecycleRequest)) {
return false;
}
UpdateRecommendationLifecycleRequest other = (UpdateRecommendationLifecycleRequest) obj;
return Objects.equals(lifecycleStageAsString(), other.lifecycleStageAsString())
&& Objects.equals(recommendationIdentifier(), other.recommendationIdentifier())
&& Objects.equals(updateReason(), other.updateReason())
&& Objects.equals(updateReasonCodeAsString(), other.updateReasonCodeAsString());
}
/**
* 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("UpdateRecommendationLifecycleRequest").add("LifecycleStage", lifecycleStageAsString())
.add("RecommendationIdentifier", recommendationIdentifier())
.add("UpdateReason", updateReason() == null ? null : "*** Sensitive Data Redacted ***")
.add("UpdateReasonCode", updateReasonCodeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "lifecycleStage":
return Optional.ofNullable(clazz.cast(lifecycleStageAsString()));
case "recommendationIdentifier":
return Optional.ofNullable(clazz.cast(recommendationIdentifier()));
case "updateReason":
return Optional.ofNullable(clazz.cast(updateReason()));
case "updateReasonCode":
return Optional.ofNullable(clazz.cast(updateReasonCodeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function