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,14 +3,13 @@ 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/instance&describeinstances]
6
- def list_servers(options={})
7
-
6
+ def list_servers(options = {})
8
7
  _action = 'DescribeInstances'
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)
12
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
14
13
 
15
14
  _InstanceId = options[:instanceId]
16
15
  _VpcId = options[:vpcId]
@@ -18,51 +17,49 @@ module Fog
18
17
  _PageNumber = options[:pageNumber]
19
18
  _PageSize = options[:pageSize]
20
19
 
21
- if _InstanceId != nil
20
+ unless _InstanceId.nil?
22
21
  _InstanceStr = "[\"#{_InstanceId}\"]"
23
22
  _parameters['InstanceIds'] = _InstanceStr
24
- _pathURL += '&InstanceIds='+_InstanceStr
23
+ _pathURL += '&InstanceIds=' + _InstanceStr
25
24
  end
26
25
 
27
- if _VpcId != nil
26
+ unless _VpcId.nil?
28
27
  _parameters['VpcId'] = _VpcId
29
- _pathURL += '&VpcId='+_VpcId
28
+ _pathURL += '&VpcId=' + _VpcId
30
29
  end
31
30
 
32
- if _SecurityGroupId != nil
33
- _parameters['SecurityGroupId']=_SecurityGroupId
34
- _pathURL += '&SecurityGroupId='+_SecurityGroupId
35
- end
36
-
37
- if _PageNumber != nil
38
- _parameters['PageNumber']=_PageNumber
39
- _pathURL += '&PageNumber='+_PageNumber
31
+ unless _SecurityGroupId.nil?
32
+ _parameters['SecurityGroupId'] = _SecurityGroupId
33
+ _pathURL += '&SecurityGroupId=' + _SecurityGroupId
40
34
  end
41
-
42
- unless _PageSize
43
- _PageSize = '50'
35
+
36
+ unless _PageNumber.nil?
37
+ _parameters['PageNumber'] = _PageNumber
38
+ _pathURL += '&PageNumber=' + _PageNumber
44
39
  end
45
- _parameters['PageSize']=_PageSize
46
- _pathURL += '&PageSize='+_PageSize
40
+
41
+ _PageSize = '50' unless _PageSize
42
+ _parameters['PageSize'] = _PageSize
43
+ _pathURL += '&PageSize=' + _PageSize
47
44
 
48
45
  _signature = sign(@aliyun_accesskey_secret, _parameters)
49
- _pathURL += '&Signature='+_signature
46
+ _pathURL += '&Signature=' + _signature
50
47
 
51
48
  request(
52
- :expects => [200, 203],
53
- :method => 'GET',
54
- :path => _pathURL
49
+ expects: [200, 203],
50
+ method: 'GET',
51
+ path: _pathURL
55
52
  )
56
53
  end
57
54
  end
58
55
 
59
56
  class Mock
60
- def list_servers(options = {})
57
+ def list_servers(_options = {})
61
58
  response = Excon::Response.new
62
59
  data = list_servers_detail.body['servers']
63
60
  servers = []
64
61
  for server in data
65
- servers << server.reject { |key, value| !['id', 'name', 'links'].include?(key) }
62
+ servers << server.reject { |key, _value| !%w(id name links).include?(key) }
66
63
  end
67
64
  response.status = [200, 203][rand(1)]
68
65
  response.body = { 'servers' => servers }
@@ -71,4 +68,4 @@ module Fog
71
68
  end
72
69
  end
73
70
  end
74
- end
71
+ end
@@ -3,10 +3,9 @@ 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/snapshot&describesnapshots]
6
- def list_snapshots(options={})
7
-
6
+ def list_snapshots(options = {})
8
7
  action = 'DescribeSnapshots'
9
- sigNonce = randonStr()
8
+ sigNonce = randonStr
10
9
  time = Time.new.utc
11
10
 
12
11
  parameters = defalutParameters(action, sigNonce, time)
