associateCreatedArtifact method

Future<void> associateCreatedArtifact({
  1. required CreatedArtifact createdArtifact,
  2. required String migrationTaskName,
  3. required String progressUpdateStream,
  4. bool? dryRun,
})

Associates a created artifact of an AWS cloud resource, the target receiving the migration, with the migration task performed by a migration tool. This API has the following traits:

  • Migration tools can call the AssociateCreatedArtifact operation to indicate which AWS artifact is associated with a migration task.
  • The created artifact name must be provided in ARN (Amazon Resource Name) format which will contain information about type and region; for example: arn:aws:ec2:us-east-1:488216288981:image/ami-6d0ba87b.
  • Examples of the AWS resource behind the created artifact are, AMI's, EC2 instance, or DMS endpoint, etc.

May throw AccessDeniedException. May throw ThrottlingException. May throw InternalServerError. May throw ServiceUnavailableException. May throw DryRunOperation. May throw UnauthorizedOperation. May throw InvalidInputException. May throw ResourceNotFoundException. May throw HomeRegionNotSetException.

Parameter createdArtifact : An ARN of the AWS resource related to the migration (e.g., AMI, EC2 instance, RDS instance, etc.)

Parameter migrationTaskName : Unique identifier that references the migration task. Do not store personal data in this field.

Parameter progressUpdateStream : The name of the ProgressUpdateStream.

Parameter dryRun : Optional boolean flag to indicate whether any effect should take place. Used to test if the caller has permission to make the call.

Implementation

Future<void> associateCreatedArtifact({
  required CreatedArtifact createdArtifact,
  required String migrationTaskName,
  required String progressUpdateStream,
  bool? dryRun,
}) async {
  ArgumentError.checkNotNull(createdArtifact, 'createdArtifact');
  ArgumentError.checkNotNull(migrationTaskName, 'migrationTaskName');
  _s.validateStringLength(
    'migrationTaskName',
    migrationTaskName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(progressUpdateStream, 'progressUpdateStream');
  _s.validateStringLength(
    'progressUpdateStream',
    progressUpdateStream,
    1,
    50,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSMigrationHub.AssociateCreatedArtifact'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CreatedArtifact': createdArtifact,
      'MigrationTaskName': migrationTaskName,
      'ProgressUpdateStream': progressUpdateStream,
      if (dryRun != null) 'DryRun': dryRun,
    },
  );
}