fog 0.3.13 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/fog.gemspec +26 -20
- data/lib/fog.rb +1 -11
- data/lib/fog/aws.rb +5 -0
- data/lib/fog/aws/bin.rb +5 -1
- data/lib/fog/aws/cdn.rb +98 -0
- data/lib/fog/aws/iam.rb +86 -0
- data/lib/fog/aws/models/compute/volume.rb +10 -0
- data/lib/fog/aws/models/storage/directory.rb +11 -0
- data/lib/fog/aws/models/storage/file.rb +9 -11
- data/lib/fog/aws/parsers/cdn/distribution.rb +44 -0
- data/lib/fog/aws/parsers/cdn/get_distribution_list.rb +48 -0
- data/lib/fog/aws/parsers/cdn/post_invalidation.rb +28 -0
- data/lib/fog/aws/parsers/iam/basic.rb +19 -0
- data/lib/fog/aws/parsers/iam/create_group.rb +26 -0
- data/lib/fog/aws/parsers/iam/list_groups.rb +32 -0
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +36 -0
- data/lib/fog/aws/requests/cdn/get_distribution.rb +55 -0
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +59 -0
- data/lib/fog/aws/requests/cdn/post_distribution.rb +88 -0
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +59 -0
- data/lib/fog/aws/requests/compute/create_volume.rb +1 -0
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +3 -0
- data/lib/fog/aws/requests/iam/create_group.rb +43 -0
- data/lib/fog/aws/requests/iam/delete_group.rb +36 -0
- data/lib/fog/aws/requests/iam/list_groups.rb +45 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +4 -1
- data/lib/fog/aws/requests/storage/delete_bucket.rb +5 -1
- data/lib/fog/aws/requests/storage/delete_object.rb +5 -1
- data/lib/fog/aws/requests/storage/get_bucket.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_location.rb +5 -1
- data/lib/fog/aws/requests/storage/get_bucket_logging.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_versioning.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object_acl.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object_torrent.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +4 -1
- data/lib/fog/aws/requests/storage/get_request_payment.rb +5 -1
- data/lib/fog/aws/requests/storage/get_service.rb +5 -1
- data/lib/fog/aws/requests/storage/head_object.rb +5 -1
- data/lib/fog/aws/requests/storage/post_object_hidden_fields.rb +4 -3
- data/lib/fog/aws/requests/storage/put_bucket.rb +11 -6
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +5 -1
- data/lib/fog/aws/requests/storage/put_bucket_logging.rb +5 -1
- data/lib/fog/aws/requests/storage/put_bucket_versioning.rb +5 -1
- data/lib/fog/aws/requests/storage/put_object.rb +5 -1
- data/lib/fog/aws/requests/storage/put_object_url.rb +4 -1
- data/lib/fog/aws/requests/storage/put_request_payment.rb +5 -1
- data/lib/fog/aws/storage.rb +2 -0
- data/lib/fog/bluebox/compute.rb +1 -0
- data/lib/fog/core.rb +4 -2
- data/lib/fog/core/attributes.rb +9 -5
- data/lib/fog/core/compute.rb +33 -0
- data/lib/fog/core/credentials.rb +0 -1
- data/lib/fog/core/model.rb +2 -11
- data/lib/fog/core/ssh.rb +1 -0
- data/lib/fog/core/storage.rb +24 -0
- data/lib/fog/go_grid/compute.rb +2 -0
- data/lib/fog/google.rb +3 -0
- data/lib/fog/google/models/storage/directory.rb +11 -0
- data/lib/fog/google/models/storage/file.rb +19 -10
- data/lib/fog/google/requests/storage/put_bucket.rb +5 -4
- data/lib/fog/google/storage.rb +2 -0
- data/lib/fog/linode/compute.rb +1 -0
- data/lib/fog/new_servers.rb +3 -0
- data/lib/fog/rackspace.rb +1 -0
- data/lib/fog/rackspace/bin.rb +3 -1
- data/lib/fog/rackspace/cdn.rb +81 -0
- data/lib/fog/rackspace/compute.rb +1 -0
- data/lib/fog/rackspace/models/storage/file.rb +2 -2
- data/lib/fog/rackspace/requests/{storage → cdn}/get_cdn_containers.rb +1 -1
- data/lib/fog/rackspace/requests/{storage → cdn}/head_cdn_container.rb +1 -1
- data/lib/fog/rackspace/requests/{storage → cdn}/put_cdn_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/delete_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/delete_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_containers.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/head_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/head_containers.rb +1 -1
- data/lib/fog/rackspace/requests/storage/head_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/put_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/put_object.rb +1 -1
- data/lib/fog/rackspace/storage.rb +13 -47
- data/lib/fog/slicehost.rb +4 -1
- data/lib/fog/terremark.rb +3 -0
- data/lib/fog/vcloud.rb +3 -0
- data/spec/aws/models/storage/directory_spec.rb +1 -0
- data/spec/bluebox/models/compute/flavors_spec.rb +5 -2
- data/spec/bluebox/models/compute/server_spec.rb +5 -1
- data/spec/bluebox/models/compute/servers_spec.rb +5 -1
- data/spec/google/models/storage/files_spec.rb +1 -2
- data/spec/rackspace/models/compute/flavors_spec.rb +5 -1
- data/spec/rackspace/models/compute/server_spec.rb +5 -1
- data/spec/slicehost/models/compute/flavors_spec.rb +5 -1
- data/spec/slicehost/models/compute/server_spec.rb +5 -1
- data/spec/slicehost/models/compute/servers_spec.rb +5 -1
- data/tests/aws/requests/compute/volume_tests.rb +8 -7
- data/tests/aws/requests/storage/bucket_tests.rb +55 -0
- data/tests/aws/requests/storage/object_tests.rb +18 -0
- data/tests/rackspace/requests/storage/container_tests.rb +64 -0
- data/tests/rackspace/requests/storage/object_tests.rb +69 -0
- metadata +27 -21
- data/spec/aws/requests/storage/copy_object_spec.rb +0 -61
- data/spec/aws/requests/storage/get_bucket_location_spec.rb +0 -30
- data/spec/aws/requests/storage/get_bucket_spec.rb +0 -114
- data/spec/aws/requests/storage/get_request_payment_spec.rb +0 -30
- data/spec/aws/requests/storage/put_request_payment_spec.rb +0 -29
- data/spec/rackspace/requests/storage/delete_container_spec.rb +0 -24
- data/spec/rackspace/requests/storage/delete_object_spec.rb +0 -37
- data/spec/rackspace/requests/storage/get_container_spec.rb +0 -35
- data/spec/rackspace/requests/storage/get_containers_spec.rb +0 -22
- data/spec/rackspace/requests/storage/get_object_spec.rb +0 -21
- data/spec/rackspace/requests/storage/head_container_spec.rb +0 -30
- data/spec/rackspace/requests/storage/head_containers_spec.rb +0 -19
- data/spec/rackspace/requests/storage/head_object_spec.rb +0 -21
- data/spec/rackspace/requests/storage/put_container_spec.rb +0 -15
- data/spec/rackspace/requests/storage/put_object_spec.rb +0 -20
data/Gemfile.lock
CHANGED
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'fog'
|
10
|
-
s.version = '0.3.
|
11
|
-
s.date = '2010-
|
10
|
+
s.version = '0.3.14'
|
11
|
+
s.date = '2010-11-02'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
@@ -75,9 +75,11 @@ Gem::Specification.new do |s|
|
|
75
75
|
lib/fog.rb
|
76
76
|
lib/fog/aws.rb
|
77
77
|
lib/fog/aws/bin.rb
|
78
|
+
lib/fog/aws/cdn.rb
|
78
79
|
lib/fog/aws/compute.rb
|
79
80
|
lib/fog/aws/ec2.rb
|
80
81
|
lib/fog/aws/elb.rb
|
82
|
+
lib/fog/aws/iam.rb
|
81
83
|
lib/fog/aws/models/compute/address.rb
|
82
84
|
lib/fog/aws/models/compute/addresses.rb
|
83
85
|
lib/fog/aws/models/compute/flavor.rb
|
@@ -100,6 +102,9 @@ Gem::Specification.new do |s|
|
|
100
102
|
lib/fog/aws/models/storage/directory.rb
|
101
103
|
lib/fog/aws/models/storage/file.rb
|
102
104
|
lib/fog/aws/models/storage/files.rb
|
105
|
+
lib/fog/aws/parsers/cdn/distribution.rb
|
106
|
+
lib/fog/aws/parsers/cdn/get_distribution_list.rb
|
107
|
+
lib/fog/aws/parsers/cdn/post_invalidation.rb
|
103
108
|
lib/fog/aws/parsers/compute/allocate_address.rb
|
104
109
|
lib/fog/aws/parsers/compute/attach_volume.rb
|
105
110
|
lib/fog/aws/parsers/compute/basic.rb
|
@@ -134,6 +139,9 @@ Gem::Specification.new do |s|
|
|
134
139
|
lib/fog/aws/parsers/elb/disable_availability_zones_for_load_balancer.rb
|
135
140
|
lib/fog/aws/parsers/elb/enable_availability_zones_for_load_balancer.rb
|
136
141
|
lib/fog/aws/parsers/elb/register_instances_with_load_balancer.rb
|
142
|
+
lib/fog/aws/parsers/iam/basic.rb
|
143
|
+
lib/fog/aws/parsers/iam/create_group.rb
|
144
|
+
lib/fog/aws/parsers/iam/list_groups.rb
|
137
145
|
lib/fog/aws/parsers/simpledb/basic.rb
|
138
146
|
lib/fog/aws/parsers/simpledb/domain_metadata.rb
|
139
147
|
lib/fog/aws/parsers/simpledb/get_attributes.rb
|
@@ -148,6 +156,11 @@ Gem::Specification.new do |s|
|
|
148
156
|
lib/fog/aws/parsers/storage/get_bucket_versioning.rb
|
149
157
|
lib/fog/aws/parsers/storage/get_request_payment.rb
|
150
158
|
lib/fog/aws/parsers/storage/get_service.rb
|
159
|
+
lib/fog/aws/requests/cdn/delete_distribution.rb
|
160
|
+
lib/fog/aws/requests/cdn/get_distribution.rb
|
161
|
+
lib/fog/aws/requests/cdn/get_distribution_list.rb
|
162
|
+
lib/fog/aws/requests/cdn/post_distribution.rb
|
163
|
+
lib/fog/aws/requests/cdn/post_invalidation.rb
|
151
164
|
lib/fog/aws/requests/compute/allocate_address.rb
|
152
165
|
lib/fog/aws/requests/compute/associate_address.rb
|
153
166
|
lib/fog/aws/requests/compute/attach_volume.rb
|
@@ -197,6 +210,9 @@ Gem::Specification.new do |s|
|
|
197
210
|
lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb
|
198
211
|
lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb
|
199
212
|
lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb
|
213
|
+
lib/fog/aws/requests/iam/create_group.rb
|
214
|
+
lib/fog/aws/requests/iam/delete_group.rb
|
215
|
+
lib/fog/aws/requests/iam/list_groups.rb
|
200
216
|
lib/fog/aws/requests/simpledb/batch_put_attributes.rb
|
201
217
|
lib/fog/aws/requests/simpledb/create_domain.rb
|
202
218
|
lib/fog/aws/requests/simpledb/delete_attributes.rb
|
@@ -255,6 +271,7 @@ Gem::Specification.new do |s|
|
|
255
271
|
lib/fog/core/attributes.rb
|
256
272
|
lib/fog/core/bin.rb
|
257
273
|
lib/fog/core/collection.rb
|
274
|
+
lib/fog/core/compute.rb
|
258
275
|
lib/fog/core/connection.rb
|
259
276
|
lib/fog/core/credentials.rb
|
260
277
|
lib/fog/core/deprecation.rb
|
@@ -265,6 +282,7 @@ Gem::Specification.new do |s|
|
|
265
282
|
lib/fog/core/provider.rb
|
266
283
|
lib/fog/core/service.rb
|
267
284
|
lib/fog/core/ssh.rb
|
285
|
+
lib/fog/core/storage.rb
|
268
286
|
lib/fog/go_grid.rb
|
269
287
|
lib/fog/go_grid/bin.rb
|
270
288
|
lib/fog/go_grid/compute.rb
|
@@ -343,6 +361,7 @@ Gem::Specification.new do |s|
|
|
343
361
|
lib/fog/new_servers/requests/compute/reboot_server.rb
|
344
362
|
lib/fog/rackspace.rb
|
345
363
|
lib/fog/rackspace/bin.rb
|
364
|
+
lib/fog/rackspace/cdn.rb
|
346
365
|
lib/fog/rackspace/compute.rb
|
347
366
|
lib/fog/rackspace/files.rb
|
348
367
|
lib/fog/rackspace/models/compute/flavor.rb
|
@@ -355,6 +374,9 @@ Gem::Specification.new do |s|
|
|
355
374
|
lib/fog/rackspace/models/storage/directory.rb
|
356
375
|
lib/fog/rackspace/models/storage/file.rb
|
357
376
|
lib/fog/rackspace/models/storage/files.rb
|
377
|
+
lib/fog/rackspace/requests/cdn/get_cdn_containers.rb
|
378
|
+
lib/fog/rackspace/requests/cdn/head_cdn_container.rb
|
379
|
+
lib/fog/rackspace/requests/cdn/put_cdn_container.rb
|
358
380
|
lib/fog/rackspace/requests/compute/create_image.rb
|
359
381
|
lib/fog/rackspace/requests/compute/create_server.rb
|
360
382
|
lib/fog/rackspace/requests/compute/delete_image.rb
|
@@ -375,15 +397,12 @@ Gem::Specification.new do |s|
|
|
375
397
|
lib/fog/rackspace/requests/compute/update_server.rb
|
376
398
|
lib/fog/rackspace/requests/storage/delete_container.rb
|
377
399
|
lib/fog/rackspace/requests/storage/delete_object.rb
|
378
|
-
lib/fog/rackspace/requests/storage/get_cdn_containers.rb
|
379
400
|
lib/fog/rackspace/requests/storage/get_container.rb
|
380
401
|
lib/fog/rackspace/requests/storage/get_containers.rb
|
381
402
|
lib/fog/rackspace/requests/storage/get_object.rb
|
382
|
-
lib/fog/rackspace/requests/storage/head_cdn_container.rb
|
383
403
|
lib/fog/rackspace/requests/storage/head_container.rb
|
384
404
|
lib/fog/rackspace/requests/storage/head_containers.rb
|
385
405
|
lib/fog/rackspace/requests/storage/head_object.rb
|
386
|
-
lib/fog/rackspace/requests/storage/put_cdn_container.rb
|
387
406
|
lib/fog/rackspace/requests/storage/put_container.rb
|
388
407
|
lib/fog/rackspace/requests/storage/put_object.rb
|
389
408
|
lib/fog/rackspace/servers.rb
|
@@ -573,11 +592,6 @@ Gem::Specification.new do |s|
|
|
573
592
|
spec/aws/requests/simpledb/list_domains_spec.rb
|
574
593
|
spec/aws/requests/simpledb/put_attributes_spec.rb
|
575
594
|
spec/aws/requests/simpledb/select_spec.rb
|
576
|
-
spec/aws/requests/storage/copy_object_spec.rb
|
577
|
-
spec/aws/requests/storage/get_bucket_location_spec.rb
|
578
|
-
spec/aws/requests/storage/get_bucket_spec.rb
|
579
|
-
spec/aws/requests/storage/get_request_payment_spec.rb
|
580
|
-
spec/aws/requests/storage/put_request_payment_spec.rb
|
581
595
|
spec/bluebox/models/compute/flavors_spec.rb
|
582
596
|
spec/bluebox/models/compute/server_spec.rb
|
583
597
|
spec/bluebox/models/compute/servers_spec.rb
|
@@ -599,16 +613,6 @@ Gem::Specification.new do |s|
|
|
599
613
|
spec/rackspace/models/compute/flavors_spec.rb
|
600
614
|
spec/rackspace/models/compute/server_spec.rb
|
601
615
|
spec/rackspace/models/compute/servers_spec.rb
|
602
|
-
spec/rackspace/requests/storage/delete_container_spec.rb
|
603
|
-
spec/rackspace/requests/storage/delete_object_spec.rb
|
604
|
-
spec/rackspace/requests/storage/get_container_spec.rb
|
605
|
-
spec/rackspace/requests/storage/get_containers_spec.rb
|
606
|
-
spec/rackspace/requests/storage/get_object_spec.rb
|
607
|
-
spec/rackspace/requests/storage/head_container_spec.rb
|
608
|
-
spec/rackspace/requests/storage/head_containers_spec.rb
|
609
|
-
spec/rackspace/requests/storage/head_object_spec.rb
|
610
|
-
spec/rackspace/requests/storage/put_container_spec.rb
|
611
|
-
spec/rackspace/requests/storage/put_object_spec.rb
|
612
616
|
spec/shared_examples/flavors_examples.rb
|
613
617
|
spec/shared_examples/server_examples.rb
|
614
618
|
spec/shared_examples/servers_examples.rb
|
@@ -694,6 +698,8 @@ Gem::Specification.new do |s|
|
|
694
698
|
tests/rackspace/requests/compute/flavor_tests.rb
|
695
699
|
tests/rackspace/requests/compute/image_tests.rb
|
696
700
|
tests/rackspace/requests/compute/server_tests.rb
|
701
|
+
tests/rackspace/requests/storage/container_tests.rb
|
702
|
+
tests/rackspace/requests/storage/object_tests.rb
|
697
703
|
tests/slicehost/helper.rb
|
698
704
|
tests/slicehost/requests/compute/backup_tests.rb
|
699
705
|
tests/slicehost/requests/compute/flavor_tests.rb
|
data/lib/fog.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'base64'
|
3
3
|
require 'cgi'
|
4
|
-
require 'digest/md5'
|
5
4
|
require 'excon'
|
6
5
|
require 'formatador'
|
7
|
-
require 'json'
|
8
|
-
require 'mime/types'
|
9
|
-
require 'net/ssh'
|
10
|
-
require 'nokogiri'
|
11
|
-
require 'tempfile'
|
12
6
|
require 'time'
|
13
7
|
|
14
8
|
__DIR__ = File.dirname(__FILE__)
|
@@ -24,7 +18,7 @@ module Fog
|
|
24
18
|
@mocking = false
|
25
19
|
|
26
20
|
unless const_defined?(:VERSION)
|
27
|
-
VERSION = '0.3.
|
21
|
+
VERSION = '0.3.14'
|
28
22
|
end
|
29
23
|
|
30
24
|
module Mock
|
@@ -52,10 +46,6 @@ module Fog
|
|
52
46
|
@bin = new_bin
|
53
47
|
end
|
54
48
|
|
55
|
-
def self.credentials
|
56
|
-
{}
|
57
|
-
end
|
58
|
-
|
59
49
|
def self.mock!
|
60
50
|
@mocking = true
|
61
51
|
end
|
data/lib/fog/aws.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'fog/core/parser'
|
3
|
+
|
1
4
|
module Fog
|
2
5
|
module AWS
|
3
6
|
|
4
7
|
extend Fog::Provider
|
5
8
|
|
6
9
|
service_path 'fog/aws'
|
10
|
+
service 'cdn'
|
7
11
|
service 'compute'
|
8
12
|
service 'ec2'
|
9
13
|
service 'elb'
|
14
|
+
service 'iam'
|
10
15
|
service 's3'
|
11
16
|
service 'simpledb'
|
12
17
|
service 'storage'
|
data/lib/fog/aws/bin.rb
CHANGED
@@ -4,6 +4,8 @@ class AWS < Fog::Bin
|
|
4
4
|
def [](service)
|
5
5
|
@@connections ||= Hash.new do |hash, key|
|
6
6
|
hash[key] = case key
|
7
|
+
when :cdn
|
8
|
+
Fog::AWS::CDN.new
|
7
9
|
when :compute
|
8
10
|
Fog::AWS::Compute.new
|
9
11
|
when :ec2
|
@@ -16,6 +18,8 @@ class AWS < Fog::Bin
|
|
16
18
|
Fog::AWS::ELB.new
|
17
19
|
when :eu_storage
|
18
20
|
Fog::AWS::Storage.new(:region => 'eu-west-1')
|
21
|
+
when :iam
|
22
|
+
Fog::AWS::IAM.new
|
19
23
|
when :sdb
|
20
24
|
Fog::AWS::SimpleDB.new
|
21
25
|
when :s3
|
@@ -32,7 +36,7 @@ class AWS < Fog::Bin
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def services
|
35
|
-
[:compute, :elb, :sdb, :storage]
|
39
|
+
[:cdn, :compute, :elb, :iam, :sdb, :storage]
|
36
40
|
end
|
37
41
|
|
38
42
|
end
|
data/lib/fog/aws/cdn.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class CDN < Fog::Service
|
4
|
+
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
+
|
7
|
+
model_path 'fog/aws/models/cdn'
|
8
|
+
|
9
|
+
request_path 'fog/aws/requests/cdn'
|
10
|
+
request 'delete_distribution'
|
11
|
+
request 'get_distribution'
|
12
|
+
request 'get_distribution_list'
|
13
|
+
request 'post_distribution'
|
14
|
+
request 'post_invalidation'
|
15
|
+
|
16
|
+
class Mock
|
17
|
+
|
18
|
+
def self.data
|
19
|
+
@data ||= Hash.new do |hash, region|
|
20
|
+
hash[region] = Hash.new do |region_hash, key|
|
21
|
+
region_hash[key] = {
|
22
|
+
:buckets => {}
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.reset_data(keys=data.keys)
|
29
|
+
for key in [*keys]
|
30
|
+
data.delete(key)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(options={})
|
35
|
+
require 'mime/types'
|
36
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
37
|
+
@data = self.class.data[options[:region]][@aws_access_key_id]
|
38
|
+
end
|
39
|
+
|
40
|
+
def signature(params)
|
41
|
+
"foo"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Real
|
46
|
+
|
47
|
+
# Initialize connection to Cloudfront
|
48
|
+
#
|
49
|
+
# ==== Notes
|
50
|
+
# options parameter must include values for :aws_access_key_id and
|
51
|
+
# :aws_secret_access_key in order to create a connection
|
52
|
+
#
|
53
|
+
# ==== Examples
|
54
|
+
# cdn = Fog::AWS::CDN.new(
|
55
|
+
# :aws_access_key_id => your_aws_access_key_id,
|
56
|
+
# :aws_secret_access_key => your_aws_secret_access_key
|
57
|
+
# )
|
58
|
+
#
|
59
|
+
# ==== Parameters
|
60
|
+
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
61
|
+
#
|
62
|
+
# ==== Returns
|
63
|
+
# * cdn object with connection to aws.
|
64
|
+
def initialize(options={})
|
65
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
66
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
67
|
+
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
|
68
|
+
@host = options[:host] || 'cloudfront.amazonaws.com'
|
69
|
+
@path = options[:path] || '/'
|
70
|
+
@port = options[:port] || 443
|
71
|
+
@scheme = options[:scheme] || 'https'
|
72
|
+
@version = options[:version] || '2010-08-01'
|
73
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent] || true)
|
74
|
+
end
|
75
|
+
|
76
|
+
def reload
|
77
|
+
@connection.reset
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def request(params, &block)
|
83
|
+
params[:headers] ||= {}
|
84
|
+
params[:headers]['Date'] = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S +0000")
|
85
|
+
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
86
|
+
params[:path] = "/#{@version}/#{params[:path]}"
|
87
|
+
@connection.request(params, &block)
|
88
|
+
end
|
89
|
+
|
90
|
+
def signature(params)
|
91
|
+
string_to_sign = params[:headers]['Date']
|
92
|
+
signed_string = @hmac.sign(string_to_sign)
|
93
|
+
signature = Base64.encode64(signed_string).chomp!
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/lib/fog/aws/iam.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM < Fog::Service
|
4
|
+
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
+
|
7
|
+
request_path 'fog/aws/requests/iam'
|
8
|
+
request :create_group
|
9
|
+
request :delete_group
|
10
|
+
request :list_groups
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def initialize(options={})
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class Real
|
20
|
+
|
21
|
+
# Initialize connection to IAM
|
22
|
+
#
|
23
|
+
# ==== Notes
|
24
|
+
# options parameter must include values for :aws_access_key_id and
|
25
|
+
# :aws_secret_access_key in order to create a connection
|
26
|
+
#
|
27
|
+
# ==== Examples
|
28
|
+
# iam = IAM.new(
|
29
|
+
# :aws_access_key_id => your_aws_access_key_id,
|
30
|
+
# :aws_secret_access_key => your_aws_secret_access_key
|
31
|
+
# )
|
32
|
+
#
|
33
|
+
# ==== Parameters
|
34
|
+
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
35
|
+
#
|
36
|
+
# ==== Returns
|
37
|
+
# * IAM object with connection to AWS.
|
38
|
+
def initialize(options={})
|
39
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
40
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
41
|
+
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
|
42
|
+
@host = options[:host] || 'iam.amazonaws.com'
|
43
|
+
@path = options[:path] || '/'
|
44
|
+
@port = options[:port] || 443
|
45
|
+
@scheme = options[:scheme] || 'https'
|
46
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent])
|
47
|
+
end
|
48
|
+
|
49
|
+
def reload
|
50
|
+
@connection.reset
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def request(params)
|
56
|
+
idempotent = params.delete(:idempotent)
|
57
|
+
parser = params.delete(:parser)
|
58
|
+
|
59
|
+
body = AWS.signed_params(
|
60
|
+
params,
|
61
|
+
{
|
62
|
+
:aws_access_key_id => @aws_access_key_id,
|
63
|
+
:hmac => @hmac,
|
64
|
+
:host => @host,
|
65
|
+
:path => @path,
|
66
|
+
:version => '2010-05-08'
|
67
|
+
}
|
68
|
+
)
|
69
|
+
|
70
|
+
response = @connection.request({
|
71
|
+
:body => body,
|
72
|
+
:expects => 200,
|
73
|
+
:idempotent => idempotent,
|
74
|
+
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
75
|
+
:host => @host,
|
76
|
+
:method => 'POST',
|
77
|
+
:parser => parser
|
78
|
+
})
|
79
|
+
|
80
|
+
response
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -14,6 +14,14 @@ module Fog
|
|
14
14
|
|
15
15
|
attribute :creation_date, :aliases => 'CreationDate'
|
16
16
|
|
17
|
+
def acl=(new_acl)
|
18
|
+
valid_acls = ['private', 'public-read', 'public-read-write', 'authenticated-read']
|
19
|
+
unless valid_acls.include?(new_acl)
|
20
|
+
raise ArgumentError.new("acl must be one of [#{valid_acls.join(', ')}]")
|
21
|
+
end
|
22
|
+
@acl = new_acl
|
23
|
+
end
|
24
|
+
|
17
25
|
def destroy
|
18
26
|
requires :key
|
19
27
|
connection.delete_bucket(key)
|
@@ -56,6 +64,9 @@ module Fog
|
|
56
64
|
def save
|
57
65
|
requires :key
|
58
66
|
options = {}
|
67
|
+
if @acl
|
68
|
+
options['x-amz-acl'] = @acl
|
69
|
+
end
|
59
70
|
if @location
|
60
71
|
options['LocationConstraint'] = @location
|
61
72
|
end
|