attachSecurityProfile method

Future<void> attachSecurityProfile({
  1. required String securityProfileName,
  2. required String securityProfileTargetArn,
})

Associates a Device Defender security profile with a thing group or this account. Each thing group or account can have up to five security profiles associated with it.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw VersionConflictException. May throw ThrottlingException. May throw InternalFailureException.

Parameter securityProfileName : The security profile that is attached.

Parameter securityProfileTargetArn : The ARN of the target (thing group) to which the security profile is attached.

Implementation

Future<void> attachSecurityProfile({
  required String securityProfileName,
  required String securityProfileTargetArn,
}) async {
  ArgumentError.checkNotNull(securityProfileName, 'securityProfileName');
  _s.validateStringLength(
    'securityProfileName',
    securityProfileName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      securityProfileTargetArn, 'securityProfileTargetArn');
  final $query = <String, List<String>>{
    'securityProfileTargetArn': [securityProfileTargetArn],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'PUT',
    requestUri:
        '/security-profiles/${Uri.encodeComponent(securityProfileName)}/targets',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}