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

Class: Aws::Inspector::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for Amazon Inspector. To construct a client, you need to configure a :region and :credentials.

inspector = Aws::Inspector::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Inspector::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

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

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Inspector::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :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. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When :simple_json is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects. See Plugins::Protocols::JsonRpc for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :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. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#add_attributes_to_findings(options = {}) ⇒ Types::AddAttributesToFindingsResponse

Assigns attributes (key and value pairs) to the findings that are specified by the ARNs of the findings.

Examples:

Example: Add attributes to findings


# Assigns attributes (key and value pairs) to the findings that are specified by the ARNs of the findings.

resp = client.add_attributes_to_findings({
  attributes: [
    {
      key: "Example", 
      value: "example", 
    }, 
  ], 
  finding_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-8l1VIE0D/run/0-Z02cjjug/finding/0-T8yM9mEU", 
  ], 
})

# resp.to_h outputs the following:
{
  failed_items: {
  }, 
}

Request syntax with placeholder values


resp = client.add_attributes_to_findings({
  finding_arns: ["Arn"], # required
  attributes: [ # required
    {
      key: "AttributeKey", # required
      value: "AttributeValue",
    },
  ],
})

Response structure


resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :finding_arns (required, Array<String>)

    The ARNs that specify the findings that you want to assign attributes to.

  • :attributes (required, Array<Types::Attribute>)

    The array of attributes that you want to assign to specified findings.

Returns:

See Also:

#create_assessment_target(options = {}) ⇒ Types::CreateAssessmentTargetResponse

Creates a new assessment target using the ARN of the resource group that is generated by CreateResourceGroup. You can create up to 50 assessment targets per AWS account. You can run up to 500 concurrent agents per AWS account. For more information, see Amazon Inspector Assessment Targets.

Examples:

Example: Create assessment target


# Creates a new assessment target using the ARN of the resource group that is generated by CreateResourceGroup. You can create up to 50 assessment targets per AWS account. You can run up to 500 concurrent agents per AWS account.

resp = client.create_assessment_target({
  assessment_target_name: "ExampleAssessmentTarget", 
  resource_group_arn: "arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv", 
})

# resp.to_h outputs the following:
{
  assessment_target_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX", 
}

Request syntax with placeholder values


resp = client.create_assessment_target({
  assessment_target_name: "AssessmentTargetName", # required
  resource_group_arn: "Arn", # required
})

Response structure


resp.assessment_target_arn #=> String

Options Hash (options):

  • :assessment_target_name (required, String)

    The user-defined name that identifies the assessment target that you want to create. The name must be unique within the AWS account.

  • :resource_group_arn (required, String)

    The ARN that specifies the resource group that is used to create the assessment target.

Returns:

See Also:

#create_assessment_template(options = {}) ⇒ Types::CreateAssessmentTemplateResponse

Creates an assessment template for the assessment target that is specified by the ARN of the assessment target.

Examples:

Example: Create assessment template


# Creates an assessment template for the assessment target that is specified by the ARN of the assessment target.

resp = client.create_assessment_template({
  assessment_target_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX", 
  assessment_template_name: "ExampleAssessmentTemplate", 
  duration_in_seconds: 180, 
  rules_package_arns: [
    "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-11B9DBXp", 
  ], 
  user_attributes_for_findings: [
    {
      key: "Example", 
      value: "example", 
    }, 
  ], 
})

# resp.to_h outputs the following:
{
  assessment_template_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T", 
}

Request syntax with placeholder values


resp = client.create_assessment_template({
  assessment_target_arn: "Arn", # required
  assessment_template_name: "AssessmentTemplateName", # required
  duration_in_seconds: 1, # required
  rules_package_arns: ["Arn"], # required
  user_attributes_for_findings: [
    {
      key: "AttributeKey", # required
      value: "AttributeValue",
    },
  ],
})

Response structure


resp.assessment_template_arn #=> String

Options Hash (options):

  • :assessment_target_arn (required, String)

    The ARN that specifies the assessment target for which you want to create the assessment template.

  • :assessment_template_name (required, String)

    The user-defined name that identifies the assessment template that you want to create. You can create several assessment templates for an assessment target. The names of the assessment templates that correspond to a particular assessment target must be unique.

  • :duration_in_seconds (required, Integer)

    The duration of the assessment run in seconds. The default value is 3600 seconds (one hour).

  • :rules_package_arns (required, Array<String>)

    The ARNs that specify the rules packages that you want to attach to the assessment template.

  • :user_attributes_for_findings (Array<Types::Attribute>)

    The user-defined attributes that are assigned to every finding that is generated by the assessment run that uses this assessment template. An attribute is a key and value pair (an Attribute object). Within an assessment template, each key must be unique.

Returns:

See Also:

#create_resource_group(options = {}) ⇒ Types::CreateResourceGroupResponse

Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see CreateAssessmentTarget.

Examples:

Example: Create resource group


# Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. 

resp = client.create_resource_group({
  resource_group_tags: [
    {
      key: "Name", 
      value: "example", 
    }, 
  ], 
})

# resp.to_h outputs the following:
{
  resource_group_arn: "arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv", 
}

Request syntax with placeholder values


