Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/client-resource-groups-tagging-api

Package Overview
Dependencies
Maintainers
7
Versions
422
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-resource-groups-tagging-api

AWS SDK for JavaScript Resource Groups Tagging Api Client for Node.js, Browser and React Native

  • 3.47.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created

What is @aws-sdk/client-resource-groups-tagging-api?

The @aws-sdk/client-resource-groups-tagging-api package is part of the AWS SDK for JavaScript. It provides a client for interacting with the AWS Resource Groups Tagging API, which allows you to manage and query tags for your AWS resources. This can be useful for organizing, searching, and managing resources based on their tags.

What are @aws-sdk/client-resource-groups-tagging-api's main functionalities?

ListTagsForResource

This feature allows you to list the tags for a specific AWS resource. The code sample demonstrates how to use the GetResourcesCommand to retrieve tags for a given resource ARN.

const { ResourceGroupsTaggingAPIClient, GetResourcesCommand } = require('@aws-sdk/client-resource-groups-tagging-api');

const client = new ResourceGroupsTaggingAPIClient({ region: 'us-west-2' });

const params = {
  ResourceARNList: ['arn:aws:s3:::example-bucket']
};

const run = async () => {
  try {
    const data = await client.send(new GetResourcesCommand(params));
    console.log('Tags for resource:', data.ResourceTagMappingList);
  } catch (err) {
    console.error(err);
  }
};

run();

TagResources

This feature allows you to add or update tags for specified AWS resources. The code sample demonstrates how to use the TagResourcesCommand to tag a resource with key-value pairs.

const { ResourceGroupsTaggingAPIClient, TagResourcesCommand } = require('@aws-sdk/client-resource-groups-tagging-api');

const client = new ResourceGroupsTaggingAPIClient({ region: 'us-west-2' });

const params = {
  ResourceARNList: ['arn:aws:s3:::example-bucket'],
  Tags: {
    'Environment': 'Production',
    'Department': 'Finance'
  }
};

const run = async () => {
  try {
    const data = await client.send(new TagResourcesCommand(params));
    console.log('Resources tagged successfully:', data);
  } catch (err) {
    console.error(err);
  }
};

run();

UntagResources

This feature allows you to remove tags from specified AWS resources. The code sample demonstrates how to use the UntagResourcesCommand to remove specific tags from a resource.

const { ResourceGroupsTaggingAPIClient, UntagResourcesCommand } = require('@aws-sdk/client-resource-groups-tagging-api');

const client = new ResourceGroupsTaggingAPIClient({ region: 'us-west-2' });

const params = {
  ResourceARNList: ['arn:aws:s3:::example-bucket'],
  TagKeys: ['Environment', 'Department']
};

const run = async () => {
  try {
    const data = await client.send(new UntagResourcesCommand(params));
    console.log('Tags removed successfully:', data);
  } catch (err) {
    console.error(err);
  }
};

run();

GetTagKeys

This feature allows you to retrieve all tag keys in your AWS account. The code sample demonstrates how to use the GetTagKeysCommand to list all tag keys.

const { ResourceGroupsTaggingAPIClient, GetTagKeysCommand } = require('@aws-sdk/client-resource-groups-tagging-api');

const client = new ResourceGroupsTaggingAPIClient({ region: 'us-west-2' });

const run = async () => {
  try {
    const data = await client.send(new GetTagKeysCommand({}));
    console.log('Tag keys:', data.TagKeys);
  } catch (err) {
    console.error(err);
  }
};

run();

GetTagValues

This feature allows you to retrieve all tag values for a specific tag key in your AWS account. The code sample demonstrates how to use the GetTagValuesCommand to list all values for a given tag key.

const { ResourceGroupsTaggingAPIClient, GetTagValuesCommand } = require('@aws-sdk/client-resource-groups-tagging-api');

const client = new ResourceGroupsTaggingAPIClient({ region: 'us-west-2' });

const params = {
  Key: 'Environment'
};

const run = async () => {
  try {
    const data = await client.send(new GetTagValuesCommand(params));
    console.log('Tag values for key:', data.TagValues);
  } catch (err) {
    console.error(err);
  }
};

run();

Other packages similar to @aws-sdk/client-resource-groups-tagging-api

FAQs

Package last updated on 15 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc