You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::Comprehend::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::Comprehend::Client
- Defined in:
- (unknown)
Overview
An API client for Amazon Comprehend. To construct a client, you need to configure a :region
and :credentials
.
comprehend = Aws::Comprehend::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::Comprehend::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::Comprehend::Client
constructor
Constructs an API client.
API Operations collapse
-
#batch_detect_dominant_language(options = {}) ⇒ Types::BatchDetectDominantLanguageResponse
Determines the dominant language of the input text for a batch of documents.
-
#batch_detect_entities(options = {}) ⇒ Types::BatchDetectEntitiesResponse
Inspects the text of a batch of documents for named entities and returns information about them.
-
#batch_detect_key_phrases(options = {}) ⇒ Types::BatchDetectKeyPhrasesResponse
Detects the key noun phrases found in a batch of documents.
.
-
#batch_detect_sentiment(options = {}) ⇒ Types::BatchDetectSentimentResponse
Inspects a batch of documents and returns an inference of the prevailing sentiment,
POSITIVE
,NEUTRAL
,MIXED
, orNEGATIVE
, in each one..
-
#batch_detect_syntax(options = {}) ⇒ Types::BatchDetectSyntaxResponse
Inspects the text of a batch of documents for the syntax and part of speech of the words in the document and returns information about them.
-
#classify_document(options = {}) ⇒ Types::ClassifyDocumentResponse
Creates a new document classification request to analyze a single document in real-time, using a previously created and trained custom model and an endpoint.
.
-
#create_document_classifier(options = {}) ⇒ Types::CreateDocumentClassifierResponse
Creates a new document classifier that you can use to categorize documents.
-
#create_endpoint(options = {}) ⇒ Types::CreateEndpointResponse
Creates a model-specific endpoint for synchronous inference for a previously trained custom model
.
-
#create_entity_recognizer(options = {}) ⇒ Types::CreateEntityRecognizerResponse
Creates an entity recognizer using submitted files.
-
#delete_document_classifier(options = {}) ⇒ Struct
Deletes a previously created document classifier
Only those classifiers that are in terminated states (IN_ERROR, TRAINED) will be deleted.
-
#delete_endpoint(options = {}) ⇒ Struct
Deletes a model-specific endpoint for a previously-trained custom model.
-
#delete_entity_recognizer(options = {}) ⇒ Struct
Deletes an entity recognizer.
Only those recognizers that are in terminated states (IN_ERROR, TRAINED) will be deleted.
-
#describe_document_classification_job(options = {}) ⇒ Types::DescribeDocumentClassificationJobResponse
Gets the properties associated with a document classification job.
-
#describe_document_classifier(options = {}) ⇒ Types::DescribeDocumentClassifierResponse
Gets the properties associated with a document classifier.
.
-
#describe_dominant_language_detection_job(options = {}) ⇒ Types::DescribeDominantLanguageDetectionJobResponse
Gets the properties associated with a dominant language detection job.
-
#describe_endpoint(options = {}) ⇒ Types::DescribeEndpointResponse
Gets the properties associated with a specific endpoint.
-
#describe_entities_detection_job(options = {}) ⇒ Types::DescribeEntitiesDetectionJobResponse
Gets the properties associated with an entities detection job.
-
#describe_entity_recognizer(options = {}) ⇒ Types::DescribeEntityRecognizerResponse
Provides details about an entity recognizer including status, S3 buckets containing training data, recognizer metadata, metrics, and so on.
.
-
#describe_key_phrases_detection_job(options = {}) ⇒ Types::DescribeKeyPhrasesDetectionJobResponse
Gets the properties associated with a key phrases detection job.
-
#describe_pii_entities_detection_job(options = {}) ⇒ Types::DescribePiiEntitiesDetectionJobResponse
Gets the properties associated with a PII entities detection job.
-
#describe_sentiment_detection_job(options = {}) ⇒ Types::DescribeSentimentDetectionJobResponse
Gets the properties associated with a sentiment detection job.
-
#describe_topics_detection_job(options = {}) ⇒ Types::DescribeTopicsDetectionJobResponse
Gets the properties associated with a topic detection job.
-
#detect_dominant_language(options = {}) ⇒ Types::DetectDominantLanguageResponse
Determines the dominant language of the input text.
-
#detect_entities(options = {}) ⇒ Types::DetectEntitiesResponse
Inspects text for named entities, and returns information about them.
-
#detect_key_phrases(options = {}) ⇒ Types::DetectKeyPhrasesResponse
Detects the key noun phrases found in the text.
-
#detect_pii_entities(options = {}) ⇒ Types::DetectPiiEntitiesResponse
Inspects the input text for entities that contain personally identifiable information (PII) and returns information about them.
.
-
#detect_sentiment(options = {}) ⇒ Types::DetectSentimentResponse
Inspects text and returns an inference of the prevailing sentiment (
POSITIVE
,NEUTRAL
,MIXED
, orNEGATIVE
). -
#detect_syntax(options = {}) ⇒ Types::DetectSyntaxResponse
Inspects text for syntax and the part of speech of words in the document.
-
#list_document_classification_jobs(options = {}) ⇒ Types::ListDocumentClassificationJobsResponse
Gets a list of the documentation classification jobs that you have submitted.
.
-
#list_document_classifiers(options = {}) ⇒ Types::ListDocumentClassifiersResponse
Gets a list of the document classifiers that you have created.
.
-
#list_dominant_language_detection_jobs(options = {}) ⇒ Types::ListDominantLanguageDetectionJobsResponse
Gets a list of the dominant language detection jobs that you have submitted.
.
-
#list_endpoints(options = {}) ⇒ Types::ListEndpointsResponse
Gets a list of all existing endpoints that you've created.
.
-
#list_entities_detection_jobs(options = {}) ⇒ Types::ListEntitiesDetectionJobsResponse
Gets a list of the entity detection jobs that you have submitted.
.
-
#list_entity_recognizers(options = {}) ⇒ Types::ListEntityRecognizersResponse
Gets a list of the properties of all entity recognizers that you created, including recognizers currently in training.
-
#list_key_phrases_detection_jobs(options = {}) ⇒ Types::ListKeyPhrasesDetectionJobsResponse
Get a list of key phrase detection jobs that you have submitted.
.
-
#list_pii_entities_detection_jobs(options = {}) ⇒ Types::ListPiiEntitiesDetectionJobsResponse
Gets a list of the PII entity detection jobs that you have submitted.
.
-
#list_sentiment_detection_jobs(options = {}) ⇒ Types::ListSentimentDetectionJobsResponse
Gets a list of sentiment detection jobs that you have submitted.
.
-
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Lists all tags associated with a given Amazon Comprehend resource.
-
#list_topics_detection_jobs(options = {}) ⇒ Types::ListTopicsDetectionJobsResponse
Gets a list of the topic detection jobs that you have submitted.
.
-
#start_document_classification_job(options = {}) ⇒ Types::StartDocumentClassificationJobResponse
Starts an asynchronous document classification job.
-
#start_dominant_language_detection_job(options = {}) ⇒ Types::StartDominantLanguageDetectionJobResponse
Starts an asynchronous dominant language detection job for a collection of documents.
-
#start_entities_detection_job(options = {}) ⇒ Types::StartEntitiesDetectionJobResponse
Starts an asynchronous entity detection job for a collection of documents.
-
#start_key_phrases_detection_job(options = {}) ⇒ Types::StartKeyPhrasesDetectionJobResponse
Starts an asynchronous key phrase detection job for a collection of documents.
-
#start_pii_entities_detection_job(options = {}) ⇒ Types::StartPiiEntitiesDetectionJobResponse
Starts an asynchronous PII entity detection job for a collection of documents.
.
-
#start_sentiment_detection_job(options = {}) ⇒ Types::StartSentimentDetectionJobResponse
Starts an asynchronous sentiment detection job for a collection of documents.
-
#start_topics_detection_job(options = {}) ⇒ Types::StartTopicsDetectionJobResponse
Starts an asynchronous topic detection job.
-
#stop_dominant_language_detection_job(options = {}) ⇒ Types::StopDominantLanguageDetectionJobResponse
Stops a dominant language detection job in progress.
If the job state is
IN_PROGRESS
the job is marked for termination and put into theSTOP_REQUESTED
state. -
#stop_entities_detection_job(options = {}) ⇒ Types::StopEntitiesDetectionJobResponse
Stops an entities detection job in progress.
If the job state is
IN_PROGRESS
the job is marked for termination and put into theSTOP_REQUESTED
state. -
#stop_key_phrases_detection_job(options = {}) ⇒ Types::StopKeyPhrasesDetectionJobResponse
Stops a key phrases detection job in progress.
If the job state is
IN_PROGRESS
the job is marked for termination and put into theSTOP_REQUESTED
state. -
#stop_pii_entities_detection_job(options = {}) ⇒ Types::StopPiiEntitiesDetectionJobResponse
Stops a PII entities detection job in progress.
.
-
#stop_sentiment_detection_job(options = {}) ⇒ Types::StopSentimentDetectionJobResponse
Stops a sentiment detection job in progress.
If the job state is
IN_PROGRESS
the job is marked for termination and put into theSTOP_REQUESTED
state. -
#stop_training_document_classifier(options = {}) ⇒ Struct
Stops a document classifier training job while in progress.
If the training job state is
TRAINING
, the job is marked for termination and put into theSTOP_REQUESTED
state. -
#stop_training_entity_recognizer(options = {}) ⇒ Struct
Stops an entity recognizer training job while in progress.
If the training job state is
TRAINING
, the job is marked for termination and put into theSTOP_REQUESTED
state. -
#tag_resource(options = {}) ⇒ Struct
Associates a specific tag with an Amazon Comprehend resource.
-
#untag_resource(options = {}) ⇒ Struct
Removes a specific tag associated with an Amazon Comprehend resource.
-
#update_endpoint(options = {}) ⇒ Struct
Updates information about the specified endpoint.
.
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::Comprehend::Client
Constructs an API client.
Instance Method Details
#batch_detect_dominant_language(options = {}) ⇒ Types::BatchDetectDominantLanguageResponse
Determines the dominant language of the input text for a batch of documents. For a list of languages that Amazon Comprehend can detect, see Amazon Comprehend Supported Languages.
#batch_detect_entities(options = {}) ⇒ Types::BatchDetectEntitiesResponse
Inspects the text of a batch of documents for named entities and returns information about them. For more information about named entities, see how-entities
#batch_detect_key_phrases(options = {}) ⇒ Types::BatchDetectKeyPhrasesResponse
Detects the key noun phrases found in a batch of documents.
#batch_detect_sentiment(options = {}) ⇒ Types::BatchDetectSentimentResponse
Inspects a batch of documents and returns an inference of the prevailing sentiment, POSITIVE
, NEUTRAL
, MIXED
, or NEGATIVE
, in each one.
#batch_detect_syntax(options = {}) ⇒ Types::BatchDetectSyntaxResponse
Inspects the text of a batch of documents for the syntax and part of speech of the words in the document and returns information about them. For more information, see how-syntax.
#classify_document(options = {}) ⇒ Types::ClassifyDocumentResponse
Creates a new document classification request to analyze a single document in real-time, using a previously created and trained custom model and an endpoint.
#create_document_classifier(options = {}) ⇒ Types::CreateDocumentClassifierResponse
Creates a new document classifier that you can use to categorize documents. To create a classifier, you provide a set of training documents that labeled with the categories that you want to use. After the classifier is trained you can use it to categorize a set of labeled documents into the categories. For more information, see how-document-classification.
#create_endpoint(options = {}) ⇒ Types::CreateEndpointResponse
Creates a model-specific endpoint for synchronous inference for a previously trained custom model
#create_entity_recognizer(options = {}) ⇒ Types::CreateEntityRecognizerResponse
Creates an entity recognizer using submitted files. After your CreateEntityRecognizer
request is submitted, you can check job status using the API.
#delete_document_classifier(options = {}) ⇒ Struct
Deletes a previously created document classifier
Only those classifiers that are in terminated states (IN_ERROR, TRAINED) will be deleted. If an active inference job is using the model, a ResourceInUseException
will be returned.
This is an asynchronous action that puts the classifier into a DELETING state, and it is then removed by a background job. Once removed, the classifier disappears from your account and is no longer available for use.
#delete_endpoint(options = {}) ⇒ Struct
Deletes a model-specific endpoint for a previously-trained custom model. All endpoints must be deleted in order for the model to be deleted.
#delete_entity_recognizer(options = {}) ⇒ Struct
Deletes an entity recognizer.
Only those recognizers that are in terminated states (IN_ERROR, TRAINED) will be deleted. If an active inference job is using the model, a ResourceInUseException
will be returned.
This is an asynchronous action that puts the recognizer into a DELETING state, and it is then removed by a background job. Once removed, the recognizer disappears from your account and is no longer available for use.
#describe_document_classification_job(options = {}) ⇒ Types::DescribeDocumentClassificationJobResponse
Gets the properties associated with a document classification job. Use this operation to get the status of a classification job.
#describe_document_classifier(options = {}) ⇒ Types::DescribeDocumentClassifierResponse
Gets the properties associated with a document classifier.
#describe_dominant_language_detection_job(options = {}) ⇒ Types::DescribeDominantLanguageDetectionJobResponse
Gets the properties associated with a dominant language detection job. Use this operation to get the status of a detection job.
#describe_endpoint(options = {}) ⇒ Types::DescribeEndpointResponse
Gets the properties associated with a specific endpoint. Use this operation to get the status of an endpoint.
#describe_entities_detection_job(options = {}) ⇒ Types::DescribeEntitiesDetectionJobResponse
Gets the properties associated with an entities detection job. Use this operation to get the status of a detection job.
#describe_entity_recognizer(options = {}) ⇒ Types::DescribeEntityRecognizerResponse
Provides details about an entity recognizer including status, S3 buckets containing training data, recognizer metadata, metrics, and so on.
#describe_key_phrases_detection_job(options = {}) ⇒ Types::DescribeKeyPhrasesDetectionJobResponse
Gets the properties associated with a key phrases detection job. Use this operation to get the status of a detection job.
#describe_pii_entities_detection_job(options = {}) ⇒ Types::DescribePiiEntitiesDetectionJobResponse
Gets the properties associated with a PII entities detection job. For example, you can use this operation to get the job status.
#describe_sentiment_detection_job(options = {}) ⇒ Types::DescribeSentimentDetectionJobResponse
Gets the properties associated with a sentiment detection job. Use this operation to get the status of a detection job.
#describe_topics_detection_job(options = {}) ⇒ Types::DescribeTopicsDetectionJobResponse
Gets the properties associated with a topic detection job. Use this operation to get the status of a detection job.
#detect_dominant_language(options = {}) ⇒ Types::DetectDominantLanguageResponse
Determines the dominant language of the input text. For a list of languages that Amazon Comprehend can detect, see Amazon Comprehend Supported Languages.
#detect_entities(options = {}) ⇒ Types::DetectEntitiesResponse
Inspects text for named entities, and returns information about them. For more information, about named entities, see how-entities.
#detect_key_phrases(options = {}) ⇒ Types::DetectKeyPhrasesResponse
Detects the key noun phrases found in the text.
#detect_pii_entities(options = {}) ⇒ Types::DetectPiiEntitiesResponse
Inspects the input text for entities that contain personally identifiable information (PII) and returns information about them.
#detect_sentiment(options = {}) ⇒ Types::DetectSentimentResponse
Inspects text and returns an inference of the prevailing sentiment (POSITIVE
, NEUTRAL
, MIXED
, or NEGATIVE
).
#detect_syntax(options = {}) ⇒ Types::DetectSyntaxResponse
Inspects text for syntax and the part of speech of words in the document. For more information, how-syntax.
#list_document_classification_jobs(options = {}) ⇒ Types::ListDocumentClassificationJobsResponse
Gets a list of the documentation classification jobs that you have submitted.
#list_document_classifiers(options = {}) ⇒ Types::ListDocumentClassifiersResponse
Gets a list of the document classifiers that you have created.
#list_dominant_language_detection_jobs(options = {}) ⇒ Types::ListDominantLanguageDetectionJobsResponse
Gets a list of the dominant language detection jobs that you have submitted.
#list_endpoints(options = {}) ⇒ Types::ListEndpointsResponse
Gets a list of all existing endpoints that you've created.
#list_entities_detection_jobs(options = {}) ⇒ Types::ListEntitiesDetectionJobsResponse
Gets a list of the entity detection jobs that you have submitted.
#list_entity_recognizers(options = {}) ⇒ Types::ListEntityRecognizersResponse
Gets a list of the properties of all entity recognizers that you created, including recognizers currently in training. Allows you to filter the list of recognizers based on criteria such as status and submission time. This call returns up to 500 entity recognizers in the list, with a default number of 100 recognizers in the list.
The results of this list are not in any particular order. Please get the list and sort locally if needed.
#list_key_phrases_detection_jobs(options = {}) ⇒ Types::ListKeyPhrasesDetectionJobsResponse
Get a list of key phrase detection jobs that you have submitted.
#list_pii_entities_detection_jobs(options = {}) ⇒ Types::ListPiiEntitiesDetectionJobsResponse
Gets a list of the PII entity detection jobs that you have submitted.
#list_sentiment_detection_jobs(options = {}) ⇒ Types::ListSentimentDetectionJobsResponse
Gets a list of sentiment detection jobs that you have submitted.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse
Lists all tags associated with a given Amazon Comprehend resource.
#list_topics_detection_jobs(options = {}) ⇒ Types::ListTopicsDetectionJobsResponse
Gets a list of the topic detection jobs that you have submitted.
#start_document_classification_job(options = {}) ⇒ Types::StartDocumentClassificationJobResponse
Starts an asynchronous document classification job. Use the operation to track the progress of the job.
#start_dominant_language_detection_job(options = {}) ⇒ Types::StartDominantLanguageDetectionJobResponse
Starts an asynchronous dominant language detection job for a collection of documents. Use the operation to track the status of a job.
#start_entities_detection_job(options = {}) ⇒ Types::StartEntitiesDetectionJobResponse
Starts an asynchronous entity detection job for a collection of documents. Use the operation to track the status of a job.
This API can be used for either standard entity detection or custom entity recognition. In order to be used for custom entity recognition, the optional EntityRecognizerArn
must be used in order to provide access to the recognizer being used to detect the custom entity.
#start_key_phrases_detection_job(options = {}) ⇒ Types::StartKeyPhrasesDetectionJobResponse
Starts an asynchronous key phrase detection job for a collection of documents. Use the operation to track the status of a job.
#start_pii_entities_detection_job(options = {}) ⇒ Types::StartPiiEntitiesDetectionJobResponse
Starts an asynchronous PII entity detection job for a collection of documents.
#start_sentiment_detection_job(options = {}) ⇒ Types::StartSentimentDetectionJobResponse
Starts an asynchronous sentiment detection job for a collection of documents. use the operation to track the status of a job.
#start_topics_detection_job(options = {}) ⇒ Types::StartTopicsDetectionJobResponse
Starts an asynchronous topic detection job. Use the DescribeTopicDetectionJob
operation to track the status of a job.
#stop_dominant_language_detection_job(options = {}) ⇒ Types::StopDominantLanguageDetectionJobResponse
Stops a dominant language detection job in progress.
If the job state is IN_PROGRESS
the job is marked for termination and put into the STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the COMPLETED
state; otherwise the job is stopped and put into the STOPPED
state.
If the job is in the COMPLETED
or FAILED
state when you call the StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
When a job is stopped, any documents already processed are written to the output location.
#stop_entities_detection_job(options = {}) ⇒ Types::StopEntitiesDetectionJobResponse
Stops an entities detection job in progress.
If the job state is IN_PROGRESS
the job is marked for termination and put into the STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the COMPLETED
state; otherwise the job is stopped and put into the STOPPED
state.
If the job is in the COMPLETED
or FAILED
state when you call the StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
When a job is stopped, any documents already processed are written to the output location.
#stop_key_phrases_detection_job(options = {}) ⇒ Types::StopKeyPhrasesDetectionJobResponse
Stops a key phrases detection job in progress.
If the job state is IN_PROGRESS
the job is marked for termination and put into the STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the COMPLETED
state; otherwise the job is stopped and put into the STOPPED
state.
If the job is in the COMPLETED
or FAILED
state when you call the StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
When a job is stopped, any documents already processed are written to the output location.
#stop_pii_entities_detection_job(options = {}) ⇒ Types::StopPiiEntitiesDetectionJobResponse
Stops a PII entities detection job in progress.
#stop_sentiment_detection_job(options = {}) ⇒ Types::StopSentimentDetectionJobResponse
Stops a sentiment detection job in progress.
If the job state is IN_PROGRESS
the job is marked for termination and put into the STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the COMPLETED
state; otherwise the job is be stopped and put into the STOPPED
state.
If the job is in the COMPLETED
or FAILED
state when you call the StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
When a job is stopped, any documents already processed are written to the output location.
#stop_training_document_classifier(options = {}) ⇒ Struct
Stops a document classifier training job while in progress.
If the training job state is TRAINING
, the job is marked for termination and put into the STOP_REQUESTED
state. If the training job completes before it can be stopped, it is put into the TRAINED
; otherwise the training job is stopped and put into the STOPPED
state and the service sends back an HTTP 200 response with an empty HTTP body.
#stop_training_entity_recognizer(options = {}) ⇒ Struct
Stops an entity recognizer training job while in progress.
If the training job state is TRAINING
, the job is marked for termination and put into the STOP_REQUESTED
state. If the training job completes before it can be stopped, it is put into the TRAINED
; otherwise the training job is stopped and putted into the STOPPED
state and the service sends back an HTTP 200 response with an empty HTTP body.
#tag_resource(options = {}) ⇒ Struct
Associates a specific tag with an Amazon Comprehend resource. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.
#untag_resource(options = {}) ⇒ Struct
Removes a specific tag associated with an Amazon Comprehend resource.
#update_endpoint(options = {}) ⇒ Struct
Updates information about the specified endpoint.
#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: |
---|