Class: AWS.ResourceGroups

Inherits:
AWS.Service show all
Identifier:
resourcegroups
API Version:
2017-11-27
Defined in:
(unknown)

Overview

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

Service Description

AWS Resource Groups lets you organize AWS resources such as Amazon EC2 instances, Amazon Relational Database Service databases, and Amazon S3 buckets into groups using criteria that you define as tags. A resource group is a collection of resources that match the resource types specified in a query, and share one or more tags or portions of tags. You can create a group of resources based on their roles in your cloud infrastructure, lifecycle stages, regions, application layers, or virtually any criteria. Resource groups enable you to automate management tasks, such as those in AWS Systems Manager Automation documents, on tag-related resources in AWS Systems Manager. Groups of tagged resources also let you quickly view a custom console in AWS Systems Manager that shows AWS Config compliance and other monitoring data about member resources.

To create a resource group, build a resource query, and specify tags that identify the criteria that members of the group have in common. Tags are key-value pairs.

For more information about Resource Groups, see the AWS Resource Groups User Guide.

AWS Resource Groups uses a REST-compliant API that you can use to perform the following types of operations.

  • Create, Read, Update, and Delete (CRUD) operations on resource groups and resource query entities

  • Applying, editing, and removing tags from resource groups

  • Resolving resource group member ARNs so they can be returned as search results

  • Getting data about resources that are members of a group

  • Searching AWS resources based on a resource query

Sending a Request Using ResourceGroups

var resourcegroups = new AWS.ResourceGroups();
resourcegroups.createGroup(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 ResourceGroups object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var resourcegroups = new AWS.ResourceGroups({apiVersion: '2017-11-27'});

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

AWS.config.apiVersions = {
  resourcegroups: '2017-11-27',
  // other service API versions
};

var resourcegroups = new AWS.ResourceGroups();

Version:

  • 2017-11-27

Constructor Summary

Property Summary

Properties inherited from AWS.Service

apiVersions

Method Summary

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

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

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

Examples:

Constructing a ResourceGroups object

var resourcegroups = new AWS.ResourceGroups({apiVersion: '2017-11-27'});

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.ResourceGroups.region for more information.

  • maxRetries (Integer)

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

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.ResourceGroups.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.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean)

    whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to 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

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

Creates a group with a specified name, description, and resource query.

Service Reference:

Examples:

Calling the createGroup operation

