lib/aws-sdk-neptunegraph/client.rb in aws-sdk-neptunegraph-1.0.0 vs lib/aws-sdk-neptunegraph/client.rb in aws-sdk-neptunegraph-1.1.0
- old
+ new
@@ -973,10 +973,16 @@
# resp.kms_key_identifier #=> String
# resp.source_snapshot_id #=> String
# resp.deletion_protection #=> Boolean
# resp.build_number #=> String
#
+ #
+ # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):
+ #
+ # * graph_available
+ # * graph_deleted
+ #
# @see http://docs.aws.amazon.com/goto/WebAPI/neptune-graph-2023-11-29/GetGraph AWS API Documentation
#
# @overload get_graph(params = {})
# @param [Hash] params ({})
def get_graph(params = {}, options = {})
@@ -1013,10 +1019,16 @@
# resp.source_graph_id #=> String
# resp.snapshot_create_time #=> Time
# resp.status #=> String, one of "CREATING", "AVAILABLE", "DELETING", "FAILED"
# resp.kms_key_identifier #=> String
#
+ #
+ # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):
+ #
+ # * graph_snapshot_available
+ # * graph_snapshot_deleted
+ #
# @see http://docs.aws.amazon.com/goto/WebAPI/neptune-graph-2023-11-29/GetGraphSnapshot AWS API Documentation
#
# @overload get_graph_snapshot(params = {})
# @param [Hash] params ({})
def get_graph_snapshot(params = {}, options = {})
@@ -1069,10 +1081,16 @@
# resp.import_task_details.statement_count #=> Integer
# resp.import_task_details.dictionary_entry_count #=> Integer
# resp.attempt_number #=> Integer
# resp.status_reason #=> String
#
+ #
+ # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):
+ #
+ # * import_task_cancelled
+ # * import_task_successful
+ #
# @see http://docs.aws.amazon.com/goto/WebAPI/neptune-graph-2023-11-29/GetImportTask AWS API Documentation
#
# @overload get_import_task(params = {})
# @param [Hash] params ({})
def get_import_task(params = {}, options = {})
@@ -1108,10 +1126,16 @@
# resp.subnet_ids #=> Array
# resp.subnet_ids[0] #=> String
# resp.status #=> String, one of "CREATING", "AVAILABLE", "DELETING", "FAILED"
# resp.vpc_endpoint_id #=> String
#
+ #
+ # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):
+ #
+ # * private_graph_endpoint_available
+ # * private_graph_endpoint_deleted
+ #
# @see http://docs.aws.amazon.com/goto/WebAPI/neptune-graph-2023-11-29/GetPrivateGraphEndpoint AWS API Documentation
#
# @overload get_private_graph_endpoint(params = {})
# @param [Hash] params ({})
def get_private_graph_endpoint(params = {}, options = {})
@@ -1677,17 +1701,144 @@
operation: config.api.operation(operation_name),
client: self,
params: params,
config: config)
context[:gem_name] = 'aws-sdk-neptunegraph'
- context[:gem_version] = '1.0.0'
+ context[:gem_version] = '1.1.0'
Seahorse::Client::Request.new(handlers, context)
end
+ # 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
+ # {Aws::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 |
+ # | -------------------------------- | ----------------------------------- | -------- | ------------- |
+ # | graph_available | {Client#get_graph} | 60 | 480 |
+ # | graph_deleted | {Client#get_graph} | 60 | 60 |
+ # | graph_snapshot_available | {Client#get_graph_snapshot} | 60 | 120 |
+ # | graph_snapshot_deleted | {Client#get_graph_snapshot} | 60 | 60 |
+ # | import_task_cancelled | {Client#get_import_task} | 60 | 60 |
+ # | import_task_successful | {Client#get_import_task} | 60 | 480 |
+ # | private_graph_endpoint_available | {Client#get_private_graph_endpoint} | 10 | 180 |
+ # | private_graph_endpoint_deleted | {Client#get_private_graph_endpoint} | 10 | 180 |
+ #
+ # @raise [Errors::FailureStateError] Raised when the waiter terminates
+ # because the waiter has entered a state that it will not transition
+ # out of, preventing success.
+ #
+ # @raise [Errors::TooManyAttemptsError] Raised when the configured
+ # maximum number of attempts have been made, and the waiter is not
+ # yet successful.
+ #
+ # @raise [Errors::UnexpectedError] Raised when an error is encounted
+ # while polling for a resource that is not expected.
+ #
+ # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
+ # for an unknown state.
+ #
+ # @return [Boolean] Returns `true` if the waiter was successful.
+ # @param [Symbol] waiter_name
+ # @param [Hash] params ({})
+ # @param [Hash] options ({})
+ # @option options [Integer] :max_attempts
+ # @option options [Integer] :delay
+ # @option options [Proc] :before_attempt
+ # @option options [Proc] :before_wait
+ def wait_until(waiter_name, params = {}, options = {})
+ w = waiter(waiter_name, options)
+ yield(w.waiter) if block_given? # deprecated
+ w.wait(params)
+ end
+
# @api private
# @deprecated
def waiter_names
- []
+ waiters.keys
+ end
+
+ private
+
+ # @param [Symbol] waiter_name
+ # @param [Hash] options ({})
+ def waiter(waiter_name, options = {})
+ waiter_class = waiters[waiter_name]
+ if waiter_class
+ waiter_class.new(options.merge(client: self))
+ else
+ raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
+ end
+ end
+
+ def waiters
+ {
+ graph_available: Waiters::GraphAvailable,
+ graph_deleted: Waiters::GraphDeleted,
+ graph_snapshot_available: Waiters::GraphSnapshotAvailable,
+ graph_snapshot_deleted: Waiters::GraphSnapshotDeleted,
+ import_task_cancelled: Waiters::ImportTaskCancelled,
+ import_task_successful: Waiters::ImportTaskSuccessful,
+ private_graph_endpoint_available: Waiters::PrivateGraphEndpointAvailable,
+ private_graph_endpoint_deleted: Waiters::PrivateGraphEndpointDeleted
+ }
end
class << self
# @api private