fog-aliyun 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +23 -10
  3. data/.rubocop.yml +31 -4
  4. data/.rubocop_todo.yml +83 -55
  5. data/Gemfile +2 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +4 -3
  8. data/fog-aliyun.gemspec +19 -18
  9. data/lib/fog/aliyun.rb +4 -2
  10. data/lib/fog/aliyun/compute.rb +45 -43
  11. data/lib/fog/aliyun/models/compute/eip_address.rb +10 -8
  12. data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -3
  13. data/lib/fog/aliyun/models/compute/image.rb +23 -21
  14. data/lib/fog/aliyun/models/compute/images.rb +2 -0
  15. data/lib/fog/aliyun/models/compute/route_entry.rb +7 -5
  16. data/lib/fog/aliyun/models/compute/route_entrys.rb +2 -0
  17. data/lib/fog/aliyun/models/compute/route_table.rb +6 -4
  18. data/lib/fog/aliyun/models/compute/route_tables.rb +3 -3
  19. data/lib/fog/aliyun/models/compute/security_group.rb +7 -5
  20. data/lib/fog/aliyun/models/compute/security_group_rule.rb +15 -13
  21. data/lib/fog/aliyun/models/compute/security_group_rules.rb +2 -0
  22. data/lib/fog/aliyun/models/compute/security_groups.rb +2 -0
  23. data/lib/fog/aliyun/models/compute/server.rb +28 -26
  24. data/lib/fog/aliyun/models/compute/servers.rb +3 -3
  25. data/lib/fog/aliyun/models/compute/snapshot.rb +12 -10
  26. data/lib/fog/aliyun/models/compute/snapshots.rb +2 -0
  27. data/lib/fog/aliyun/models/compute/volume.rb +27 -25
  28. data/lib/fog/aliyun/models/compute/volumes.rb +2 -0
  29. data/lib/fog/aliyun/models/compute/vpc.rb +12 -10
  30. data/lib/fog/aliyun/models/compute/vpcs.rb +3 -3
  31. data/lib/fog/aliyun/models/compute/vrouter.rb +8 -6
  32. data/lib/fog/aliyun/models/compute/vrouters.rb +3 -3
  33. data/lib/fog/aliyun/models/compute/vswitch.rb +11 -9
  34. data/lib/fog/aliyun/models/compute/vswitches.rb +3 -3
  35. data/lib/fog/aliyun/models/storage/directories.rb +3 -1
  36. data/lib/fog/aliyun/models/storage/directory.rb +2 -0
  37. data/lib/fog/aliyun/models/storage/file.rb +18 -16
  38. data/lib/fog/aliyun/models/storage/files.rb +13 -19
  39. data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +5 -3
  40. data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +4 -2
  41. data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +4 -2
  42. data/lib/fog/aliyun/requests/compute/attach_disk.rb +7 -5
  43. data/lib/fog/aliyun/requests/compute/create_disk.rb +15 -13
  44. data/lib/fog/aliyun/requests/compute/create_image.rb +3 -1
  45. data/lib/fog/aliyun/requests/compute/create_security_group.rb +11 -9
  46. data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +13 -11
  47. data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +12 -10
  48. data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +13 -11
  49. data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +12 -10
  50. data/lib/fog/aliyun/requests/compute/create_server.rb +11 -9
  51. data/lib/fog/aliyun/requests/compute/create_snapshot.rb +3 -1
  52. data/lib/fog/aliyun/requests/compute/create_vpc.rb +6 -4
  53. data/lib/fog/aliyun/requests/compute/create_vpn_connection.rb +8 -6
  54. data/lib/fog/aliyun/requests/compute/create_vpn_customergateway.rb +6 -6
  55. data/lib/fog/aliyun/requests/compute/create_vswitch.rb +6 -4
  56. data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -6
  57. data/lib/fog/aliyun/requests/compute/delete_image.rb +3 -1
  58. data/lib/fog/aliyun/requests/compute/delete_security_group.rb +7 -5
  59. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +13 -11
  60. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +12 -10
  61. data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +13 -11
  62. data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +12 -10
  63. data/lib/fog/aliyun/requests/compute/delete_server.rb +2 -0
  64. data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +3 -1
  65. data/lib/fog/aliyun/requests/compute/delete_vpc.rb +6 -4
  66. data/lib/fog/aliyun/requests/compute/delete_vpn_connection.rb +6 -4
  67. data/lib/fog/aliyun/requests/compute/delete_vpn_customergateway.rb +6 -4
  68. data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +6 -4
  69. data/lib/fog/aliyun/requests/compute/detach_disk.rb +6 -4
  70. data/lib/fog/aliyun/requests/compute/join_security_group.rb +2 -0
  71. data/lib/fog/aliyun/requests/compute/leave_security_group.rb +2 -0
  72. data/lib/fog/aliyun/requests/compute/list_disks.rb +5 -3
  73. data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +5 -3
  74. data/lib/fog/aliyun/requests/compute/list_images.rb +5 -3
  75. data/lib/fog/aliyun/requests/compute/list_route_tables.rb +6 -4
  76. data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +7 -5
  77. data/lib/fog/aliyun/requests/compute/list_security_groups.rb +10 -8
  78. data/lib/fog/aliyun/requests/compute/list_server_types.rb +8 -6
  79. data/lib/fog/aliyun/requests/compute/list_servers.rb +4 -2
  80. data/lib/fog/aliyun/requests/compute/list_snapshots.rb +4 -2
  81. data/lib/fog/aliyun/requests/compute/list_vpcs.rb +5 -3
  82. data/lib/fog/aliyun/requests/compute/list_vpn_connections.rb +49 -49
  83. data/lib/fog/aliyun/requests/compute/list_vpn_customergateways.rb +42 -43
  84. data/lib/fog/aliyun/requests/compute/list_vpn_gateways.rb +49 -49
  85. data/lib/fog/aliyun/requests/compute/list_vrouters.rb +6 -4
  86. data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +6 -4
  87. data/lib/fog/aliyun/requests/compute/list_zones.rb +3 -1
  88. data/lib/fog/aliyun/requests/compute/modify_vpc.rb +7 -5
  89. data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +6 -4
  90. data/lib/fog/aliyun/requests/compute/reboot_server.rb +2 -0
  91. data/lib/fog/aliyun/requests/compute/release_eip_address.rb +4 -2
  92. data/lib/fog/aliyun/requests/compute/start_server.rb +9 -7
  93. data/lib/fog/aliyun/requests/compute/stop_server.rb +9 -7
  94. data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +4 -2
  95. data/lib/fog/aliyun/requests/storage/copy_object.rb +3 -2
  96. data/lib/fog/aliyun/requests/storage/delete_bucket.rb +3 -2
  97. data/lib/fog/aliyun/requests/storage/delete_container.rb +3 -2
  98. data/lib/fog/aliyun/requests/storage/delete_object.rb +4 -3
  99. data/lib/fog/aliyun/requests/storage/get_bucket.rb +6 -11
  100. data/lib/fog/aliyun/requests/storage/get_container.rb +3 -2
  101. data/lib/fog/aliyun/requests/storage/get_containers.rb +3 -2
  102. data/lib/fog/aliyun/requests/storage/get_object.rb +4 -3
  103. data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +5 -4
  104. data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +5 -4
  105. data/lib/fog/aliyun/requests/storage/head_object.rb +3 -2
  106. data/lib/fog/aliyun/requests/storage/list_buckets.rb +3 -2
  107. data/lib/fog/aliyun/requests/storage/list_objects.rb +5 -4
  108. data/lib/fog/aliyun/requests/storage/put_bucket.rb +3 -2
  109. data/lib/fog/aliyun/requests/storage/put_container.rb +3 -2
  110. data/lib/fog/aliyun/requests/storage/put_object.rb +12 -17
  111. data/lib/fog/aliyun/storage.rb +41 -52
  112. data/lib/fog/aliyun/version.rb +3 -1
  113. data/lib/fog/bin/aliyun.rb +10 -7
  114. metadata +37 -37
