updateReplicationJob method

Future<void> updateReplicationJob({
  1. required String replicationJobId,
  2. String? description,
  3. bool? encrypted,
  4. int? frequency,
  5. String? kmsKeyId,
  6. LicenseType? licenseType,
  7. DateTime? nextReplicationRunStartTime,
  8. int? numberOfRecentAmisToKeep,
  9. String? roleName,
})

Updates the specified settings for the specified replication job.

May throw InvalidParameterException. May throw MissingRequiredParameterException. May throw OperationNotPermittedException. May throw UnauthorizedOperationException. May throw ServerCannotBeReplicatedException. May throw ReplicationJobNotFoundException. May throw InternalError. May throw TemporarilyUnavailableException.

Parameter replicationJobId : The ID of the replication job.

Parameter description : The description of the replication job.

Parameter encrypted : When true, the replication job produces encrypted AMIs. For more information, KmsKeyId.

Parameter frequency : The time between consecutive replication runs, in hours.

Parameter kmsKeyId : The ID of the KMS key for replication jobs that produce encrypted AMIs. This value can be any of the following:

  • KMS key ID
  • KMS key alias
  • ARN referring to the KMS key ID
  • ARN referring to the KMS key alias
If encrypted is enabled but a KMS key ID is not specified, the customer's default KMS key for Amazon EBS is used.

Parameter licenseType : The license type to be used for the AMI created by a successful replication run.

Parameter nextReplicationRunStartTime : The start time of the next replication run.

Parameter numberOfRecentAmisToKeep : The maximum number of SMS-created AMIs to retain. The oldest is deleted after the maximum number is reached and a new AMI is created.

Parameter roleName : The name of the IAM role to be used by AWS SMS.

Implementation

Future<void> updateReplicationJob({
  required String replicationJobId,
  String? description,
  bool? encrypted,
  int? frequency,
  String? kmsKeyId,
  LicenseType? licenseType,
  DateTime? nextReplicationRunStartTime,
  int? numberOfRecentAmisToKeep,
  String? roleName,
}) async {
  ArgumentError.checkNotNull(replicationJobId, 'replicationJobId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSServerMigrationService_V2016_10_24.UpdateReplicationJob'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'replicationJobId': replicationJobId,
      if (description != null) 'description': description,
      if (encrypted != null) 'encrypted': encrypted,
      if (frequency != null) 'frequency': frequency,
      if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
      if (licenseType != null) 'licenseType': licenseType.toValue(),
      if (nextReplicationRunStartTime != null)
        'nextReplicationRunStartTime':
            unixTimestampToJson(nextReplicationRunStartTime),
      if (numberOfRecentAmisToKeep != null)
        'numberOfRecentAmisToKeep': numberOfRecentAmisToKeep,
      if (roleName != null) 'roleName': roleName,
    },
  );
}