createResiliencyPolicy method
Creates a resiliency policy for an application.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter policy :
The type of resiliency policy to be created, including the recovery time
objective (RTO) and recovery point objective (RPO) in seconds.
Parameter policyName :
Name of the resiliency policy.
Parameter tier :
The tier for this resiliency policy, ranging from the highest severity
(MissionCritical) to lowest (NonCritical).
Parameter clientToken :
Used for an idempotency token. A client token is a unique, case-sensitive
string of up to 64 ASCII characters. You should not reuse the same client
token for other API requests.
Parameter dataLocationConstraint :
Specifies a high-level geographical location constraint for where your
resilience policy data can be stored.
Parameter policyDescription :
Description of the resiliency policy.
Parameter tags :
Tags assigned to the resource. A tag is a label that you assign to an
Amazon Web Services resource. Each tag consists of a key/value pair.
Implementation
Future<CreateResiliencyPolicyResponse> createResiliencyPolicy({
required Map<DisruptionType, FailurePolicy> policy,
required String policyName,
required ResiliencyPolicyTier tier,
String? clientToken,
DataLocationConstraint? dataLocationConstraint,
String? policyDescription,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'policy': policy.map((k, e) => MapEntry(k.value, e)),
'policyName': policyName,
'tier': tier.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (dataLocationConstraint != null)
'dataLocationConstraint': dataLocationConstraint.value,
if (policyDescription != null) 'policyDescription': policyDescription,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/create-resiliency-policy',
exceptionFnMap: _exceptionFns,
);
return CreateResiliencyPolicyResponse.fromJson(response);
}