@@ -24,91 +23,75 @@ module Fog
24
23
  usage = options[:usage]
25
24
 
26
25
  if usage
27
- parameters["Usage"] = usage
26
+ parameters['Usage'] = usage
28
27
  pathUrl += '&Usage='
29
28
  pathUrl += usage
30
29
  end
31
30
 
32
31
  if type
33
- parameters["SnapshotType"] = type
32
+ parameters['SnapshotType'] = type
34
33
  pathUrl += '&SnapshotType='
35
34
  pathUrl += type
36
35
  end
37
36
 
38
37
  if state
39
- parameters["Status"] = state
38
+ parameters['Status'] = state
40
39
  pathUrl += '&Status='
41
40
  pathUrl += state
42
41
  end
43
42
 
44
43
  if name
45
- parameters["SnapshotName"] = name
44
+ parameters['SnapshotName'] = name
46
45
  pathUrl += '&SnapshotName='
47
46
  pathUrl += name
48
47
  end
49
48
 
50
49
  if instanceId
51
- parameters["InstanceId"] = instanceId
50
+ parameters['InstanceId'] = instanceId
52
51
  pathUrl += '&InstanceId='
53
52
  pathUrl += instanceId
54
53
  end
55
54
 
56
55
  if diskId
57
- parameters["DiskId"] = diskId
56
+ parameters['DiskId'] = diskId
58
57
  pathUrl += '&DiskId='
59
58
  pathUrl += diskId
60
- end
59
+ end
61
60
 
62
61
  if snapshotId
63
- parameters["SnapshotIds"] = Fog::JSON.encode(snapshotId)
62
+ parameters['SnapshotIds'] = Fog::JSON.encode(snapshotId)
64
63
  pathUrl += '&SnapshotIds='
65
64
  pathUrl += Fog::JSON.encode(snapshotId)
66
65
  end
67
-
66
+
68
67
  if sourceDiskType
69
- parameters["SourceDiskType"] = sourceDiskType
68
+ parameters['SourceDiskType'] = sourceDiskType
70
69
  pathUrl += '&SourceDiskType='
71
70
  pathUrl += sourceDiskType
72
71
  end
73
-
72
+
74
73
  if pageNumber
75
- parameters["PageNumber"] = pageNumber
74
+ parameters['PageNumber'] = pageNumber
76
75
  pathUrl += '&PageNumber='
77
76
  pathUrl += pageNumber
78
77
  end
79
78
 
80
- unless pageSize
81
- pageSize = '50'
82
- end
83
- parameters["PageSize"] = pageSize
79
+ pageSize = '50' unless pageSize
80
+ parameters['PageSize'] = pageSize
84
81
  pathUrl += '&PageSize='
85
- pathUrl += pageSize
82
+ pathUrl += pageSize
86
83
 
87
84
  signature = sign(@aliyun_accesskey_secret, parameters)
88
85
  pathUrl += '&Signature='
89
86
  pathUrl += signature
90
87
 
91
88
  request(
92
- :expects => [200, 203],
93
- :method => 'GET',
94
- :path => pathUrl
89
+ expects: [200, 203],
90
+ method: 'GET',
91
+ path: pathUrl
95
92
  )
96
93
  end
97
94
  end
98
-
99
- class Mock
100
- def list_images
101
- response = Excon::Response.new
102
- data = list_images_detail.body['images']
103
- images = []
104
- for image in data
105
- images << image.reject { |key, value| !['id', 'name', 'links'].include?(key) }
106
- end
107
- response.status = [200, 203][rand(1)]
108
- response.body = { 'images' => images }
109
- response
110
- end
111
- end
112
95
  end
113
96
  end
114
97
  end
@@ -3,62 +3,45 @@ 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&describevpcs]
6
- def list_vpcs(options={})
7
-
6
+ def list_vpcs(options = {})
8
7
  action = 'DescribeVpcs'
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
- _VpcId = options[:vpcId]
14
+ _VpcId = options[:vpcId]
16
15
  if _VpcId
17
- parameters["VpcId"] = _VpcId
16
+ parameters['VpcId'] = _VpcId
18
17
  pathUrl += '&VpcId='
19
18
  pathUrl += _VpcId
20
19
  end
21
20
 
22
21
  pageNumber = options[:pageNumber]
23
- pageSize = options[:pageSize]
22
+ pageSize = options[:pageSize]
24
23
  if pageNumber
25
- parameters["PageNumber"] = pageNumber
24
+ parameters['PageNumber'] = pageNumber
26
25
  pathUrl += '&PageNumber='
27
26
  pathUrl += pageNumber
28
27
  end
29
28
 
30
- unless pageSize
31
- pageSize = '50'
32
- end
33
- parameters["PageSize"] = pageSize
29
+ pageSize = '50' unless pageSize
30
+ parameters['PageSize'] = pageSize
34
31
  pathUrl += '&PageSize='
35
- pathUrl += pageSize
32
+ pathUrl += pageSize
36
33
 
37
34
  signature = sign(@aliyun_accesskey_secret, parameters)
38
35
  pathUrl += '&Signature='
39
36
  pathUrl += signature
40
37
 
41
38
  request(
42
- :expects => [200, 203],
43
- :method => 'GET',
44
- :path => pathUrl
39
+ expects: [200, 203],
40
+ method: 'GET',
41
+ path: pathUrl
45
42
  )
46
43
  end
47
44
  end
48
-
49
- class Mock
50
- def list_images
51
- response = Excon::Response.new
52
- data = list_images_detail.body['images']
53
- images = []
54
- for image in data
55
- images << image.reject { |key, value| !['id', 'name', 'links'].include?(key) }
56
- end
57
- response.status = [200, 203][rand(1)]
58
- response.body = { 'images' => images }
59
- response
60
- end
61
- end
62
45
  end
63
46
  end
64
47
  end
@@ -3,45 +3,42 @@ 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&describevpcs]
6
- def list_vrouters(options={})
7
-
6
+ def list_vrouters(options = {})
8
7
  action = 'DescribeVrouters'
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
- _VRouterId = options[:vRouterId]
14
+ _VRouterId = options[:vRouterId]
16
15
  if _VRouterId
17
- parameters["VRouterId"] = _VRouterId
16
+ parameters['VRouterId'] = _VRouterId
18
17
  pathUrl += '&VRouterId='
19
18
  pathUrl += _VRouterId
20
19
  end
21
20
 
22
21
  pageNumber = options[:pageNumber]
23
- pageSize = options[:pageSize]
22
+ pageSize = options[:pageSize]
24
23
  if pageNumber
25
- parameters["PageNumber"] = pageNumber
24
+ parameters['PageNumber'] = pageNumber
26
25
  pathUrl += '&PageNumber='
27
26
  pathUrl += pageNumber
28
27
  end
29
28
 
30
- unless pageSize
31
- pageSize = '50'
32
- end
33
- parameters["PageSize"] = pageSize
29
+ pageSize = '50' unless pageSize
30
+ parameters['PageSize'] = pageSize
34
31
  pathUrl += '&PageSize='
35
- pathUrl += pageSize
32
+ pathUrl += pageSize
36
33
 
37
34
  signature = sign(@aliyun_accesskey_secret, parameters)
38
35
  pathUrl += '&Signature='
39
36
  pathUrl += signature
40
37
 
41
38
  request(
42
- :expects => [200, 203],
43
- :method => 'GET',
44
- :path => pathUrl
39
+ expects: [200, 203],
40
+ method: 'GET',
41
+ path: pathUrl
45
42
  )
46
43
  end
47
44
  end
@@ -52,7 +49,7 @@ module Fog
52
49
  data = list_images_detail.body['VRouters']
53
50
  images = []
54
51
  for image in data
55
- images << image.reject { |key, value| !['id', 'name', 'links'].include?(key) }
52
+ images << image.reject { |key, _value| !%w(id name links).include?(key) }
56
53
  end
