fog-aws 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fog/aws.rb +205 -28
- data/lib/fog/aws/auto_scaling.rb +0 -2
- data/lib/fog/aws/beanstalk.rb +0 -2
- data/lib/fog/aws/cdn.rb +0 -2
- data/lib/fog/aws/cloud_formation.rb +0 -2
- data/lib/fog/aws/cloud_watch.rb +0 -2
- data/lib/fog/aws/compute.rb +0 -2
- data/lib/fog/aws/credential_fetcher.rb +0 -2
- data/lib/fog/aws/data_pipeline.rb +0 -2
- data/lib/fog/aws/dns.rb +0 -2
- data/lib/fog/aws/dynamodb.rb +0 -2
- data/lib/fog/aws/elasticache.rb +0 -2
- data/lib/fog/aws/elb.rb +0 -2
- data/lib/fog/aws/emr.rb +0 -2
- data/lib/fog/aws/errors.rb +14 -0
- data/lib/fog/aws/federation.rb +0 -2
- data/lib/fog/aws/glacier.rb +0 -2
- data/lib/fog/aws/iam.rb +0 -2
- data/lib/fog/aws/mock.rb +170 -0
- data/lib/fog/aws/models/auto_scaling/activity.rb +0 -2
- data/lib/fog/aws/models/auto_scaling/configuration.rb +0 -2
- data/lib/fog/aws/models/auto_scaling/group.rb +0 -2
- data/lib/fog/aws/models/auto_scaling/instance.rb +0 -2
- data/lib/fog/aws/models/auto_scaling/policy.rb +0 -2
- data/lib/fog/aws/models/beanstalk/application.rb +0 -2
- data/lib/fog/aws/models/beanstalk/applications.rb +0 -1
- data/lib/fog/aws/models/beanstalk/environment.rb +0 -2
- data/lib/fog/aws/models/beanstalk/environments.rb +0 -1
- data/lib/fog/aws/models/beanstalk/event.rb +0 -2
- data/lib/fog/aws/models/beanstalk/events.rb +0 -1
- data/lib/fog/aws/models/beanstalk/template.rb +0 -2
- data/lib/fog/aws/models/beanstalk/templates.rb +0 -1
- data/lib/fog/aws/models/beanstalk/version.rb +0 -2
- data/lib/fog/aws/models/beanstalk/versions.rb +0 -1
- data/lib/fog/aws/models/cdn/distribution.rb +0 -1
- data/lib/fog/aws/models/cdn/distribution_helper.rb +0 -2
- data/lib/fog/aws/models/cdn/distributions.rb +0 -1
- data/lib/fog/aws/models/cdn/distributions_helper.rb +0 -2
- data/lib/fog/aws/models/cdn/invalidation.rb +0 -2
- data/lib/fog/aws/models/cdn/invalidations.rb +0 -1
- data/lib/fog/aws/models/cdn/streaming_distribution.rb +0 -1
- data/lib/fog/aws/models/cdn/streaming_distributions.rb +0 -1
- data/lib/fog/aws/models/cloud_watch/alarm.rb +0 -2
- data/lib/fog/aws/models/cloud_watch/alarm_data.rb +0 -1
- data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +0 -2
- data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +0 -1
- data/lib/fog/aws/models/cloud_watch/alarm_history.rb +0 -2
- data/lib/fog/aws/models/cloud_watch/alarms.rb +0 -1
- data/lib/fog/aws/models/cloud_watch/metric.rb +0 -2
- data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +0 -2
- data/lib/fog/aws/models/cloud_watch/metric_statistics.rb +0 -1
- data/lib/fog/aws/models/cloud_watch/metrics.rb +0 -1
- data/lib/fog/aws/models/compute/address.rb +0 -2
- data/lib/fog/aws/models/compute/addresses.rb +0 -1
- data/lib/fog/aws/models/compute/dhcp_option.rb +0 -2
- data/lib/fog/aws/models/compute/dhcp_options.rb +0 -1
- data/lib/fog/aws/models/compute/flavor.rb +0 -2
- data/lib/fog/aws/models/compute/flavors.rb +0 -1
- data/lib/fog/aws/models/compute/image.rb +0 -2
- data/lib/fog/aws/models/compute/images.rb +0 -1
- data/lib/fog/aws/models/compute/internet_gateway.rb +0 -2
- data/lib/fog/aws/models/compute/internet_gateways.rb +0 -1
- data/lib/fog/aws/models/compute/key_pair.rb +0 -2
- data/lib/fog/aws/models/compute/key_pairs.rb +0 -1
- data/lib/fog/aws/models/compute/network_acl.rb +0 -2
- data/lib/fog/aws/models/compute/network_acls.rb +0 -1
- data/lib/fog/aws/models/compute/network_interface.rb +0 -2
- data/lib/fog/aws/models/compute/network_interfaces.rb +0 -1
- data/lib/fog/aws/models/compute/route_table.rb +0 -2
- data/lib/fog/aws/models/compute/route_tables.rb +0 -1
- data/lib/fog/aws/models/compute/security_group.rb +0 -2
- data/lib/fog/aws/models/compute/security_groups.rb +0 -1
- data/lib/fog/aws/models/compute/servers.rb +1 -2
- data/lib/fog/aws/models/compute/snapshot.rb +0 -2
- data/lib/fog/aws/models/compute/snapshots.rb +0 -1
- data/lib/fog/aws/models/compute/spot_requests.rb +0 -1
- data/lib/fog/aws/models/compute/subnet.rb +0 -2
- data/lib/fog/aws/models/compute/subnets.rb +0 -1
- data/lib/fog/aws/models/compute/tag.rb +0 -2
- data/lib/fog/aws/models/compute/tags.rb +0 -1
- data/lib/fog/aws/models/compute/volume.rb +0 -2
- data/lib/fog/aws/models/compute/volumes.rb +0 -1
- data/lib/fog/aws/models/compute/vpc.rb +0 -2
- data/lib/fog/aws/models/compute/vpcs.rb +0 -1
- data/lib/fog/aws/models/data_pipeline/pipeline.rb +0 -2
- data/lib/fog/aws/models/data_pipeline/pipelines.rb +0 -1
- data/lib/fog/aws/models/dns/record.rb +0 -2
- data/lib/fog/aws/models/dns/records.rb +0 -1
- data/lib/fog/aws/models/dns/zone.rb +0 -1
- data/lib/fog/aws/models/dns/zones.rb +0 -1
- data/lib/fog/aws/models/elasticache/cluster.rb +0 -2
- data/lib/fog/aws/models/elasticache/clusters.rb +0 -1
- data/lib/fog/aws/models/elasticache/parameter_group.rb +0 -2
- data/lib/fog/aws/models/elasticache/parameter_groups.rb +0 -1
- data/lib/fog/aws/models/elasticache/security_group.rb +0 -2
- data/lib/fog/aws/models/elasticache/security_groups.rb +0 -1
- data/lib/fog/aws/models/elasticache/subnet_group.rb +0 -2
- data/lib/fog/aws/models/elasticache/subnet_groups.rb +0 -1
- data/lib/fog/aws/models/elb/backend_server_description.rb +0 -1
- data/lib/fog/aws/models/elb/listener.rb +0 -1
- data/lib/fog/aws/models/elb/load_balancer.rb +0 -1
- data/lib/fog/aws/models/elb/policy.rb +0 -1
- data/lib/fog/aws/models/glacier/archive.rb +0 -2
- data/lib/fog/aws/models/glacier/archives.rb +0 -1
- data/lib/fog/aws/models/glacier/job.rb +0 -2
- data/lib/fog/aws/models/glacier/jobs.rb +0 -1
- data/lib/fog/aws/models/glacier/vault.rb +0 -1
- data/lib/fog/aws/models/glacier/vaults.rb +0 -1
- data/lib/fog/aws/models/iam/access_key.rb +0 -2
- data/lib/fog/aws/models/iam/access_keys.rb +0 -1
- data/lib/fog/aws/models/iam/policies.rb +0 -1
- data/lib/fog/aws/models/iam/policy.rb +0 -2
- data/lib/fog/aws/models/iam/role.rb +0 -2
- data/lib/fog/aws/models/iam/roles.rb +0 -1
- data/lib/fog/aws/models/iam/user.rb +0 -2
- data/lib/fog/aws/models/iam/users.rb +0 -1
- data/lib/fog/aws/models/rds/event_subscription.rb +0 -2
- data/lib/fog/aws/models/rds/event_subscriptions.rb +0 -1
- data/lib/fog/aws/models/rds/instance_option.rb +0 -2
- data/lib/fog/aws/models/rds/instance_options.rb +0 -1
- data/lib/fog/aws/models/rds/log_file.rb +0 -2
- data/lib/fog/aws/models/rds/log_files.rb +0 -1
- data/lib/fog/aws/models/rds/parameter.rb +0 -2
- data/lib/fog/aws/models/rds/parameter_group.rb +0 -2
- data/lib/fog/aws/models/rds/parameter_groups.rb +0 -1
- data/lib/fog/aws/models/rds/parameters.rb +0 -1
- data/lib/fog/aws/models/rds/security_group.rb +0 -3
- data/lib/fog/aws/models/rds/security_groups.rb +0 -1
- data/lib/fog/aws/models/rds/server.rb +0 -2
- data/lib/fog/aws/models/rds/servers.rb +0 -1
- data/lib/fog/aws/models/rds/snapshot.rb +0 -2
- data/lib/fog/aws/models/rds/snapshots.rb +0 -1
- data/lib/fog/aws/models/rds/subnet_group.rb +0 -2
- data/lib/fog/aws/models/rds/subnet_groups.rb +0 -1
- data/lib/fog/aws/models/sns/subscriptions.rb +0 -1
- data/lib/fog/aws/models/sns/topic.rb +0 -2
- data/lib/fog/aws/models/sns/topics.rb +0 -1
- data/lib/fog/aws/models/storage/directories.rb +0 -1
- data/lib/fog/aws/models/storage/directory.rb +0 -1
- data/lib/fog/aws/models/storage/file.rb +8 -5
- data/lib/fog/aws/models/storage/files.rb +0 -1
- data/lib/fog/aws/models/storage/version.rb +0 -2
- data/lib/fog/aws/models/storage/versions.rb +0 -1
- data/lib/fog/aws/parsers/compute/associate_route_table.rb +0 -0
- data/lib/fog/aws/parsers/compute/create_route_table.rb +0 -0
- data/lib/fog/aws/parsers/compute/describe_route_tables.rb +0 -0
- data/lib/fog/aws/parsers/compute/describe_spot_price_history.rb +1 -1
- data/lib/fog/aws/rds.rb +16 -2
- data/lib/fog/aws/redshift.rb +0 -2
- data/lib/fog/aws/requests/compute/associate_route_table.rb +0 -0
- data/lib/fog/aws/requests/compute/create_route.rb +0 -0
- data/lib/fog/aws/requests/compute/create_route_table.rb +0 -0
- data/lib/fog/aws/requests/compute/delete_route.rb +0 -0
- data/lib/fog/aws/requests/compute/delete_route_table.rb +0 -0
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
- data/lib/fog/aws/requests/compute/describe_route_tables.rb +0 -0
- data/lib/fog/aws/requests/compute/describe_spot_price_history.rb +27 -1
- data/lib/fog/aws/requests/compute/disassociate_route_table.rb +0 -0
- data/lib/fog/aws/requests/compute/replace_route.rb +0 -0
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +3 -2
- data/lib/fog/aws/requests/rds/create_db_snapshot.rb +1 -0
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +20 -14
- data/lib/fog/aws/requests/rds/describe_db_engine_versions.rb +8 -1
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +2 -3
- data/lib/fog/aws/requests/storage/post_object_hidden_fields.rb +9 -3
- data/lib/fog/aws/ses.rb +0 -2
- data/lib/fog/aws/signaturev4.rb +2 -3
- data/lib/fog/aws/simpledb.rb +0 -2
- data/lib/fog/aws/sns.rb +0 -2
- data/lib/fog/aws/sqs.rb +0 -2
- data/lib/fog/aws/storage.rb +27 -17
- data/lib/fog/aws/sts.rb +0 -2
- data/lib/fog/aws/version.rb +1 -1
- data/tests/models/rds/server_tests.rb +4 -3
- data/tests/requests/compute/spot_price_history_tests.rb +2 -1
- data/tests/requests/dns/change_resource_record_sets_tests.rb +10 -0
- data/tests/requests/rds/db_engine_versions.rb +7 -0
- data/tests/requests/rds/helper.rb +14 -0
- metadata +6 -5
- data/lib/fog/aws/core.rb +0 -344
- data/lib/fog/aws/parsers/.DS_Store +0 -0
- data/lib/fog/aws/requests/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73747ec0175ac8091923c4376ba41da0626c0331
|
4
|
+
data.tar.gz: c43e09c5fa96cf35808262263fa58cc8d30e59bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebb50ffdefcab540dd712073abf9be5ee889429a8b482f6c9300ad226d545d673dd7f9c228c57ba2bc444725d57078a053b053992f0b626bc9b47679820b2cf9
|
7
|
+
data.tar.gz: 4e5c905d9c783195184d9e18a135e5aafa89cef6c0bbf2ad616a1e6a039274a305dabe4d153b58fb2873f2fd831e49dfd6601b6c517432bc3010651c8b8c7d71
|
data/lib/fog/aws.rb
CHANGED
@@ -1,32 +1,209 @@
|
|
1
|
-
require 'fog/
|
1
|
+
require 'fog/core'
|
2
|
+
require 'fog/xml'
|
3
|
+
require 'fog/json'
|
4
|
+
|
5
|
+
require File.expand_path('../aws/version', __FILE__)
|
6
|
+
require File.expand_path('../aws/credential_fetcher', __FILE__)
|
7
|
+
require File.expand_path('../aws/region_methods', __FILE__)
|
8
|
+
require File.expand_path('../aws/signaturev4', __FILE__)
|
2
9
|
|
3
10
|
module Fog
|
11
|
+
module CDN
|
12
|
+
autoload :AWS, File.expand_path('../aws/cdn', __FILE__)
|
13
|
+
end
|
14
|
+
|
15
|
+
module Compute
|
16
|
+
autoload :AWS, File.expand_path('../aws/compute', __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
module DNS
|
20
|
+
autoload :AWS, File.expand_path('../aws/dns', __FILE__)
|
21
|
+
end
|
22
|
+
|
23
|
+
module Storage
|
24
|
+
autoload :AWS, File.expand_path('../aws/storage', __FILE__)
|
25
|
+
end
|
26
|
+
|
4
27
|
module AWS
|
28
|
+
extend Fog::Provider
|
29
|
+
|
30
|
+
autoload :Mock, File.expand_path('../aws/mock', __FILE__)
|
31
|
+
autoload :Errors, File.expand_path('../aws/errors', __FILE__)
|
32
|
+
|
33
|
+
# Services
|
34
|
+
autoload :AutoScaling, File.expand_path('../aws/auto_scaling', __FILE__)
|
35
|
+
autoload :ElasticBeanstalk, File.expand_path('../aws/beanstalk', __FILE__)
|
36
|
+
autoload :CloudFormation, File.expand_path('../aws/cloud_formation', __FILE__)
|
37
|
+
autoload :CloudWatch, File.expand_path('../aws/cloud_watch', __FILE__)
|
38
|
+
autoload :DataPipeline, File.expand_path('../aws/data_pipeline', __FILE__)
|
39
|
+
autoload :DynamoDB, File.expand_path('../aws/dynamodb', __FILE__)
|
40
|
+
autoload :Elasticache, File.expand_path('../aws/elasticache', __FILE__)
|
41
|
+
autoload :ELB, File.expand_path('../aws/elb', __FILE__)
|
42
|
+
autoload :EMR, File.expand_path('../aws/emr', __FILE__)
|
43
|
+
autoload :Federation, File.expand_path('../aws/federation', __FILE__)
|
44
|
+
autoload :Glacier, File.expand_path('../aws/glacier', __FILE__)
|
45
|
+
autoload :IAM, File.expand_path('../aws/iam', __FILE__)
|
46
|
+
autoload :RDS, File.expand_path('../aws/rds', __FILE__)
|
47
|
+
autoload :Redshift, File.expand_path('../aws/redshift', __FILE__)
|
48
|
+
autoload :SES, File.expand_path('../aws/ses', __FILE__)
|
49
|
+
autoload :SimpleDB, File.expand_path('../aws/simpledb', __FILE__)
|
50
|
+
autoload :SNS, File.expand_path('../aws/sns', __FILE__)
|
51
|
+
autoload :SQS, File.expand_path('../aws/sqs', __FILE__)
|
52
|
+
autoload :STS, File.expand_path('../aws/sts', __FILE__)
|
53
|
+
|
54
|
+
service(:auto_scaling, 'AutoScaling')
|
55
|
+
service(:beanstalk, 'ElasticBeanstalk')
|
56
|
+
service(:cdn, 'CDN')
|
57
|
+
service(:compute, 'Compute')
|
58
|
+
service(:cloud_formation, 'CloudFormation')
|
59
|
+
service(:cloud_watch, 'CloudWatch')
|
60
|
+
service(:data_pipeline, 'DataPipeline')
|
61
|
+
service(:dynamodb, 'DynamoDB')
|
62
|
+
service(:dns, 'DNS')
|
63
|
+
service(:elasticache, 'Elasticache')
|
64
|
+
service(:elb, 'ELB')
|
65
|
+
service(:emr, 'EMR')
|
66
|
+
service(:federation, 'Federation')
|
67
|
+
service(:glacier, 'Glacier')
|
68
|
+
service(:iam, 'IAM')
|
69
|
+
service(:rds, 'RDS')
|
70
|
+
service(:redshift, 'Redshift')
|
71
|
+
service(:ses, 'SES')
|
72
|
+
service(:simpledb, 'SimpleDB')
|
73
|
+
service(:sns, 'SNS')
|
74
|
+
service(:sqs, 'SQS')
|
75
|
+
service(:sts, 'STS')
|
76
|
+
service(:storage, 'Storage')
|
77
|
+
|
78
|
+
def self.indexed_param(key, values)
|
79
|
+
params = {}
|
80
|
+
unless key.include?('%d')
|
81
|
+
key << '.%d'
|
82
|
+
end
|
83
|
+
[*values].each_with_index do |value, index|
|
84
|
+
if value.respond_to?('keys')
|
85
|
+
k = format(key, index + 1)
|
86
|
+
value.each do | vkey, vvalue |
|
87
|
+
params["#{k}.#{vkey}"] = vvalue
|
88
|
+
end
|
89
|
+
else
|
90
|
+
params[format(key, index + 1)] = value
|
91
|
+
end
|
92
|
+
end
|
93
|
+
params
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.serialize_keys(key, value, options = {})
|
97
|
+
case value
|
98
|
+
when Hash
|
99
|
+
value.each do | k, v |
|
100
|
+
options.merge!(serialize_keys("#{key}.#{k}", v))
|
101
|
+
end
|
102
|
+
return options
|
103
|
+
when Array
|
104
|
+
value.each_with_index do | it, idx |
|
105
|
+
options.merge!(serialize_keys("#{key}.member.#{(idx + 1)}", it))
|
106
|
+
end
|
107
|
+
return options
|
108
|
+
else
|
109
|
+
return {key => value}
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.indexed_request_param(name, values)
|
114
|
+
idx = -1
|
115
|
+
Array(values).reduce({}) do |params, value|
|
116
|
+
params["#{name}.#{idx += 1}"] = value
|
117
|
+
params
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.indexed_filters(filters)
|
122
|
+
params = {}
|
123
|
+
filters.keys.each_with_index do |key, key_index|
|
124
|
+
key_index += 1
|
125
|
+
params[format('Filter.%d.Name', key_index)] = key
|
126
|
+
[*filters[key]].each_with_index do |value, value_index|
|
127
|
+
value_index += 1
|
128
|
+
params[format('Filter.%d.Value.%d', key_index, value_index)] = value
|
129
|
+
end
|
130
|
+
end
|
131
|
+
params
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.escape(string)
|
135
|
+
string.gsub(/([^a-zA-Z0-9_.\-~]+)/) {
|
136
|
+
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.signed_params_v4(params, headers, options={})
|
141
|
+
date = Fog::Time.now
|
142
|
+
|
143
|
+
params = params.merge('Version' => options[:version])
|
144
|
+
|
145
|
+
headers = headers.merge('Host' => options[:host], 'x-amz-date' => date.to_iso8601_basic)
|
146
|
+
headers['x-amz-security-token'] = options[:aws_session_token] if options[:aws_session_token]
|
147
|
+
|
148
|
+
body = ''
|
149
|
+
for key in params.keys.sort
|
150
|
+
unless (value = params[key]).nil?
|
151
|
+
body << "#{key}=#{escape(value.to_s)}&"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
body.chop!
|
155
|
+
|
156
|
+
headers['Authorization'] = options[:signer].sign({:method => options[:method], :headers => headers, :body => body, :query => {}, :path => options[:path]}, date)
|
157
|
+
|
158
|
+
return body, headers
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.signed_params(params, options = {})
|
162
|
+
params.merge!({
|
163
|
+
'AWSAccessKeyId' => options[:aws_access_key_id],
|
164
|
+
'SignatureMethod' => 'HmacSHA256',
|
165
|
+
'SignatureVersion' => '2',
|
166
|
+
'Timestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
|
167
|
+
'Version' => options[:version]
|
168
|
+
})
|
169
|
+
|
170
|
+
params.merge!({
|
171
|
+
'SecurityToken' => options[:aws_session_token]
|
172
|
+
}) if options[:aws_session_token]
|
173
|
+
|
174
|
+
body = ''
|
175
|
+
for key in params.keys.sort
|
176
|
+
unless (value = params[key]).nil?
|
177
|
+
body << "#{key}=#{escape(value.to_s)}&"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
string_to_sign = "POST\n#{options[:host]}:#{options[:port]}\n#{options[:path]}\n" << body.chop
|
181
|
+
signed_string = options[:hmac].sign(string_to_sign)
|
182
|
+
body << "Signature=#{escape(Base64.encode64(signed_string).chomp!)}"
|
183
|
+
|
184
|
+
body
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.parse_security_group_options(group_name, options)
|
188
|
+
options ||= Hash.new
|
189
|
+
if group_name.is_a?(Hash)
|
190
|
+
options = group_name
|
191
|
+
elsif group_name
|
192
|
+
if options.key?('GroupName')
|
193
|
+
raise Fog::Compute::AWS::Error, 'Arguments specified both group_name and GroupName in options'
|
194
|
+
end
|
195
|
+
options = options.clone
|
196
|
+
options['GroupName'] = group_name
|
197
|
+
end
|
198
|
+
name_specified = options.key?('GroupName') && !options['GroupName'].nil?
|
199
|
+
group_id_specified = options.key?('GroupId') && !options['GroupId'].nil?
|
200
|
+
unless name_specified || group_id_specified
|
201
|
+
raise Fog::Compute::AWS::Error, 'Neither GroupName nor GroupId specified'
|
202
|
+
end
|
203
|
+
if name_specified && group_id_specified
|
204
|
+
options.delete('GroupName')
|
205
|
+
end
|
206
|
+
options
|
207
|
+
end
|
5
208
|
end
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'fog/aws/core'
|
9
|
-
|
10
|
-
require 'fog/aws/auto_scaling'
|
11
|
-
require 'fog/aws/beanstalk'
|
12
|
-
require 'fog/aws/cdn'
|
13
|
-
require 'fog/aws/cloud_formation'
|
14
|
-
require 'fog/aws/cloud_watch'
|
15
|
-
require 'fog/aws/compute'
|
16
|
-
require 'fog/aws/data_pipeline'
|
17
|
-
require 'fog/aws/dns'
|
18
|
-
require 'fog/aws/dynamodb'
|
19
|
-
require 'fog/aws/elasticache'
|
20
|
-
require 'fog/aws/elb'
|
21
|
-
require 'fog/aws/emr'
|
22
|
-
require 'fog/aws/federation'
|
23
|
-
require 'fog/aws/glacier'
|
24
|
-
require 'fog/aws/iam'
|
25
|
-
require 'fog/aws/rds'
|
26
|
-
require 'fog/aws/redshift'
|
27
|
-
require 'fog/aws/ses'
|
28
|
-
require 'fog/aws/simpledb'
|
29
|
-
require 'fog/aws/sns'
|
30
|
-
require 'fog/aws/sqs'
|
31
|
-
require 'fog/aws/storage'
|
32
|
-
require 'fog/aws/sts'
|
209
|
+
end
|
data/lib/fog/aws/auto_scaling.rb
CHANGED
data/lib/fog/aws/beanstalk.rb
CHANGED
data/lib/fog/aws/cdn.rb
CHANGED
data/lib/fog/aws/cloud_watch.rb
CHANGED
data/lib/fog/aws/compute.rb
CHANGED
data/lib/fog/aws/dns.rb
CHANGED
data/lib/fog/aws/dynamodb.rb
CHANGED
data/lib/fog/aws/elasticache.rb
CHANGED
data/lib/fog/aws/elb.rb
CHANGED
data/lib/fog/aws/emr.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module Errors
|
4
|
+
def self.match_error(error)
|
5
|
+
matcher = lambda {|s| s.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)}
|
6
|
+
[error.message, error.response.body].each(&Proc.new {|s|
|
7
|
+
match = matcher.call(s)
|
8
|
+
return {:code => match[1].split('.').last, :message => match[2]} if match
|
9
|
+
})
|
10
|
+
{} # we did not match the message or response body
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/fog/aws/federation.rb
CHANGED
data/lib/fog/aws/glacier.rb
CHANGED
data/lib/fog/aws/iam.rb
CHANGED
data/lib/fog/aws/mock.rb
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class Mock
|
4
|
+
def self.arn(vendor, account_id, path, region = nil)
|
5
|
+
"arn:aws:#{vendor}:#{region}:#{account_id}:#{path}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.availability_zone(region)
|
9
|
+
"#{region}#{Fog::Mock.random_selection('abcd', 1)}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.box_usage
|
13
|
+
sprintf("%0.10f", rand / 100).to_f
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.console_output
|
17
|
+
# "[ 0.000000] Linux version 2.6.18-xenU-ec2-v1.2 (root@domU-12-31-39-07-51-82) (gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)) #2 SMP Wed Aug 19 09:04:38 EDT 2009"
|
18
|
+
Base64.decode64("WyAwLjAwMDAwMF0gTGludXggdmVyc2lvbiAyLjYuMTgteGVuVS1lYzItdjEu\nMiAocm9vdEBkb21VLTEyLTMxLTM5LTA3LTUxLTgyKSAoZ2NjIHZlcnNpb24g\nNC4xLjIgMjAwNzA2MjYgKFJlZCBIYXQgNC4xLjItMTMpKSAjMiBTTVAgV2Vk\nIEF1ZyAxOSAwOTowNDozOCBFRFQgMjAwOQ==\n")
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.dns_name_for(ip_address)
|
22
|
+
"ec2-#{ip_address.gsub('.','-')}.compute-1.amazonaws.com"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.private_dns_name_for(ip_address)
|
26
|
+
"ip-#{ip_address.gsub('.','-')}.ec2.internal"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.image
|
30
|
+
path = []
|
31
|
+
(rand(3) + 2).times do
|
32
|
+
path << Fog::Mock.random_letters(rand(9) + 8)
|
33
|
+
end
|
34
|
+
{
|
35
|
+
"imageOwnerId" => Fog::Mock.random_letters(rand(5) + 4),
|
36
|
+
"blockDeviceMapping" => [],
|
37
|
+
"productCodes" => [],
|
38
|
+
"kernelId" => kernel_id,
|
39
|
+
"ramdiskId" => ramdisk_id,
|
40
|
+
"imageState" => "available",
|
41
|
+
"imageId" => image_id,
|
42
|
+
"architecture" => "i386",
|
43
|
+
"isPublic" => true,
|
44
|
+
"imageLocation" => path.join('/'),
|
45
|
+
"imageType" => "machine",
|
46
|
+
"rootDeviceType" => ["ebs","instance-store"][rand(2)],
|
47
|
+
"rootDeviceName" => "/dev/sda1"
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.image_id
|
52
|
+
"ami-#{Fog::Mock.random_hex(8)}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.key_fingerprint
|
56
|
+
fingerprint = []
|
57
|
+
20.times do
|
58
|
+
fingerprint << Fog::Mock.random_hex(2)
|
59
|
+
end
|
60
|
+
fingerprint.join(':')
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.instance_id
|
64
|
+
"i-#{Fog::Mock.random_hex(8)}"
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.ip_address
|
68
|
+
Fog::Mock.random_ip
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.private_ip_address
|
72
|
+
ip_address.gsub(/^\d{1,3}\./,"10.")
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.kernel_id
|
76
|
+
"aki-#{Fog::Mock.random_hex(8)}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.key_material
|
80
|
+
OpenSSL::PKey::RSA.generate(1024).to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.owner_id
|
84
|
+
Fog::Mock.random_numbers(12)
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.ramdisk_id
|
88
|
+
"ari-#{Fog::Mock.random_hex(8)}"
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.request_id
|
92
|
+
request_id = []
|
93
|
+
request_id << Fog::Mock.random_hex(8)
|
94
|
+
3.times do
|
95
|
+
request_id << Fog::Mock.random_hex(4)
|
96
|
+
end
|
97
|
+
request_id << Fog::Mock.random_hex(12)
|
98
|
+
request_id.join('-')
|
99
|
+
end
|
100
|
+
|
101
|
+
class << self
|
102
|
+
alias_method :reserved_instances_id, :request_id
|
103
|
+
alias_method :reserved_instances_offering_id, :request_id
|
104
|
+
alias_method :sqs_message_id, :request_id
|
105
|
+
alias_method :sqs_sender_id, :request_id
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.reservation_id
|
109
|
+
"r-#{Fog::Mock.random_hex(8)}"
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.snapshot_id
|
113
|
+
"snap-#{Fog::Mock.random_hex(8)}"
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.volume_id
|
117
|
+
"vol-#{Fog::Mock.random_hex(8)}"
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.security_group_id
|
121
|
+
"sg-#{Fog::Mock.random_hex(8)}"
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.network_acl_id
|
125
|
+
"acl-#{Fog::Mock.random_hex(8)}"
|
126
|
+
end
|
127
|
+
def self.network_acl_association_id
|
128
|
+
"aclassoc-#{Fog::Mock.random_hex(8)}"
|
129
|
+
end
|
130
|
+
def self.network_interface_id
|
131
|
+
"eni-#{Fog::Mock.random_hex(8)}"
|
132
|
+
end
|
133
|
+
def self.internet_gateway_id
|
134
|
+
"igw-#{Fog::Mock.random_hex(8)}"
|
135
|
+
end
|
136
|
+
def self.dhcp_options_id
|
137
|
+
"dopt-#{Fog::Mock.random_hex(8)}"
|
138
|
+
end
|
139
|
+
def self.vpc_id
|
140
|
+
"vpc-#{Fog::Mock.random_hex(8)}"
|
141
|
+
end
|
142
|
+
def self.subnet_id
|
143
|
+
"subnet-#{Fog::Mock.random_hex(8)}"
|
144
|
+
end
|
145
|
+
def self.zone_id
|
146
|
+
"zone-#{Fog::Mock.random_hex(8)}"
|
147
|
+
end
|
148
|
+
def self.change_id
|
149
|
+
Fog::Mock.random_letters_and_numbers(14)
|
150
|
+
end
|
151
|
+
def self.nameservers
|
152
|
+
[
|
153
|
+
'ns-2048.awsdns-64.com',
|
154
|
+
'ns-2049.awsdns-65.net',
|
155
|
+
'ns-2050.awsdns-66.org',
|
156
|
+
'ns-2051.awsdns-67.co.uk'
|
157
|
+
]
|
158
|
+
end
|
159
|
+
|
160
|
+
def self.key_id(length=21)
|
161
|
+
#Probably close enough
|
162
|
+
Fog::Mock.random_selection('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',length)
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.rds_address(db_name,region)
|
166
|
+
"#{db_name}.#{Fog::Mock.random_letters(rand(12) + 4)}.#{region}.rds.amazonaws.com"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|