@@ -1,43 +1,42 @@
1
- module Fog
2
- module Compute
3
- class Aliyun
4
- class Real
5
- # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vpc&describevpcs]
6
- def list_vpn_customergateways(options = {})
7
- action = 'DescribeCustomerGateways'
8
- sigNonce = randonStr
9
- time = Time.new.utc
10
-
11
- parameters = defalutVPCParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
13
-
14
-
15
- pageNumber = options[:pageNumber]
16
- pageSize = options[:pageSize]
17
- if pageNumber
18
- parameters['PageNumber'] = pageNumber
19
- pathUrl += '&PageNumber='
20
- pathUrl += pageNumber
21
- end
22
-
23
- pageSize = '50' unless pageSize
24
- parameters['PageSize'] = pageSize
25
- pathUrl += '&PageSize='
26
- pathUrl += pageSize
27
-
28
- signature = sign(@aliyun_accesskey_secret, parameters)
29
- pathUrl += '&Signature='
30
- pathUrl += signature
31
-
32
- VPCrequest(
33
- expects: [200, 203],
34
- method: 'GET',
35
- path: pathUrl
36
- )
37
- end
38
- end
39
-
40
-
41
- end
42
- end
43
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fog
4
+ module Compute
5
+ class Aliyun
6
+ class Real
7
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vpc&describevpcs]
8
+ def list_vpn_customergateways(options = {})
9
+ action = 'DescribeCustomerGateways'
10
+ sigNonce = randonStr
11
+ time = Time.new.utc
12
+
13
+ parameters = defalutVPCParameters(action, sigNonce, time)
14
+ pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
15
+
16
+ pageNumber = options[:pageNumber]
17
+ pageSize = options[:pageSize]
18
+ if pageNumber
19
+ parameters['PageNumber'] = pageNumber
20
+ pathUrl += '&PageNumber='
21
+ pathUrl += pageNumber
22
+ end
23
+
24
+ pageSize ||= '50'
25
+ parameters['PageSize'] = pageSize
26
+ pathUrl += '&PageSize='
27
+ pathUrl += pageSize
28
+
29
+ signature = sign(@aliyun_accesskey_secret, parameters)
30
+ pathUrl += '&Signature='
31
+ pathUrl += signature
32
+
33
+ VPCrequest(
34
+ expects: [200, 203],
35
+ method: 'GET',
36
+ path: pathUrl
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,49 +1,49 @@
1
- module Fog
2
- module Compute
3
- class Aliyun
4
- class Real
5
- # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vpc&describevpcs]
6
- def list_vpn_gateways(options = {})
7
- action = 'DescribeVpnGateways'
8
- sigNonce = randonStr
9
- time = Time.new.utc
10
-
11
- parameters = defalutVPCParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
13
-
14
- _VpcId = options[:vpcId]
15
- if _VpcId
16
- parameters['VpcId'] = _VpcId
17
- pathUrl += '&VpcId='
18
- pathUrl += _VpcId
19
- end
20
-
21
- pageNumber = options[:pageNumber]
22
- pageSize = options[:pageSize]
23
- if pageNumber
24
- parameters['PageNumber'] = pageNumber
25
- pathUrl += '&PageNumber='
26
- pathUrl += pageNumber
27
- end
28
-
29
- pageSize = '50' unless pageSize
30
- parameters['PageSize'] = pageSize
31
- pathUrl += '&PageSize='
32
- pathUrl += pageSize
33
-
34
- signature = sign(@aliyun_accesskey_secret, parameters)
35
- pathUrl += '&Signature='
36
- pathUrl += signature
37
-
38
- VPCrequest(
39
- expects: [200, 203],
40
- method: 'GET',
41
- path: pathUrl
42
- )
43
- end
44
- end
45
-
46
-
47
- end
48
- end
49
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fog
4
+ module Compute
5
+ class Aliyun
6
+ class Real
7
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vpc&describevpcs]
8
+ def list_vpn_gateways(options = {})
9
+ action = 'DescribeVpnGateways'
10
+ sigNonce = randonStr
11
+ time = Time.new.utc
12
+
13
+ parameters = defalutVPCParameters(action, sigNonce, time)
14
+ pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
15
+
16
+ _VpcId = options[:vpcId]
17
+ if _VpcId
18
+ parameters['VpcId'] = _VpcId
19
+ pathUrl += '&VpcId='
20
+ pathUrl += _VpcId
21
+ end
22
+
23
+ pageNumber = options[:pageNumber]
24
+ pageSize = options[:pageSize]
25
+ if pageNumber
26
+ parameters['PageNumber'] = pageNumber
27
+ pathUrl += '&PageNumber='
28
+ pathUrl += pageNumber
29
+ end
30
+
31
+ pageSize ||= '50'
32
+ parameters['PageSize'] = pageSize
33
+ pathUrl += '&PageSize='
34
+ pathUrl += pageSize
35
+
36
+ signature = sign(@aliyun_accesskey_secret, parameters)
37
+ pathUrl += '&Signature='
38
+ pathUrl += signature
39
+
40
+ VPCrequest(
41
+ expects: [200, 203],
42
+ method: 'GET',
43
+ path: pathUrl
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -9,7 +11,7 @@ module Fog
9
11
  time = Time.new.utc
10
12
 
11
13
  parameters = defalutParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunUri(action, sigNonce, time)
14
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
15
 
14
16
  _VRouterId = options[:vRouterId]
15
17
  if _VRouterId
@@ -19,14 +21,14 @@ module Fog
19
21
  end
20
22
 
21
23
  pageNumber = options[:pageNumber]
22
- pageSize = options[:pageSize]
24
+ pageSize = options[:pageSize]
23
25
  if pageNumber
24
26
  parameters['PageNumber'] = pageNumber
25
27
  pathUrl += '&PageNumber='
26
28
  pathUrl += pageNumber
27
29
  end
28
30
 
29
- pageSize = '50' unless pageSize
31
+ pageSize ||= '50'
30
32
  parameters['PageSize'] = pageSize
31
33
  pathUrl += '&PageSize='
32
34
  pathUrl += pageSize
@@ -49,7 +51,7 @@ module Fog
49
51
  data = list_images_detail.body['VRouters']
50
52
  images = []
51
53
  for image in data
52
- images << image.reject { |key, _value| !%w(id name links).include?(key) }
54
+ images << image.select { |key, _value| %w[id name links].include?(key) }
53
55
  end
54
56
  response.status = [200, 203][rand(1)]
55
57
  response.body = { 'VRouter' => images }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -9,15 +11,15 @@ module Fog
9
11
  time = Time.new.utc
10
12
 
11
13
  parameters = defalutParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunUri(action, sigNonce, time)
14
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
15
 
14
16
  parameters['VpcId'] = vpcid
15
17
  pathUrl += '&VpcId='
16
18
  pathUrl += vpcid
17
19
 
18
20
  pageNumber = options[:pageNumber]
19
- pageSize = options[:pageSize]
20
- vswitchId = options[:vSwitchId]
21
+ pageSize = options[:pageSize]
22
+ vswitchId = options[:vSwitchId]
21
23
  if vswitchId
22
24
  parameters['VSwitchId'] = vswitchId
23
25
  pathUrl += '&VSwitchId='
@@ -29,7 +31,7 @@ module Fog
29
31
  pathUrl += pageNumber
30
32
  end
31
33
 
32
- pageSize = '50' unless pageSize
34
+ pageSize ||= '50'
33
35
  parameters['PageSize'] = pageSize
34
36
  pathUrl += '&PageSize='
35
37
  pathUrl += pageSize
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -9,7 +11,7 @@ module Fog
9
11
  time = Time.new.utc
10
12
 
11
13
  parameters = defalutParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunUri(action, sigNonce, time)
14
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
15
 
14
16
  signature = sign(@aliyun_accesskey_secret, parameters)
15
17
  pathUrl += '&Signature='
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -9,7 +11,7 @@ module Fog
9
11
  time = Time.new.utc
10
12
 
11
13
  parameters = defalutParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunUri(action, sigNonce, time)
14
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
15
 
14
16
  parameters['VpcId'] = vpcId
15
17
  pathUrl += '&VpcId='
@@ -67,7 +69,7 @@ module Fog
67
69
  }
