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

software.amazon.awssdk.services.backup.model.StartRestoreJobRequest Maven / Gradle / Ivy

/*
 * 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.beans.Transient;
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 StartRestoreJobRequest extends BackupRequest implements
        ToCopyableBuilder {
    private static final SdkField RECOVERY_POINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("RecoveryPointArn").getter(getter(StartRestoreJobRequest::recoveryPointArn))
            .setter(setter(Builder::recoveryPointArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecoveryPointArn").build()).build();

    private static final SdkField> METADATA_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Metadata")
            .getter(getter(StartRestoreJobRequest::metadata))
            .setter(setter(Builder::metadata))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metadata").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 SdkField IAM_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("IamRoleArn").getter(getter(StartRestoreJobRequest::iamRoleArn)).setter(setter(Builder::iamRoleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRoleArn").build()).build();

    private static final SdkField IDEMPOTENCY_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("IdempotencyToken").getter(getter(StartRestoreJobRequest::idempotencyToken))
            .setter(setter(Builder::idempotencyToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdempotencyToken").build()).build();

    private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ResourceType").getter(getter(StartRestoreJobRequest::resourceType))
            .setter(setter(Builder::resourceType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RECOVERY_POINT_ARN_FIELD,
            METADATA_FIELD, IAM_ROLE_ARN_FIELD, IDEMPOTENCY_TOKEN_FIELD, RESOURCE_TYPE_FIELD));

    private final String recoveryPointArn;

    private final Map metadata;

    private final String iamRoleArn;

    private final String idempotencyToken;

    private final String resourceType;

    private StartRestoreJobRequest(BuilderImpl builder) {
        super(builder);
        this.recoveryPointArn = builder.recoveryPointArn;
        this.metadata = builder.metadata;
        this.iamRoleArn = builder.iamRoleArn;
        this.idempotencyToken = builder.idempotencyToken;
        this.resourceType = builder.resourceType;
    }

    /**
     * 

* An ARN that uniquely identifies a recovery point; for example, * arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45. *

* * @return An ARN that uniquely identifies a recovery point; for example, * arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45. */ public final String recoveryPointArn() { return recoveryPointArn; } /** * For responses, this returns true if the service returned a value for the Metadata 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 hasMetadata() { return metadata != null && !(metadata instanceof SdkAutoConstructMap); } /** *

* A set of metadata key-value pairs. Contains information, such as a resource name, required to restore a recovery * point. *

*

* You can get configuration metadata about a resource at the time it was backed up by calling * GetRecoveryPointRestoreMetadata. However, values in addition to those provided by * GetRecoveryPointRestoreMetadata might be required to restore a resource. For example, you might need * to provide a new resource name if the original already exists. *

*

* You need to specify specific metadata to restore an Amazon Elastic File System (Amazon EFS) instance: *

*
    *
  • *

    * file-system-id: The ID of the Amazon EFS file system that is backed up by Backup. Returned in * GetRecoveryPointRestoreMetadata. *

    *
  • *
  • *

    * Encrypted: A Boolean value that, if true, specifies that the file system is encrypted. If * KmsKeyId is specified, Encrypted must be set to true. *

    *
  • *
  • *

    * KmsKeyId: Specifies the Amazon Web Services KMS key that is used to encrypt the restored file * system. You can specify a key from another Amazon Web Services account provided that key it is properly shared * with your account via Amazon Web Services KMS. *

    *
  • *
  • *

    * PerformanceMode: Specifies the throughput mode of the file system. *

    *
  • *
  • *

    * CreationToken: A user-supplied value that ensures the uniqueness (idempotency) of the request. *

    *
  • *
  • *

    * newFileSystem: A Boolean value that, if true, specifies that the recovery point is restored to a new * Amazon EFS file system. *

    *
  • *
  • *

    * ItemsToRestore: An array of one to five strings where each string is a file path. Use * ItemsToRestore to restore specific files or directories rather than the entire file system. This * parameter is optional. For example, "itemsToRestore":"[\"/my.test\"]". *

    *
  • *
*

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

* * @return A set of metadata key-value pairs. Contains information, such as a resource name, required to restore a * recovery point.

*

* You can get configuration metadata about a resource at the time it was backed up by calling * GetRecoveryPointRestoreMetadata. However, values in addition to those provided by * GetRecoveryPointRestoreMetadata might be required to restore a resource. For example, you * might need to provide a new resource name if the original already exists. *

*

* You need to specify specific metadata to restore an Amazon Elastic File System (Amazon EFS) instance: *

*
    *
  • *

    * file-system-id: The ID of the Amazon EFS file system that is backed up by Backup. Returned * in GetRecoveryPointRestoreMetadata. *

    *
  • *
  • *

    * Encrypted: A Boolean value that, if true, specifies that the file system is encrypted. If * KmsKeyId is specified, Encrypted must be set to true. *

    *
  • *
  • *

    * KmsKeyId: Specifies the Amazon Web Services KMS key that is used to encrypt the restored * file system. You can specify a key from another Amazon Web Services account provided that key it is * properly shared with your account via Amazon Web Services KMS. *

    *
  • *
  • *

    * PerformanceMode: Specifies the throughput mode of the file system. *

    *
  • *
  • *

    * CreationToken: A user-supplied value that ensures the uniqueness (idempotency) of the * request. *

    *
  • *
  • *

    * newFileSystem: A Boolean value that, if true, specifies that the recovery point is restored * to a new Amazon EFS file system. *

    *
  • *
  • *

    * ItemsToRestore: An array of one to five strings where each string is a file path. Use * ItemsToRestore to restore specific files or directories rather than the entire file system. * This parameter is optional. For example, "itemsToRestore":"[\"/my.test\"]". *

    *
  • */ public final Map metadata() { return metadata; } /** *

    * The Amazon Resource Name (ARN) of the IAM role that Backup uses to create the target recovery point; for example, * arn:aws:iam::123456789012:role/S3Access. *

    * * @return The Amazon Resource Name (ARN) of the IAM role that Backup uses to create the target recovery point; for * example, arn:aws:iam::123456789012:role/S3Access. */ public final String iamRoleArn() { return iamRoleArn; } /** *

    * A customer-chosen string that you can use to distinguish between otherwise identical calls to * StartRestoreJob. Retrying a successful request with the same idempotency token results in a success * message with no action taken. *

    * * @return A customer-chosen string that you can use to distinguish between otherwise identical calls to * StartRestoreJob. Retrying a successful request with the same idempotency token results in a * success message with no action taken. */ public final String idempotencyToken() { return idempotencyToken; } /** *

    * Starts a job to restore a recovery point for one of the following resources: *

    *
      *
    • *

      * DynamoDB for Amazon DynamoDB *

      *
    • *
    • *

      * EBS for Amazon Elastic Block Store *

      *
    • *
    • *

      * EC2 for Amazon Elastic Compute Cloud *

      *
    • *
    • *

      * EFS for Amazon Elastic File System *

      *
    • *
    • *

      * RDS for Amazon Relational Database Service *

      *
    • *
    • *

      * Aurora for Amazon Aurora *

      *
    • *
    • *

      * Storage Gateway for Storage Gateway *

      *
    • *
    * * @return Starts a job to restore a recovery point for one of the following resources:

    *
      *
    • *

      * DynamoDB for Amazon DynamoDB *

      *
    • *
    • *

      * EBS for Amazon Elastic Block Store *

      *
    • *
    • *

      * EC2 for Amazon Elastic Compute Cloud *

      *
    • *
    • *

      * EFS for Amazon Elastic File System *

      *
    • *
    • *

      * RDS for Amazon Relational Database Service *

      *
    • *
    • *

      * Aurora for Amazon Aurora *

      *
    • *
    • *

      * Storage Gateway for Storage Gateway *

      *
    • */ public final String resourceType() { return resourceType; } @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(recoveryPointArn()); hashCode = 31 * hashCode + Objects.hashCode(hasMetadata() ? metadata() : null); hashCode = 31 * hashCode + Objects.hashCode(iamRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(idempotencyToken()); hashCode = 31 * hashCode + Objects.hashCode(resourceType()); 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 StartRestoreJobRequest)) { return false; } StartRestoreJobRequest other = (StartRestoreJobRequest) obj; return Objects.equals(recoveryPointArn(), other.recoveryPointArn()) && hasMetadata() == other.hasMetadata() && Objects.equals(metadata(), other.metadata()) && Objects.equals(iamRoleArn(), other.iamRoleArn()) && Objects.equals(idempotencyToken(), other.idempotencyToken()) && Objects.equals(resourceType(), other.resourceType()); } /** * 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("StartRestoreJobRequest").add("RecoveryPointArn", recoveryPointArn()) .add("Metadata", metadata() == null ? null : "*** Sensitive Data Redacted ***").add("IamRoleArn", iamRoleArn()) .add("IdempotencyToken", idempotencyToken()).add("ResourceType", resourceType()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "RecoveryPointArn": return Optional.ofNullable(clazz.cast(recoveryPointArn())); case "Metadata": return Optional.ofNullable(clazz.cast(metadata())); case "IamRoleArn": return Optional.ofNullable(clazz.cast(iamRoleArn())); case "IdempotencyToken": return Optional.ofNullable(clazz.cast(idempotencyToken())); case "ResourceType": return Optional.ofNullable(clazz.cast(resourceType())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartRestoreJobRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends BackupRequest.Builder, SdkPojo, CopyableBuilder { /** *

      * An ARN that uniquely identifies a recovery point; for example, * arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45. *

      * * @param recoveryPointArn * An ARN that uniquely identifies a recovery point; for example, * arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45 * . * @return Returns a reference to this object so that method calls can be chained together. */ Builder recoveryPointArn(String recoveryPointArn); /** *

      * A set of metadata key-value pairs. Contains information, such as a resource name, required to restore a * recovery point. *

      *

      * You can get configuration metadata about a resource at the time it was backed up by calling * GetRecoveryPointRestoreMetadata. However, values in addition to those provided by * GetRecoveryPointRestoreMetadata might be required to restore a resource. For example, you might * need to provide a new resource name if the original already exists. *

      *

      * You need to specify specific metadata to restore an Amazon Elastic File System (Amazon EFS) instance: *

      *
        *
      • *

        * file-system-id: The ID of the Amazon EFS file system that is backed up by Backup. Returned in * GetRecoveryPointRestoreMetadata. *

        *
      • *
      • *

        * Encrypted: A Boolean value that, if true, specifies that the file system is encrypted. If * KmsKeyId is specified, Encrypted must be set to true. *

        *
      • *
      • *

        * KmsKeyId: Specifies the Amazon Web Services KMS key that is used to encrypt the restored file * system. You can specify a key from another Amazon Web Services account provided that key it is properly * shared with your account via Amazon Web Services KMS. *

        *
      • *
      • *

        * PerformanceMode: Specifies the throughput mode of the file system. *

        *
      • *
      • *

        * CreationToken: A user-supplied value that ensures the uniqueness (idempotency) of the request. *

        *
      • *
      • *

        * newFileSystem: A Boolean value that, if true, specifies that the recovery point is restored to a * new Amazon EFS file system. *

        *
      • *
      • *

        * ItemsToRestore: An array of one to five strings where each string is a file path. Use * ItemsToRestore to restore specific files or directories rather than the entire file system. This * parameter is optional. For example, "itemsToRestore":"[\"/my.test\"]". *

        *
      • *
      * * @param metadata * A set of metadata key-value pairs. Contains information, such as a resource name, required to restore * a recovery point.

      *

      * You can get configuration metadata about a resource at the time it was backed up by calling * GetRecoveryPointRestoreMetadata. However, values in addition to those provided by * GetRecoveryPointRestoreMetadata might be required to restore a resource. For example, you * might need to provide a new resource name if the original already exists. *

      *

      * You need to specify specific metadata to restore an Amazon Elastic File System (Amazon EFS) instance: *

      *
        *
      • *

        * file-system-id: The ID of the Amazon EFS file system that is backed up by Backup. * Returned in GetRecoveryPointRestoreMetadata. *

        *
      • *
      • *

        * Encrypted: A Boolean value that, if true, specifies that the file system is encrypted. If * KmsKeyId is specified, Encrypted must be set to true. *

        *
      • *
      • *

        * KmsKeyId: Specifies the Amazon Web Services KMS key that is used to encrypt the restored * file system. You can specify a key from another Amazon Web Services account provided that key it is * properly shared with your account via Amazon Web Services KMS. *

        *
      • *
      • *

        * PerformanceMode: Specifies the throughput mode of the file system. *

        *
      • *
      • *

        * CreationToken: A user-supplied value that ensures the uniqueness (idempotency) of the * request. *

        *
      • *
      • *

        * newFileSystem: A Boolean value that, if true, specifies that the recovery point is * restored to a new Amazon EFS file system. *

        *
      • *
      • *

        * ItemsToRestore: An array of one to five strings where each string is a file path. Use * ItemsToRestore to restore specific files or directories rather than the entire file * system. This parameter is optional. For example, "itemsToRestore":"[\"/my.test\"]". *

        *
      • * @return Returns a reference to this object so that method calls can be chained together. */ Builder metadata(Map metadata); /** *

        * The Amazon Resource Name (ARN) of the IAM role that Backup uses to create the target recovery point; for * example, arn:aws:iam::123456789012:role/S3Access. *

        * * @param iamRoleArn * The Amazon Resource Name (ARN) of the IAM role that Backup uses to create the target recovery point; * for example, arn:aws:iam::123456789012:role/S3Access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder iamRoleArn(String iamRoleArn); /** *

        * A customer-chosen string that you can use to distinguish between otherwise identical calls to * StartRestoreJob. Retrying a successful request with the same idempotency token results in a * success message with no action taken. *

        * * @param idempotencyToken * A customer-chosen string that you can use to distinguish between otherwise identical calls to * StartRestoreJob. Retrying a successful request with the same idempotency token results in * a success message with no action taken. * @return Returns a reference to this object so that method calls can be chained together. */ Builder idempotencyToken(String idempotencyToken); /** *

        * Starts a job to restore a recovery point for one of the following resources: *

        *
          *
        • *

          * DynamoDB for Amazon DynamoDB *

          *
        • *
        • *

          * EBS for Amazon Elastic Block Store *

          *
        • *
        • *

          * EC2 for Amazon Elastic Compute Cloud *

          *
        • *
        • *

          * EFS for Amazon Elastic File System *

          *
        • *
        • *

          * RDS for Amazon Relational Database Service *

          *
        • *
        • *

          * Aurora for Amazon Aurora *

          *
        • *
        • *

          * Storage Gateway for Storage Gateway *

          *
        • *
        * * @param resourceType * Starts a job to restore a recovery point for one of the following resources:

        *
          *
        • *

          * DynamoDB for Amazon DynamoDB *

          *
        • *
        • *

          * EBS for Amazon Elastic Block Store *

          *
        • *
        • *

          * EC2 for Amazon Elastic Compute Cloud *

          *
        • *
        • *

          * EFS for Amazon Elastic File System *

          *
        • *
        • *

          * RDS for Amazon Relational Database Service *

          *
        • *
        • *

          * Aurora for Amazon Aurora *

          *
        • *
        • *

          * Storage Gateway for Storage Gateway *

          *
        • * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceType(String resourceType); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends BackupRequest.BuilderImpl implements Builder { private String recoveryPointArn; private Map metadata = DefaultSdkAutoConstructMap.getInstance(); private String iamRoleArn; private String idempotencyToken; private String resourceType; private BuilderImpl() { } private BuilderImpl(StartRestoreJobRequest model) { super(model); recoveryPointArn(model.recoveryPointArn); metadata(model.metadata); iamRoleArn(model.iamRoleArn); idempotencyToken(model.idempotencyToken); resourceType(model.resourceType); } public final String getRecoveryPointArn() { return recoveryPointArn; } public final void setRecoveryPointArn(String recoveryPointArn) { this.recoveryPointArn = recoveryPointArn; } @Override @Transient public final Builder recoveryPointArn(String recoveryPointArn) { this.recoveryPointArn = recoveryPointArn; return this; } public final Map getMetadata() { if (metadata instanceof SdkAutoConstructMap) { return null; } return metadata; } public final void setMetadata(Map metadata) { this.metadata = MetadataCopier.copy(metadata); } @Override @Transient public final Builder metadata(Map metadata) { this.metadata = MetadataCopier.copy(metadata); return this; } public final String getIamRoleArn() { return iamRoleArn; } public final void setIamRoleArn(String iamRoleArn) { this.iamRoleArn = iamRoleArn; } @Override @Transient public final Builder iamRoleArn(String iamRoleArn) { this.iamRoleArn = iamRoleArn; return this; } public final String getIdempotencyToken() { return idempotencyToken; } public final void setIdempotencyToken(String idempotencyToken) { this.idempotencyToken = idempotencyToken; } @Override @Transient public final Builder idempotencyToken(String idempotencyToken) { this.idempotencyToken = idempotencyToken; return this; } public final String getResourceType() { return resourceType; } public final void setResourceType(String resourceType) { this.resourceType = resourceType; } @Override @Transient public final Builder resourceType(String resourceType) { this.resourceType = resourceType; 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 StartRestoreJobRequest build() { return new StartRestoreJobRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy