File: keypairs.rb

package info (click to toggle)
ruby-amazon-ec2 0.9.17-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,232 kB
  • sloc: ruby: 4,659; makefile: 5
file content (47 lines) | stat: -rw-r--r-- 1,704 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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