untagResource method

Future<void> untagResource({
  1. required String secretId,
  2. required List<String> tagKeys,
})

Removes one or more tags from the specified secret.

This operation is idempotent. If a requested tag is not attached to the secret, no error is returned and the secret metadata is unchanged. Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:UntagResource
Related operations
  • To add one or more tags to the collection attached to a secret, use TagResource.
  • To view the list of tags attached to a secret, use DescribeSecret.

May throw ResourceNotFoundException. May throw InvalidRequestException. May throw InvalidParameterException. May throw InternalServiceError.

Parameter secretId : The identifier for the secret that you want to remove tags from. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.

If you specify an incomplete ARN without the random suffix, and instead provide the 'friendly name', you must not include the random suffix. If you do include the random suffix added by Secrets Manager, you receive either a ResourceNotFoundException or an AccessDeniedException error, depending on your permissions.

Parameter tagKeys : A list of tag key names to remove from the secret. You don't specify the value. Both the key and its associated value are removed.

This parameter to the API requires a JSON text string argument. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the AWS CLI User Guide.

Implementation

Future<void> untagResource({
  required String secretId,
  required List<String> tagKeys,
}) async {
  ArgumentError.checkNotNull(secretId, 'secretId');
  _s.validateStringLength(
    'secretId',
    secretId,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tagKeys, 'tagKeys');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'secretsmanager.UntagResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SecretId': secretId,
      'TagKeys': tagKeys,
    },
  );
}