createPolicyStore method

Future<CreatePolicyStoreOutput> createPolicyStore({
  1. required ValidationSettings validationSettings,
  2. String? clientToken,
  3. DeletionProtection? deletionProtection,
  4. String? description,
  5. EncryptionSettings? encryptionSettings,
  6. Map<String, String>? tags,
})

Creates a policy store. A policy store is a container for policy resources.

May throw ConflictException. May throw ServiceQuotaExceededException.

Parameter validationSettings : Specifies the validation setting for this policy store.

Currently, the only valid and required value is Mode.

Parameter clientToken : Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value..

If you don't provide this value, then Amazon Web Services generates a random one for you.

If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an ConflictException error.

Verified Permissions recognizes a ClientToken for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of ClientToken.

Parameter deletionProtection : Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.

The default state is DISABLED.

Parameter description : Descriptive text that you can provide to help with identification of the current policy store.

Parameter encryptionSettings : Specifies the encryption settings used to encrypt the policy store and their child resources. Allows for the ability to use a customer owned KMS key for encryption of data.

This is an optional field to be used when providing a customer-managed KMS key for encryption.

Parameter tags : The list of key-value pairs to associate with the policy store.

Implementation

Future<CreatePolicyStoreOutput> createPolicyStore({
  required ValidationSettings validationSettings,
  String? clientToken,
  DeletionProtection? deletionProtection,
  String? description,
  EncryptionSettings? encryptionSettings,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'VerifiedPermissions.CreatePolicyStore'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'validationSettings': validationSettings,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (deletionProtection != null)
        'deletionProtection': deletionProtection.value,
      if (description != null) 'description': description,
      if (encryptionSettings != null)
        'encryptionSettings': encryptionSettings,
      if (tags != null) 'tags': tags,
    },
  );

  return CreatePolicyStoreOutput.fromJson(jsonResponse.body);
}