resp = client.create_resource_group({
  resource_group_tags: [ # required
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.resource_group_arn #=> String

Options Hash (options):

  • :resource_group_tags (required, Array<Types::ResourceGroupTag>)

    A collection of keys and an array of possible values, \'[`\"key\":\"key1\",\"values\":[\"Value1\",\"Value2\"],\"key\":\"Key2\",\"values\":[\"Value3\"]`]\'.

    For example,\'[`\"key\":\"Name\",\"values\":[\"TestEC2Instance\"]`]\'.

Returns:

See Also:

#delete_assessment_run(options = {}) ⇒ Struct

Deletes the assessment run that is specified by the ARN of the assessment run.

Examples:

Example: Delete assessment run


# Deletes the assessment run that is specified by the ARN of the assessment run.

resp = client.delete_assessment_run({
  assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T/run/0-11LMTAVe", 
})

Request syntax with placeholder values


resp = client.delete_assessment_run({
  assessment_run_arn: "Arn", # required
})

Options Hash (options):

  • :assessment_run_arn (required, String)

    The ARN that specifies the assessment run that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_assessment_target(options = {}) ⇒ Struct

Deletes the assessment target that is specified by the ARN of the assessment target.

Examples:

Example: Delete assessment target


# Deletes the assessment target that is specified by the ARN of the assessment target.

resp = client.delete_assessment_target({
  assessment_target_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
})

Request syntax with placeholder values


resp = client.delete_assessment_target({
  assessment_target_arn: "Arn", # required
})

Options Hash (options):

  • :assessment_target_arn (required, String)

    The ARN that specifies the assessment target that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_assessment_template(options = {}) ⇒ Struct

Deletes the assessment template that is specified by the ARN of the assessment template.

Examples:

Example: Delete assessment template


# Deletes the assessment template that is specified by the ARN of the assessment template.

resp = client.delete_assessment_template({
  assessment_template_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T", 
})

Request syntax with placeholder values


resp = client.delete_assessment_template({
  assessment_template_arn: "Arn", # required
})

Options Hash (options):

  • :assessment_template_arn (required, String)

    The ARN that specifies the assessment template that you want to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_assessment_runs(options = {}) ⇒ Types::DescribeAssessmentRunsResponse

Describes the assessment runs that are specified by the ARNs of the assessment runs.

Examples:

Example: Describte assessment runs


# Describes the assessment runs that are specified by the ARNs of the assessment runs.

resp = client.describe_assessment_runs({
  assessment_run_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
  ], 
})

# resp.to_h outputs the following:
{
  assessment_runs: [
    {
      name: "Run 1 for ExampleAssessmentTemplate", 
      arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
      assessment_template_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw", 
      completed_at: Time.parse("1458680301.4"), 
      created_at: Time.parse("1458680170.035"), 
      data_collected: true, 
      duration_in_seconds: 3600, 
      finding_counts: {
        "High" => 14, 
        "Informational" => 0, 
        "Low" => 0, 
        "Medium" => 2, 
        "Undefined" => 0, 
      }, 
      notifications: [
      ], 
      rules_package_arns: [
        "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-X1KXtawP", 
      ], 
      started_at: Time.parse("1458680170.161"), 
      state: "COMPLETED", 
      state_changed_at: Time.parse("1458680301.4"), 
      state_changes: [
        {
          state: "CREATED", 
          state_changed_at: Time.parse("1458680170.035"), 
        }, 
        {
          state: "START_DATA_COLLECTION_PENDING", 
          state_changed_at: Time.parse("1458680170.065"), 
        }, 
        {
          state: "START_DATA_COLLECTION_IN_PROGRESS", 
          state_changed_at: Time.parse("1458680170.096"), 
        }, 
        {
          state: "COLLECTING_DATA", 
          state_changed_at: Time.parse("1458680170.161"), 
        }, 
        {
          state: "STOP_DATA_COLLECTION_PENDING", 
          state_changed_at: Time.parse("1458680239.883"), 
        }, 
        {
          state: "DATA_COLLECTED", 
          state_changed_at: Time.parse("1458680299.847"), 
        }, 
        {
          state: "EVALUATING_RULES", 
          state_changed_at: Time.parse("1458680300.099"), 
        }, 
        {
          state: "COMPLETED", 
          state_changed_at: Time.parse("1458680301.4"), 
        }, 
      ], 
      user_attributes_for_findings: [
      ], 
    }, 
  ], 
  failed_items: {
  }, 
}

Request syntax with placeholder values


resp = client.describe_assessment_runs({
  assessment_run_arns: ["Arn"], # required
})

Response structure


resp.assessment_runs #=> Array
resp.assessment_runs[0].arn #=> String
resp.assessment_runs[0].name #=> String
resp.assessment_runs[0].assessment_template_arn #=> String
resp.assessment_runs[0].state #=> String, one of "CREATED", "START_DATA_COLLECTION_PENDING", "START_DATA_COLLECTION_IN_PROGRESS", "COLLECTING_DATA", "STOP_DATA_COLLECTION_PENDING", "DATA_COLLECTED", "START_EVALUATING_RULES_PENDING", "EVALUATING_RULES", "FAILED", "ERROR", "COMPLETED", "COMPLETED_WITH_ERRORS", "CANCELED"
resp.assessment_runs[0].duration_in_seconds #=> Integer
resp.assessment_runs[0].rules_package_arns #=> Array
resp.assessment_runs[0].rules_package_arns[0] #=> String
resp.assessment_runs[0].user_attributes_for_findings #=> Array
resp.assessment_runs[0].user_attributes_for_findings[0].key #=> String
resp.assessment_runs[0].user_attributes_for_findings[0].value #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.assessment_runs[0].created_at #=> Time
resp.assessment_runs[0].started_at #=> Time
resp.assessment_runs[0].completed_at #=> Time
resp.assessment_runs[0].state_changed_at #=> Time
resp.assessment_runs[0].data_collected #=> true/false
resp.assessment_runs[0].state_changes #=> Array
resp.assessment_runs[0].state_changes[0].state_changed_at #=> Time
resp.assessment_runs[0].state_changes[0].state #=> String, one of "CREATED", "START_DATA_COLLECTION_PENDING", "START_DATA_COLLECTION_IN_PROGRESS", "COLLECTING_DATA", "STOP_DATA_COLLECTION_PENDING", "DATA_COLLECTED", "START_EVALUATING_RULES_PENDING", "EVALUATING_RULES", "FAILED", "ERROR", "COMPLETED", "COMPLETED_WITH_ERRORS", "CANCELED"
resp.assessment_runs[0].notifications #=> Array
resp.assessment_runs[0].notifications[0].date #=> Time
resp.assessment_runs[0].notifications[0].event #=> String, one of "ASSESSMENT_RUN_STARTED", "ASSESSMENT_RUN_COMPLETED", "ASSESSMENT_RUN_STATE_CHANGED", "FINDING_REPORTED", "OTHER"
resp.assessment_runs[0].notifications[0].message #=> String
resp.assessment_runs[0].notifications[0].error #=> true/false
resp.assessment_runs[0].notifications[0].sns_topic_arn #=> String
resp.assessment_runs[0].notifications[0].sns_publish_status_code #=> String, one of "SUCCESS", "TOPIC_DOES_NOT_EXIST", "ACCESS_DENIED", "INTERNAL_ERROR"
resp.assessment_runs[0].finding_counts #=> Hash
resp.assessment_runs[0].finding_counts["Severity"] #=> Integer
resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :assessment_run_arns (required, Array<String>)

    The ARN that specifies the assessment run that you want to describe.

Returns:

See Also:

#describe_assessment_targets(options = {}) ⇒ Types::DescribeAssessmentTargetsResponse

Describes the assessment targets that are specified by the ARNs of the assessment targets.

Examples:

Example: Describte assessment targets


# Describes the assessment targets that are specified by the ARNs of the assessment targets.

resp = client.describe_assessment_targets({
  assessment_target_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
  ], 
})

# resp.to_h outputs the following:
{
  assessment_targets: [
    {
      name: "ExampleAssessmentTarget", 
      arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
      created_at: Time.parse("1458074191.459"), 
      resource_group_arn: "arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-PyGXopAI", 
      updated_at: Time.parse("1458074191.459"), 
    }, 
  ], 
  failed_items: {
  }, 
}

Request syntax with placeholder values


resp = client.describe_assessment_targets({
  assessment_target_arns: ["Arn"], # required
})

Response structure


resp.assessment_targets #=> Array
resp.assessment_targets[0].arn #=> String
resp.assessment_targets[0].name #=> String
resp.assessment_targets[0].resource_group_arn #=> String
resp.assessment_targets[0].created_at #=> Time
resp.assessment_targets[0].updated_at #=> Time
resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :assessment_target_arns (required, Array<String>)

    The ARNs that specifies the assessment targets that you want to describe.

Returns:

See Also:

#describe_assessment_templates(options = {}) ⇒ Types::DescribeAssessmentTemplatesResponse

Describes the assessment templates that are specified by the ARNs of the assessment templates.

Examples:

Example: Describte assessment templates


# Describes the assessment templates that are specified by the ARNs of the assessment templates.

resp = client.describe_assessment_templates({
  assessment_template_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw", 
  ], 
})

