software.amazon.awssdk.services.backup.model.PutRestoreValidationResultRequest Maven / Gradle / Ivy
Show all versions of backup 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.backup.model;
import java.util.Arrays;
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.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 PutRestoreValidationResultRequest extends BackupRequest implements
ToCopyableBuilder {
private static final SdkField RESTORE_JOB_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RestoreJobId").getter(getter(PutRestoreValidationResultRequest::restoreJobId))
.setter(setter(Builder::restoreJobId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("restoreJobId").build()).build();
private static final SdkField VALIDATION_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ValidationStatus").getter(getter(PutRestoreValidationResultRequest::validationStatusAsString))
.setter(setter(Builder::validationStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationStatus").build()).build();
private static final SdkField VALIDATION_STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ValidationStatusMessage").getter(getter(PutRestoreValidationResultRequest::validationStatusMessage))
.setter(setter(Builder::validationStatusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationStatusMessage").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESTORE_JOB_ID_FIELD,
VALIDATION_STATUS_FIELD, VALIDATION_STATUS_MESSAGE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String restoreJobId;
private final String validationStatus;
private final String validationStatusMessage;
private PutRestoreValidationResultRequest(BuilderImpl builder) {
super(builder);
this.restoreJobId = builder.restoreJobId;
this.validationStatus = builder.validationStatus;
this.validationStatusMessage = builder.validationStatusMessage;
}
/**
*
* This is a unique identifier of a restore job within Backup.
*
*
* @return This is a unique identifier of a restore job within Backup.
*/
public final String restoreJobId() {
return restoreJobId;
}
/**
*
* The status of your restore validation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #validationStatus}
* will return {@link RestoreValidationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #validationStatusAsString}.
*
*
* @return The status of your restore validation.
* @see RestoreValidationStatus
*/
public final RestoreValidationStatus validationStatus() {
return RestoreValidationStatus.fromValue(validationStatus);
}
/**
*
* The status of your restore validation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #validationStatus}
* will return {@link RestoreValidationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #validationStatusAsString}.
*
*
* @return The status of your restore validation.
* @see RestoreValidationStatus
*/
public final String validationStatusAsString() {
return validationStatus;
}
/**
*
* This is an optional message string you can input to describe the validation status for the restore test
* validation.
*
*
* @return This is an optional message string you can input to describe the validation status for the restore test
* validation.
*/
public final String validationStatusMessage() {
return validationStatusMessage;
}
@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(restoreJobId());
hashCode = 31 * hashCode + Objects.hashCode(validationStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(validationStatusMessage());
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 PutRestoreValidationResultRequest)) {
return false;
}
PutRestoreValidationResultRequest other = (PutRestoreValidationResultRequest) obj;
return Objects.equals(restoreJobId(), other.restoreJobId())
&& Objects.equals(validationStatusAsString(), other.validationStatusAsString())
&& Objects.equals(validationStatusMessage(), other.validationStatusMessage());
}
/**
* 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("PutRestoreValidationResultRequest").add("RestoreJobId", restoreJobId())
.add("ValidationStatus", validationStatusAsString()).add("ValidationStatusMessage", validationStatusMessage())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RestoreJobId":
return Optional.ofNullable(clazz.cast(restoreJobId()));
case "ValidationStatus":
return Optional.ofNullable(clazz.cast(validationStatusAsString()));
case "ValidationStatusMessage":
return Optional.ofNullable(clazz.cast(validationStatusMessage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("restoreJobId", RESTORE_JOB_ID_FIELD);
map.put("ValidationStatus", VALIDATION_STATUS_FIELD);
map.put("ValidationStatusMessage", VALIDATION_STATUS_MESSAGE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function