You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

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

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

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 'gems/aws-sdk-ec2/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 Method Details

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

Returns a response object which responds to the following methods:

Parameters:

  • params (Hash) (defaults to: {})

    a customizable set of options

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 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/waiters.rb', line 669

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