# resp.to_h outputs the following:
{
  assessment_templates: [
    {
      name: "ExampleAssessmentTemplate", 
      arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw", 
      assessment_target_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
      created_at: Time.parse("1458074191.844"), 
      duration_in_seconds: 3600, 
      rules_package_arns: [
        "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-X1KXtawP", 
      ], 
      user_attributes_for_findings: [
      ], 
    }, 
  ], 
  failed_items: {
  }, 
}

Request syntax with placeholder values


resp = client.describe_assessment_templates({
  assessment_template_arns: ["Arn"], # required
})

Response structure


resp.assessment_templates #=> Array
resp.assessment_templates[0].arn #=> String
resp.assessment_templates[0].name #=> String
resp.assessment_templates[0].assessment_target_arn #=> String
resp.assessment_templates[0].duration_in_seconds #=> Integer
resp.assessment_templates[0].rules_package_arns #=> Array
resp.assessment_templates[0].rules_package_arns[0] #=> String
resp.assessment_templates[0].user_attributes_for_findings #=> Array
resp.assessment_templates[0].user_attributes_for_findings[0].key #=> String
resp.assessment_templates[0].user_attributes_for_findings[0].value #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.assessment_templates[0].created_at #=> Time
resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :assessment_template_arns (required, Array<String>)

Returns:

See Also:

#describe_cross_account_access_role(options = {}) ⇒ Types::DescribeCrossAccountAccessRoleResponse

Describes the IAM role that enables Amazon Inspector to access your AWS account.

Examples:

Example: Describte cross account access role


# Describes the IAM role that enables Amazon Inspector to access your AWS account.

resp = client.({
})

# resp.to_h outputs the following:
{
  registered_at: Time.parse("1458069182.826"), 
  role_arn: "arn:aws:iam::123456789012:role/inspector", 
  valid: true, 
}

Request syntax with placeholder values


resp = client.()

Response structure


resp.role_arn #=> String
resp.valid #=> true/false
resp.registered_at #=> Time

Returns:

See Also:

#describe_findings(options = {}) ⇒ Types::DescribeFindingsResponse

Describes the findings that are specified by the ARNs of the findings.

Examples:

Example: Describe findings


# Describes the findings that are specified by the ARNs of the findings.

resp = client.describe_findings({
  finding_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE/finding/0-HwPnsDm4", 
  ], 
})