57
54
  response.status = [200, 203][rand(1)]
58
55
  response.body = { 'VRouter' => images }
@@ -3,65 +3,48 @@ 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&describevswitches]
6
- def list_vswitchs(vpcid, options={})
7
-
6
+ def list_vswitchs(vpcid, options = {})
8
7
  action = 'DescribeVSwitches'
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
16
  pathUrl += vpcid
18
17
 
19
18
  pageNumber = options[:pageNumber]
20
- pageSize = options[:pageSize]
21
- vswitchId = options[:vSwitchId]
19
+ pageSize = options[:pageSize]
20
+ vswitchId = options[:vSwitchId]
22
21
  if vswitchId
23
- parameters["VSwitchId"] = vswitchId
24
- pathUrl +='&VSwitchId='
22
+ parameters['VSwitchId'] = vswitchId
23
+ pathUrl += '&VSwitchId='
25
24
  pathUrl += vswitchId
26
25
  end
27
26
  if pageNumber
28
- parameters["PageNumber"] = pageNumber
27
+ parameters['PageNumber'] = pageNumber
29
28
  pathUrl += '&PageNumber='
30
29
  pathUrl += pageNumber
31
30
  end
32
31
 
33
- unless pageSize
34
- pageSize = '50'
35
- end
36
- parameters["PageSize"] = pageSize
32
+ pageSize = '50' unless pageSize
33
+ parameters['PageSize'] = pageSize
37
34
  pathUrl += '&PageSize='
38
- pathUrl += pageSize
35
+ pathUrl += pageSize
39
36
 
40
37
  signature = sign(@aliyun_accesskey_secret, parameters)
41
38
  pathUrl += '&Signature='
42
39
  pathUrl += signature
43
40
 
44
41
  request(
45
- :expects => [200, 203],
46
- :method => 'GET',
47
- :path => pathUrl
42
+ expects: [200, 203],
43
+ method: 'GET',
44
+ path: pathUrl
48
45
  )
49
46
  end
50
47
  end
51
-
52
- class Mock
53
- def list_images
54
- response = Excon::Response.new
55
- data = list_images_detail.body['images']
56
- images = []
57
- for image in data
58
- images << image.reject { |key, value| !['id', 'name', 'links'].include?(key) }
59
- end
60
- response.status = [200, 203][rand(1)]
61
- response.body = { 'images' => images }
62
- response
63
- end
64
- end
65
48
  end
66
49
  end
67
50
  end
@@ -3,9 +3,9 @@ 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/region&describezones]
6
- def list_zones()
6
+ def list_zones
7
7
  action = 'DescribeZones'
8
- sigNonce = randonStr()
8
+ sigNonce = randonStr
9
9
  time = Time.new.utc
10
10
 
11
11
  parameters = defalutParameters(action, sigNonce, time)
@@ -16,26 +16,26 @@ module Fog
16
16
  pathUrl += signature
17
17
 
18
18
  request(
19
- :expects => [200, 203],
20
- :method => 'GET',
21
- :path => pathUrl
19
+ expects: [200, 203],
20
+ method: 'GET',
21
+ path: pathUrl
22
22
  )
23
23
  end
24
24
  end
25
25
 
26
26
  class Mock
27
- def list_zones(*args)
27
+ def list_zones(*_args)
28
28
  Excon::Response.new(
29
- :body => { "availabilityZoneInfo" => [
30
- {
31
- "zoneState" => {
32
- "available" => true
33
- },
34
- "hosts" => nil,
35
- "zoneName" => "nova"
36
- }
37
- ] },
38
- :status => 200
29
+ body: { 'availabilityZoneInfo' => [
30
+ {
31
+ 'zoneState' => {
32
+ 'available' => true
33
+ },
34
+ 'hosts' => nil,
35
+ 'zoneName' => 'nova'
36
+ }
37
+ ] },
38
+ status: 200
39
39
  )
40
40
  end
41
41
  end