detachThingPrincipal method

Future<void> detachThingPrincipal({
  1. required String principal,
  2. required String thingName,
})

Detaches the specified principal from the specified thing. A principal can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito identities or federated identities. Requires permission to access the DetachThingPrincipal action.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter principal : If the principal is a certificate, this value must be ARN of the certificate. If the principal is an Amazon Cognito identity, this value must be the ID of the Amazon Cognito identity.

Parameter thingName : The name of the thing.

Implementation

Future<void> detachThingPrincipal({
  required String principal,
  required String thingName,
}) async {
  final headers = <String, String>{
    'x-amzn-principal': principal.toString(),
  };
  final response = await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/principals',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}