aliyun 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a16600c438443e782fe9ada9aa2787fac4d854b
4
- data.tar.gz: dabf5f36779ed8ef91ef2b64d5fd59ae8434dcaf
3
+ metadata.gz: 014e1ae72ad9a1e98ab9079c1540e8c72f611258
4
+ data.tar.gz: ac6ee5edc6bcf3f5c6934e59a2e16d7512c3a7e0
5
5
  SHA512:
6
- metadata.gz: e78f69ccc2d5c206d6aecdb0a59564846ede592eaada49a3a65384414f8f6a7c71a98ff05e1291af870083e268a9a1d1c18041f7fc033c51ff50dd27e61060e8
7
- data.tar.gz: f38e76b74ca48e66a5a2f87bcff06558b8644d85ce68a40947d2e859633285ea782ac38472d62efcac3fadad3e671f526969b92469ff899d4a573d1dc50137cb
6
+ metadata.gz: c7af9c873e85086cc7bfb8eb0d65a89394f4e0e53e95e5fc1307b91a27b0744dfb54958f9c6c3a4e900c1b2228d16532be3d553381b7237c0bc5c2e38aeaded2
7
+ data.tar.gz: 25117578507b07c03228bfa90a7964ec86f292baa5d615fc6a756c03a8b544e19ef221918c9717bd4e4d037bd6e46a7104fce58dd00b76a3eeccee3425f6272d
data/README.md CHANGED
@@ -42,7 +42,18 @@ Example:
42
42
 
43
43
  puts service.DescribeRegions parameters
44
44
 
45
- You can create/fetch `access key`/`secret` at [https://i.aliyun.com/access_key](https://i.aliyun.com/access_key)
45
+ You can create/fetch `access key` and `secret` at [https://i.aliyun.com/access_key](https://i.aliyun.com/access_key)
46
+
47
+ Current support these services:
48
+
49
+ * `:cdn` => `CDN` (Content Delivery Network)
50
+ * `:cms` => `CMS` (Cloud Monitor Service)
51
+ * `:dns` => `DNS` (Domain Name Service)
52
+ * `:ecs` => `ECS` (Elastic Compute Service)
53
+ * `:ram` => `RAM` (Resource Access Management)
54
+ * `:rds` => `RDS` (Relational Database Service)
55
+ * `:slb` => `SLB` (Server Load Balancer)
56
+ * `:sts` => `STS` (Security Token Service)
46
57
 
47
58
  ## Contributing
48
59
 
@@ -1,5 +1,6 @@
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"
@@ -10,6 +11,7 @@ module Aliyun
10
11
  SERVICES = {
11
12
  :cdn => CDNConfig,
12
13
  :cms => CMSConfig,
14
+ :dns => DNSConfig,
13
15
  :ecs => ECSConfig,
14
16
  :ram => RAMConfig,
15
17
  :rds => RDSConfig,
@@ -4,7 +4,7 @@ module Aliyun
4
4
  "Aliyu CMS Service"
5
5
  end
6
6
  def self.endpoint
7
- 'https://metrics.aliyuncs.com/'
7
+ 'http://metrics.aliyuncs.com/'
8
8
  end
9
9
  def self.default_parameters
10
10
  {
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Aliyun
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -9,4 +9,24 @@ describe Aliyun do
9
9
  expect(service).to be_instance_of(Aliyun::Service)
10
10
  expect(service.service).to be(Aliyun::CMSConfig)
11
11
  end
12
+
13
+ it 'can describe metric datum' do
14
+ options = load_options
15
+ options[:service] = :cms
16
+ service = Aliyun::Service.new options
17
+ instanceId = load_ecs_instance_id
18
+ instanceRegion = load_ecs_instance_region
19
+ parameters = {
20
+ Namespace: 'acs/ecs',
21
+ MetricName: 'vm.DiskUtilization',
22
+ StartTime: (Time.now - 180).utc.iso8601,
23
+ Dimensions: "{instanceId:'%s',mountpoint:'/'}" % instanceId,
24
+ RegionId: instanceRegion,
25
+ Length: 1000
26
+ }
27
+ metric_datum = service.DescribeMetricDatum parameters
28
+
29
+ expect(metric_datum).to have_key("Datapoints")
30
+ expect(metric_datum["Datapoints"]).to have_key("Datapoint")
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
data/spec/spec_helper.rb CHANGED
@@ -5,3 +5,10 @@ require 'yaml'
5
5
  def load_options
6
6
  {:access_key_id => ENV['ACCESS_KEY_ID'], :access_key_secret => ENV['ACCESS_KEY_SECRET']}
7
7
  end
8
+
9
+ def load_ecs_instance_id
10
+ ENV['ECS_InstanceId']
11
+ end
12
+ def load_ecs_instance_region
13
+ ENV['ECS_InstanceRegion']
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Lantao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,6 +103,7 @@ files:
103
103
  - lib/aliyun/services.rb
104
104
  - lib/aliyun/services/cdn.rb
105
105
  - lib/aliyun/services/cms.rb
106
+ - lib/aliyun/services/dns.rb
106
107
  - lib/aliyun/services/ecs.rb
107
108
  - lib/aliyun/services/ram.rb
108
109
  - lib/aliyun/services/rds.rb
@@ -111,6 +112,7 @@ files:
111
112
  - lib/aliyun/version.rb
112
113
  - spec/aliyun_cdn_spec.rb
113
114
  - spec/aliyun_cms_spec.rb
115
+ - spec/aliyun_dns_spec.rb
114
116
  - spec/aliyun_ecs_spec.rb
115
117
  - spec/aliyun_ram_spec.rb
116
118
  - spec/aliyun_rds_spec.rb
@@ -145,6 +147,7 @@ summary: Ruby wrapper of Aliyun API for system administrator
145
147
  test_files:
146
148
  - spec/aliyun_cdn_spec.rb
147
149
  - spec/aliyun_cms_spec.rb
150
+ - spec/aliyun_dns_spec.rb
148
151
  - spec/aliyun_ecs_spec.rb
149
152
  - spec/aliyun_ram_spec.rb
150
153
  - spec/aliyun_rds_spec.rb