68
70
  response
69
71
  end
70
- end # mock
71
- end # aliyun
72
- end # compute
73
- end # fog
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -9,7 +11,7 @@ module Fog
9
11
  time = Time.new.utc
10
12
 
11
13
  parameters = defalutParameters(action, sigNonce, time)
12
- pathUrl = defaultAliyunUri(action, sigNonce, time)
14
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
15
 
14
16
  parameters['VSwitchId'] = vSwitchId
15
17
  pathUrl += '&VSwitchId='
@@ -40,6 +42,6 @@ module Fog
40
42
  )
41
43
  end
42
44
  end
43
- end # aliyun
44
- end # compute
45
- end # fog
45
+ end
46
+ end
47
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -24,6 +26,6 @@ module Fog
24
26
  )
25
27
  end
26
28
  end
27
- end # aliyun
28
- end # compute
29
+ end
30
+ end
29
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -28,14 +30,14 @@ module Fog
28
30
  method: 'GET',
29
31
  path: _pathURL
30
32
  )
31
- end # def start_server
32
- end # class Real
33
+ end start_server
34
+ end Real
33
35
 
34
36
  class Mock
35
37
  def start_server(_server_id)
36
38
  true
37
- end # def start_server
38
- end # class Mock
39
- end # class aliyun
40
- end # module Compute
41
- end # module Fog
39
+ end start_server
40
+ end Mock
41
+ end aliyun
42
+ end Compute
43
+ end Fog
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -28,14 +30,14 @@ module Fog
28
30
  method: 'GET',
