putDomainPermissionsPolicy method

Future<PutDomainPermissionsPolicyResult> putDomainPermissionsPolicy({
  1. required String domain,
  2. required String policyDocument,
  3. String? domainOwner,
  4. String? policyRevision,
})

Sets a resource policy on a domain that specifies permissions to access it.

When you call PutDomainPermissionsPolicy, the resource policy on the domain is ignored when evaluting permissions. This ensures that the owner of a domain cannot lock themselves out of the domain, which would prevent them from being able to update the resource policy.

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

Parameter domain : The name of the domain on which to set the resource policy.

Parameter policyDocument : A valid displayable JSON Aspen policy string to be set as the access control resource policy on the provided domain.

Parameter domainOwner : The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

Parameter policyRevision : The current revision of the resource policy to be set. This revision is used for optimistic locking, which prevents others from overwriting your changes to the domain's resource policy.

Implementation

Future<PutDomainPermissionsPolicyResult> putDomainPermissionsPolicy({
  required String domain,
  required String policyDocument,
  String? domainOwner,
  String? policyRevision,
}) async {
  final $payload = <String, dynamic>{
    'domain': domain,
    'policyDocument': policyDocument,
    if (domainOwner != null) 'domainOwner': domainOwner,
    if (policyRevision != null) 'policyRevision': policyRevision,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/v1/domain/permissions/policy',
    exceptionFnMap: _exceptionFns,
  );
  return PutDomainPermissionsPolicyResult.fromJson(response);
}