Class: Aws::EC2::Waiters::KeyPairExists

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-ec2/waiters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ KeyPairExists

Returns a new instance of KeyPairExists.

Parameters:

  • options (Hash)

Options Hash (options):

  • :client (required, Client)
  • :max_attempts (Integer) — default: 6
  • :delay (Integer) — default: 5
  • :before_attempt (Proc)
  • :before_wait (Proc)


643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/aws-sdk-ec2/waiters.rb', line 643

def initialize(options)
  @client = options.fetch(:client)
  @waiter = Aws::Waiters::Waiter.new({
    max_attempts: 6,
    delay: 5,
    poller: Aws::Waiters::Poller.new(
      operation_name: :describe_key_pairs,
      acceptors: [
        {
          "expected" => true,
          "matcher" => "path",
          "state" => "success",
          "argument" => "length(key_pairs[].key_name) > `0`"
        },
        {
          "expected" => "InvalidKeyPair.NotFound",
          "matcher" => "error",
          "state" => "retry"
        }
      ]
    )
  }.merge(options))
end

Instance Attribute Details

#waiterObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



674
675
676
# File 'lib/aws-sdk-ec2/waiters.rb', line 674

def waiter
  @waiter
end

Instance Method Details

#wait(params = {}) ⇒ Types::DescribeKeyPairsResult

Returns a response object which responds to the following methods:

Options Hash (params):

  • :filters (Array<Types::Filter>)

    One or more filters.

    • ‘fingerprint` - The fingerprint of the key pair.

    • ‘key-name` - The name of the key pair.

  • :key_names (Array<String>)

    One or more key pair names.

    Default: Describes all your key pairs.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is ‘DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.

Returns:



669
670
671
# File 'lib/aws-sdk-ec2/waiters.rb', line 669

def wait(params = {})
  @waiter.wait(client: @client, params: params)
end