Class: AWS.ResourceGroupsTaggingAPI

Inherits:
AWS.Service show all
Identifier:
resourcegroupstaggingapi
API Version:
2017-01-26
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Sending a Request Using ResourceGroupsTaggingAPI

var resourcegroupstaggingapi = new AWS.ResourceGroupsTaggingAPI();
resourcegroupstaggingapi.getResources(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the ResourceGroupsTaggingAPI object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var resourcegroupstaggingapi = new AWS.ResourceGroupsTaggingAPI({apiVersion: '2017-01-26'});

You can also set the API version globally in AWS.config.apiVersions using the resourcegroupstaggingapi service identifier:

AWS.config.apiVersions = {
  resourcegroupstaggingapi: '2017-01-26',
  // other service API versions
};

var resourcegroupstaggingapi = new AWS.ResourceGroupsTaggingAPI();

Version:

  • 2017-01-26

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.ResourceGroupsTaggingAPI(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a ResourceGroupsTaggingAPI object

var resourcegroupstaggingapi = new AWS.ResourceGroupsTaggingAPI({apiVersion: '2017-01-26'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.ResourceGroupsTaggingAPI.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.ResourceGroupsTaggingAPI.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.ResourceGroupsTaggingAPI.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

getResources(params = {}, callback) ⇒ AWS.Request

Returns all the tagged resources that are associated with the specified tags (keys and values) located in the specified region for the AWS account. The tags and the resource types that you specify in the request are known as filters. The response includes all tags that are associated with the requested resources. If no filter is provided, this action returns a paginated resource list with the associated tags.

Service Reference:

Examples:

Calling the getResources operation

var params = {
  PaginationToken: 'STRING_VALUE',
  ResourceTypeFilters: [
    'STRING_VALUE',
    /* more items */
  ],
  ResourcesPerPage: 0,
  TagFilters: [
    {
      Key: 'STRING_VALUE',
      Values: [
        'STRING_VALUE',
        /* more items */
      ]
    },
    /* more items */
  ],
  TagsPerPage: 0
};
resourcegroupstaggingapi.getResources(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PaginationToken — (String)

      A string that indicates that additional data is available. Leave this value empty for your initial request. If the response includes a PaginationToken, use that string for this value to request an additional page of data.

    • TagFilters — (Array<map>)

      A list of tags (keys and values). A request can include up to 50 keys, and each key can include up to 20 values.

      If you specify multiple filters connected by an AND operator in a single request, the response returns only those resources that are associated with every specified filter.

      If you specify multiple filters connected by an OR operator in a single request, the response returns all resources that are associated with at least one or possibly more of the specified filters.

      • Key — (String)

        One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

      • Values — (Array<String>)

        The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

    • ResourcesPerPage — (Integer)

      A limit that restricts the number of resources returned by GetResources in paginated output. You can set ResourcesPerPage to a minimum of 1 item and the maximum of 50 items.

    • TagsPerPage — (Integer)

      A limit that restricts the number of tags (key and value pairs) returned by GetResources in paginated output. A resource with no tags is counted as having one tag (one key and value pair).

      GetResources does not split a resource and its associated tags across pages. If the specified TagsPerPage would cause such a break, a PaginationToken is returned in place of the affected resource and its tags. Use that token in another request to get the remaining data. For example, if you specify a TagsPerPage of 100 and the account has 22 resources with 10 tags each (meaning that each resource has 10 key and value pairs), the output will consist of 3 pages, with the first page displaying the first 10 resources, each with its 10 tags, the second page displaying the next 10 resources each with its 10 tags, and the third page displaying the remaining 2 resources, each with its 10 tags.

      You can set TagsPerPage to a minimum of 100 items and the maximum of 500 items.

    • ResourceTypeFilters — (Array<String>)

      The constraints on the resources that you want returned. The format of each resource type is service[:resourceType]. For example, specifying a resource type of ec2 returns all tagged Amazon EC2 resources (which includes tagged EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.

      The string for each service name and resource type is the same as that embedded in a resource's Amazon Resource Name (ARN). Consult the AWS General Reference for the following:

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • PaginationToken — (String)

        A string that indicates that the response contains more data than can be returned in a single response. To receive additional data, specify this string for the PaginationToken value in a subsequent request.

      • ResourceTagMappingList — (Array<map>)

        A list of resource ARNs and the tags (keys and values) associated with each.

        • ResourceARN — (String)

          An array of resource ARN(s).

        • Tags — (Array<map>)

          The tags that have been applied to one or more AWS resources.

          • Keyrequired — (String)

            One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

          • Valuerequired — (String)

            The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getTagKeys(params = {}, callback) ⇒ AWS.Request

Returns all tag keys in the specified region for the AWS account.

Service Reference:

Examples:

Calling the getTagKeys operation

var params = {
  PaginationToken: 'STRING_VALUE'
};
resourcegroupstaggingapi.getTagKeys(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PaginationToken — (String)

      A string that indicates that additional data is available. Leave this value empty for your initial request. If the response includes a PaginationToken, use that string for this value to request an additional page of data.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • PaginationToken — (String)

        A string that indicates that the response contains more data than can be returned in a single response. To receive additional data, specify this string for the PaginationToken value in a subsequent request.

      • TagKeys — (Array<String>)

        A list of all tag keys in the AWS account.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getTagValues(params = {}, callback) ⇒ AWS.Request

Returns all tag values for the specified key in the specified region for the AWS account.

Service Reference:

Examples:

Calling the getTagValues operation

var params = {
  Key: 'STRING_VALUE', /* required */
  PaginationToken: 'STRING_VALUE'
};
resourcegroupstaggingapi.getTagValues(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PaginationToken — (String)

      A string that indicates that additional data is available. Leave this value empty for your initial request. If the response includes a PaginationToken, use that string for this value to request an additional page of data.

    • Key — (String)

      The key for which you want to list all existing values in the specified region for the AWS account.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • PaginationToken — (String)

        A string that indicates that the response contains more data than can be returned in a single response. To receive additional data, specify this string for the PaginationToken value in a subsequent request.

      • TagValues — (Array<String>)

        A list of all tag values for the specified key in the AWS account.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

tagResources(params = {}, callback) ⇒ AWS.Request

Applies one or more tags to the specified resources. Note the following:

  • Not all resources can have tags. For a list of resources that support tagging, see Supported Resources in the AWS Resource Groups and Tag Editor User Guide.

  • Each resource can have up to 50 tags. For other limits, see Tag Restrictions in the Amazon EC2 User Guide for Linux Instances.

  • You can only tag resources that are located in the specified region for the AWS account.

  • To add tags to a resource, you need the necessary permissions for the service that the resource belongs to as well as permissions for adding tags. For more information, see Obtaining Permissions for Tagging in the AWS Resource Groups and Tag Editor User Guide.

Service Reference:

Examples:

Calling the tagResources operation

var params = {
  ResourceARNList: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  Tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
resourcegroupstaggingapi.tagResources(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceARNList — (Array<String>)

      A list of ARNs. An ARN (Amazon Resource Name) uniquely identifies a resource. You can specify a minimum of 1 and a maximum of 20 ARNs (resources) to tag. An ARN can be set to a maximum of 1600 characters. For more information, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

    • Tags — (map<String>)

      The tags that you want to add to the specified resources. A tag consists of a key and a value that you define.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • FailedResourcesMap — (map<map>)

        Details of resources that could not be tagged. An error code, status code, and error message are returned for each failed item.

        • StatusCode — (Integer)

          The HTTP status code of the common error.

        • ErrorCode — (String)

          The code of the common error. Valid values include InternalServiceException, InvalidParameterException, and any valid error code returned by the AWS service that hosts the resource that you want to tag.

          Possible values include:
          • "InternalServiceException"
          • "InvalidParameterException"
        • ErrorMessage — (String)

          The message of the common error.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

untagResources(params = {}, callback) ⇒ AWS.Request

Removes the specified tags from the specified resources. When you specify a tag key, the action removes both that key and its associated value. The operation succeeds even if you attempt to remove tags from a resource that were already removed. Note the following:

  • To remove tags from a resource, you need the necessary permissions for the service that the resource belongs to as well as permissions for removing tags. For more information, see Obtaining Permissions for Tagging in the AWS Resource Groups and Tag Editor User Guide.

  • You can only tag resources that are located in the specified region for the AWS account.

Service Reference:

Examples:

Calling the untagResources operation

var params = {
  ResourceARNList: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
resourcegroupstaggingapi.untagResources(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceARNList — (Array<String>)

      A list of ARNs. An ARN (Amazon Resource Name) uniquely identifies a resource. You can specify a minimum of 1 and a maximum of 20 ARNs (resources) to untag. An ARN can be set to a maximum of 1600 characters. For more information, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

    • TagKeys — (Array<String>)

      A list of the tag keys that you want to remove from the specified resources.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • FailedResourcesMap — (map<map>)

        Details of resources that could not be untagged. An error code, status code, and error message are returned for each failed item.

        • StatusCode — (Integer)

          The HTTP status code of the common error.

        • ErrorCode — (String)

          The code of the common error. Valid values include InternalServiceException, InvalidParameterException, and any valid error code returned by the AWS service that hosts the resource that you want to tag.

          Possible values include:
          • "InternalServiceException"
          • "InvalidParameterException"
        • ErrorMessage — (String)

          The message of the common error.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.