You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::GuardDuty::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::GuardDuty::Client
- Defined in:
- (unknown)
Overview
An API client for Amazon GuardDuty. To construct a client, you need to configure a :region
and :credentials
.
guardduty = Aws::GuardDuty::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']
andENV['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::GuardDuty::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
Constructor collapse
-
#initialize(options = {}) ⇒ Aws::GuardDuty::Client
constructor
Constructs an API client.
API Operations collapse
-
#accept_invitation(options = {}) ⇒ Struct
Accepts the invitation to be monitored by a master GuardDuty account.
.
-
#archive_findings(options = {}) ⇒ Struct
Archives GuardDuty findings that are specified by the list of finding IDs.
Only the master account can archive findings.
-
#create_detector(options = {}) ⇒ Types::CreateDetectorResponse
Creates a single Amazon GuardDuty detector.
-
#create_filter(options = {}) ⇒ Types::CreateFilterResponse
Creates a filter using the specified finding criteria.
.
-
#create_ip_set(options = {}) ⇒ Types::CreateIPSetResponse
Creates a new IPSet, which is called a trusted IP list in the console user interface.
-
#create_members(options = {}) ⇒ Types::CreateMembersResponse
Creates member accounts of the current AWS account by specifying a list of AWS account IDs.
-
#create_publishing_destination(options = {}) ⇒ Types::CreatePublishingDestinationResponse
Creates a publishing destination to export findings to.
-
#create_sample_findings(options = {}) ⇒ Struct
Generates example findings of types specified by the list of finding types.
-
#create_threat_intel_set(options = {}) ⇒ Types::CreateThreatIntelSetResponse
Creates a new ThreatIntelSet.
-
#decline_invitations(options = {}) ⇒ Types::DeclineInvitationsResponse
Declines invitations sent to the current member account by AWS accounts specified by their account IDs.
.
-
#delete_detector(options = {}) ⇒ Struct
Deletes an Amazon GuardDuty detector that is specified by the detector ID.
.
-
#delete_filter(options = {}) ⇒ Struct
Deletes the filter specified by the filter name.
.
-
#delete_invitations(options = {}) ⇒ Types::DeleteInvitationsResponse
Deletes invitations sent to the current member account by AWS accounts specified by their account IDs.
.
-
#delete_ip_set(options = {}) ⇒ Struct
Deletes the IPSet specified by the
ipSetId
. -
#delete_members(options = {}) ⇒ Types::DeleteMembersResponse
Deletes GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.
.
-
#delete_publishing_destination(options = {}) ⇒ Struct
Deletes the publishing definition with the specified
destinationId
..
-
#delete_threat_intel_set(options = {}) ⇒ Struct
Deletes the ThreatIntelSet specified by the ThreatIntelSet ID.
.
-
#describe_organization_configuration(options = {}) ⇒ Types::DescribeOrganizationConfigurationResponse
Returns information about the account selected as the delegated administrator for GuardDuty.
.
-
#describe_publishing_destination(options = {}) ⇒ Types::DescribePublishingDestinationResponse
Returns information about the publishing destination specified by the provided
destinationId
..
-
#disable_organization_admin_account(options = {}) ⇒ Struct
Disables an AWS account within the Organization as the GuardDuty delegated administrator.
.
-
#disassociate_from_master_account(options = {}) ⇒ Struct
Disassociates the current GuardDuty member account from its master account.
.
-
#disassociate_members(options = {}) ⇒ Types::DisassociateMembersResponse
Disassociates GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.
.
-
#enable_organization_admin_account(options = {}) ⇒ Struct
Enables an AWS account within the organization as the GuardDuty delegated administrator.
.
-
#get_detector(options = {}) ⇒ Types::GetDetectorResponse
Retrieves an Amazon GuardDuty detector specified by the detectorId.
.
-
#get_filter(options = {}) ⇒ Types::GetFilterResponse
Returns the details of the filter specified by the filter name.
.
-
#get_findings(options = {}) ⇒ Types::GetFindingsResponse
Describes Amazon GuardDuty findings specified by finding IDs.
.
-
#get_findings_statistics(options = {}) ⇒ Types::GetFindingsStatisticsResponse
Lists Amazon GuardDuty findings statistics for the specified detector ID.
.
-
#get_invitations_count(options = {}) ⇒ Types::GetInvitationsCountResponse
Returns the count of all GuardDuty membership invitations that were sent to the current member account except the currently accepted invitation.
.
-
#get_ip_set(options = {}) ⇒ Types::GetIPSetResponse
Retrieves the IPSet specified by the
ipSetId
..
-
#get_master_account(options = {}) ⇒ Types::GetMasterAccountResponse
Provides the details for the GuardDuty master account associated with the current GuardDuty member account.
.
-
#get_member_detectors(options = {}) ⇒ Types::GetMemberDetectorsResponse
Describes which data sources are enabled for the member account's detector.
.
-
#get_members(options = {}) ⇒ Types::GetMembersResponse
Retrieves GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.
.
-
#get_threat_intel_set(options = {}) ⇒ Types::GetThreatIntelSetResponse
Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID.
.
-
#get_usage_statistics(options = {}) ⇒ Types::GetUsageStatisticsResponse
Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID.
-
#invite_members(options = {}) ⇒ Types::InviteMembersResponse
Invites other AWS accounts (created as members of the current AWS account by CreateMembers) to enable GuardDuty, and allow the current AWS account to view and manage these accounts' GuardDuty findings on their behalf as the master account.
.
-
#list_detectors(options = {}) ⇒ Types::ListDetectorsResponse
Lists detectorIds of all the existing Amazon GuardDuty detector resources.
.
-
#list_filters(options = {}) ⇒ Types::ListFiltersResponse
Returns a paginated list of the current filters.
.
-
#list_findings(options = {}) ⇒ Types::ListFindingsResponse
Lists Amazon GuardDuty findings for the specified detector ID.
.
-
#list_invitations(options = {}) ⇒ Types::ListInvitationsResponse
Lists all GuardDuty membership invitations that were sent to the current AWS account.
.
-
#list_ip_sets(options = {}) ⇒ Types::ListIPSetsResponse
Lists the IPSets of the GuardDuty service specified by the detector ID.
-
#list_members(options = {}) ⇒ Types::ListMembersResponse
Lists details about all member accounts for the current GuardDuty master account.
.
-
#list_organization_admin_accounts(options = {}) ⇒ Types::ListOrganizationAdminAccountsResponse
Lists the accounts configured as GuardDuty delegated administrators.
.
-
#list_publishing_destinations(options = {}) ⇒ Types::ListPublishingDestinationsResponse
Returns a list of publishing destinations associated with the specified
dectectorId
..
-
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Lists tags for a resource.
-
#list_threat_intel_sets(options = {}) ⇒ Types::ListThreatIntelSetsResponse
Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID.
-
#start_monitoring_members(options = {}) ⇒ Types::StartMonitoringMembersResponse
Turns on GuardDuty monitoring of the specified member accounts.
-
#stop_monitoring_members(options = {}) ⇒ Types::StopMonitoringMembersResponse
Stops GuardDuty monitoring for the specified member accounts.
-
#tag_resource(options = {}) ⇒ Struct
Adds tags to a resource.
.
-
#unarchive_findings(options = {}) ⇒ Struct
Unarchives GuardDuty findings specified by the
findingIds
..
-
#untag_resource(options = {}) ⇒ Struct
Removes tags from a resource.
.
-
#update_detector(options = {}) ⇒ Struct
Updates the Amazon GuardDuty detector specified by the detectorId.
.
-
#update_filter(options = {}) ⇒ Types::UpdateFilterResponse
Updates the filter specified by the filter name.
.
-
#update_findings_feedback(options = {}) ⇒ Struct
Marks the specified GuardDuty findings as useful or not useful.
.
-
#update_ip_set(options = {}) ⇒ Struct
Updates the IPSet specified by the IPSet ID.
.
-
#update_member_detectors(options = {}) ⇒ Types::UpdateMemberDetectorsResponse
Contains information on member accounts to be updated.
.
-
#update_organization_configuration(options = {}) ⇒ Struct
Updates the delegated administrator account with the values provided.
.
-
#update_publishing_destination(options = {}) ⇒ Struct
Updates information about the publishing destination specified by the
destinationId
..
-
#update_threat_intel_set(options = {}) ⇒ Struct
Updates the ThreatIntelSet specified by the ThreatIntelSet ID.
.
Instance Method Summary collapse
-
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
-
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters.
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::GuardDuty::Client
Constructs an API client.
Instance Method Details
#accept_invitation(options = {}) ⇒ Struct
Accepts the invitation to be monitored by a master GuardDuty account.
#archive_findings(options = {}) ⇒ Struct
Archives GuardDuty findings that are specified by the list of finding IDs.
Only the master account can archive findings. Member accounts don't have permission to archive findings from their accounts.
#create_detector(options = {}) ⇒ Types::CreateDetectorResponse
Creates a single Amazon GuardDuty detector. A detector is a resource that represents the GuardDuty service. To start using GuardDuty, you must create a detector in each Region where you enable the service. You can have only one detector per account per Region. All data sources are enabled in a new detector by default.
#create_filter(options = {}) ⇒ Types::CreateFilterResponse
Creates a filter using the specified finding criteria.
#create_ip_set(options = {}) ⇒ Types::CreateIPSetResponse
Creates a new IPSet, which is called a trusted IP list in the console user interface. An IPSet is a list of IP addresses that are trusted for secure communication with AWS infrastructure and applications. GuardDuty doesn't generate findings for IP addresses that are included in IPSets. Only users from the master account can use this operation.
#create_members(options = {}) ⇒ Types::CreateMembersResponse
Creates member accounts of the current AWS account by specifying a list of AWS account IDs. This step is a prerequisite for managing the associated member accounts either by invitation or through an organization.
When using Create Members
as an organizations delegated administrator this action will enable GuardDuty in the added member accounts, with the exception of the organization master account, which must enable GuardDuty prior to being added as a member.
If you are adding accounts by invitation use this action after GuardDuty has been enabled in potential member accounts and before using Invite Members
.
#create_publishing_destination(options = {}) ⇒ Types::CreatePublishingDestinationResponse
Creates a publishing destination to export findings to. The resource to export findings to must exist before you use this operation.
#create_sample_findings(options = {}) ⇒ Struct
Generates example findings of types specified by the list of finding types. If 'NULL' is specified for findingTypes
, the API generates example findings of all supported finding types.
#create_threat_intel_set(options = {}) ⇒ Types::CreateThreatIntelSetResponse
Creates a new ThreatIntelSet. ThreatIntelSets consist of known malicious IP addresses. GuardDuty generates findings based on ThreatIntelSets. Only users of the master account can use this operation.
#decline_invitations(options = {}) ⇒ Types::DeclineInvitationsResponse
Declines invitations sent to the current member account by AWS accounts specified by their account IDs.
#delete_detector(options = {}) ⇒ Struct
Deletes an Amazon GuardDuty detector that is specified by the detector ID.
#delete_filter(options = {}) ⇒ Struct
Deletes the filter specified by the filter name.
#delete_invitations(options = {}) ⇒ Types::DeleteInvitationsResponse
Deletes invitations sent to the current member account by AWS accounts specified by their account IDs.
#delete_ip_set(options = {}) ⇒ Struct
Deletes the IPSet specified by the ipSetId
. IPSets are called trusted IP lists in the console user interface.
#delete_members(options = {}) ⇒ Types::DeleteMembersResponse
Deletes GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.
#delete_publishing_destination(options = {}) ⇒ Struct
Deletes the publishing definition with the specified destinationId
.
#delete_threat_intel_set(options = {}) ⇒ Struct
Deletes the ThreatIntelSet specified by the ThreatIntelSet ID.
#describe_organization_configuration(options = {}) ⇒ Types::DescribeOrganizationConfigurationResponse
Returns information about the account selected as the delegated administrator for GuardDuty.
#describe_publishing_destination(options = {}) ⇒ Types::DescribePublishingDestinationResponse
Returns information about the publishing destination specified by the provided destinationId
.
#disable_organization_admin_account(options = {}) ⇒ Struct
Disables an AWS account within the Organization as the GuardDuty delegated administrator.
#disassociate_from_master_account(options = {}) ⇒ Struct
Disassociates the current GuardDuty member account from its master account.
#disassociate_members(options = {}) ⇒ Types::DisassociateMembersResponse
Disassociates GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.
#enable_organization_admin_account(options = {}) ⇒ Struct
Enables an AWS account within the organization as the GuardDuty delegated administrator.
#get_detector(options = {}) ⇒ Types::GetDetectorResponse
Retrieves an Amazon GuardDuty detector specified by the detectorId.
#get_filter(options = {}) ⇒ Types::GetFilterResponse
Returns the details of the filter specified by the filter name.
#get_findings(options = {}) ⇒ Types::GetFindingsResponse
Describes Amazon GuardDuty findings specified by finding IDs.
#get_findings_statistics(options = {}) ⇒ Types::GetFindingsStatisticsResponse
Lists Amazon GuardDuty findings statistics for the specified detector ID.
#get_invitations_count(options = {}) ⇒ Types::GetInvitationsCountResponse
Returns the count of all GuardDuty membership invitations that were sent to the current member account except the currently accepted invitation.
#get_ip_set(options = {}) ⇒ Types::GetIPSetResponse
Retrieves the IPSet specified by the ipSetId
.
#get_master_account(options = {}) ⇒ Types::GetMasterAccountResponse
Provides the details for the GuardDuty master account associated with the current GuardDuty member account.
#get_member_detectors(options = {}) ⇒ Types::GetMemberDetectorsResponse
Describes which data sources are enabled for the member account's detector.
#get_members(options = {}) ⇒ Types::GetMembersResponse
Retrieves GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.
#get_threat_intel_set(options = {}) ⇒ Types::GetThreatIntelSetResponse
Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID.
#get_usage_statistics(options = {}) ⇒ Types::GetUsageStatisticsResponse
Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled detectors or data sources the cost returned will include only the usage so far under 30 days, this may differ from the cost metrics in the console, which projects usage over 30 days to provide a monthly cost estimate. For more information see Understanding How Usage Costs are Calculated.
#invite_members(options = {}) ⇒ Types::InviteMembersResponse
Invites other AWS accounts (created as members of the current AWS account by CreateMembers) to enable GuardDuty, and allow the current AWS account to view and manage these accounts' GuardDuty findings on their behalf as the master account.
#list_detectors(options = {}) ⇒ Types::ListDetectorsResponse
Lists detectorIds of all the existing Amazon GuardDuty detector resources.
#list_filters(options = {}) ⇒ Types::ListFiltersResponse
Returns a paginated list of the current filters.
#list_findings(options = {}) ⇒ Types::ListFindingsResponse
Lists Amazon GuardDuty findings for the specified detector ID.
#list_invitations(options = {}) ⇒ Types::ListInvitationsResponse
Lists all GuardDuty membership invitations that were sent to the current AWS account.
#list_ip_sets(options = {}) ⇒ Types::ListIPSetsResponse
Lists the IPSets of the GuardDuty service specified by the detector ID. If you use this operation from a member account, the IPSets returned are the IPSets from the associated master account.
#list_members(options = {}) ⇒ Types::ListMembersResponse
Lists details about all member accounts for the current GuardDuty master account.
#list_organization_admin_accounts(options = {}) ⇒ Types::ListOrganizationAdminAccountsResponse
Lists the accounts configured as GuardDuty delegated administrators.
#list_publishing_destinations(options = {}) ⇒ Types::ListPublishingDestinationsResponse
Returns a list of publishing destinations associated with the specified dectectorId
.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Lists tags for a resource. Tagging is currently supported for detectors, finding filters, IP sets, and threat intel sets, with a limit of 50 tags per resource. When invoked, this operation returns all assigned tags for a given resource.
#list_threat_intel_sets(options = {}) ⇒ Types::ListThreatIntelSetsResponse
Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID. If you use this operation from a member account, the ThreatIntelSets associated with the master account are returned.
#start_monitoring_members(options = {}) ⇒ Types::StartMonitoringMembersResponse
Turns on GuardDuty monitoring of the specified member accounts. Use this operation to restart monitoring of accounts that you stopped monitoring with the StopMonitoringMembers
operation.
#stop_monitoring_members(options = {}) ⇒ Types::StopMonitoringMembersResponse
Stops GuardDuty monitoring for the specified member accounts. Use the StartMonitoringMembers
operation to restart monitoring for those accounts.
#tag_resource(options = {}) ⇒ Struct
Adds tags to a resource.
#unarchive_findings(options = {}) ⇒ Struct
Unarchives GuardDuty findings specified by the findingIds
.
#untag_resource(options = {}) ⇒ Struct
Removes tags from a resource.
#update_detector(options = {}) ⇒ Struct
Updates the Amazon GuardDuty detector specified by the detectorId.
#update_filter(options = {}) ⇒ Types::UpdateFilterResponse
Updates the filter specified by the filter name.
#update_findings_feedback(options = {}) ⇒ Struct
Marks the specified GuardDuty findings as useful or not useful.
#update_ip_set(options = {}) ⇒ Struct
Updates the IPSet specified by the IPSet ID.
#update_member_detectors(options = {}) ⇒ Types::UpdateMemberDetectorsResponse
Contains information on member accounts to be updated.
#update_organization_configuration(options = {}) ⇒ Struct
Updates the delegated administrator account with the values provided.
#update_publishing_destination(options = {}) ⇒ Struct
Updates information about the publishing destination specified by the destinationId
.
#update_threat_intel_set(options = {}) ⇒ Struct
Updates the ThreatIntelSet specified by the ThreatIntelSet ID.
#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
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name | Client Method | Default Delay: | Default Max Attempts: |
---|