createEmailIdentityPolicy method
Creates the specified sending authorization policy for the given identity (an email address or a domain). Sending authorization is a feature that enables an identity owner to authorize other senders to use its identities. For information about using sending authorization, see the Amazon SES Developer Guide.
You can execute this operation no more than once per second.
May throw NotFoundException. May throw AlreadyExistsException. May throw TooManyRequestsException. May throw LimitExceededException. May throw BadRequestException.
Parameter emailIdentity
:
The email identity for which you want to create a policy.
Parameter policy
:
The text of the policy in JSON format. The policy cannot exceed 4 KB.
For information about the syntax of sending authorization policies, see the Amazon SES Developer Guide.
Parameter policyName
:
The name of the policy.
The policy name cannot exceed 64 characters and can only include alphanumeric characters, dashes, and underscores.
Implementation
Future<void> createEmailIdentityPolicy({
required String emailIdentity,
required String policy,
required String policyName,
}) async {
ArgumentError.checkNotNull(emailIdentity, 'emailIdentity');
_s.validateStringLength(
'emailIdentity',
emailIdentity,
1,
1152921504606846976,
isRequired: true,
);
ArgumentError.checkNotNull(policy, 'policy');
_s.validateStringLength(
'policy',
policy,
1,
1152921504606846976,
isRequired: true,
);
ArgumentError.checkNotNull(policyName, 'policyName');
_s.validateStringLength(
'policyName',
policyName,
1,
64,
isRequired: true,
);
final $payload = <String, dynamic>{
'Policy': policy,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/v2/email/identities/${Uri.encodeComponent(emailIdentity)}/policies/${Uri.encodeComponent(policyName)}',
exceptionFnMap: _exceptionFns,
);
}