You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::ResourceGroups::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#api_requests, #stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

Options Hash (options):

  • :credentials (required, Aws::CredentialProvider)

    Your AWS credentials. This can be an instance of any one of the following classes:

    • Aws::Credentials - Used for configuring static, non-refreshing credentials.

    • Aws::InstanceProfileCredentials - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • Aws::SharedCredentials - Used for loading credentials from a shared file, such as ~/.aws/config.

    • Aws::AssumeRoleCredentials - Used when you need to assume a role.

    When :credentials are not configured directly, the following locations will be searched for credentials:

    • Aws.config[:credentials]
    • The :access_key_id, :secret_access_key, and :session_token options.
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • ~/.aws/credentials
    • ~/.aws/config
    • EC2 IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of Aws::InstanceProfileCredentails to enable retries and extended timeouts.
  • :region (required, String)

    The AWS region to connect to. The configured :region is used to determine the service :endpoint. When not passed, a default :region is search for in the following locations:

    • Aws.config[:region]
    • ENV['AWS_REGION']
    • ENV['AMAZON_REGION']
    • ENV['AWS_DEFAULT_REGION']
    • ~/.aws/credentials
    • ~/.aws/config
  • :access_key_id (String)
  • :active_endpoint_cache (Boolean) — default: false

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false.

  • :client_side_monitoring (Boolean) — default: false

    When true, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: ""

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_host (String) — default: "127.0.0.1"

    Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_port (Integer) — default: 31000

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types.

  • :disable_host_prefix_injection (Boolean) — default: false

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available.

  • :endpoint (String)

    The client endpoint is normally constructed from the :region option. You should only configure an :endpoint when connecting to test endpoints. This should be avalid HTTP(S) URI.

  • :endpoint_cache_max_entries (Integer) — default: 1000

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec.

  • :endpoint_discovery (Boolean) — default: false

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default

    The log formatter.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the :logger at.

  • :logger (Logger)

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :profile (String) — default: "default"

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used.

  • :retry_base_delay (Float) — default: 0.3

    The base delay in seconds used by the default backoff function.

  • :retry_jitter (Symbol) — default: :none

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.

    @see https://www.awsarchitectureblog.com/2015/03/backoff.html

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials.

  • :retry_max_delay (Integer) — default: 0

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.

  • :secret_access_key (String)
  • :session_token (String)
  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request.

  • :http_proxy (URI::HTTP, String)

    A proxy to send requests through. Formatted like 'http://proxy.com:123'.

  • :http_open_timeout (Float) — default: 15

    The number of seconds to wait when opening a HTTP session before rasing a Timeout::Error.

  • :http_read_timeout (Integer) — default: 60

    The default number of seconds to wait for response data. This value can safely be set per-request on the session yeidled by #session_for.

  • :http_idle_timeout (Float) — default: 5

    The number of seconds a connection is allowed to sit idble before it is considered stale. Stale connections are closed and removed from the pool before making a request.

  • :http_continue_timeout (Float) — default: 1

    The number of seconds to wait for a 100-continue response before sending the request body. This option has no effect unless the request has "Expect" header set to "100-continue". Defaults to nil which disables this behaviour. This value can safely be set per request on the session yeidled by #session_for.

  • :http_wire_trace (Boolean) — default: false

    When true, HTTP debug output will be sent to the :logger.

  • :ssl_verify_peer (Boolean) — default: true

    When true, SSL peer certificates are verified when establishing a connection.

  • :ssl_ca_bundle (String)

    Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.

  • :ssl_ca_directory (String)

    Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.



251
252
253
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 251

def initialize(*args)
  super
end

Instance Method Details

#create_group(params = {}) ⇒ Types::CreateGroupOutput

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

Examples:

Request syntax with placeholder values


