Class: Aws::AbuseSignal::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::AbuseSignal::Client
- Includes:
- ClientStubs
- Defined in:
- gems/aws-sdk-abusesignal/lib/aws-sdk-abusesignal/client.rb
Overview
An API client for AbuseSignal. To construct a client, you need to configure a :region and :credentials.
client = Aws::AbuseSignal::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the developer guide.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
API Operations collapse
-
#create_abuse_report(params = {}) ⇒ Types::CreateAbuseReportResponse
Submits a structured report.
-
#get_abuse_report_status(params = {}) ⇒ Types::GetAbuseReportStatusResponse
Retrieves the current processing status of a previously submitted abuse report, including the status, submission timestamp, and last-update time.
-
#list_abuse_report_statuses(params = {}) ⇒ Types::ListAbuseReportStatusesResponse
Lists abuse report statuses for the calling account, ordered by submission time, with optional filtering and pagination.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
Methods included from ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
479 480 481 |
# File 'gems/aws-sdk-abusesignal/lib/aws-sdk-abusesignal/client.rb', line 479 def initialize(*args) super end |
Instance Method Details
#create_abuse_report(params = {}) ⇒ Types::CreateAbuseReportResponse
Submits a structured report. Amazon Web Services validates it and returns a report ID. A successful response confirms that Amazon Web Services received your report. It doesn't mean that Amazon Web Services has reached an outcome. Use GetAbuseReportStatus with the report ID to check the report's status and outcome.
This operation is idempotent within a time window. If you provide a
clientToken, duplicate requests within 24 hours return the existing
report ID. If you omit it, the service generates a token scoped to 5
minutes.
Cross-Region data residency: By submitting a report, you instruct
Amazon Web Services to store it in all supported Regions (us-east-1,
us-west-2, and eu-west-2), including across the United States and
Europe. If data must remain in a single Region, do not include it in
the report.
560 561 562 563 |
# File 'gems/aws-sdk-abusesignal/lib/aws-sdk-abusesignal/client.rb', line 560 def create_abuse_report(params = {}, = {}) req = build_request(:create_abuse_report, params) req.send_request() end |
#get_abuse_report_status(params = {}) ⇒ Types::GetAbuseReportStatusResponse
Retrieves the current processing status of a previously submitted abuse report, including the status, submission timestamp, and last-update time.
You can poll this operation to track the report's status.
PROCESSING confirms that Amazon Web Services received your report
and is processing it. COMPLETED means Amazon Web Services finished
resolving the report, and the response includes a reasonCode. The
time to reach COMPLETED may vary and can take up to several days
depending on the scope and complexity of the suspected abuse.
COMPLETED is the only terminal status. To wait for a report, use the
ReportProcessing waiter, which succeeds when the report reaches
PROCESSING or COMPLETED. If you poll this operation yourself, wait
1–5 seconds between calls.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- report_processing
637 638 639 640 |
# File 'gems/aws-sdk-abusesignal/lib/aws-sdk-abusesignal/client.rb', line 637 def get_abuse_report_status(params = {}, = {}) req = build_request(:get_abuse_report_status, params) req.send_request() end |
#list_abuse_report_statuses(params = {}) ⇒ Types::ListAbuseReportStatusesResponse
Lists abuse report statuses for the calling account, ordered by submission time, with optional filtering and pagination.
Use the correlationId parameter to filter results by the
reporter-provided correlation ID that was specified during report
submission.
Results are paginated. Use nextToken to retrieve additional results.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
708 709 710 711 |
# File 'gems/aws-sdk-abusesignal/lib/aws-sdk-abusesignal/client.rb', line 708 def list_abuse_report_statuses(params = {}, = {}) req = build_request(:list_abuse_report_statuses, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
Basic Usage
A waiter will call an API operation until:
- It is successful
- It enters a terminal state
- It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# polls in a loop, sleeping between attempts
client.wait_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
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(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
Valid Waiters
The following table lists the valid waiter names, the operations they call,
and the default :delay and :max_attempts values.
| waiter_name | params | :delay | :max_attempts |
|---|---|---|---|
| report_processing | #get_abuse_report_status | 1 | 5 |
823 824 825 826 827 |
# File 'gems/aws-sdk-abusesignal/lib/aws-sdk-abusesignal/client.rb', line 823 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |