fog-aliyun 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/.rubocop_todo.yml +149 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Rakefile +3 -3
  7. data/fog-aliyun.gemspec +16 -13
  8. data/lib/fog/aliyun.rb +8 -8
  9. data/lib/fog/aliyun/compute.rb +99 -113
  10. data/lib/fog/aliyun/models/compute/eip_address.rb +23 -29
  11. data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -5
  12. data/lib/fog/aliyun/models/compute/image.rb +26 -28
  13. data/lib/fog/aliyun/models/compute/images.rb +2 -6
  14. data/lib/fog/aliyun/models/compute/route_entry.rb +9 -11
  15. data/lib/fog/aliyun/models/compute/route_entrys.rb +7 -7
  16. data/lib/fog/aliyun/models/compute/route_table.rb +10 -11
  17. data/lib/fog/aliyun/models/compute/route_tables.rb +2 -2
  18. data/lib/fog/aliyun/models/compute/security_group.rb +24 -24
  19. data/lib/fog/aliyun/models/compute/security_group_rule.rb +20 -20
  20. data/lib/fog/aliyun/models/compute/security_group_rules.rb +4 -4
  21. data/lib/fog/aliyun/models/compute/security_groups.rb +6 -7
  22. data/lib/fog/aliyun/models/compute/server.rb +42 -43
  23. data/lib/fog/aliyun/models/compute/servers.rb +9 -11
  24. data/lib/fog/aliyun/models/compute/snapshot.rb +15 -15
  25. data/lib/fog/aliyun/models/compute/snapshots.rb +6 -10
  26. data/lib/fog/aliyun/models/compute/volume.rb +36 -40
  27. data/lib/fog/aliyun/models/compute/volumes.rb +7 -11
  28. data/lib/fog/aliyun/models/compute/vpc.rb +18 -19
  29. data/lib/fog/aliyun/models/compute/vpcs.rb +5 -6
  30. data/lib/fog/aliyun/models/compute/vrouter.rb +13 -13
  31. data/lib/fog/aliyun/models/compute/vrouters.rb +4 -5
  32. data/lib/fog/aliyun/models/compute/vswitch.rb +18 -20
  33. data/lib/fog/aliyun/models/compute/vswitches.rb +6 -6
  34. data/lib/fog/aliyun/models/storage/directories.rb +10 -16
  35. data/lib/fog/aliyun/models/storage/directory.rb +8 -8
  36. data/lib/fog/aliyun/models/storage/file.rb +58 -64
  37. data/lib/fog/aliyun/models/storage/files.rb +95 -115
  38. data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +18 -44
  39. data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +12 -36
  40. data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +16 -40
  41. data/lib/fog/aliyun/requests/compute/attach_disk.rb +19 -22
  42. data/lib/fog/aliyun/requests/compute/create_disk.rb +33 -63
  43. data/lib/fog/aliyun/requests/compute/create_image.rb +21 -21
  44. data/lib/fog/aliyun/requests/compute/create_security_group.rb +16 -16
  45. data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +22 -63
  46. data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +23 -61
  47. data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +22 -63
  48. data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +23 -61
  49. data/lib/fog/aliyun/requests/compute/create_server.rb +76 -78
  50. data/lib/fog/aliyun/requests/compute/create_snapshot.rb +12 -26
  51. data/lib/fog/aliyun/requests/compute/create_vpc.rb +11 -38
  52. data/lib/fog/aliyun/requests/compute/create_vswitch.rb +13 -40
  53. data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -35
  54. data/lib/fog/aliyun/requests/compute/delete_image.rb +6 -33
  55. data/lib/fog/aliyun/requests/compute/delete_security_group.rb +13 -13
  56. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +22 -63
  57. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +23 -61
  58. data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +22 -62
  59. data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +23 -61
  60. data/lib/fog/aliyun/requests/compute/delete_server.rb +15 -15
  61. data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +6 -20
  62. data/lib/fog/aliyun/requests/compute/delete_vpc.rb +9 -26
  63. data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +9 -25
  64. data/lib/fog/aliyun/requests/compute/detach_disk.rb +11 -27
  65. data/lib/fog/aliyun/requests/compute/join_security_group.rb +15 -16
  66. data/lib/fog/aliyun/requests/compute/leave_security_group.rb +15 -16
  67. data/lib/fog/aliyun/requests/compute/list_disks.rb +24 -43
  68. data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +26 -52
  69. data/lib/fog/aliyun/requests/compute/list_images.rb +21 -24
  70. data/lib/fog/aliyun/requests/compute/list_route_tables.rb +16 -19
  71. data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +22 -23
  72. data/lib/fog/aliyun/requests/compute/list_security_groups.rb +21 -24
  73. data/lib/fog/aliyun/requests/compute/list_server_types.rb +50 -50
  74. data/lib/fog/aliyun/requests/compute/list_servers.rb +25 -28
  75. data/lib/fog/aliyun/requests/compute/list_snapshots.rb +20 -37
  76. data/lib/fog/aliyun/requests/compute/list_vpcs.rb +12 -29
  77. data/lib/fog/aliyun/requests/compute/list_vrouters.rb +13 -16
  78. data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +14 -31
  79. data/lib/fog/aliyun/requests/compute/list_zones.rb +16 -16
  80. data/lib/fog/aliyun/requests/compute/modify_vpc.rb +17 -17
  81. data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +11 -39
  82. data/lib/fog/aliyun/requests/compute/reboot_server.rb +15 -16
  83. data/lib/fog/aliyun/requests/compute/release_eip_address.rb +12 -36
  84. data/lib/fog/aliyun/requests/compute/start_server.rb +14 -15
  85. data/lib/fog/aliyun/requests/compute/stop_server.rb +13 -14
  86. data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +16 -41
  87. data/lib/fog/aliyun/requests/storage/copy_object.rb +11 -14
  88. data/lib/fog/aliyun/requests/storage/delete_bucket.rb +30 -30
  89. data/lib/fog/aliyun/requests/storage/delete_container.rb +11 -14
  90. data/lib/fog/aliyun/requests/storage/delete_object.rb +20 -22
  91. data/lib/fog/aliyun/requests/storage/get_bucket.rb +141 -148
  92. data/lib/fog/aliyun/requests/storage/get_container.rb +26 -38
  93. data/lib/fog/aliyun/requests/storage/get_containers.rb +20 -32
  94. data/lib/fog/aliyun/requests/storage/get_object.rb +12 -12
  95. data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +11 -11
  96. data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +11 -11
  97. data/lib/fog/aliyun/requests/storage/head_object.rb +11 -11
  98. data/lib/fog/aliyun/requests/storage/list_buckets.rb +40 -47
  99. data/lib/fog/aliyun/requests/storage/list_objects.rb +91 -104
  100. data/lib/fog/aliyun/requests/storage/put_bucket.rb +22 -23
  101. data/lib/fog/aliyun/requests/storage/put_container.rb +12 -12
  102. data/lib/fog/aliyun/requests/storage/put_object.rb +100 -110
  103. data/lib/fog/aliyun/storage.rb +209 -214
  104. data/lib/fog/aliyun/version.rb +1 -1
  105. data/lib/fog/bin/aliyun.rb +5 -5
  106. metadata +55 -4