resp = client.create_group({
  name: "GroupName", # required
  description: "GroupDescription",
  resource_query: { # required
    type: "TAG_FILTERS_1_0", # required, accepts TAG_FILTERS_1_0, CLOUDFORMATION_STACK_1_0
    query: "Query", # required
  },
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.group.group_arn #=> String
resp.group.name #=> String
resp.group.description #=> String
resp.resource_query.type #=> String, one of "TAG_FILTERS_1_0", "CLOUDFORMATION_STACK_1_0"
resp.resource_query.query #=> String
resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, 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.

  • :resource_query (required, Types::ResourceQuery)

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

  • :tags (Hash<String,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.

Returns:

See Also:



317
318
319
320
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 317

def create_group(params = {}, options = {})
  req = build_request(:create_group, params)
  req.send_request(options)
end

#delete_group(params = {}) ⇒ Types::DeleteGroupOutput

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.

Examples:

Request syntax with placeholder values


resp = client.delete_group({
  group_name: "GroupName", # required
})

Response structure


resp.group.group_arn #=> String
resp.group.name #=> String
resp.group.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the resource group to delete.

Returns:

See Also:



349
350
351
352
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 349

def delete_group(params = {}, options = {})
  req = build_request(:delete_group, params)
  req.send_request(options)
end

#get_group(params = {}) ⇒ Types::GetGroupOutput

Returns information about a specified resource group.

Examples:

Request syntax with placeholder values


resp = client.get_group({
  group_name: "GroupName", # required
})

Response structure


resp.group.group_arn #=> String
resp.group.name #=> String
resp.group.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the resource group.

Returns:

See Also:



379
380
381
382
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 379

def get_group(params = {}, options = {})
  req = build_request(:get_group, params)
  req.send_request(options)
end

#get_group_query(params = {}) ⇒ Types::GetGroupQueryOutput

Returns the resource query associated with the specified resource group.

Examples:

Request syntax with placeholder values


resp = client.get_group_query({
  group_name: "GroupName", # required
})

Response structure


resp.group_query.group_name #=> String
resp.group_query.resource_query.type #=> String, one of "TAG_FILTERS_1_0", "CLOUDFORMATION_STACK_1_0"
resp.group_query.resource_query.query #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the resource group.

Returns:

See Also:



410
411
412
413
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 410

def get_group_query(params = {}, options = {})
  req = build_request(:get_group_query, params)
  req.send_request(options)
end

#get_tags(params = {}) ⇒ Types::GetTagsOutput

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

Examples:

Request syntax with placeholder values


resp = client.get_tags({
  arn: "GroupArn", # required
})

Response structure


resp.arn #=> String
resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :arn (required, 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.

Returns:

See Also:



443
444
445
446
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 443

def get_tags(params = {}, options = {})
  req = build_request(:get_tags, params)
  req.send_request(options)
end

#list_group_resources(params = {}) ⇒ Types::ListGroupResourcesOutput

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

Examples:

Request syntax with placeholder values


resp = client.list_group_resources({
  group_name: "GroupName", # required
  filters: [
    {
      name: "resource-type", # required, accepts resource-type
      values: ["ResourceFilterValue"], # required
    },
  ],
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.resource_identifiers #=> Array
resp.resource_identifiers[0].resource_arn #=> String
resp.resource_identifiers[0].resource_type #=> String
resp.next_token #=> String
resp.query_errors #=> Array
resp.query_errors[0].error_code #=> String, one of "CLOUDFORMATION_STACK_INACTIVE", "CLOUDFORMATION_STACK_NOT_EXISTING"
resp.query_errors[0].message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

    The name of the resource group.

  • :filters (Array<Types::ResourceFilter>)

    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.

    ^

  • :max_results (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.

  • :next_token (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.

Returns:

See Also:



508
509
510
511
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 508

def list_group_resources(params = {}, options = {})
  req = build_request(:list_group_resources, params)
  req.send_request(options)
end

#list_groups(params = {}) ⇒ Types::ListGroupsOutput

Returns a list of existing resource groups in your account.

Examples:

Request syntax with placeholder values


resp = client.list_groups({
  filters: [
    {
      name: "resource-type", # required, accepts resource-type
      values: ["GroupFilterValue"], # required
    },
  ],
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.group_identifiers #=> Array
resp.group_identifiers[0].group_name #=> String
resp.group_identifiers[0].group_arn #=> String
resp.groups #=> Array
resp.groups[0].group_arn #=> String
resp.groups[0].name #=> String
resp.groups[0].description #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :filters (Array<Types::GroupFilter>)

    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.

    ^

  • :max_results (Integer)

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

  • :next_token (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.

Returns:

See Also:



568
569
570
571
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 568

def list_groups(params = {}, options = {})
  req = build_request(:list_groups, params)
  req.send_request(options)
end

#search_resources(params = {}) ⇒ Types::SearchResourcesOutput

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.

Examples:

Request syntax with placeholder values


resp = client.search_resources({
  resource_query: { # required
    type: "TAG_FILTERS_1_0", # required, accepts TAG_FILTERS_1_0, CLOUDFORMATION_STACK_1_0
    query: "Query", # required
  },
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.resource_identifiers #=> Array
resp.resource_identifiers[0].resource_arn #=> String
resp.resource_identifiers[0].resource_type #=> String
resp.next_token #=> String
resp.query_errors #=> Array
resp.query_errors[0].error_code #=> String, one of "CLOUDFORMATION_STACK_INACTIVE", "CLOUDFORMATION_STACK_NOT_EXISTING"
resp.query_errors[0].message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :resource_query (required, Types::ResourceQuery)

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

  • :max_results (Integer)

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

  • :next_token (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.

Returns:

See Also:



621
622
623
624
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 621

def search_resources(params = {}, options = {})
  req = build_request(:search_resources, params)
  req.send_request(options)
end

#tag(params = {}) ⇒ Types::TagOutput

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.

Examples:

Request syntax with placeholder values


resp = client.tag({
  arn: "GroupArn", # required
  tags: { # required
    "TagKey" => "TagValue",
  },
})

Response structure


resp.arn #=> String
resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :arn (required, String)

    The ARN of the resource to which to add tags.

  • :tags (required, Hash<String,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.

Returns:

See Also:



663
664
665
666
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 663

def tag(params = {}, options = {})
  req = build_request(:tag, params)
  req.send_request(options)
end

#untag(params = {}) ⇒ Types::UntagOutput

Deletes specified tags from a specified resource.

Examples:

Request syntax with placeholder values


resp = client.untag({
  arn: "GroupArn", # required
  keys: ["TagKey"], # required
})

Response structure


resp.arn #=> String
resp.keys #=> Array
resp.keys[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :arn (required, String)

    The ARN of the resource from which to remove tags.

  • :keys (required, Array<String>)

    The keys of the tags to be removed.

Returns:

See Also:



698
699
700
701
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 698

def untag(params = {}, options = {})
  req = build_request(:untag, params)
  req.send_request(options)
end

#update_group(params = {}) ⇒ Types::UpdateGroupOutput

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

Examples:

Request syntax with placeholder values


resp = client.update_group({
  group_name: "GroupName", # required
  description: "GroupDescription",
})

Response structure


resp.group.group_arn #=> String
resp.group.name #=> String
resp.group.description #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, 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.

Returns:

See Also:



736
737
738
739
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 736

def update_group(params = {}, options = {})
  req = build_request(:update_group, params)
  req.send_request(options)
end

#update_group_query(params = {}) ⇒ Types::UpdateGroupQueryOutput

Updates the resource query of a group.

Examples:

Request syntax with placeholder values


resp = client.update_group_query({
  group_name: "GroupName", # required
  resource_query: { # required
    type: "TAG_FILTERS_1_0", # required, accepts TAG_FILTERS_1_0, CLOUDFORMATION_STACK_1_0
    query: "Query", # required
  },
})

Response structure


resp.group_query.group_name #=> String
resp.group_query.resource_query.type #=> String, one of "TAG_FILTERS_1_0", "CLOUDFORMATION_STACK_1_0"
resp.group_query.resource_query.query #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :group_name (required, String)

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

  • :resource_query (required, Types::ResourceQuery)

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

Returns:

See Also:



774
775
776
777
# File 'gems/aws-sdk-resourcegroups/lib/aws-sdk-resourcegroups/client.rb', line 774

def update_group_query(params = {}, options = {})
  req = build_request(:update_group_query, params)
  req.send_request(options)
end