fog 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/iam.rb +4 -0
- data/lib/fog/aws/parsers/iam/list_groups_for_user.rb +32 -0
- data/lib/fog/aws/parsers/iam/list_signing_certificates.rb +32 -0
- data/lib/fog/aws/parsers/iam/upload_signing_certificate.rb +26 -0
- data/lib/fog/aws/requests/iam/delete_signing_certificate.rb +41 -0
- data/lib/fog/aws/requests/iam/list_groups_for_user.rb +51 -0
- data/lib/fog/aws/requests/iam/list_signing_certificates.rb +46 -0
- data/lib/fog/aws/requests/iam/upload_signing_certificate.rb +46 -0
- data/lib/fog/aws/ses.rb +1 -1
- data/lib/fog/cdn/aws.rb +1 -1
- data/lib/fog/compute/go_grid.rb +4 -0
- data/lib/fog/compute/models/go_grid/password.rb +50 -0
- data/lib/fog/compute/models/go_grid/passwords.rb +36 -0
- data/lib/fog/compute/requests/go_grid/support_password_get.rb +36 -0
- data/lib/fog/compute/requests/go_grid/support_password_list.rb +38 -0
- data/lib/fog/core/time.rb +19 -13
- data/lib/fog/dns/aws.rb +1 -1
- data/lib/fog/storage/aws.rb +1 -1
- data/lib/fog/storage/google.rb +1 -1
- data/lib/fog/storage/requests/aws/get_object.rb +2 -2
- data/lib/fog/storage/requests/aws/head_object.rb +2 -2
- data/lib/fog/storage/requests/aws/put_object.rb +1 -1
- data/lib/fog/storage/requests/google/get_object.rb +2 -2
- data/lib/fog/storage/requests/google/head_object.rb +2 -2
- data/lib/fog/storage/requests/google/put_object.rb +1 -1
- data/tests/helper.rb +0 -1
- metadata +18 -7
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fog (0.5.
|
4
|
+
fog (0.5.1)
|
5
5
|
builder
|
6
6
|
excon (>= 0.4.0)
|
7
7
|
formatador (>= 0.0.16)
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
rake (0.8.7)
|
25
25
|
rspec (1.3.1)
|
26
26
|
ruby-hmac (0.4.0)
|
27
|
-
shindo (0.2.
|
27
|
+
shindo (0.2.2)
|
28
28
|
formatador (>= 0.0.16)
|
29
29
|
|
30
30
|
PLATFORMS
|
@@ -42,4 +42,4 @@ DEPENDENCIES
|
|
42
42
|
rake
|
43
43
|
rspec (= 1.3.1)
|
44
44
|
ruby-hmac
|
45
|
-
shindo (= 0.2.
|
45
|
+
shindo (= 0.2.2)
|
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.5.
|
11
|
-
s.date = '2011-01-
|
10
|
+
s.version = '0.5.1'
|
11
|
+
s.date = '2011-01-31'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
## those that are only needed during development
|
56
56
|
s.add_development_dependency('rake')
|
57
57
|
s.add_development_dependency('rspec', '1.3.1')
|
58
|
-
s.add_development_dependency('shindo', '0.2.
|
58
|
+
s.add_development_dependency('shindo', '0.2.2')
|
59
59
|
|
60
60
|
s.files = `git ls-files`.split("\n")
|
61
61
|
s.test_files = `git ls-files -- {spec,tests}/*`.split("\n")
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws/iam.rb
CHANGED
@@ -13,18 +13,22 @@ module Fog
|
|
13
13
|
request :delete_access_key
|
14
14
|
request :delete_group
|
15
15
|
request :delete_group_policy
|
16
|
+
request :delete_signing_certificate
|
16
17
|
request :delete_user
|
17
18
|
request :delete_user_policy
|
18
19
|
request :get_user
|
19
20
|
request :list_access_keys
|
20
21
|
request :list_groups
|
22
|
+
request :list_groups_for_user
|
21
23
|
request :list_group_policies
|
24
|
+
request :list_signing_certificates
|
22
25
|
request :list_user_policies
|
23
26
|
request :list_users
|
24
27
|
request :put_group_policy
|
25
28
|
request :put_user_policy
|
26
29
|
request :remove_user_from_group
|
27
30
|
request :update_access_key
|
31
|
+
request :upload_signing_certificate
|
28
32
|
|
29
33
|
class Mock
|
30
34
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module IAM
|
5
|
+
|
6
|
+
class ListGroupsForUser < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@group_for_user = {}
|
10
|
+
@response = { 'GroupsForUser' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case name
|
15
|
+
when 'Path', 'GroupName', 'GroupId', 'Arn'
|
16
|
+
@group_for_user[name] = @value
|
17
|
+
when 'member'
|
18
|
+
@response['GroupsForUser'] << @group_for_user
|
19
|
+
@group_for_user = {}
|
20
|
+
when 'IsTruncated'
|
21
|
+
response[name] = (@value == 'true')
|
22
|
+
when 'Marker', 'RequestId'
|
23
|
+
response[name] = @value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module IAM
|
5
|
+
|
6
|
+
class ListSigningCertificates < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@signing_certificate = {}
|
10
|
+
@response = { 'SigningCertificates' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case name
|
15
|
+
when 'UserName', 'CertificateId', 'CertificateBody', 'Status'
|
16
|
+
@signing_certificate[name] = @value
|
17
|
+
when 'member'
|
18
|
+
@response['SigningCertificates'] << @signing_certificate
|
19
|
+
@signing_certificate = {}
|
20
|
+
when 'IsTruncated'
|
21
|
+
response[name] = (@value == 'true')
|
22
|
+
when 'Marker', 'RequestId'
|
23
|
+
response[name] = @value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module IAM
|
5
|
+
|
6
|
+
class UploadSigningCertificate < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'Certificate' => {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def end_element(name)
|
13
|
+
case name
|
14
|
+
when 'CertificateId', 'UserName', 'CertificateBody', 'Status'
|
15
|
+
@response['Certificate'][name] = @value
|
16
|
+
when 'RequestId'
|
17
|
+
@response[name] = @value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/iam/basic'
|
7
|
+
|
8
|
+
# Upload signing certificate for user (by default detects user from access credentials)
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * 'UserName'<~String> - name of the user to upload certificate for (do not include path)
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
# * 'RequestId'<~String> - Id of the request
|
18
|
+
#
|
19
|
+
# ==== See Also
|
20
|
+
# http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_DeleteSigningCertificate.html
|
21
|
+
#
|
22
|
+
def delete_signing_certificate(certificate_id, options = {})
|
23
|
+
request({
|
24
|
+
'Action' => 'DeleteSigningCertificate',
|
25
|
+
'CertificateId' => certificate_id,
|
26
|
+
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
27
|
+
}.merge!(options))
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
|
34
|
+
def delete_signing_certificate(user_name = nil)
|
35
|
+
Fog::Mock.not_implemented
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/iam/list_groups_for_user'
|
7
|
+
|
8
|
+
# List groups_for_user
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * user_name<~String> - the username you want to look up group membership for
|
12
|
+
# * options<~Hash>:
|
13
|
+
# * 'Marker'<~String> - used to paginate subsequent requests
|
14
|
+
# * 'MaxItems'<~Integer> - limit results to this number per page
|
15
|
+
#
|
16
|
+
# ==== Returns
|
17
|
+
# * response<~Excon::Response>:
|
18
|
+
# * body<~Hash>:
|
19
|
+
# * 'GroupsForUser'<~Array> - Groups for a user
|
20
|
+
# * group_for_user<~Hash>:
|
21
|
+
# * 'Arn' -
|
22
|
+
# * 'GroupId' -
|
23
|
+
# * 'GroupName' -
|
24
|
+
# * 'Path' -
|
25
|
+
# * 'IsTruncated'<~Boolean> - Whether or not results were truncated
|
26
|
+
# * 'Marker'<~String> - appears when IsTruncated is true as the next marker to use
|
27
|
+
# * 'RequestId'<~String> - Id of the request
|
28
|
+
#
|
29
|
+
# ==== See Also
|
30
|
+
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_ListGroupsForUser.html
|
31
|
+
#
|
32
|
+
def list_groups_for_user(user_name, options = {})
|
33
|
+
request({
|
34
|
+
'Action' => 'ListGroupsForUser',
|
35
|
+
'UserName' => user_name,
|
36
|
+
:parser => Fog::Parsers::AWS::IAM::ListGroupsForUser.new
|
37
|
+
}.merge!(options))
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
class Mock
|
43
|
+
|
44
|
+
def list_groups_for_user(user_name = nil)
|
45
|
+
Fog::Mock.not_implemented
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/iam/list_signing_certificates'
|
7
|
+
|
8
|
+
# List signing certificates for user (by default detects user from access credentials)
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * 'UserName'<~String> - name of the user to list certificates for (do not include path)
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
# * 'SigningCertificates'<~Array> - Matching signing certificates
|
18
|
+
# * signing_certificate<~Hash>:
|
19
|
+
# * CertificateId<~String> -
|
20
|
+
# * Status<~String> -
|
21
|
+
# * 'IsTruncated'<~Boolean> - Whether or not the results were truncated
|
22
|
+
# * 'Marker'<~String> - appears when IsTruncated is true as the next marker to use
|
23
|
+
# * 'RequestId'<~String> - Id of the request
|
24
|
+
#
|
25
|
+
# ==== See Also
|
26
|
+
# http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_ListSigningCertificates.html
|
27
|
+
#
|
28
|
+
def list_signing_certificates(options = {})
|
29
|
+
request({
|
30
|
+
'Action' => 'ListSigningCertificates',
|
31
|
+
:parser => Fog::Parsers::AWS::IAM::ListSigningCertificates.new
|
32
|
+
}.merge!(options))
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
class Mock
|
38
|
+
|
39
|
+
def list_signing_certificates(user_name = nil)
|
40
|
+
Fog::Mock.not_implemented
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/iam/upload_signing_certificate'
|
7
|
+
|
8
|
+
# Upload signing certificate for user (by default detects user from access credentials)
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * 'UserName'<~String> - name of the user to upload certificate for (do not include path)
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
# * 'Certificate'<~Hash>:
|
18
|
+
# * 'CertificateId'<~String> -
|
19
|
+
# * 'UserName'<~String> -
|
20
|
+
# * 'CertificateBody'<~String> -
|
21
|
+
# * 'Status'<~String> -
|
22
|
+
# * 'RequestId'<~String> - Id of the request
|
23
|
+
#
|
24
|
+
# ==== See Also
|
25
|
+
# http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_UploadSigningCertificate.html
|
26
|
+
#
|
27
|
+
def upload_signing_certificate(certificate, options = {})
|
28
|
+
request({
|
29
|
+
'Action' => 'UploadSigningCertificate',
|
30
|
+
'CertificateBody' => certificate,
|
31
|
+
:parser => Fog::Parsers::AWS::IAM::UploadSigningCertificate.new
|
32
|
+
}.merge!(options))
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
class Mock
|
38
|
+
|
39
|
+
def upload_signing_certificate(user_name = nil)
|
40
|
+
Fog::Mock.not_implemented
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/fog/aws/ses.rb
CHANGED
@@ -70,7 +70,7 @@ module Fog
|
|
70
70
|
|
71
71
|
headers = {
|
72
72
|
'Content-Type' => 'application/x-www-form-urlencoded',
|
73
|
-
'Date' => Time.now.
|
73
|
+
'Date' => Fog::Time.now.to_date_header
|
74
74
|
}
|
75
75
|
|
76
76
|
#AWS3-HTTPS AWSAccessKeyId=<Your AWS Access Key ID>, Algorithm=HmacSHA256, Signature=<Signature>
|
data/lib/fog/cdn/aws.rb
CHANGED
@@ -98,7 +98,7 @@ module Fog
|
|
98
98
|
|
99
99
|
def request(params, &block)
|
100
100
|
params[:headers] ||= {}
|
101
|
-
params[:headers]['Date'] = Time.now.
|
101
|
+
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
102
102
|
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
103
103
|
params[:path] = "/#{@version}/#{params[:path]}"
|
104
104
|
@connection.request(params, &block)
|
data/lib/fog/compute/go_grid.rb
CHANGED
@@ -11,6 +11,8 @@ module Fog
|
|
11
11
|
collection :images
|
12
12
|
model :server
|
13
13
|
collection :servers
|
14
|
+
model :password
|
15
|
+
collection :passwords
|
14
16
|
|
15
17
|
request_path 'fog/compute/requests/go_grid'
|
16
18
|
request :common_lookup_list
|
@@ -23,6 +25,8 @@ module Fog
|
|
23
25
|
request :grid_server_get
|
24
26
|
request :grid_server_list
|
25
27
|
request :grid_server_power
|
28
|
+
request :support_password_get
|
29
|
+
request :support_password_list
|
26
30
|
|
27
31
|
class Mock
|
28
32
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module GoGrid
|
5
|
+
class Compute
|
6
|
+
|
7
|
+
class Password < Fog::Model
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
|
11
|
+
attribute :server_id
|
12
|
+
attribute :applicationtype
|
13
|
+
attribute :username
|
14
|
+
attribute :password_id, :aliases => 'id'
|
15
|
+
attribute :password
|
16
|
+
attribute :server
|
17
|
+
|
18
|
+
def initialize(attributes={})
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy
|
23
|
+
requires :id
|
24
|
+
connection.grid_server_destroy(id)
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
def image
|
29
|
+
requires :image_id
|
30
|
+
connection.grid_image_get(image_id)
|
31
|
+
end
|
32
|
+
|
33
|
+
def ready?
|
34
|
+
@state == 'On'
|
35
|
+
end
|
36
|
+
|
37
|
+
def save
|
38
|
+
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
39
|
+
requires :password_id
|
40
|
+
data = connection.support_password_list()
|
41
|
+
merge_attributes(data.body)
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/compute/models/go_grid/password'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module GoGrid
|
6
|
+
class Compute
|
7
|
+
|
8
|
+
class Passwords < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::GoGrid::Compute::Password
|
11
|
+
|
12
|
+
def all
|
13
|
+
data = connection.support_password_list.body['list']
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def bootstrap(new_attributes = {})
|
18
|
+
password = create(new_attributes)
|
19
|
+
password.wait_for { ready? }
|
20
|
+
password
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(id)
|
24
|
+
#if server_id && server = connection.grid_server_get(server_id).body['list']
|
25
|
+
if id && server = connection.support_password_get(id).body['list']
|
26
|
+
new(server)
|
27
|
+
end
|
28
|
+
rescue Fog::GoGrid::Compute::NotFound
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module GoGrid
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Get one or more passwords by id
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * options<~Hash>:
|
10
|
+
# * 'id'<~String> - id of the password to retrieve
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Array>:
|
15
|
+
# TODO: docs
|
16
|
+
def support_password_get(id, options={})
|
17
|
+
request(
|
18
|
+
:path => 'support/password/get',
|
19
|
+
:query => {
|
20
|
+
'id' => id
|
21
|
+
}.merge!(options)
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
class Mock
|
28
|
+
|
29
|
+
def support_password_get(options={})
|
30
|
+
Fog::Mock.not_implemented
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fog
|
2
|
+
module GoGrid
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# List passwords
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * options<~Hash>:
|
10
|
+
# * 'datacenter'<~String> - datacenter to limit results to
|
11
|
+
# * 'isSandbox'<~String> - If true only returns Image Sandbox servers, in ['false', 'true']
|
12
|
+
# * 'num_items'<~Integer> - Number of items to return
|
13
|
+
# * 'page'<~Integer> - Page index for paginated results
|
14
|
+
# * 'server.type'<~String> - server type to limit results to
|
15
|
+
#
|
16
|
+
# ==== Returns
|
17
|
+
# * response<~Excon::Response>:
|
18
|
+
# * body<~Array>:
|
19
|
+
# TODO: docs
|
20
|
+
def support_password_list(options={})
|
21
|
+
request(
|
22
|
+
:path => 'support/password/list',
|
23
|
+
:query => options
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
class Mock
|
30
|
+
|
31
|
+
def support_password_list(options={})
|
32
|
+
Fog::Mock.not_implemented
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/fog/core/time.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
module Fog
|
2
2
|
class Time < ::Time
|
3
|
-
class << self
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
end
|
4
|
+
DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
5
|
+
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
new_now
|
13
|
-
end
|
7
|
+
def self.now
|
8
|
+
at((::Time.now - offset).to_i)
|
9
|
+
end
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
def self.now=(new_now)
|
12
|
+
old_now = ::Time.now
|
13
|
+
@offset = old_now - new_now
|
14
|
+
new_now
|
15
|
+
end
|
18
16
|
|
17
|
+
def self.offset
|
18
|
+
@offset ||= 0
|
19
19
|
end
|
20
|
+
|
21
|
+
def to_date_header
|
22
|
+
now = self.class.now.utc
|
23
|
+
now.strftime("#{DAYS[now.wday]}, %d #{MONTHS[now.month - 1]} %Y %H:%M:%S +0000")
|
24
|
+
end
|
25
|
+
|
20
26
|
end
|
21
|
-
end
|
27
|
+
end
|
data/lib/fog/dns/aws.rb
CHANGED
@@ -103,7 +103,7 @@ module Fog
|
|
103
103
|
|
104
104
|
def request(params, &block)
|
105
105
|
params[:headers] ||= {}
|
106
|
-
params[:headers]['Date'] = Time.now.
|
106
|
+
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
107
107
|
params[:headers]['X-Amzn-Authorization'] = "AWS3-HTTPS AWSAccessKeyId=#{@aws_access_key_id},Algorithm=HmacSHA1,Signature=#{signature(params)}"
|
108
108
|
params[:path] = "/#{@version}/#{params[:path]}"
|
109
109
|
@connection.request(params, &block)
|
data/lib/fog/storage/aws.rb
CHANGED
@@ -289,7 +289,7 @@ module Fog
|
|
289
289
|
private
|
290
290
|
|
291
291
|
def request(params, &block)
|
292
|
-
params[:headers]['Date'] = Time.now.
|
292
|
+
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
293
293
|
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
294
294
|
params[:expects] = [307, *params[:expects]].flatten
|
295
295
|
# FIXME: ToHashParser should make this not needed
|
data/lib/fog/storage/google.rb
CHANGED
@@ -212,7 +212,7 @@ module Fog
|
|
212
212
|
private
|
213
213
|
|
214
214
|
def request(params, &block)
|
215
|
-
params[:headers]['Date'] = Time.now.
|
215
|
+
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
216
216
|
params[:headers]['Authorization'] = "GOOG1 #{@google_storage_access_key_id}:#{signature(params)}"
|
217
217
|
|
218
218
|
response = @connection.request(params, &block)
|
@@ -39,8 +39,8 @@ module Fog
|
|
39
39
|
query = {'versionId' => version_id}
|
40
40
|
end
|
41
41
|
headers = {}
|
42
|
-
headers['If-Modified-Since'] = options['If-Modified-Since'].
|
43
|
-
headers['If-Unmodified-Since'] = options['If-Unmodified-Since'].
|
42
|
+
headers['If-Modified-Since'] = Fog::Time.at(options['If-Modified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
43
|
+
headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
44
44
|
headers.merge!(options)
|
45
45
|
request({
|
46
46
|
:expects => 200,
|
@@ -39,8 +39,8 @@ module Fog
|
|
39
39
|
query = {'versionId' => version_id}
|
40
40
|
end
|
41
41
|
headers = {}
|
42
|
-
headers['If-Modified-Since'] = options['If-Modified-Since'].
|
43
|
-
headers['If-Unmodified-Since'] = options['If-Unmodified-Since'].
|
42
|
+
headers['If-Modified-Since'] = Fog::Time.at(options['If-Modified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
43
|
+
headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
44
44
|
headers.merge!(options)
|
45
45
|
request({
|
46
46
|
:expects => 200,
|
@@ -67,7 +67,7 @@ module Fog
|
|
67
67
|
'Content-Type' => data[:headers]['Content-Type'],
|
68
68
|
'ETag' => Fog::AWS::Mock.etag,
|
69
69
|
'Key' => object_name,
|
70
|
-
'LastModified' => Time.now.
|
70
|
+
'LastModified' => Fog::Time.now.to_date_header,
|
71
71
|
'Size' => data[:headers]['Content-Length'],
|
72
72
|
'StorageClass' => 'STANDARD'
|
73
73
|
}
|
@@ -36,8 +36,8 @@ module Fog
|
|
36
36
|
query = {'versionId' => version_id}
|
37
37
|
end
|
38
38
|
headers = {}
|
39
|
-
headers['If-Modified-Since'] = options['If-Modified-Since'].
|
40
|
-
headers['If-Unmodified-Since'] = options['If-Unmodified-Since'].
|
39
|
+
headers['If-Modified-Since'] = Fog::Time.at(options['If-Modified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
40
|
+
headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
41
41
|
headers.merge!(options)
|
42
42
|
request({
|
43
43
|
:expects => 200,
|
@@ -35,8 +35,8 @@ module Fog
|
|
35
35
|
query = {'versionId' => version_id}
|
36
36
|
end
|
37
37
|
headers = {}
|
38
|
-
headers['If-Modified-Since'] = options['If-Modified-Since'].
|
39
|
-
headers['If-Unmodified-Since'] = options['If-Unmodified-Since'].
|
38
|
+
headers['If-Modified-Since'] = Fog::Time.at(options['If-Modified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
39
|
+
headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
40
40
|
headers.merge!(options)
|
41
41
|
request({
|
42
42
|
:expects => 200,
|
@@ -62,7 +62,7 @@ module Fog
|
|
62
62
|
'Content-Type' => data[:headers]['Content-Type'],
|
63
63
|
'ETag' => Fog::Google::Mock.etag,
|
64
64
|
'Key' => object_name,
|
65
|
-
'LastModified' => Time.now.
|
65
|
+
'LastModified' => Fog::Time.now.to_date_header,
|
66
66
|
'Size' => data[:headers]['Content-Length'],
|
67
67
|
'StorageClass' => 'STANDARD'
|
68
68
|
}
|
data/tests/helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- geemus (Wesley Beary)
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-31 00:00:00 -08:00
|
19
19
|
default_executable: fog
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -174,12 +174,12 @@ dependencies:
|
|
174
174
|
requirements:
|
175
175
|
- - "="
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
hash:
|
177
|
+
hash: 19
|
178
178
|
segments:
|
179
179
|
- 0
|
180
180
|
- 2
|
181
|
-
-
|
182
|
-
version: 0.2.
|
181
|
+
- 2
|
182
|
+
version: 0.2.2
|
183
183
|
type: :development
|
184
184
|
name: shindo
|
185
185
|
prerelease: false
|
@@ -224,8 +224,11 @@ files:
|
|
224
224
|
- lib/fog/aws/parsers/iam/get_user.rb
|
225
225
|
- lib/fog/aws/parsers/iam/list_access_keys.rb
|
226
226
|
- lib/fog/aws/parsers/iam/list_groups.rb
|
227
|
+
- lib/fog/aws/parsers/iam/list_groups_for_user.rb
|
227
228
|
- lib/fog/aws/parsers/iam/list_policies.rb
|
229
|
+
- lib/fog/aws/parsers/iam/list_signing_certificates.rb
|
228
230
|
- lib/fog/aws/parsers/iam/list_users.rb
|
231
|
+
- lib/fog/aws/parsers/iam/upload_signing_certificate.rb
|
229
232
|
- lib/fog/aws/parsers/ses/delete_verified_email_address.rb
|
230
233
|
- lib/fog/aws/parsers/ses/get_send_quota.rb
|
231
234
|
- lib/fog/aws/parsers/ses/get_send_statistics.rb
|
@@ -253,18 +256,22 @@ files:
|
|
253
256
|
- lib/fog/aws/requests/iam/delete_access_key.rb
|
254
257
|
- lib/fog/aws/requests/iam/delete_group.rb
|
255
258
|
- lib/fog/aws/requests/iam/delete_group_policy.rb
|
259
|
+
- lib/fog/aws/requests/iam/delete_signing_certificate.rb
|
256
260
|
- lib/fog/aws/requests/iam/delete_user.rb
|
257
261
|
- lib/fog/aws/requests/iam/delete_user_policy.rb
|
258
262
|
- lib/fog/aws/requests/iam/get_user.rb
|
259
263
|
- lib/fog/aws/requests/iam/list_access_keys.rb
|
260
264
|
- lib/fog/aws/requests/iam/list_group_policies.rb
|
261
265
|
- lib/fog/aws/requests/iam/list_groups.rb
|
266
|
+
- lib/fog/aws/requests/iam/list_groups_for_user.rb
|
267
|
+
- lib/fog/aws/requests/iam/list_signing_certificates.rb
|
262
268
|
- lib/fog/aws/requests/iam/list_user_policies.rb
|
263
269
|
- lib/fog/aws/requests/iam/list_users.rb
|
264
270
|
- lib/fog/aws/requests/iam/put_group_policy.rb
|
265
271
|
- lib/fog/aws/requests/iam/put_user_policy.rb
|
266
272
|
- lib/fog/aws/requests/iam/remove_user_from_group.rb
|
267
273
|
- lib/fog/aws/requests/iam/update_access_key.rb
|
274
|
+
- lib/fog/aws/requests/iam/upload_signing_certificate.rb
|
268
275
|
- lib/fog/aws/requests/ses/delete_verified_email_address.rb
|
269
276
|
- lib/fog/aws/requests/ses/get_send_quota.rb
|
270
277
|
- lib/fog/aws/requests/ses/get_send_statistics.rb
|
@@ -360,6 +367,8 @@ files:
|
|
360
367
|
- lib/fog/compute/models/brightbox/zones.rb
|
361
368
|
- lib/fog/compute/models/go_grid/image.rb
|
362
369
|
- lib/fog/compute/models/go_grid/images.rb
|
370
|
+
- lib/fog/compute/models/go_grid/password.rb
|
371
|
+
- lib/fog/compute/models/go_grid/passwords.rb
|
363
372
|
- lib/fog/compute/models/go_grid/server.rb
|
364
373
|
- lib/fog/compute/models/go_grid/servers.rb
|
365
374
|
- lib/fog/compute/models/rackspace/flavor.rb
|
@@ -524,6 +533,8 @@ files:
|
|
524
533
|
- lib/fog/compute/requests/go_grid/grid_server_get.rb
|
525
534
|
- lib/fog/compute/requests/go_grid/grid_server_list.rb
|
526
535
|
- lib/fog/compute/requests/go_grid/grid_server_power.rb
|
536
|
+
- lib/fog/compute/requests/go_grid/support_password_get.rb
|
537
|
+
- lib/fog/compute/requests/go_grid/support_password_list.rb
|
527
538
|
- lib/fog/compute/requests/linode/avail_datacenters.rb
|
528
539
|
- lib/fog/compute/requests/linode/avail_distributions.rb
|
529
540
|
- lib/fog/compute/requests/linode/avail_kernels.rb
|