29
31
  path: _pathURL
30
32
  )
31
- end # def stop_server
32
- end # class Real
33
+ end stop_server
34
+ end Real
33
35
 
34
36
  class Mock
35
37
  def stop_server(_server_id)
36
38
  true
37
- end # def stop_server
38
- end # class Mock
39
- end # class aliyun
40
- end # module Compute
41
- end # module Fog
39
+ end stop_server
40
+ end Mock
41
+ end aliyun
42
+ end Compute
43
+ end Fog
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -44,6 +46,6 @@ module Fog
44
46
  )
45
47
  end
46
48
  end
47
- end # aliyun
48
- end # compute
49
+ end
50
+ end
49
51
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Storage
3
5
  class Aliyun
@@ -31,8 +33,7 @@ module Fog
31
33
  end
32
34
 
33
35
  class Mock
34
- def copy_object(source_bucket, source_object, target_bucket, target_object)
35
- end
36
+ def copy_object(source_bucket, source_object, target_bucket, target_object); end
36
37
  end
37
38
  end
38
39
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Storage
3
5
  class Aliyun
@@ -22,8 +24,7 @@ module Fog
22
24
  end
23
25
 
24
26
  class Mock
25
- def delete_bucket(bucket)
26
- end
27
+ def delete_bucket(bucket); end
27
28
  end
28
29
  end
29
30
  end