aliyun 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aliyun/common.rb +1 -1
- data/lib/aliyun/services.rb +5 -1
- data/lib/aliyun/services/ram.rb +24 -0
- data/lib/aliyun/services/sts.rb +24 -0
- data/lib/aliyun/version.rb +1 -1
- data/spec/aliyun_spec.rb +41 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1de23cde61df7e18309d92f7e9038edbff6e0ed
|
4
|
+
data.tar.gz: f8c26ae26532dcba4f24b053ebc1b1a9a16b8674
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b12265ce711f32b006384fe63146d8859c2235e1ace36159757d479419b26664c598da18d39299b5a20b02a149f7d389bfe20af7ee41200d0c9f882d0f891f4d
|
7
|
+
data.tar.gz: 84f5c5dc83da8bd11461edf6bc14e7003bdeee9c7219d7ec5617e82ced6c60c438ee938a10a4c9e83e9beb2cd3dec6ef7ec50df84c2066f55ed51f6d51a49778
|
data/lib/aliyun/common.rb
CHANGED
@@ -69,7 +69,7 @@ module Aliyun
|
|
69
69
|
params.merge! self.options
|
70
70
|
|
71
71
|
params[:Action] = method.to_s
|
72
|
-
params[:
|
72
|
+
params[:Timestamp] = Time.now.utc.iso8601
|
73
73
|
params[:SignatureNonce] = SecureRandom.uuid
|
74
74
|
params[:Signature] = compute_signature params
|
75
75
|
|
data/lib/aliyun/services.rb
CHANGED
@@ -2,12 +2,16 @@ require "aliyun/services/ecs"
|
|
2
2
|
require "aliyun/services/slb"
|
3
3
|
require "aliyun/services/rds"
|
4
4
|
require "aliyun/services/cdn"
|
5
|
+
require "aliyun/services/ram"
|
6
|
+
require "aliyun/services/sts"
|
5
7
|
|
6
8
|
module Aliyun
|
7
9
|
SERVICES = {
|
8
10
|
:ecs => ECSConfig,
|
9
11
|
:slb => SLBConfig,
|
10
12
|
:rds => RDSConfig,
|
11
|
-
:cdn => CDNConfig
|
13
|
+
:cdn => CDNConfig,
|
14
|
+
:ram => RAMConfig,
|
15
|
+
:sts => STSConfig
|
12
16
|
}
|
13
17
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Aliyun
|
2
|
+
class RAMConfig < APIConfig
|
3
|
+
def self.info
|
4
|
+
"Aliyu RAM Service"
|
5
|
+
end
|
6
|
+
def self.endpoint
|
7
|
+
'https://ram.aliyuncs.com/'
|
8
|
+
end
|
9
|
+
def self.default_parameters
|
10
|
+
{
|
11
|
+
:Format=>"JSON",
|
12
|
+
:Version=>"2015-05-01",
|
13
|
+
:SignatureMethod=>"HMAC-SHA1",
|
14
|
+
:SignatureVersion=>"1.0"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
def self.separator
|
18
|
+
super
|
19
|
+
end
|
20
|
+
def self.http_method
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Aliyun
|
2
|
+
class STSConfig < APIConfig
|
3
|
+
def self.info
|
4
|
+
"Aliyu STS Service"
|
5
|
+
end
|
6
|
+
def self.endpoint
|
7
|
+
'https://sts.aliyuncs.com/'
|
8
|
+
end
|
9
|
+
def self.default_parameters
|
10
|
+
{
|
11
|
+
:Format=>"JSON",
|
12
|
+
:Version=>"2015-04-01",
|
13
|
+
:SignatureMethod=>"HMAC-SHA1",
|
14
|
+
:SignatureVersion=>"1.0"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
def self.separator
|
18
|
+
super
|
19
|
+
end
|
20
|
+
def self.http_method
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/aliyun/version.rb
CHANGED
data/spec/aliyun_spec.rb
CHANGED
@@ -48,6 +48,24 @@ describe Aliyun do
|
|
48
48
|
expect(service.service).to be(Aliyun::CDNConfig)
|
49
49
|
end
|
50
50
|
|
51
|
+
it 'can create aliyun ram service' do
|
52
|
+
options = load_options
|
53
|
+
options[:service] = :ram
|
54
|
+
service = Aliyun::Service.new options
|
55
|
+
|
56
|
+
expect(service).to be_instance_of(Aliyun::Service)
|
57
|
+
expect(service.service).to be(Aliyun::RAMConfig)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'can create aliyun sts service' do
|
61
|
+
options = load_options
|
62
|
+
options[:service] = :sts
|
63
|
+
service = Aliyun::Service.new options
|
64
|
+
|
65
|
+
expect(service).to be_instance_of(Aliyun::Service)
|
66
|
+
expect(service.service).to be(Aliyun::STSConfig)
|
67
|
+
end
|
68
|
+
|
51
69
|
it 'can query aliyun ecs regions' do
|
52
70
|
options = load_options
|
53
71
|
options[:service] = :ecs
|
@@ -92,6 +110,29 @@ describe Aliyun do
|
|
92
110
|
expect(cdn_service).to have_key("OpeningTime")
|
93
111
|
end
|
94
112
|
|
113
|
+
# it 'can list aliyun ram users' do
|
114
|
+
# options = load_options
|
115
|
+
# options[:service] = :ram
|
116
|
+
# service = Aliyun::Service.new options
|
117
|
+
# parameters = {}
|
118
|
+
# users = service.ListUsers parameters
|
119
|
+
#
|
120
|
+
# expect(users).to have_key("Users")
|
121
|
+
# expect(users["Users"]).to have_key("User")
|
122
|
+
# end
|
123
|
+
|
124
|
+
# TODO: define a test policy
|
125
|
+
# it 'can get aliyun sts token' do
|
126
|
+
# options = load_options
|
127
|
+
# options[:service] = :sts
|
128
|
+
# service = Aliyun::Service.new options
|
129
|
+
# parameters = {:StsVersion => 1, :Name => "aliyun_gem_t#{Time.now.to_i}", :Policy => "", :DurationSeconds => 900}
|
130
|
+
# sts_token = service.GetFederationToken parameters
|
131
|
+
#
|
132
|
+
# expect(sts_token).to have_key("Credentials")
|
133
|
+
# expect(sts_token).to have_key("FederatedUser")
|
134
|
+
# end
|
135
|
+
|
95
136
|
it "can describe aliyun slb regions" do
|
96
137
|
options = load_options
|
97
138
|
options[:service] = :slb
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Lantao
|
@@ -103,8 +103,10 @@ files:
|
|
103
103
|
- lib/aliyun/services.rb
|
104
104
|
- lib/aliyun/services/cdn.rb
|
105
105
|
- lib/aliyun/services/ecs.rb
|
106
|
+
- lib/aliyun/services/ram.rb
|
106
107
|
- lib/aliyun/services/rds.rb
|
107
108
|
- lib/aliyun/services/slb.rb
|
109
|
+
- lib/aliyun/services/sts.rb
|
108
110
|
- lib/aliyun/version.rb
|
109
111
|
- spec/aliyun_spec.rb
|
110
112
|
- spec/spec_helper.rb
|