startRestoreJob method

Future<StartRestoreJobOutput> startRestoreJob({
  1. required Map<String, String> metadata,
  2. required String recoveryPointArn,
  3. bool? copySourceTagsToRestoredResource,
  4. String? iamRoleArn,
  5. String? idempotencyToken,
  6. String? resourceType,
})

Recovers the saved resource identified by an Amazon Resource Name (ARN).

May throw InvalidParameterValueException. May throw InvalidRequestException. May throw MissingParameterValueException. May throw ResourceNotFoundException. May throw ServiceUnavailableException.

Parameter metadata : A set of metadata key-value pairs.

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.

For more information about the metadata for each resource, see the following:

Parameter 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.

Parameter copySourceTagsToRestoredResource : This is an optional parameter. If this equals True, tags included in the backup will be copied to the restored resource.

This can only be applied to backups created through Backup.

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

Parameter 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.

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

  • Aurora - Amazon Aurora
  • DocumentDB - Amazon DocumentDB
  • CloudFormation - CloudFormation
  • DynamoDB - Amazon DynamoDB
  • EBS - Amazon Elastic Block Store
  • EC2 - Amazon Elastic Compute Cloud
  • EFS - Amazon Elastic File System
  • EKS - Amazon Elastic Kubernetes Service
  • FSx - Amazon FSx
  • Neptune - Amazon Neptune
  • RDS - Amazon Relational Database Service
  • Redshift - Amazon Redshift
  • Storage Gateway - Storage Gateway
  • S3 - Amazon Simple Storage Service
  • Timestream - Amazon Timestream
  • VirtualMachine - Virtual machines

Implementation

Future<StartRestoreJobOutput> startRestoreJob({
  required Map<String, String> metadata,
  required String recoveryPointArn,
  bool? copySourceTagsToRestoredResource,
  String? iamRoleArn,
  String? idempotencyToken,
  String? resourceType,
}) async {
  final $payload = <String, dynamic>{
    'Metadata': metadata,
    'RecoveryPointArn': recoveryPointArn,
    if (copySourceTagsToRestoredResource != null)
      'CopySourceTagsToRestoredResource': copySourceTagsToRestoredResource,
    if (iamRoleArn != null) 'IamRoleArn': iamRoleArn,
    'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
    if (resourceType != null) 'ResourceType': resourceType,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/restore-jobs',
    exceptionFnMap: _exceptionFns,
  );
  return StartRestoreJobOutput.fromJson(response);
}