detachPrincipalPolicy method
Removes the specified policy from the specified certificate.
Note: This API is deprecated. Please use DetachPolicy instead.
May throw ResourceNotFoundException. May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException.
Parameter policyName
:
The name of the policy to detach.
Parameter principal
:
The principal.
Valid principals are CertificateArn (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).
Implementation
@Deprecated('Deprecated')
Future<void> detachPrincipalPolicy({
required String policyName,
required String principal,
}) async {
ArgumentError.checkNotNull(policyName, 'policyName');
_s.validateStringLength(
'policyName',
policyName,
1,
128,
isRequired: true,
);
ArgumentError.checkNotNull(principal, 'principal');
final headers = <String, String>{
'x-amzn-iot-principal': principal.toString(),
};
await _protocol.send(
payload: null,
method: 'DELETE',
requestUri: '/principal-policies/${Uri.encodeComponent(policyName)}',
headers: headers,
exceptionFnMap: _exceptionFns,
);
}