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)


786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/waiters.rb', line 786

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):

  • :key_names (Array<String>)

    The key pair names.

    Default: Describes all of your key pairs.

  • :key_pair_ids (Array<String>)

    The IDs of the key pairs.

  • :include_public_key (Boolean)

    If true, the public key material is included in the response.

    Default: false

  • :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.

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

    The filters.

    • key-pair-id - The ID of the key pair.

    • fingerprint - The fingerprint of the key pair.

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

    • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

    • tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

Returns:



812
813
814
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/waiters.rb', line 812

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