Sha256: 313e2cd9a8c52e7b323685f923c0a976103b838cbccd388f0d7754249ac728d3

Contents?: true

Size: 1.68 KB

Versions: 23

Compression:

Stored size: 1.68 KB

Contents

module AWS
  module EC2

    class Base < AWS::Base


      # The CreateKeyPair operation creates a new 2048 bit RSA keypair and returns a unique ID that can be
      # used to reference this keypair when launching new instances.
      #
      # @option options [String] :key_name ("")
      #
      def create_keypair( options = {} )

        options = { :key_name => "" }.merge(options)

        raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?

        params = { "KeyName" => options[:key_name] }

        return response_generator(:action => "CreateKeyPair", :params => params)

      end


      # The DescribeKeyPairs operation returns information about keypairs available for use by the user
      # making the request. Selected keypairs may be specified or the list may be left empty if information for
      # all registered keypairs is required.
      #
      # @option options [Array] :key_name ([])
      #
      def describe_keypairs( options = {} )

        options = { :key_name => [] }.merge(options)

        params = pathlist("KeyName", options[:key_name] )

        return response_generator(:action => "DescribeKeyPairs", :params => params)

      end


      # The DeleteKeyPair operation deletes a keypair.
      #
      # @option options [String] :key_name ("")
      #
      def delete_keypair( options = {} )

        options = { :key_name => "" }.merge(options)

        raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?

        params = { "KeyName" => options[:key_name] }

        return response_generator(:action => "DeleteKeyPair", :params => params)

      end

    end

  end
end

Version data entries

23 entries across 23 versions & 4 rubygems

Version Path
amazon-ec2-0.5.2 lib/AWS/EC2/keypairs.rb
amazon-ec2-0.5.3 lib/AWS/EC2/keypairs.rb
amazon-ec2-0.5.4 lib/AWS/EC2/keypairs.rb