# resp.to_h outputs the following:
{
  failed_items: {
  }, 
  findings: [
    {
      arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE/finding/0-HwPnsDm4", 
      asset_attributes: {
        ipv4_addresses: [
        ], 
        schema_version: 1, 
      }, 
      asset_type: "ec2-instance", 
      attributes: [
      ], 
      confidence: 10, 
      created_at: Time.parse("1458680301.37"), 
      description: "Amazon Inspector did not find any potential security issues during this assessment.", 
      indicator_of_compromise: false, 
      numeric_severity: 0, 
      recommendation: "No remediation needed.", 
      schema_version: 1, 
      service: "Inspector", 
      service_attributes: {
        assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
        rules_package_arn: "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-X1KXtawP", 
        schema_version: 1, 
      }, 
      severity: "Informational", 
      title: "No potential security issues found", 
      updated_at: Time.parse("1458680301.37"), 
      user_attributes: [
      ], 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_findings({
  finding_arns: ["Arn"], # required
  locale: "EN_US", # accepts EN_US
})

Response structure


resp.findings #=> Array
resp.findings[0].arn #=> String
resp.findings[0].schema_version #=> Integer
resp.findings[0].service #=> String
resp.findings[0].service_attributes.schema_version #=> Integer
resp.findings[0].service_attributes.assessment_run_arn #=> String
resp.findings[0].service_attributes.rules_package_arn #=> String
resp.findings[0].asset_type #=> String, one of "ec2-instance"
resp.findings[0].asset_attributes.schema_version #=> Integer
resp.findings[0].asset_attributes.agent_id #=> String
resp.findings[0].asset_attributes.auto_scaling_group #=> String
resp.findings[0].asset_attributes.ami_id #=> String
resp.findings[0].asset_attributes.hostname #=> String
resp.findings[0].asset_attributes.ipv4_addresses #=> Array
resp.findings[0].asset_attributes.ipv4_addresses[0] #=> String
resp.findings[0].id #=> String
resp.findings[0].title #=> String
resp.findings[0].description #=> String
resp.findings[0].recommendation #=> String
resp.findings[0].severity #=> String, one of "Low", "Medium", "High", "Informational", "Undefined"
resp.findings[0].numeric_severity #=> Float
resp.findings[0].confidence #=> Integer
resp.findings[0].indicator_of_compromise #=> true/false
resp.findings[0].attributes #=> Array
resp.findings[0].attributes[0].key #=> String
resp.findings[0].attributes[0].value #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.findings[0].user_attributes #=> Array
resp.findings[0].user_attributes[0].key #=> String
resp.findings[0].user_attributes[0].value #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.findings[0].created_at #=> Time
resp.findings[0].updated_at #=> Time
resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :finding_arns (required, Array<String>)

    The ARN that specifies the finding that you want to describe.

  • :locale (String)

    The locale into which you want to translate a finding description, recommendation, and the short description that identifies the finding.

Returns:

See Also:

#describe_resource_groups(options = {}) ⇒ Types::DescribeResourceGroupsResponse

Describes the resource groups that are specified by the ARNs of the resource groups.

Examples:

Example: Describe resource groups


# Describes the resource groups that are specified by the ARNs of the resource groups.

resp = client.describe_resource_groups({
  resource_group_arns: [
    "arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-PyGXopAI", 
  ], 
})

# resp.to_h outputs the following:
{
  failed_items: {
  }, 
  resource_groups: [
    {
      arn: "arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-PyGXopAI", 
      created_at: Time.parse("1458074191.098"), 
      tags: [
        {
          key: "Name", 
          value: "example", 
        }, 
      ], 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_resource_groups({
  resource_group_arns: ["Arn"], # required
})

Response structure


resp.resource_groups #=> Array
resp.resource_groups[0].arn #=> String
resp.resource_groups[0].tags #=> Array
resp.resource_groups[0].tags[0].key #=> String
resp.resource_groups[0].tags[0].value #=> String
resp.resource_groups[0].created_at #=> Time
resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :resource_group_arns (required, Array<String>)

    The ARN that specifies the resource group that you want to describe.

Returns:

See Also:

#describe_rules_packages(options = {}) ⇒ Types::DescribeRulesPackagesResponse

Describes the rules packages that are specified by the ARNs of the rules packages.

Examples:

Example: Describe rules packages


# Describes the rules packages that are specified by the ARNs of the rules packages.

resp = client.describe_rules_packages({
  rules_package_arns: [
    "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-JJOtZiqQ", 
  ], 
})

# resp.to_h outputs the following:
{
  failed_items: {
  }, 
  rules_packages: [
    {
      version: "1.1", 
      name: "Security Best Practices", 
      arn: "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-JJOtZiqQ", 
      description: "The rules in this package help determine whether your systems are configured securely.", 
      provider: "Amazon Web Services, Inc.", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_rules_packages({
  rules_package_arns: ["Arn"], # required
  locale: "EN_US", # accepts EN_US
})

Response structure


resp.rules_packages #=> Array
resp.rules_packages[0].arn #=> String
resp.rules_packages[0].name #=> String
resp.rules_packages[0].version #=> String
resp.rules_packages[0].provider #=> String
resp.rules_packages[0].description #=> String
resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :rules_package_arns (required, Array<String>)

    The ARN that specifies the rules package that you want to describe.

  • :locale (String)

    The locale that you want to translate a rules package description into.

Returns:

See Also:

#get_assessment_report(options = {}) ⇒ Types::GetAssessmentReportResponse

Produces an assessment report that includes detailed and comprehensive results of a specified assessment run.

Examples:

Request syntax with placeholder values


resp = client.get_assessment_report({
  assessment_run_arn: "Arn", # required
  report_file_format: "HTML", # required, accepts HTML, PDF
  report_type: "FINDING", # required, accepts FINDING, FULL
})

Response structure


resp.status #=> String, one of "WORK_IN_PROGRESS", "FAILED", "COMPLETED"
resp.url #=> String

Options Hash (options):

  • :assessment_run_arn (required, String)

    The ARN that specifies the assessment run for which you want to generate a report.

  • :report_file_format (required, String)

    Specifies the file format (html or pdf) of the assessment report that you want to generate.

  • :report_type (required, String)

    Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: a finding report and a full report. For more information, see Assessment Reports.

Returns:

See Also:

#get_telemetry_metadata(options = {}) ⇒ Types::GetTelemetryMetadataResponse

Information about the data that is collected for the specified assessment run.

Examples:

Example: Get telemetry metadata


# Information about the data that is collected for the specified assessment run.

resp = client.({
  assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
})

# resp.to_h outputs the following:
{
  telemetry_metadata: [
    {
      count: 2, 
      data_size: 345, 
      message_type: "InspectorDuplicateProcess", 
    }, 
    {
      count: 3, 
      data_size: 255, 
      message_type: "InspectorTimeEventMsg", 
    }, 
    {
      count: 4, 
      data_size: 1082, 
      message_type: "InspectorNetworkInterface", 
    }, 
    {
      count: 2, 
      data_size: 349, 
      message_type: "InspectorDnsEntry", 
    }, 
    {
      count: 11, 
      data_size: 2514, 
      message_type: "InspectorDirectoryInfoMsg", 
    }, 
    {
      count: 1, 
      data_size: 179, 
      message_type: "InspectorTcpV6ListeningPort", 
    }, 
    {
      count: 101, 
      data_size: 10949, 
      message_type: "InspectorTerminal", 
    }, 
    {
      count: 26, 
      data_size: 5916, 
      message_type: "InspectorUser", 
    }, 
    {
      count: 282, 
      data_size: 32148, 
      message_type: "InspectorDynamicallyLoadedCodeModule", 
    }, 
    {
      count: 18, 
      data_size: 10172, 
      message_type: "InspectorCreateProcess", 
    }, 
    {
      count: 3, 
      data_size: 8001, 
      message_type: "InspectorProcessPerformance", 
    }, 
    {
      count: 1, 
      data_size: 360, 
      message_type: "InspectorOperatingSystem", 
    }, 
    {
      count: 6, 
      data_size: 546, 
      message_type: "InspectorStopProcess", 
    }, 
    {
      count: 1, 
      data_size: 1553, 
      message_type: "InspectorInstanceMetaData", 
    }, 
    {
      count: 2, 
      data_size: 434, 
      message_type: "InspectorTcpV4Connection", 
    }, 
    {
      count: 474, 
      data_size: 2960322, 
      message_type: "InspectorPackageInfo", 
    }, 
    {
      count: 3, 
      data_size: 2235, 
      message_type: "InspectorSystemPerformance", 
    }, 
    {
      count: 105, 
      data_size: 46048, 
      message_type: "InspectorCodeModule", 
    }, 
    {
      count: 1, 
      data_size: 182, 
      message_type: "InspectorUdpV6ListeningPort", 
    }, 
    {
      count: 2, 
      data_size: 371, 
      message_type: "InspectorUdpV4ListeningPort", 
    }, 
    {
      count: 18, 
      data_size: 8362, 
      message_type: "InspectorKernelModule", 
    }, 
    {
      count: 29, 
      data_size: 48788, 
      message_type: "InspectorConfigurationInfo", 
    }, 
    {
      count: 1, 
      data_size: 79, 
      message_type: "InspectorMonitoringStart", 
    }, 
    {
      count: 5, 
      data_size: 0, 
      message_type: "InspectorSplitMsgBegin", 
    }, 
    {
      count: 51, 
      data_size: 4593, 
      message_type: "InspectorGroup", 
    }, 
    {
      count: 1, 
      data_size: 184, 
      message_type: "InspectorTcpV4ListeningPort", 
    }, 
    {
      count: 1159, 
      data_size: 3146579, 
      message_type: "Total", 
    }, 
    {
      count: 5, 
      data_size: 0, 
      message_type: "InspectorSplitMsgEnd", 
    }, 
    {
      count: 1, 
      data_size: 612, 
      message_type: "InspectorLoadImageInProcess", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.({
  assessment_run_arn: "Arn", # required
})

Response structure


resp. #=> Array
resp.[0].message_type #=> String
resp.[0].count #=> Integer
resp.[0].data_size #=> Integer

Options Hash (options):

  • :assessment_run_arn (required, String)

    The ARN that specifies the assessment run that has the telemetry data that you want to obtain.

Returns:

See Also:

#list_assessment_run_agents(options = {}) ⇒ Types::ListAssessmentRunAgentsResponse

Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.

Examples:

Example: List assessment run agents


# Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.

resp = client.list_assessment_run_agents({
  assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
  max_results: 123, 
})

# resp.to_h outputs the following:
{
  assessment_run_agents: [
    {
      agent_health: "HEALTHY", 
      agent_health_code: "RUNNING", 
      agent_id: "i-49113b93", 
      assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
      telemetry_metadata: [
        {
          count: 2, 
          data_size: 345, 
          message_type: "InspectorDuplicateProcess", 
        }, 
        {
          count: 3, 
          data_size: 255, 
          message_type: "InspectorTimeEventMsg", 
        }, 
        {
          count: 4, 
          data_size: 1082, 
          message_type: "InspectorNetworkInterface", 
        }, 
        {
          count: 2, 
          data_size: 349, 
          message_type: "InspectorDnsEntry", 
        }, 
        {
          count: 11, 
          data_size: 2514, 
          message_type: "InspectorDirectoryInfoMsg", 
        }, 
        {
          count: 1, 
          data_size: 179, 
          message_type: "InspectorTcpV6ListeningPort", 
        }, 
        {
          count: 101, 
          data_size: 10949, 
          message_type: "InspectorTerminal", 
        }, 
        {
          count: 26, 
          data_size: 5916, 
          message_type: "InspectorUser", 
        }, 
        {
          count: 282, 
          data_size: 32148, 
          message_type: "InspectorDynamicallyLoadedCodeModule", 
        }, 
        {
          count: 18, 
          data_size: 10172, 
          message_type: "InspectorCreateProcess", 
        }, 
        {
          count: 3, 
          data_size: 8001, 
          message_type: "InspectorProcessPerformance", 
        }, 
        {
          count: 1, 
          data_size: 360, 
          message_type: "InspectorOperatingSystem", 
        }, 
        {
          count: 6, 
          data_size: 546, 
          message_type: "InspectorStopProcess", 
        }, 
        {
          count: 1, 
          data_size: 1553, 
          message_type: "InspectorInstanceMetaData", 
        }, 
        {
          count: 2, 
          data_size: 434, 
          message_type: "InspectorTcpV4Connection", 
        }, 
        {
          count: 474, 
          data_size: 2960322, 
          message_type: "InspectorPackageInfo", 
        }, 
        {
          count: 3, 
          data_size: 2235, 
          message_type: "InspectorSystemPerformance", 
        }, 
        {
          count: 105, 
          data_size: 46048, 
          message_type: "InspectorCodeModule", 
        }, 
        {
          count: 1, 
          data_size: 182, 
          message_type: "InspectorUdpV6ListeningPort", 
        }, 
        {
          count: 2, 
          data_size: 371, 
          message_type: "InspectorUdpV4ListeningPort", 
        }, 
        {
          count: 18, 
          data_size: 8362, 
          message_type: "InspectorKernelModule", 
        }, 
        {
          count: 29, 
          data_size: 48788, 
          message_type: "InspectorConfigurationInfo", 
        }, 
        {
          count: 1, 
          data_size: 79, 
          message_type: "InspectorMonitoringStart", 
        }, 
        {
          count: 5, 
          data_size: 0, 
          message_type: "InspectorSplitMsgBegin", 
        }, 
        {
          count: 51, 
          data_size: 4593, 
          message_type: "InspectorGroup", 
        }, 
        {
          count: 1, 
          data_size: 184, 
          message_type: "InspectorTcpV4ListeningPort", 
        }, 
        {
          count: 1159, 
          data_size: 3146579, 
          message_type: "Total", 
        }, 
        {
          count: 5, 
          data_size: 0, 
          message_type: "InspectorSplitMsgEnd", 
        }, 
        {
          count: 1, 
          data_size: 612, 
          message_type: "InspectorLoadImageInProcess", 
        }, 
      ], 
    }, 
  ], 
  next_token: "1", 
}

Request syntax with placeholder values


resp = client.list_assessment_run_agents({
  assessment_run_arn: "Arn", # required
  filter: {
    agent_healths: ["HEALTHY"], # required, accepts HEALTHY, UNHEALTHY
    agent_health_codes: ["IDLE"], # required, accepts IDLE, RUNNING, SHUTDOWN, UNHEALTHY, THROTTLED, UNKNOWN
  },
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.assessment_run_agents #=> Array
resp.assessment_run_agents[0].agent_id #=> String
resp.assessment_run_agents[0].assessment_run_arn #=> String
resp.assessment_run_agents[0].agent_health #=> String, one of "HEALTHY", "UNHEALTHY"
resp.assessment_run_agents[0].agent_health_code #=> String, one of "IDLE", "RUNNING", "SHUTDOWN", "UNHEALTHY", "THROTTLED", "UNKNOWN"
resp.assessment_run_agents[0].agent_health_details #=> String
resp.assessment_run_agents[0].auto_scaling_group #=> String
resp.assessment_run_agents[0]. #=> Array
resp.assessment_run_agents[0].[0].message_type #=> String
resp.assessment_run_agents[0].[0].count #=> Integer
resp.assessment_run_agents[0].[0].data_size #=> Integer
resp.next_token #=> String

Options Hash (options):

  • :assessment_run_arn (required, String)

    The ARN that specifies the assessment run whose agents you want to list.

  • :filter (Types::AgentFilter)

    You can use this parameter to specify a subset of data to be included in the action\'s response.

    For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentRunAgents action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items that you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_assessment_runs(options = {}) ⇒ Types::ListAssessmentRunsResponse

Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the assessment templates.

Examples:

Example: List assessment runs


# Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the assessment templates.

resp = client.list_assessment_runs({
  assessment_template_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw", 
  ], 
  max_results: 123, 
})

# resp.to_h outputs the following:
{
  assessment_run_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-v5D6fI3v", 
  ], 
  next_token: "1", 
}

Request syntax with placeholder values


resp = client.list_assessment_runs({
  assessment_template_arns: ["Arn"],
  filter: {
    name_pattern: "NamePattern",
    states: ["CREATED"], # accepts CREATED, START_DATA_COLLECTION_PENDING, START_DATA_COLLECTION_IN_PROGRESS, COLLECTING_DATA, STOP_DATA_COLLECTION_PENDING, DATA_COLLECTED, START_EVALUATING_RULES_PENDING, EVALUATING_RULES, FAILED, ERROR, COMPLETED, COMPLETED_WITH_ERRORS, CANCELED
    duration_range: {
      min_seconds: 1,
      max_seconds: 1,
    },
    rules_package_arns: ["Arn"],
    start_time_range: {
      begin_date: Time.now,
      end_date: Time.now,
    },
    completion_time_range: {
      begin_date: Time.now,
      end_date: Time.now,
    },
    state_change_time_range: {
      begin_date: Time.now,
      end_date: Time.now,
    },
  },
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.assessment_run_arns #=> Array
resp.assessment_run_arns[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :assessment_template_arns (Array<String>)

    The ARNs that specify the assessment templates whose assessment runs you want to list.

  • :filter (Types::AssessmentRunFilter)

    You can use this parameter to specify a subset of data to be included in the action\'s response.

    For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentRuns action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items that you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_assessment_targets(options = {}) ⇒ Types::ListAssessmentTargetsResponse

Lists the ARNs of the assessment targets within this AWS account. For more information about assessment targets, see Amazon Inspector Assessment Targets.

Examples:

Example: List assessment targets


# Lists the ARNs of the assessment targets within this AWS account. 

resp = client.list_assessment_targets({
  max_results: 123, 
})

# resp.to_h outputs the following:
{
  assessment_target_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
  ], 
  next_token: "1", 
}

Request syntax with placeholder values


resp = client.list_assessment_targets({
  filter: {
    assessment_target_name_pattern: "NamePattern",
  },
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.assessment_target_arns #=> Array
resp.assessment_target_arns[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :filter (Types::AssessmentTargetFilter)

    You can use this parameter to specify a subset of data to be included in the action\'s response.

    For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentTargets action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_assessment_templates(options = {}) ⇒ Types::ListAssessmentTemplatesResponse

Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the assessment targets.

Examples:

Example: List assessment templates


# Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the assessment targets.

resp = client.list_assessment_templates({
  assessment_target_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
  ], 
  max_results: 123, 
})

# resp.to_h outputs the following:
{
  assessment_template_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw", 
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-Uza6ihLh", 
  ], 
  next_token: "1", 
}

Request syntax with placeholder values


resp = client.list_assessment_templates({
  assessment_target_arns: ["Arn"],
  filter: {
    name_pattern: "NamePattern",
    duration_range: {
      min_seconds: 1,
      max_seconds: 1,
    },
    rules_package_arns: ["Arn"],
  },
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.assessment_template_arns #=> Array
resp.assessment_template_arns[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :assessment_target_arns (Array<String>)

    A list of ARNs that specifies the assessment targets whose assessment templates you want to list.

  • :filter (Types::AssessmentTemplateFilter)

    You can use this parameter to specify a subset of data to be included in the action\'s response.

    For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentTemplates action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_event_subscriptions(options = {}) ⇒ Types::ListEventSubscriptionsResponse

Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment template. For more information, see SubscribeToEvent and UnsubscribeFromEvent.

Examples:

Example: List event subscriptions


# Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment template. 

resp = client.list_event_subscriptions({
  max_results: 123, 
  resource_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0", 
})

# resp.to_h outputs the following:
{
  next_token: "1", 
  subscriptions: [
    {
      event_subscriptions: [
        {
          event: "ASSESSMENT_RUN_COMPLETED", 
          subscribed_at: Time.parse("1459455440.867"), 
        }, 
      ], 
      resource_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0", 
      topic_arn: "arn:aws:sns:us-west-2:123456789012:exampletopic", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_event_subscriptions({
  resource_arn: "Arn",
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.subscriptions #=> Array
resp.subscriptions[0].resource_arn #=> String
resp.subscriptions[0].topic_arn #=> String
resp.subscriptions[0].event_subscriptions #=> Array
resp.subscriptions[0].event_subscriptions[0].event #=> String, one of "ASSESSMENT_RUN_STARTED", "ASSESSMENT_RUN_COMPLETED", "ASSESSMENT_RUN_STATE_CHANGED", "FINDING_REPORTED", "OTHER"
resp.subscriptions[0].event_subscriptions[0].subscribed_at #=> Time
resp.next_token #=> String

Options Hash (options):

  • :resource_arn (String)

    The ARN of the assessment template for which you want to list the existing event subscriptions.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListEventSubscriptions action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_findings(options = {}) ⇒ Types::ListFindingsResponse

Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.

Examples:

Example: List findings


# Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.

resp = client.list_findings({
  assessment_run_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE", 
  ], 
  max_results: 123, 
})

# resp.to_h outputs the following:
{
  finding_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE/finding/0-HwPnsDm4", 
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-v5D6fI3v/finding/0-tyvmqBLy", 
  ], 
  next_token: "1", 
}

Request syntax with placeholder values


resp = client.list_findings({
  assessment_run_arns: ["Arn"],
  filter: {
    agent_ids: ["AgentId"],
    auto_scaling_groups: ["AutoScalingGroup"],
    rule_names: ["RuleName"],
    severities: ["Low"], # accepts Low, Medium, High, Informational, Undefined
    rules_package_arns: ["Arn"],
    attributes: [
      {
        key: "AttributeKey", # required
        value: "AttributeValue",
      },
    ],
    user_attributes: [
      {
        key: "AttributeKey", # required
        value: "AttributeValue",
      },
    ],
    creation_time_range: {
      begin_date: Time.now,
      end_date: Time.now,
    },
  },
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.finding_arns #=> Array
resp.finding_arns[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :assessment_run_arns (Array<String>)

    The ARNs of the assessment runs that generate the findings that you want to list.

  • :filter (Types::FindingFilter)

    You can use this parameter to specify a subset of data to be included in the action\'s response.

    For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListFindings action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_rules_packages(options = {}) ⇒ Types::ListRulesPackagesResponse

Lists all available Amazon Inspector rules packages.

Examples:

Example: List rules packages


# Lists all available Amazon Inspector rules packages.

resp = client.list_rules_packages({
  max_results: 123, 
})

# resp.to_h outputs the following:
{
  next_token: "1", 
  rules_package_arns: [
    "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-9hgA516p", 
    "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-H5hpSawc", 
    "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-JJOtZiqQ", 
    "arn:aws:inspector:us-west-2:758058086616:rulespackage/0-vg5GGHSD", 
  ], 
}

Request syntax with placeholder values


resp = client.list_rules_packages({
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.rules_package_arns #=> Array
resp.rules_package_arns[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListRulesPackages action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse

Lists all tags associated with an assessment template.

Examples:

Example: List tags for resource


# Lists all tags associated with an assessment template.

resp = client.list_tags_for_resource({
  resource_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-gcwFliYu", 
})

# resp.to_h outputs the following:
{
  tags: [
    {
      key: "Name", 
      value: "Example", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "Arn", # required
})

Response structure


resp.tags #=> Array
resp.tags[0].key #=> String
resp.tags[0].value #=> String

Options Hash (options):

  • :resource_arn (required, String)

    The ARN that specifies the assessment template whose tags you want to list.

Returns:

See Also:

#preview_agents(options = {}) ⇒ Types::PreviewAgentsResponse

Previews the agents installed on the EC2 instances that are part of the specified assessment target.

Examples:

Example: Preview agents


# Previews the agents installed on the EC2 instances that are part of the specified assessment target.

resp = client.preview_agents({
  max_results: 123, 
  preview_agents_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq", 
})

# resp.to_h outputs the following:
{
  agent_previews: [
    {
      agent_id: "i-49113b93", 
    }, 
  ], 
  next_token: "1", 
}

Request syntax with placeholder values


resp = client.preview_agents({
  preview_agents_arn: "Arn", # required
  next_token: "PaginationToken",
  max_results: 1,
})

Response structure


resp.agent_previews #=> Array
resp.agent_previews[0].agent_id #=> String
resp.agent_previews[0].auto_scaling_group #=> String
resp.next_token #=> String

Options Hash (options):

  • :preview_agents_arn (required, String)

    The ARN of the assessment target whose agents you want to preview.

  • :next_token (String)

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the PreviewAgents action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

  • :max_results (Integer)

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Returns:

See Also:

#register_cross_account_access_role(options = {}) ⇒ Struct

Registers the IAM role that Amazon Inspector uses to list your EC2 instances at the start of the assessment run or when you call the PreviewAgents action.

Examples:

Example: Register cross account access role


# Registers the IAM role that Amazon Inspector uses to list your EC2 instances at the start of the assessment run or when you call the PreviewAgents action.

resp = client.({
  role_arn: "arn:aws:iam::123456789012:role/inspector", 
})

Request syntax with placeholder values


resp = client.({
  role_arn: "Arn", # required
})

Options Hash (options):

  • :role_arn (required, String)

    The ARN of the IAM role that Amazon Inspector uses to list your EC2 instances during the assessment run or when you call the PreviewAgents action.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#remove_attributes_from_findings(options = {}) ⇒ Types::RemoveAttributesFromFindingsResponse

Removes entire attributes (key and value pairs) from the findings that are specified by the ARNs of the findings where an attribute with the specified key exists.

Examples:

Example: Remove attributes from findings


# Removes entire attributes (key and value pairs) from the findings that are specified by the ARNs of the findings where an attribute with the specified key exists.

resp = client.remove_attributes_from_findings({
  attribute_keys: [
    "key=Example,value=example", 
  ], 
  finding_arns: [
    "arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-8l1VIE0D/run/0-Z02cjjug/finding/0-T8yM9mEU", 
  ], 
})

# resp.to_h outputs the following:
{
  failed_items: {
  }, 
}

Request syntax with placeholder values


resp = client.remove_attributes_from_findings({
  finding_arns: ["Arn"], # required
  attribute_keys: ["AttributeKey"], # required
})

Response structure


resp.failed_items #=> Hash
resp.failed_items["Arn"].failure_code #=> String, one of "INVALID_ARN", "DUPLICATE_ARN", "ITEM_DOES_NOT_EXIST", "ACCESS_DENIED", "LIMIT_EXCEEDED", "INTERNAL_ERROR"
resp.failed_items["Arn"].retryable #=> true/false

Options Hash (options):

  • :finding_arns (required, Array<String>)

    The ARNs that specify the findings that you want to remove attributes from.

  • :attribute_keys (required, Array<String>)

    The array of attribute keys that you want to remove from specified findings.

Returns:

See Also:

#set_tags_for_resource(options = {}) ⇒ Struct

Sets tags (key and value pairs) to the assessment template that is specified by the ARN of the assessment template.

Examples:

Example: Set tags for resource


# Sets tags (key and value pairs) to the assessment template that is specified by the ARN of the assessment template.

resp = client.set_tags_for_resource({
  resource_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0", 
  tags: [
    {
      key: "Example", 
      value: "example", 
    }, 
  ], 
})

Request syntax with placeholder values


resp = client.set_tags_for_resource({
  resource_arn: "Arn", # required
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Options Hash (options):

  • :resource_arn (required, String)

    The ARN of the assessment template that you want to set tags to.

  • :tags (Array<Types::Tag>)

    A collection of key and value pairs that you want to set to the assessment template.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#start_assessment_run(options = {}) ⇒ Types::StartAssessmentRunResponse

Starts the assessment run specified by the ARN of the assessment template. For this API to function properly, you must not exceed the limit of running up to 500 concurrent agents per AWS account.

Examples:

Example: Start assessment run


# Starts the assessment run specified by the ARN of the assessment template. For this API to function properly, you must not exceed the limit of running up to 500 concurrent agents per AWS account.

resp = client.start_assessment_run({
  assessment_run_name: "examplerun", 
  assessment_template_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T", 
})

# resp.to_h outputs the following:
{
  assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T/run/0-jOoroxyY", 
}

Request syntax with placeholder values


resp = client.start_assessment_run({
  assessment_template_arn: "Arn", # required
  assessment_run_name: "AssessmentRunName",
})

Response structure


resp.assessment_run_arn #=> String

Options Hash (options):

  • :assessment_template_arn (required, String)

    The ARN of the assessment template of the assessment run that you want to start.

  • :assessment_run_name (String)

    You can specify the name for the assessment run. The name must be unique for the assessment template whose ARN is used to start the assessment run.

Returns:

See Also:

#stop_assessment_run(options = {}) ⇒ Struct

Stops the assessment run that is specified by the ARN of the assessment run.

Examples:

Example: Stop assessment run


# Stops the assessment run that is specified by the ARN of the assessment run.

resp = client.stop_assessment_run({
  assessment_run_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T/run/0-11LMTAVe", 
})

Request syntax with placeholder values


resp = client.stop_assessment_run({
  assessment_run_arn: "Arn", # required
  stop_action: "START_EVALUATION", # accepts START_EVALUATION, SKIP_EVALUATION
})

Options Hash (options):

  • :assessment_run_arn (required, String)

    The ARN of the assessment run that you want to stop.

  • :stop_action (String)

    An input option that can be set to either START_EVALUATION or SKIP_EVALUATION. START_EVALUATION (the default value), stops the AWS agent from collecting data and begins the results evaluation and the findings generation process. SKIP_EVALUATION cancels the assessment run immediately, after which no findings are generated.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#subscribe_to_event(options = {}) ⇒ Struct

Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.

Examples:

Example: Subscribe to event


# Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.

resp = client.subscribe_to_event({
  event: "ASSESSMENT_RUN_COMPLETED", 
  resource_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0", 
  topic_arn: "arn:aws:sns:us-west-2:123456789012:exampletopic", 
})

Request syntax with placeholder values


resp = client.subscribe_to_event({
  resource_arn: "Arn", # required
  event: "ASSESSMENT_RUN_STARTED", # required, accepts ASSESSMENT_RUN_STARTED, ASSESSMENT_RUN_COMPLETED, ASSESSMENT_RUN_STATE_CHANGED, FINDING_REPORTED, OTHER
  topic_arn: "Arn", # required
})

Options Hash (options):

  • :resource_arn (required, String)

    The ARN of the assessment template that is used during the event for which you want to receive SNS notifications.

  • :event (required, String)

    The event for which you want to receive SNS notifications.

  • :topic_arn (required, String)

    The ARN of the SNS topic to which the SNS notifications are sent.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#unsubscribe_from_event(options = {}) ⇒ Struct

Disables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.

Examples:

Example: Unsubscribe from event


# Disables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.

resp = client.unsubscribe_from_event({
  event: "ASSESSMENT_RUN_COMPLETED", 
  resource_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0", 
  topic_arn: "arn:aws:sns:us-west-2:123456789012:exampletopic", 
})

Request syntax with placeholder values


resp = client.unsubscribe_from_event({
  resource_arn: "Arn", # required
  event: "ASSESSMENT_RUN_STARTED", # required, accepts ASSESSMENT_RUN_STARTED, ASSESSMENT_RUN_COMPLETED, ASSESSMENT_RUN_STATE_CHANGED, FINDING_REPORTED, OTHER
  topic_arn: "Arn", # required
})

Options Hash (options):

  • :resource_arn (required, String)

    The ARN of the assessment template that is used during the event for which you want to stop receiving SNS notifications.

  • :event (required, String)

    The event for which you want to stop receiving SNS notifications.

  • :topic_arn (required, String)

    The ARN of the SNS topic to which SNS notifications are sent.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_assessment_target(options = {}) ⇒ Struct

Updates the assessment target that is specified by the ARN of the assessment target.

Examples:

Example: Update assessment target


# Updates the assessment target that is specified by the ARN of the assessment target.

resp = client.update_assessment_target({
  assessment_target_arn: "arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX", 
  assessment_target_name: "Example", 
  resource_group_arn: "arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-yNbgL5Pt", 
})

Request syntax with placeholder values


resp = client.update_assessment_target({
  assessment_target_arn: "Arn", # required
  assessment_target_name: "AssessmentTargetName", # required
  resource_group_arn: "Arn", # required
})

Options Hash (options):

  • :assessment_target_arn (required, String)

    The ARN of the assessment target that you want to update.

  • :assessment_target_name (required, String)

    The name of the assessment target that you want to update.

  • :resource_group_arn (required, String)

    The ARN of the resource group that is used to specify the new resource group to associate with the assessment target.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

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

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.