var params = {
  Name: 'STRING_VALUE', /* required */
  ResourceQuery: { /* required */
    Query: 'STRING_VALUE', /* required */
    Type: TAG_FILTERS_1_0 | CLOUDFORMATION_STACK_1_0 /* required */
  },
  Description: 'STRING_VALUE',
  Tags: {
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
resourcegroups.createGroup(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: {})
    • Name — (String)

      The name of the group, which is the identifier of the group in other operations. A resource group name cannot be updated after it is created. A resource group name can have a maximum of 128 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with AWS or aws; these are reserved. A resource group name must be unique within your account.

    • Description — (String)

      The description of the resource group. Descriptions can have a maximum of 511 characters, including letters, numbers, hyphens, underscores, punctuation, and spaces.

    • ResourceQuery — (map)

      The resource query that determines which AWS resources are members of this group.

      • Typerequired — (String)

        The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

        TAG_FILTERS_1_0: A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API GetResources operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

        For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"}

        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

        The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

        • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

        • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"}

        CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you specify a CloudFormation stack ARN.

        Possible values include:
        • "TAG_FILTERS_1_0"
        • "CLOUDFORMATION_STACK_1_0"
      • Queryrequired — (String)

        The query that defines a group or a search.

    • Tags — (map<String>)

      The tags to add to the group. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

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:

      • Group — (map)

        A full description of the resource group after it is created.

        • GroupArnrequired — (String)

          The ARN of a resource group.

        • Namerequired — (String)

          The name of a resource group.

        • Description — (String)

          The description of the resource group.

      • ResourceQuery — (map)

        The resource query associated with the group.

        • Typerequired — (String)

          The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

          TAG_FILTERS_1_0: A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API GetResources operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

          For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

          • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"}

          • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

          The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

          • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

          • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"}

          CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you specify a CloudFormation stack ARN.

          Possible values include:
          • "TAG_FILTERS_1_0"
          • "CLOUDFORMATION_STACK_1_0"
        • Queryrequired — (String)

          The query that defines a group or a search.

      • Tags — (map<String>)

        The tags associated with the group.

Returns:

  • (AWS.Request)

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

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

Deletes a specified resource group. Deleting a resource group does not delete resources that are members of the group; it only deletes the group structure.

Service Reference:

Examples:

Calling the deleteGroup operation

var params = {
  GroupName: 'STRING_VALUE' /* required */
};
resourcegroups.deleteGroup(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: {})
    • GroupName — (String)

      The name of the resource group to delete.

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:

      • Group — (map)

        A full description of the deleted resource group.

        • GroupArnrequired — (String)

          The ARN of a resource group.

        • Namerequired — (String)

          The name of a resource group.

        • Description — (String)

          The description of the resource group.

Returns:

  • (AWS.Request)

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

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

Returns information about a specified resource group.

Service Reference:

Examples:

Calling the getGroup operation

var params = {
  GroupName: 'STRING_VALUE' /* required */
};
resourcegroups.getGroup(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: {})
    • GroupName — (String)

      The name of the resource group.

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:

      • Group — (map)

        A full description of the resource group.

        • GroupArnrequired — (String)

          The ARN of a resource group.

        • Namerequired — (String)

          The name of a resource group.

        • Description — (String)

          The description of the resource group.

Returns:

  • (AWS.Request)

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

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

Returns the resource query associated with the specified resource group.

Service Reference:

Examples:

Calling the getGroupQuery operation

var params = {
  GroupName: 'STRING_VALUE' /* required */
};
resourcegroups.getGroupQuery(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: {})
    • GroupName — (String)

      The name of the resource group.

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:

      • GroupQuery — (map)

        The resource query associated with the specified group.

        • GroupNamerequired — (String)

          The name of a resource group that is associated with a specific resource query.

        • ResourceQueryrequired — (map)

          The resource query which determines which AWS resources are members of the associated resource group.

          • Typerequired — (String)

            The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

            TAG_FILTERS_1_0: A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API GetResources operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

            For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

            • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"}

            • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

            The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

            • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

            • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"}

            CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you specify a CloudFormation stack ARN.

            Possible values include:
            • "TAG_FILTERS_1_0"
            • "CLOUDFORMATION_STACK_1_0"
          • Queryrequired — (String)

            The query that defines a group or a search.

Returns:

  • (AWS.Request)

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

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

Returns a list of tags that are associated with a resource group, specified by an ARN.

Service Reference:

Examples:

Calling the getTags operation

var params = {
  Arn: 'STRING_VALUE' /* required */
};
resourcegroups.getTags(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: {})
    • Arn — (String)

      The ARN of the resource group for which you want a list of tags. The resource must exist within the account you are using.

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:

      • Arn — (String)

        The ARN of the tagged resource group.

      • Tags — (map<String>)

        The tags associated with the specified resource group.

Returns:

  • (AWS.Request)

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

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

Returns a list of ARNs of resources that are members of a specified resource group.

Service Reference:

Examples:

Calling the listGroupResources operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  Filters: [
    {
      Name: resource-type, /* required */
      Values: [ /* required */
        'STRING_VALUE',
        /* more items */
      ]
    },
    /* more items */
  ],
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
resourcegroups.listGroupResources(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: {})
    • GroupName — (String)

      The name of the resource group.

    • Filters — (Array<map>)

      Filters, formatted as ResourceFilter objects, that you want to apply to a ListGroupResources operation.

      • resource-type - Filter resources by their type. Specify up to five resource types in the format AWS::ServiceCode::ResourceType. For example, AWS::EC2::Instance, or AWS::S3::Bucket.

      • Namerequired — (String)

        The name of the filter. Filter names are case-sensitive.

        Possible values include:
        • "resource-type"
      • Valuesrequired — (Array<String>)

        One or more filter values. Allowed filter values vary by resource filter name, and are case-sensitive.

    • MaxResults — (Integer)

      The maximum number of group member ARNs that are returned in a single call by ListGroupResources, in paginated output. By default, this number is 50.

    • NextToken — (String)

      The NextToken value that is returned in a paginated ListGroupResources request. To get the next page of results, run the call again, add the NextToken parameter, and specify the NextToken value.

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:

      • ResourceIdentifiers — (Array<map>)

        The ARNs and resource types of resources that are members of the group that you specified.

        • ResourceArn — (String)

          The ARN of a resource.

        • ResourceType — (String)

          The resource type of a resource, such as AWS::EC2::Instance.

      • NextToken — (String)

        The NextToken value to include in a subsequent ListGroupResources request, to get more results.

      • QueryErrors — (Array<map>)

        A list of QueryError objects. Each error is an object that contains ErrorCode and Message structures. Possible values for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING.

        • ErrorCode — (String)

          Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING.

          Possible values include:
          • "CLOUDFORMATION_STACK_INACTIVE"
          • "CLOUDFORMATION_STACK_NOT_EXISTING"
        • Message — (String)

          A message that explains the ErrorCode value. Messages might state that the specified CloudFormation stack does not exist (or no longer exists). For CLOUDFORMATION_STACK_INACTIVE, the message typically states that the CloudFormation stack has a status that is not (or no longer) active, such as CREATE_FAILED.

Returns:

  • (AWS.Request)

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

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

Returns a list of existing resource groups in your account.

Service Reference:

Examples:

Calling the listGroups operation

var params = {
  Filters: [
    {
      Name: resource-type, /* required */
      Values: [ /* required */
        'STRING_VALUE',
        /* more items */
      ]
    },
    /* more items */
  ],
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
resourcegroups.listGroups(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: {})
    • Filters — (Array<map>)

      Filters, formatted as GroupFilter objects, that you want to apply to a ListGroups operation.

      • resource-type - Filter groups by resource type. Specify up to five resource types in the format AWS::ServiceCode::ResourceType. For example, AWS::EC2::Instance, or AWS::S3::Bucket.

      • Namerequired — (String)

        The name of the filter. Filter names are case-sensitive.

        Possible values include:
        • "resource-type"
      • Valuesrequired — (Array<String>)

        One or more filter values. Allowed filter values vary by group filter name, and are case-sensitive.

    • MaxResults — (Integer)

      The maximum number of resource group results that are returned by ListGroups in paginated output. By default, this number is 50.

    • NextToken — (String)

      The NextToken value that is returned in a paginated ListGroups request. To get the next page of results, run the call again, add the NextToken parameter, and specify the NextToken value.

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:

      • GroupIdentifiers — (Array<map>)

        A list of GroupIdentifier objects. Each identifier is an object that contains both the GroupName and the GroupArn.

        • GroupName — (String)

          The name of a resource group.

        • GroupArn — (String)

          The ARN of a resource group.

      • Groups — (Array<map>)

        A list of resource groups.

        • GroupArnrequired — (String)

          The ARN of a resource group.

        • Namerequired — (String)

          The name of a resource group.

        • Description — (String)

          The description of the resource group.

      • NextToken — (String)

        The NextToken value to include in a subsequent ListGroups request, to get more results.

Returns:

  • (AWS.Request)

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

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

Returns a list of AWS resource identifiers that matches a specified query. The query uses the same format as a resource query in a CreateGroup or UpdateGroupQuery operation.

Service Reference:

Examples:

Calling the searchResources operation

var params = {
  ResourceQuery: { /* required */
    Query: 'STRING_VALUE', /* required */
    Type: TAG_FILTERS_1_0 | CLOUDFORMATION_STACK_1_0 /* required */
  },
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
resourcegroups.searchResources(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: {})
    • ResourceQuery — (map)

      The search query, using the same formats that are supported for resource group definition.

      • Typerequired — (String)

        The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

        TAG_FILTERS_1_0: A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API GetResources operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

        For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"}

        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

        The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

        • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

        • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"}

        CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you specify a CloudFormation stack ARN.

        Possible values include:
        • "TAG_FILTERS_1_0"
        • "CLOUDFORMATION_STACK_1_0"
      • Queryrequired — (String)

        The query that defines a group or a search.

    • MaxResults — (Integer)

      The maximum number of group member ARNs returned by SearchResources in paginated output. By default, this number is 50.

    • NextToken — (String)

      The NextToken value that is returned in a paginated SearchResources request. To get the next page of results, run the call again, add the NextToken parameter, and specify the NextToken value.

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:

      • ResourceIdentifiers — (Array<map>)

        The ARNs and resource types of resources that are members of the group that you specified.

        • ResourceArn — (String)

          The ARN of a resource.

        • ResourceType — (String)

          The resource type of a resource, such as AWS::EC2::Instance.

      • NextToken — (String)

        The NextToken value to include in a subsequent SearchResources request, to get more results.

      • QueryErrors — (Array<map>)

        A list of QueryError objects. Each error is an object that contains ErrorCode and Message structures. Possible values for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING.

        • ErrorCode — (String)

          Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING.

          Possible values include:
          • "CLOUDFORMATION_STACK_INACTIVE"
          • "CLOUDFORMATION_STACK_NOT_EXISTING"
        • Message — (String)

          A message that explains the ErrorCode value. Messages might state that the specified CloudFormation stack does not exist (or no longer exists). For CLOUDFORMATION_STACK_INACTIVE, the message typically states that the CloudFormation stack has a status that is not (or no longer) active, such as CREATE_FAILED.

Returns:

  • (AWS.Request)

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

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

Adds tags to a resource group with the specified ARN. Existing tags on a resource group are not changed if they are not specified in the request parameters.

Service Reference:

Examples:

Calling the tag operation

var params = {
  Arn: 'STRING_VALUE', /* required */
  Tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
resourcegroups.tag(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: {})
    • Arn — (String)

      The ARN of the resource to which to add tags.

    • Tags — (map<String>)

      The tags to add to the specified resource. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

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:

      • Arn — (String)

        The ARN of the tagged resource.

      • Tags — (map<String>)

        The tags that have been added to the specified resource.

Returns:

  • (AWS.Request)

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

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

Deletes specified tags from a specified resource.

Service Reference:

Examples:

Calling the untag operation

var params = {
  Arn: 'STRING_VALUE', /* required */
  Keys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
resourcegroups.untag(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: {})
    • Arn — (String)

      The ARN of the resource from which to remove tags.

    • Keys — (Array<String>)

      The keys of the tags to be removed.

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:

      • Arn — (String)

        The ARN of the resource from which tags have been removed.

      • Keys — (Array<String>)

        The keys of tags that have been removed.

Returns:

  • (AWS.Request)

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

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

Updates an existing group with a new or changed description. You cannot update the name of a resource group.

Service Reference:

Examples:

Calling the updateGroup operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE'
};
resourcegroups.updateGroup(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: {})
    • GroupName — (String)

      The name of the resource group for which you want to update its description.

    • Description — (String)

      The description of the resource group. Descriptions can have a maximum of 511 characters, including letters, numbers, hyphens, underscores, punctuation, and spaces.

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:

      • Group — (map)

        The full description of the resource group after it has been updated.

        • GroupArnrequired — (String)

          The ARN of a resource group.

        • Namerequired — (String)

          The name of a resource group.

        • Description — (String)

          The description of the resource group.

Returns:

  • (AWS.Request)

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

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

Updates the resource query of a group.

Service Reference:

Examples:

Calling the updateGroupQuery operation

var params = {
  GroupName: 'STRING_VALUE', /* required */
  ResourceQuery: { /* required */
    Query: 'STRING_VALUE', /* required */
    Type: TAG_FILTERS_1_0 | CLOUDFORMATION_STACK_1_0 /* required */
  }
};
resourcegroups.updateGroupQuery(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: {})
    • GroupName — (String)

      The name of the resource group for which you want to edit the query.

    • ResourceQuery — (map)

      The resource query that determines which AWS resources are members of the resource group.

      • Typerequired — (String)

        The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

        TAG_FILTERS_1_0: A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API GetResources operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

        For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"}

        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

        The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

        • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

        • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"}

        CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you specify a CloudFormation stack ARN.

        Possible values include:
        • "TAG_FILTERS_1_0"
        • "CLOUDFORMATION_STACK_1_0"
      • Queryrequired — (String)

        The query that defines a group or a search.

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:

      • GroupQuery — (map)

        The resource query associated with the resource group after the update.

        • GroupNamerequired — (String)

          The name of a resource group that is associated with a specific resource query.

        • ResourceQueryrequired — (map)

          The resource query which determines which AWS resources are members of the associated resource group.

          • Typerequired — (String)

            The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

            TAG_FILTERS_1_0: A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API GetResources operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

            For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

            • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"}

            • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

            The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

            • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

            • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"}

            CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you specify a CloudFormation stack ARN.

            Possible values include:
            • "TAG_FILTERS_1_0"
            • "CLOUDFORMATION_STACK_1_0"
          • Queryrequired — (String)

            The query that defines a group or a search.

Returns:

  • (AWS.Request)

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