@@ -3,31 +3,30 @@ module Fog
3
3
  class Aliyun
4
4
  class Real
5
5
  # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vpc&modifyvpcattribute]
6
- def modify_vpc(vpcId,options={})
7
-
6
+ def modify_vpc(vpcId, options = {})
8
7
  action = 'ModifyVpcAttribute'
9
- sigNonce = randonStr()
8
+ sigNonce = randonStr
10
9
  time = Time.new.utc
11
10
 
12
11
  parameters = defalutParameters(action, sigNonce, time)
13
12
  pathUrl = defaultAliyunUri(action, sigNonce, time)
14
13
 
15
- parameters["VpcId"] = vpcId
14
+ parameters['VpcId'] = vpcId
16
15
  pathUrl += '&VpcId='
17
- pathUrl += URI.encode(vpcId,'/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
16
+ pathUrl += URI.encode(vpcId, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
18
17
  name = options[:name]
19
18
  desc = options[:description]
20
19
 
21
20
  if name
22
- parameters["VpcName"] = name
21
+ parameters['VpcName'] = name
23
22
  pathUrl += '&VpcName='
24
- pathUrl += name
23
+ pathUrl += name
25
24
  end
26
25
 
27
26
  if desc
28
- parameters["Description"] = desc
27
+ parameters['Description'] = desc
29
28
  pathUrl += '&Description='
30
- pathUrl += desc
29
+ pathUrl += desc
31
30
  end
32
31
 
33
32
  signature = sign(@aliyun_accesskey_secret, parameters)
@@ -35,19 +34,19 @@ module Fog
35
34
  pathUrl += signature
36
35
 
37
36
  request(
38
- :expects => [200, 203],
39
- :method => 'GET',
40
- :path => pathUrl
37
+ expects: [200, 203],
38
+ method: 'GET',
39
+ path: pathUrl
41
40
  )
42
41
  end
43
42
  end
44
43
 
45
44
  class Mock
46
- def modify_vpc(vpcId, options={})
47
- Fog::Identity::OpenStack.new(:openstack_auth_url => credentials[:openstack_auth_url])
45
+ def modify_vpc(_vpcId, _options = {})
46
+ Fog::Identity::OpenStack.new(openstack_auth_url: credentials[:openstack_auth_url])
48
47
  tenant_id = Fog::Identity::OpenStack::V2::Mock.data[current_tenant][:tenants].keys.first
49
48
  security_group_id = Fog::Mock.random_numbers(2).to_i + 1
50
- self.data[:security_groups][security_group_id.to_s] = {
49
+ data[:security_groups][security_group_id.to_s] = {
51
50
  'tenant_id' => tenant_id,
52
51
  'rules' => [],
53
52
  'id' => security_group_id,
@@ -61,9 +60,10 @@ module Fog
61
60
  'X-Compute-Request-Id' => "req-#{Fog::Mock.random_hex(32)}",
62
61
  'Content-Type' => 'application/json',
63
62
  'Content-Length' => Fog::Mock.random_numbers(3).to_s,
64
- 'Date' => Date.new}
63
+ 'Date' => Date.new
64
+ }
65
65
  response.body = {
66
- 'security_group' => self.data[:security_groups][security_group_id.to_s]
66
+ 'security_group' => data[:security_groups][security_group_id.to_s]
67
67
  }
68
68
  response
69
69
  end
@@ -3,31 +3,30 @@ module Fog
3
3
  class Aliyun
4
4
  class Real
5
5
  # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vswitch&modifyvswitchattribute]
6
- def modify_vpc(vSwitchId,options={})
7
-
6
+ def modify_switch(vSwitchId, options = {})
8
7
  action = 'ModifyVSwitchAttribute'
9
- sigNonce = randonStr()
8
+ sigNonce = randonStr
10
9
  time = Time.new.utc
11
10
 
12
11
  parameters = defalutParameters(action, sigNonce, time)
13
12
  pathUrl = defaultAliyunUri(action, sigNonce, time)
14
13
 
15
- parameters["VSwitchId"] = vSwitchId
14
+ parameters['VSwitchId'] = vSwitchId
16
15
  pathUrl += '&VSwitchId='
17
- pathUrl += URI.encode(vpcId,'/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
16
+ pathUrl += URI.encode(vpcId, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
18
17
  name = options[:name]
19
18
  desc = options[:description]
20
19
 
21
20
  if name
22
- parameters["VSwitchName"] = name
21
+ parameters['VSwitchName'] = name
23
22
  pathUrl += '&VSwitchName='
24
- pathUrl += name
23
+ pathUrl += name
25
24
  end
26
25
 
27
26
  if desc
28
- parameters["Description"] = desc
27
+ parameters['Description'] = desc
29
28
  pathUrl += '&Description='
30
- pathUrl += desc
29
+ pathUrl += desc
31
30
  end
32
31
 
33
32
  signature = sign(@aliyun_accesskey_secret, parameters)
@@ -35,39 +34,12 @@ module Fog
35
34
  pathUrl += signature
36
35
 
37
36
  request(
38
- :expects => [200, 203],
39
- :method => 'GET',
40
- :path => pathUrl
37
+ expects: [200, 203],
38
+ method: 'GET',
39
+ path: pathUrl
41
40
  )
42
41
  end
43
42
  end
44
-
45
- class Mock
46
- def modify_vpc(vpcId, options={})
47
- Fog::Identity::OpenStack.new(:openstack_auth_url => credentials[:openstack_auth_url])
48
- tenant_id = Fog::Identity::OpenStack::V2::Mock.data[current_tenant][:tenants].keys.first
49
- security_group_id = Fog::Mock.random_numbers(2).to_i + 1
50
- self.data[:security_groups][security_group_id.to_s] = {
51
- 'tenant_id' => tenant_id,
52
- 'rules' => [],
53
- 'id' => security_group_id,
54
- 'name' => name,
55
- 'description' => description
56
- }
57
-
58
- response = Excon::Response.new
59
- response.status = 200
60
- response.headers = {
61
- 'X-Compute-Request-Id' => "req-#{Fog::Mock.random_hex(32)}",
62
- 'Content-Type' => 'application/json',
63
- 'Content-Length' => Fog::Mock.random_numbers(3).to_s,
64
- 'Date' => Date.new}
65
- response.body = {
66
- 'security_group' => self.data[:security_groups][security_group_id.to_s]
67
- }
68
- response
69
- end
70
- end # mock
71
43
  end # aliyun
72
44
  end # compute
73
45
  end # fog
@@ -4,36 +4,35 @@ module Fog
4
4
  class Real
5
5
  # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&rebootinstance]
6
6
  def reboot_server(server_id, options = {})
7
-
8
7
  _action = 'RebootInstance'
9
- _sigNonce = randonStr()
8
+ _sigNonce = randonStr
10
9
  _time = Time.new.utc
11
10
 
12
11
  _parameters = defalutParameters(_action, _sigNonce, _time)
13
- _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
14
-
15
- _parameters['InstanceId']=server_id
16
- _pathURL += '&InstanceId='+server_id
17
-
12
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
13
+
14
+ _parameters['InstanceId'] = server_id
15
+ _pathURL += '&InstanceId=' + server_id
16
+
18
17
  _ForceStop = options[:aliyun_ForceStop]
19
18
  if _ForceStop
20
- _parameters['ForceStop']=_ForceStop
21
- _pathURL += '&ForceStop='+_ForceStop
19
+ _parameters['ForceStop'] = _ForceStop
20
+ _pathURL += '&ForceStop=' + _ForceStop
22
21
  end
23
-
22
+
24
23
  _signature = sign(@aliyun_accesskey_secret, _parameters)
25
- _pathURL += '&Signature='+_signature
26
-
24
+ _pathURL += '&Signature=' + _signature
25
+
27
26
  request(
28
- :expects => [200, 204],
29
- :method => 'GET',
30
- :path => _pathURL
27
+ expects: [200, 204],
28
+ method: 'GET',
29
+ path: _pathURL
31
30
  )
32
31
  end
33
32
  end
34
33
 
35
34
  class Mock
36
- def reboot_server(server_id, type = 'SOFT')
35
+ def reboot_server(_server_id, _type = 'SOFT')
37
36
  response = Excon::Response.new
38
37
  response.status = 202
39
38
  response
@@ -2,52 +2,28 @@ module Fog
2
2
  module Compute
3
3
  class Aliyun
4
4
  class Real
5
- # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/network&releaseeipaddress]
5
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/network&releaseeipaddress]
6
6
  def release_eip_address(allocationId)
7
-
8
7
  _action = 'ReleaseEipAddress'
9
- _sigNonce = randonStr()
8
+ _sigNonce = randonStr
10
9
  _time = Time.new.utc
11
10
 
12
11
  _parameters = defalutParameters(_action, _sigNonce, _time)
13
- _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
14
-
12
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
13
+
15
14
  _parameters['AllocationId'] = allocationId
16
- _pathURL += '&AllocationId='+allocationId
17
-
15
+ _pathURL += '&AllocationId=' + allocationId
16
+
18
17
  _signature = sign(@aliyun_accesskey_secret, _parameters)
19
- _pathURL += '&Signature='+_signature
20
-
18
+ _pathURL += '&Signature=' + _signature
19
+
21
20
  request(
22
- :expects => [200, 204],
23
- :method => 'GET',
24
- :path => _pathURL
21
+ expects: [200, 204],
22
+ method: 'GET',
23
+ path: _pathURL
25
24
  )
26
25
  end
27
26
  end
28
-
29
- class Mock
30
- def allocate_address(pool = nil)
31
- response = Excon::Response.new
32
- response.status = 200
33
- response.headers = {
34
- "X-Compute-Request-Id" => "req-d4a21158-a86c-44a6-983a-e25645907f26",
35
- "Content-Type" => "application/json",
36
- "Content-Length" => "105",
37
- "Date"=> Date.new
38
- }
39
- response.body = {
40
- "floating_ip" => {
41
- "instance_id" => nil,
42
- "ip" => "192.168.27.132",
43
- "fixed_ip" => nil,
44
- "id" => 4,
45
- "pool"=>"nova"
46
- }
47
- }
48
- response
49
- end
50
- end # mock
51
27
  end # aliyun
52
- end #compute
28
+ end # compute
53
29
  end
@@ -8,35 +8,34 @@ module Fog
8
8
  # * server_id <~String> - The ID of the server to be started.
9
9
  # === Returns
10
10
  # * success <~Boolean>
11
- # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&staetinstance]
11
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&staetinstance]
12
12
  def start_server(server_id)
13
-
14
13
  _action = 'StartInstance'
15
- _sigNonce = randonStr()
14
+ _sigNonce = randonStr
16
15
  _time = Time.new.utc
17
16
 
18
17
  _parameters = defalutParameters(_action, _sigNonce, _time)
19
- _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
20
-
21
- _parameters['InstanceId']=server_id
22
- _pathURL += '&InstanceId='+server_id
23
-
18
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
19
+
20
+ _parameters['InstanceId'] = server_id
21
+ _pathURL += '&InstanceId=' + server_id
22
+
24
23
  _signature = sign(@aliyun_accesskey_secret, _parameters)
25
- _pathURL += '&Signature='+_signature
26
-
24
+ _pathURL += '&Signature=' + _signature
25
+
27
26
  request(
28
- :expects => [200, 204],
29
- :method => 'GET',
30
- :path => _pathURL
27
+ expects: [200, 204],
28
+ method: 'GET',
29
+ path: _pathURL
31
30
  )
32
31
  end # def start_server
33
32
  end # class Real
34
33
 
35
34
  class Mock
36
- def start_server(server_id)
35
+ def start_server(_server_id)
37
36
  true
38
37
  end # def start_server
39
38
  end # class Mock
40
39
  end # class aliyun
41
40
  end # module Compute
42
- end # module Fog
41
+ end # module Fog
@@ -10,33 +10,32 @@ module Fog
10
10
  # * success <~Boolean>
11
11
  # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&stopinstance]
12
12
  def stop_server(server_id)
13
-
14
13
  _action = 'StopInstance'
15
- _sigNonce = randonStr()
14
+ _sigNonce = randonStr
16
15
  _time = Time.new.utc
17
16
 
18
17
  _parameters = defalutParameters(_action, _sigNonce, _time)
19
- _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
20
-
21
- _parameters['InstanceId']=server_id
22
- _pathURL += '&InstanceId='+server_id
23
-
18
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
19
+
20
+ _parameters['InstanceId'] = server_id
21
+ _pathURL += '&InstanceId=' + server_id
22
+
24
23
  _signature = sign(@aliyun_accesskey_secret, _parameters)
25
- _pathURL += '&Signature='+_signature
26
-
24
+ _pathURL += '&Signature=' + _signature
25
+
27
26
  request(
28
- :expects => [200, 204],
29
- :method => 'GET',
30
- :path => _pathURL
27
+ expects: [200, 204],
28
+ method: 'GET',
29
+ path: _pathURL
31
30
  )
32
31
  end # def stop_server
33
32
  end # class Real
34
33
 
35
34
  class Mock
36
- def stop_server(server_id)
35
+ def stop_server(_server_id)
37
36
  true
38
37
  end # def stop_server
39
38
  end # class Mock
40
39
  end # class aliyun
41
40
  end # module Compute
42
- end # module Fog
41
+ end # module Fog
@@ -13,62 +13,37 @@ module Fog
13
13
  # * 'RequestId'<~String> - Id of the request
14
14
  #
15
15
  # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.201.106.DGkmH7#/pub/ecs/open-api/network&associateeipaddresss]
16
- def unassociate_eip_address(server_id, allocationId, options={})
17
-
16
+ def unassociate_eip_address(server_id, allocationId, options = {})
18
17
  _action = 'UnassociateEipAddress'
19
- _sigNonce = randonStr()
18
+ _sigNonce = randonStr
20
19
  _time = Time.new.utc
21
20
 
22
- type=options['instance_type']
21
+ type = options['instance_type']
23
22
 
24
23
  _parameters = defalutParameters(_action, _sigNonce, _time)
25
- _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
26
-
24
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
25
+
27
26
  _parameters['InstanceId'] = server_id
28
- _pathURL += '&InstanceId='+server_id
29
-
27
+ _pathURL += '&InstanceId=' + server_id
28
+
30
29
  _parameters['AllocationId'] = allocationId
31
- _pathURL += '&AllocationId='+allocationId
30
+ _pathURL += '&AllocationId=' + allocationId
32
31
 
33
32
  if type
34
33
  _parameters['InstanceType'] = type
35
- _pathURL += 'InstanceType='+type
34
+ _pathURL += 'InstanceType=' + type
36
35
  end
37
-
36
+
38
37
  _signature = sign(@aliyun_accesskey_secret, _parameters)
39
- _pathURL += '&Signature='+_signature
40
-
38
+ _pathURL += '&Signature=' + _signature
39
+
41
40
  request(
42
- :expects => [200, 204],
43
- :method => 'GET',
44
- :path => _pathURL
41
+ expects: [200, 204],
42
+ method: 'GET',
43
+ path: _pathURL
45
44
  )
46
45
  end
47
46
  end
48
-
49
- class Mock
50
- def allocate_address(pool = nil)
51
- response = Excon::Response.new
52
- response.status = 200
53
- response.headers = {
54
- "X-Compute-Request-Id" => "req-d4a21158-a86c-44a6-983a-e25645907f26",
55
- "Content-Type" => "application/json",
56
- "Content-Length" => "105",
57
- "Date"=> Date.new
58
- }
59
- response.body = {
60
- "floating_ip" => {
61
- "instance_id" => nil,
62
- "ip" => "192.168.27.132",
63
- "fixed_ip" => nil,
64
- "id" => 4,
65
- "pool"=>"nova"
66
- }
67
- }
68
- response
69
- end
70
- end # mock
71
47
  end # aliyun
72
- end #compute
48
+ end # compute
73
49
  end
74
-