aliyun_ruby_api 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -21
- data/README_EN.md +80 -0
- data/aliyun_ruby_api.gemspec +1 -1
- data/example/test.rb +16 -0
- data/lib/aliyun_ruby_api/version.rb +1 -1
- metadata +22 -12
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
# Aliyun ECS API Client for Ruby
|
2
2
|
|
3
3
|
|
4
|
-
The Aliyun ECS API Client for Ruby
|
4
|
+
The Aliyun ECS API Client for Ruby 是调用 [阿里云 ECS服务](http://help.aliyun.com/view/11108189_13730407.html) 的 [Ruby](http://www.ruby-lang.org programming language)客户端类库.
|
5
5
|
|
6
6
|
|
7
|
-
##
|
7
|
+
## 安装
|
8
8
|
|
9
|
-
|
9
|
+
可以将下面一行加入Ruby应用的Gemfile:
|
10
10
|
|
11
11
|
gem 'aliyun_ruby_api'
|
12
12
|
|
13
|
-
|
13
|
+
之后执行:
|
14
14
|
|
15
15
|
$ bundle
|
16
16
|
|
17
|
-
|
17
|
+
或者直接执行:
|
18
18
|
|
19
19
|
$ gem install aliyun_ruby_api
|
20
20
|
|
21
|
-
##
|
21
|
+
## 使用方法:
|
22
22
|
|
23
|
-
|
23
|
+
首先,需要在代码中引入类库:
|
24
24
|
|
25
25
|
```
|
26
26
|
require 'rubygems'
|
27
27
|
require 'aliyun_ruby_api'
|
28
28
|
```
|
29
29
|
|
30
|
-
|
30
|
+
然后利用自己阿里云账号下的access_key初始化service对象。如果没有access_key,可以通过[阿里云用户中心](https://i.aliyun.com/access_key/)申请access_key。
|
31
31
|
|
32
32
|
```
|
33
33
|
options = {:access_key_id => "xxxxxx",
|
@@ -37,15 +37,15 @@ options = {:access_key_id => "xxxxxx",
|
|
37
37
|
service = Aliyun::Service.new options
|
38
38
|
```
|
39
39
|
|
40
|
-
|
40
|
+
这样, 你就可以根据 [阿里云弹性计算服务API参考手册](http://help.aliyun.com/view/11108189_13730407.html)初始化业务参数(除Action参数之外)为一个hash对象,并且将其作为参数传给Action方法(Action参数)。
|
41
41
|
|
42
42
|
```
|
43
|
-
parameters = {:[parameter_name] =>
|
43
|
+
parameters = {:[parameter_name] => [parameter_value]}
|
44
44
|
|
45
45
|
service.[Action] parameters
|
46
46
|
```
|
47
47
|
|
48
|
-
(1)
|
48
|
+
(1) 例如查询可用地域列表,其Action参数为DescribeRegions,而没有其他参数,代码如下
|
49
49
|
|
50
50
|
```
|
51
51
|
parameters = {}
|
@@ -53,26 +53,24 @@ parameters = {}
|
|
53
53
|
service.DescribeRegions parameters
|
54
54
|
```
|
55
55
|
|
56
|
-
(2)
|
56
|
+
(2) 再比如查询可用镜像,代码如下
|
57
|
+
|
57
58
|
```
|
58
|
-
parameters = {:RegionId => "
|
59
|
+
parameters = {:RegionId => "cn-beijing", :PageNumber => 2, :RageSize => 20}
|
59
60
|
|
60
61
|
service.DescribeImages parameters
|
61
62
|
```
|
62
63
|
|
63
|
-
|
64
|
+
注意:
|
65
|
+
|
66
|
+
如果想要输出更详细的debug信息,请将下面这行加入到阿里云API调用
|
64
67
|
|
65
|
-
If you want to output the debug info, please add this line before you call the API
|
66
68
|
```
|
67
69
|
$DEBUG = true
|
68
70
|
|
69
71
|
```
|
70
72
|
|
71
73
|
|
72
|
-
##
|
74
|
+
## 参考例子
|
73
75
|
|
74
|
-
|
75
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
76
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
77
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
78
|
-
5. Create new Pull Request
|
76
|
+
可以参考example/test.rb来实现。
|
data/README_EN.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Aliyun ECS API Client for Ruby
|
2
|
+
|
3
|
+
|
4
|
+
The Aliyun ECS API Client for Ruby is a library for connecting to and calling [The Aliyun ECS](http://help.aliyun.com/view/11108189_13730407.html?spm=5176.7376125.1997918129.6.k2vNso) from the [Ruby](http://www.ruby-lang.org programming language).
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'aliyun_ruby_api'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install aliyun_ruby_api
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
First, you're probably gonna want to require it:
|
24
|
+
|
25
|
+
```
|
26
|
+
require 'rubygems'
|
27
|
+
require 'aliyun_ruby_api'
|
28
|
+
```
|
29
|
+
|
30
|
+
Then, you need to set
|
31
|
+
|
32
|
+
```
|
33
|
+
options = {:access_key_id => "xxxxxx",
|
34
|
+
:access_key_secret => "yyyyyy",
|
35
|
+
:endpoint_url => "https://ecs.aliyuncs.com/"}
|
36
|
+
|
37
|
+
service = Aliyun::Service.new options
|
38
|
+
```
|
39
|
+
|
40
|
+
Now, you can call all the aliyun ECS API interface in the following way
|
41
|
+
|
42
|
+
```
|
43
|
+
parameters = {:[parameter_name] => :[parameter_value]}
|
44
|
+
|
45
|
+
service.[Action] parameters
|
46
|
+
```
|
47
|
+
|
48
|
+
(1) For example, if you want to use alyun ECS API to describe regions
|
49
|
+
|
50
|
+
```
|
51
|
+
parameters = {}
|
52
|
+
|
53
|
+
service.DescribeRegions parameters
|
54
|
+
```
|
55
|
+
|
56
|
+
(2) For example, if you want to use alyun ECS API to describe images template of a specified region
|
57
|
+
|
58
|
+
```
|
59
|
+
parameters = {:RegionId => "id", :PageNumber => "2", :RageSize => "20"}
|
60
|
+
|
61
|
+
service.DescribeImages parameters
|
62
|
+
```
|
63
|
+
|
64
|
+
Notice:
|
65
|
+
|
66
|
+
If you want to output the debug info, please add this line before you call the API
|
67
|
+
|
68
|
+
```
|
69
|
+
$DEBUG = true
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
1. Fork it ( http://github.com/<my-github-username>/aliyun_ruby_api/fork )
|
77
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
78
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
79
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
80
|
+
5. Create new Pull Request
|
data/aliyun_ruby_api.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["cheyang@163.com"]
|
11
11
|
spec.summary = %q{Ruby API client for accessing Aliyun ECS}
|
12
12
|
spec.description = %q{Ruby API client for using Aliyun ECS}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/cheyang/aliyun_ruby_api"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/example/test.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'aliyun_ruby_api'
|
3
|
+
|
4
|
+
$DEBUG=true
|
5
|
+
|
6
|
+
options = {:access_key_id => "xxxxxx",
|
7
|
+
:access_key_secret => "yyyyy",
|
8
|
+
:endpoint_url => "https://ecs.aliyuncs.com/"}
|
9
|
+
|
10
|
+
|
11
|
+
service = Aliyun::Service.new options
|
12
|
+
|
13
|
+
|
14
|
+
parameters = {}
|
15
|
+
|
16
|
+
puts service.DescribeRegions parameters
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyun_ruby_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- cheyang
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,29 +30,33 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: ruby-hmac
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
description: Ruby API client for using Aliyun ECS
|
@@ -64,35 +71,38 @@ files:
|
|
64
71
|
- Gemfile
|
65
72
|
- LICENSE.txt
|
66
73
|
- README.md
|
74
|
+
- README_EN.md
|
67
75
|
- Rakefile
|
68
76
|
- aliyun_ruby_api.gemspec
|
69
77
|
- example/ecs.conf
|
78
|
+
- example/test.rb
|
70
79
|
- lib/aliyun_ruby_api.rb
|
71
80
|
- lib/aliyun_ruby_api/base.rb
|
72
81
|
- lib/aliyun_ruby_api/service.rb
|
73
82
|
- lib/aliyun_ruby_api/version.rb
|
74
|
-
homepage:
|
83
|
+
homepage: https://github.com/cheyang/aliyun_ruby_api
|
75
84
|
licenses:
|
76
85
|
- MIT
|
77
|
-
metadata: {}
|
78
86
|
post_install_message:
|
79
87
|
rdoc_options: []
|
80
88
|
require_paths:
|
81
89
|
- lib
|
82
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
83
92
|
requirements:
|
84
|
-
- - '>='
|
93
|
+
- - ! '>='
|
85
94
|
- !ruby/object:Gem::Version
|
86
95
|
version: 1.9.3
|
87
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
88
98
|
requirements:
|
89
|
-
- - '>='
|
99
|
+
- - ! '>='
|
90
100
|
- !ruby/object:Gem::Version
|
91
101
|
version: '0'
|
92
102
|
requirements: []
|
93
103
|
rubyforge_project:
|
94
|
-
rubygems_version:
|
104
|
+
rubygems_version: 1.8.23
|
95
105
|
signing_key:
|
96
|
-
specification_version:
|
106
|
+
specification_version: 3
|
97
107
|
summary: Ruby API client for accessing Aliyun ECS
|
98
108
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 5f0b6ccede45089c9a08654fea2dffc15b9dd4f9
|
4
|
-
data.tar.gz: 2abb1b6d3b155a51133ea00dd11f8217396e55a8
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 2b2ea31836e2beca06404e6f170f47e9292fcda291190a2eafebe622886ca3ac30f5f4b1d53893760240a22d05724e9835339c6f20d54a9ce37b65b8c28b1a07
|
7
|
-
data.tar.gz: 9172a34b3e3c6ddc8406d899586722de7e78c86c0a6e2e070d56118b91561417cbe70c368d36636a3c8822a7c8572e14bf7663bfe5baa5d799b10d8780d837f6
|