amazon-ec2 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,140 @@
1
+ # Amazon Web Services EC2 Query API Ruby Library
2
+ # This library has been packaged as a Ruby Gem
3
+ # by Glenn Rempe ( glenn @nospam@ elasticworkbench.com ).
4
+ #
5
+ # Source code and gem hosted on RubyForge
6
+ # under the Ruby License as of 12/14/2006:
7
+ # http://amazon-ec2.rubyforge.org
8
+
9
+ module EC2
10
+
11
+ class AWSAuthConnection
12
+
13
+ # The CreateSecurityGroup operation creates a new security group.
14
+ #
15
+ # Every instance is launched in a security group. If none is specified
16
+ # as part of the launch request then instances are launched in the
17
+ # default security group. Instances within the same security group
18
+ # have unrestricted network access to one another. Instances will reject
19
+ # network access attempts from other instances in a different security
20
+ # group. As the owner of instances you may grant or revoke specific
21
+ # permissions using the AuthorizeSecurityGroupIngress and
22
+ # RevokeSecurityGroupIngress operations.
23
+ def create_security_group(groupName, groupDescription)
24
+ params = {
25
+ "GroupName" => groupName,
26
+ "GroupDescription" => groupDescription
27
+ }
28
+ CreateSecurityGroupResponse.new(make_request("CreateSecurityGroup", params))
29
+ end
30
+
31
+ # Maintain backward compatibility. Changed method name from create_securitygroup
32
+ # to more consistent name.
33
+ alias create_securitygroup create_security_group
34
+
35
+ # The DescribeSecurityGroups operation returns information about security
36
+ # groups owned by the user making the request.
37
+ #
38
+ # An optional list of security group names may be provided to request
39
+ # information for those security groups only. If no security group
40
+ # names are provided, information of all security groups will be returned.
41
+ # If a group is specified that does not exist a fault is returned.
42
+ def describe_security_groups(groupNames=[])
43
+ params = pathlist("GroupName", groupNames)
44
+ DescribeSecurityGroupsResponse.new(make_request("DescribeSecurityGroups", params))
45
+ end
46
+
47
+ # Maintain backward compatibility. Changed method name from describe_securitygroups
48
+ # to more consistent name.
49
+ alias describe_securitygroups describe_security_groups
50
+
51
+ # The DeleteSecurityGroup operation deletes a security group.
52
+ #
53
+ # If an attempt is made to delete a security group and any
54
+ # instances exist that are members of that group a fault is
55
+ # returned.
56
+ def delete_security_group(groupName)
57
+ params = { "GroupName" => groupName }
58
+ DeleteSecurityGroupResponse.new(make_request("DeleteSecurityGroup", params))
59
+ end
60
+
61
+ # Maintain backward compatibility. Changed method name from delete_securitygroup
62
+ # to more consistent name.
63
+ alias delete_securitygroup delete_security_group
64
+
65
+ # The AuthorizeSecurityGroupIngress operation adds permissions to a security
66
+ # group.
67
+ #
68
+ # Permissions are specified in terms of the IP protocol (TCP, UDP or ICMP),
69
+ # the source of the request (by IP range or an Amazon EC2 user-group pair),
70
+ # source and destination port ranges (for TCP and UDP), and ICMP codes and
71
+ # types (for ICMP). When authorizing ICMP, -1 may be used as a wildcard in
72
+ # the type and code fields.
73
+ #
74
+ # Permission changes are propagated to instances within the security group
75
+ # being modified as quickly as possible. However, a small delay is likely,
76
+ # depending on the number of instances that are members of the indicated group.
77
+ #
78
+ # When authorizing a user/group pair permission, GroupName,
79
+ # SourceSecurityGroupName and SourceSecurityGroupOwnerId must be specified.
80
+ # When authorizing a CIDR IP permission, GroupName, IpProtocol, FromPort,
81
+ # ToPort and CidrIp must be specified. Mixing these two types of parameters
82
+ # is not allowed.
83
+ def authorize_security_group_ingress(*args)
84
+ params = auth_revoke_impl(*args)
85
+ AuthorizeSecurityGroupIngressResponse.new(make_request("AuthorizeSecurityGroupIngress", params))
86
+ end
87
+
88
+ # Maintain backward compatibility. Changed method name from authorize
89
+ # to more consistent name.
90
+ alias authorize authorize_security_group_ingress
91
+
92
+ # The RevokeSecurityGroupIngress operation revokes existing permissions
93
+ # that were previously granted to a security group. The permissions to
94
+ # revoke must be specified using the same values originally used to grant
95
+ # the permission.
96
+ #
97
+ # Permissions are specified in terms of the IP protocol (TCP, UDP or ICMP),
98
+ # the source of the request (by IP range or an Amazon EC2 user-group pair),
99
+ # source and destination port ranges (for TCP and UDP), and ICMP codes and
100
+ # types (for ICMP). When authorizing ICMP, -1 may be used as a wildcard
101
+ # in the type and code fields.
102
+ #
103
+ # Permission changes are propagated to instances within the security group
104
+ # being modified as quickly as possible. However, a small delay is likely,
105
+ # depending on the number of instances that are members of the indicated group.
106
+ #
107
+ # When revoking a user/group pair permission, GroupName, SourceSecurityGroupName
108
+ # and SourceSecurityGroupOwnerId must be specified. When authorizing a CIDR IP
109
+ # permission, GroupName, IpProtocol, FromPort, ToPort and CidrIp must be
110
+ # specified. Mixing these two types of parameters is not allowed.
111
+ def revoke_security_group_ingress(*args)
112
+ params = auth_revoke_impl(*args)
113
+ RevokeSecurityGroupIngressResponse.new(make_request("RevokeSecurityGroupIngress", params))
114
+ end
115
+
116
+ # Maintain backward compatibility. Changed method name from revoke
117
+ # to more consistent name.
118
+ alias revoke revoke_security_group_ingress
119
+
120
+ private
121
+
122
+ def auth_revoke_impl(groupName, kwargs={})
123
+ in_params = { :ipProtocol=>nil, :fromPort=>nil, :toPort=>nil, :cidrIp=>nil, :sourceSecurityGroupName=>nil,
124
+ :sourceSecurityGroupOwnerId=>nil}
125
+ in_params.merge! kwargs
126
+
127
+ { "GroupName" => in_params[:groupName] ,
128
+ "IpProtocol" => in_params[:ipProtocol],
129
+ "FromPort" => in_params[:fromPort].to_s,
130
+ "ToPort" => in_params[:toPort].to_s,
131
+ "CidrIp" => in_params[:cidrIp],
132
+ "SourceSecurityGroupName" => in_params[:sourceSecurityGroupName],
133
+ "SourceSecurityGroupOwnerId" => in_params[:sourceSecurityGroupOwnerId],
134
+ }.reject { |key, value| value.nil? or value.empty?}
135
+
136
+ end
137
+
138
+ end
139
+
140
+ end
data/lib/EC2/version.rb CHANGED
@@ -2,7 +2,7 @@ module EC2 #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: amazon-ec2
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2006-12-14 00:00:00 -08:00
6
+ version: 0.0.3
7
+ date: 2006-12-16 00:00:00 -08:00
8
8
  summary: An interface library that allows Ruby or Ruby on Rails applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate server instances.
9
9
  require_paths:
10
10
  - lib
@@ -38,6 +38,12 @@ files:
38
38
  - setup.rb
39
39
  - lib/EC2.rb
40
40
  - lib/EC2/version.rb
41
+ - lib/EC2/responses.rb
42
+ - lib/EC2/images.rb
43
+ - lib/EC2/instances.rb
44
+ - lib/EC2/keypairs.rb
45
+ - lib/EC2/image_attributes.rb
46
+ - lib/EC2/security_groups.rb
41
47
  - test/test_helper.rb
42
48
  - test/EC2_test.rb
43
49
  - examples/ec2-example.rb