aliyun 0.4.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -4
- data/README.md +19 -1
- data/aliyun.gemspec +1 -1
- data/lib/aliyun/services.rb +7 -1
- data/lib/aliyun/services/business.rb +24 -0
- data/lib/aliyun/services/cdn.rb +1 -1
- data/lib/aliyun/services/cms.rb +2 -2
- data/lib/aliyun/services/dns.rb +24 -0
- data/lib/aliyun/services/vpc.rb +24 -0
- data/lib/aliyun/version.rb +1 -1
- data/spec/aliyun_business_spec.rb +12 -0
- data/spec/aliyun_cms_spec.rb +24 -4
- data/spec/aliyun_dns_spec.rb +23 -0
- data/spec/aliyun_vpc_spec.rb +12 -0
- data/spec/spec_helper.rb +7 -0
- metadata +19 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a14e8d0a6f0efe362332a6a45e76a4f1cbf508adde7bb9d090e2363f9a5fb304
|
4
|
+
data.tar.gz: d353caada1d6bfac080e84b6d4717808d5d26472b7ec0ad251e0f986034b9549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9f1004b2afb80ef169cec6800c20c07644a5084d9db5c9c7556eab7073de814e7281c427ca64e3e590ec5fd0a0dd2f2b352dc736d6d10d9a9a05de5996454f0
|
7
|
+
data.tar.gz: 5b2c0e4af36f975eaa85fd5900e8c3c41f9858ae8ae73f1d613e52a39488b7b9f4683db6cc1a1cfd437592ebd94178693c441c14ce94478308e93637917aa90d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
[![CircleCI](https://circleci.com/gh/Lax/aliyun/tree/master.png?style=shield)](https://circleci.com/gh/Lax/aliyun)
|
8
8
|
[![security](https://hakiri.io/github/Lax/aliyun/master.svg)](https://hakiri.io/github/Lax/aliyun/master)
|
9
9
|
[![Dependency Status](https://gemnasium.com/Lax/aliyun.svg)](https://gemnasium.com/Lax/aliyun)
|
10
|
+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FLax%2Faliyun.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FLax%2Faliyun?ref=badge_shield)
|
10
11
|
|
11
12
|
Ruby wrapper of Aliyun API for system adminstrator.
|
12
13
|
|
@@ -42,7 +43,20 @@ Example:
|
|
42
43
|
|
43
44
|
puts service.DescribeRegions parameters
|
44
45
|
|
45
|
-
You can create/fetch `access key
|
46
|
+
You can create/fetch `access key` and `secret` at [https://i.aliyun.com/access_key](https://i.aliyun.com/access_key)
|
47
|
+
|
48
|
+
Current support these services:
|
49
|
+
|
50
|
+
* `:cdn` => `CDN` (Content Delivery Network)
|
51
|
+
* `:cms` => `CMS` (Cloud Monitor Service)
|
52
|
+
* `:dns` => `DNS` (Domain Name Service)
|
53
|
+
* `:ecs` => `ECS` (Elastic Compute Service)
|
54
|
+
* `:ram` => `RAM` (Resource Access Management)
|
55
|
+
* `:rds` => `RDS` (Relational Database Service)
|
56
|
+
* `:slb` => `SLB` (Server Load Balancer)
|
57
|
+
* `:sts` => `STS` (Security Token Service)
|
58
|
+
* `:vpc` => `VPC` (Virtual Private Cloud)
|
59
|
+
* `:business` => `Business` (Aliyun Account Management)
|
46
60
|
|
47
61
|
## Contributing
|
48
62
|
|
@@ -55,3 +69,7 @@ You can create/fetch `access key`/`secret` at [https://i.aliyun.com/access_key](
|
|
55
69
|
## Author
|
56
70
|
|
57
71
|
* [Liu Lantao](https://github.com/Lax)
|
72
|
+
|
73
|
+
|
74
|
+
## License
|
75
|
+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FLax%2Faliyun.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FLax%2Faliyun?ref=badge_large)
|
data/aliyun.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
spec.add_development_dependency "rspec_junit_formatter"
|
data/lib/aliyun/services.rb
CHANGED
@@ -1,19 +1,25 @@
|
|
1
1
|
require "aliyun/services/cdn"
|
2
2
|
require "aliyun/services/cms"
|
3
|
+
require "aliyun/services/dns"
|
3
4
|
require "aliyun/services/ecs"
|
4
5
|
require "aliyun/services/ram"
|
5
6
|
require "aliyun/services/rds"
|
6
7
|
require "aliyun/services/slb"
|
7
8
|
require "aliyun/services/sts"
|
9
|
+
require "aliyun/services/vpc"
|
10
|
+
require "aliyun/services/business"
|
8
11
|
|
9
12
|
module Aliyun
|
10
13
|
SERVICES = {
|
11
14
|
:cdn => CDNConfig,
|
12
15
|
:cms => CMSConfig,
|
16
|
+
:dns => DNSConfig,
|
13
17
|
:ecs => ECSConfig,
|
14
18
|
:ram => RAMConfig,
|
15
19
|
:rds => RDSConfig,
|
16
20
|
:slb => SLBConfig,
|
17
|
-
:sts => STSConfig
|
21
|
+
:sts => STSConfig,
|
22
|
+
:vpc => VPCConfig,
|
23
|
+
:business => BusinessConfig
|
18
24
|
}
|
19
25
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Aliyun
|
2
|
+
class BusinessConfig < APIConfig
|
3
|
+
def self.info
|
4
|
+
"Aliyu Business Service"
|
5
|
+
end
|
6
|
+
def self.endpoint
|
7
|
+
'https://business.aliyuncs.com/'
|
8
|
+
end
|
9
|
+
def self.default_parameters
|
10
|
+
{
|
11
|
+
:Format=>"JSON",
|
12
|
+
:Version=>"2017-12-14",
|
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/services/cdn.rb
CHANGED
data/lib/aliyun/services/cms.rb
CHANGED
@@ -4,12 +4,12 @@ module Aliyun
|
|
4
4
|
"Aliyu CMS Service"
|
5
5
|
end
|
6
6
|
def self.endpoint
|
7
|
-
|
7
|
+
raise "Service Endpoint Missing! endpoint_url: http://metrics.\%{Region}.aliyuncs.com/"
|
8
8
|
end
|
9
9
|
def self.default_parameters
|
10
10
|
{
|
11
11
|
:Format=>"JSON",
|
12
|
-
:Version=>"
|
12
|
+
:Version=>"2017-03-01",
|
13
13
|
:SignatureMethod=>"HMAC-SHA1",
|
14
14
|
:SignatureVersion=>"1.0"
|
15
15
|
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Aliyun
|
2
|
+
class DNSConfig < APIConfig
|
3
|
+
def self.info
|
4
|
+
"Aliyun DNS Service"
|
5
|
+
end
|
6
|
+
def self.endpoint
|
7
|
+
'https://dns.aliyuncs.com/'
|
8
|
+
end
|
9
|
+
def self.default_parameters
|
10
|
+
{
|
11
|
+
:Format=>"JSON",
|
12
|
+
:Version=>"2015-01-09",
|
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 VPCConfig < APIConfig
|
3
|
+
def self.info
|
4
|
+
"Aliyu VPC Service"
|
5
|
+
end
|
6
|
+
def self.endpoint
|
7
|
+
'https://vpc.aliyuncs.com/'
|
8
|
+
end
|
9
|
+
def self.default_parameters
|
10
|
+
{
|
11
|
+
:Format=>"JSON",
|
12
|
+
:Version=>"2016-04-28",
|
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
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Aliyun do
|
4
|
+
it 'can create aliyun business service' do
|
5
|
+
options = load_options
|
6
|
+
options[:service] = :business
|
7
|
+
service = Aliyun::Service.new options
|
8
|
+
|
9
|
+
expect(service).to be_instance_of(Aliyun::Service)
|
10
|
+
expect(service.service).to be(Aliyun::BusinessConfig)
|
11
|
+
end
|
12
|
+
end
|
data/spec/aliyun_cms_spec.rb
CHANGED
@@ -1,12 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Aliyun do
|
4
|
-
|
4
|
+
before do
|
5
5
|
options = load_options
|
6
6
|
options[:service] = :cms
|
7
|
-
|
7
|
+
options[:endpoint_url] = 'http://metrics.cn-beijing.aliyuncs.com/'
|
8
|
+
@service = Aliyun::Service.new options
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'can create aliyun CMS(metrics) service' do
|
12
|
+
expect(@service).to be_instance_of(Aliyun::Service)
|
13
|
+
expect(@service.service).to be(Aliyun::CMSConfig)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'can describe metric datum' do
|
17
|
+
instanceId = load_ecs_instance_id
|
18
|
+
instanceRegion = load_ecs_instance_region
|
19
|
+
parameters = {
|
20
|
+
Project: 'acs_ecs_dashboard',
|
21
|
+
Metric: 'diskusage_utilization',
|
22
|
+
StartTime: (Time.now - 180).utc.iso8601,
|
23
|
+
Dimensions: "{instanceId:'%s',device:'/dev/xvda1'}" % instanceId,
|
24
|
+
RegionId: instanceRegion,
|
25
|
+
Length: 1000
|
26
|
+
}
|
27
|
+
metric_datum = @service.QueryMetricList parameters
|
8
28
|
|
9
|
-
expect(
|
10
|
-
expect(
|
29
|
+
expect(metric_datum).to have_key("Datapoints")
|
30
|
+
expect(metric_datum["Datapoints"][0]).to have_key("diskname")
|
11
31
|
end
|
12
32
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Aliyun do
|
4
|
+
it 'can create aliyun dns service' do
|
5
|
+
options = load_options
|
6
|
+
options[:service] = :dns
|
7
|
+
service = Aliyun::Service.new options
|
8
|
+
|
9
|
+
expect(service).to be_instance_of(Aliyun::Service)
|
10
|
+
expect(service.service).to be(Aliyun::DNSConfig)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'can query aliyun dns service for domains' do
|
14
|
+
options = load_options
|
15
|
+
options[:service] = :dns
|
16
|
+
service = Aliyun::Service.new options
|
17
|
+
parameters = {}
|
18
|
+
dns_service = service.DescribeDomains parameters
|
19
|
+
|
20
|
+
expect(dns_service).to have_key("Domains")
|
21
|
+
expect(dns_service).to have_key("TotalCount")
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Aliyun do
|
4
|
+
it 'can create aliyun vpc service' do
|
5
|
+
options = load_options
|
6
|
+
options[:service] = :vpc
|
7
|
+
service = Aliyun::Service.new options
|
8
|
+
|
9
|
+
expect(service).to be_instance_of(Aliyun::Service)
|
10
|
+
expect(service.service).to be(Aliyun::VPCConfig)
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Lantao
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,28 +101,34 @@ files:
|
|
101
101
|
- lib/aliyun/base.rb
|
102
102
|
- lib/aliyun/common.rb
|
103
103
|
- lib/aliyun/services.rb
|
104
|
+
- lib/aliyun/services/business.rb
|
104
105
|
- lib/aliyun/services/cdn.rb
|
105
106
|
- lib/aliyun/services/cms.rb
|
107
|
+
- lib/aliyun/services/dns.rb
|
106
108
|
- lib/aliyun/services/ecs.rb
|
107
109
|
- lib/aliyun/services/ram.rb
|
108
110
|
- lib/aliyun/services/rds.rb
|
109
111
|
- lib/aliyun/services/slb.rb
|
110
112
|
- lib/aliyun/services/sts.rb
|
113
|
+
- lib/aliyun/services/vpc.rb
|
111
114
|
- lib/aliyun/version.rb
|
115
|
+
- spec/aliyun_business_spec.rb
|
112
116
|
- spec/aliyun_cdn_spec.rb
|
113
117
|
- spec/aliyun_cms_spec.rb
|
118
|
+
- spec/aliyun_dns_spec.rb
|
114
119
|
- spec/aliyun_ecs_spec.rb
|
115
120
|
- spec/aliyun_ram_spec.rb
|
116
121
|
- spec/aliyun_rds_spec.rb
|
117
122
|
- spec/aliyun_slb_spec.rb
|
118
123
|
- spec/aliyun_spec.rb
|
119
124
|
- spec/aliyun_sts_spec.rb
|
125
|
+
- spec/aliyun_vpc_spec.rb
|
120
126
|
- spec/spec_helper.rb
|
121
127
|
homepage: https://github.com/Lax/aliyun
|
122
128
|
licenses:
|
123
129
|
- MIT
|
124
130
|
metadata: {}
|
125
|
-
post_install_message:
|
131
|
+
post_install_message:
|
126
132
|
rdoc_options: []
|
127
133
|
require_paths:
|
128
134
|
- lib
|
@@ -137,18 +143,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
143
|
- !ruby/object:Gem::Version
|
138
144
|
version: '0'
|
139
145
|
requirements: []
|
140
|
-
|
141
|
-
|
142
|
-
signing_key:
|
146
|
+
rubygems_version: 3.1.4
|
147
|
+
signing_key:
|
143
148
|
specification_version: 4
|
144
149
|
summary: Ruby wrapper of Aliyun API for system administrator
|
145
150
|
test_files:
|
151
|
+
- spec/aliyun_business_spec.rb
|
146
152
|
- spec/aliyun_cdn_spec.rb
|
147
153
|
- spec/aliyun_cms_spec.rb
|
154
|
+
- spec/aliyun_dns_spec.rb
|
148
155
|
- spec/aliyun_ecs_spec.rb
|
149
156
|
- spec/aliyun_ram_spec.rb
|
150
157
|
- spec/aliyun_rds_spec.rb
|
151
158
|
- spec/aliyun_slb_spec.rb
|
152
159
|
- spec/aliyun_spec.rb
|
153
160
|
- spec/aliyun_sts_spec.rb
|
161
|
+
- spec/aliyun_vpc_spec.rb
|
154
162
|
- spec/spec_helper.rb
|