attachPolicy method
Attaches the specified policy to the specified principal (certificate or other credential).
Requires permission to access the AttachPolicy action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
Parameter policyName :
The name of the policy to attach.
Parameter target :
The identity
to which the policy is attached. For example, a thing group or a
certificate.
Implementation
Future<void> attachPolicy({
required String policyName,
required String target,
}) async {
final $payload = <String, dynamic>{
'target': target,
};
await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/target-policies/${Uri.encodeComponent(policyName)}',
exceptionFnMap: _exceptionFns,
);
}