createProtectConfiguration method

Future<CreateProtectConfigurationResult> createProtectConfiguration({
  1. String? clientToken,
  2. bool? deletionProtectionEnabled,
  3. List<Tag>? tags,
})

Create a new protect configuration. By default all country rule sets for each capability are set to ALLOW. Update the country rule sets using UpdateProtectConfigurationCountryRuleSet. A protect configurations name is stored as a Tag with the key set to Name and value as the name of the protect configuration.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.

Parameter deletionProtectionEnabled : When set to true deletion protection is enabled. By default this is set to false.

Parameter tags : An array of key and value pair tags that are associated with the resource.

Implementation

Future<CreateProtectConfigurationResult> createProtectConfiguration({
  String? clientToken,
  bool? deletionProtectionEnabled,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.CreateProtectConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (deletionProtectionEnabled != null)
        'DeletionProtectionEnabled': deletionProtectionEnabled,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateProtectConfigurationResult.fromJson(jsonResponse.body);
}