attachPrincipalPolicy method

  1. @Deprecated('Deprecated')
Future<void> attachPrincipalPolicy({
  1. required String policyName,
  2. required String principal,
})

Attaches the specified policy to the specified principal (certificate or other credential).

Note: This API is deprecated. Please use AttachPolicy instead.

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

Parameter policyName : The policy name.

Parameter principal : The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.

Implementation

@Deprecated('Deprecated')
Future<void> attachPrincipalPolicy({
  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: 'PUT',
    requestUri: '/principal-policies/${Uri.encodeComponent(policyName)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}