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.

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

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 {
  ArgumentError.checkNotNull(principal, 'principal');
  ArgumentError.checkNotNull(thingName, 'thingName');
  _s.validateStringLength(
    'thingName',
    thingName,
    1,
    128,
    isRequired: true,
  );
  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,
  );
}