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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b3239804802fddbe8b34af2bd07865c504cd75644b8ffd345afc3c6032ffa05
4
- data.tar.gz: e72e6d448071244c1c5ee3c453e010840f77af32ca25f390b7bd6c371adcde15
3
+ metadata.gz: c2f14d1d42f366b42d05bb045478ba66ef8aab6a596826b65acba26ac5bd13ed
4
+ data.tar.gz: a3dc9fbeadc7f311e202892fe48ee7b5c1647faca657370aa1af4345646b0f98
5
5
  SHA512:
6
- metadata.gz: 9f2df310bb9c3ee8a03e772631f24e5552599749f40b22a13b96fa1533978d8c117d1a91871f3e88a6951a45b62945cb381f95cda8dc92d94f8099ebeb61a809
7
- data.tar.gz: 619a3e800919cb95b6ee6ab7f6f91177eff9434a2a9d7fe0f32568611f587938397830bb81086d7406a49de80bc8804a355bbef1f9557cb84d9b72b0f5c5d279
6
+ metadata.gz: bebef15bc6fc524dd8a050068aa5ebcf75b76341a721b9372cc43b3c6e78ba0c78125086159da7c0dcba3197d56d2e97fb6424c2c4ad87956a66b52ad927b64a
7
+ data.tar.gz: 548d10c215516f737afd32a1b99b776878265a1cedcdc5adcac07327554d65f882b30c2f478c888effe91df2a34a6bf4a792e2c54d860e06008051e10db08d9d
data/.gitignore CHANGED
@@ -1,10 +1,23 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *~
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ gemfiles/*.lock
data/.rubocop.yml CHANGED
@@ -1,5 +1,32 @@
1
- AllCops:
2
- Exclude:
3
- - bin/**/*
1
+ inherit_from: .rubocop_todo.yml
4
2
 
5
- # inherit_from: .rubocop_todo.yml
3
+ Style/Documentation:
4
+ Enabled: false
5
+
6
+ Metrics/MethodLength:
7
+ Enabled: false
8
+
9
+ Metrics/AbcSize:
10
+ Enabled: false
11
+
12
+ Metrics/LineLength:
13
+ Max: 120
14
+
15
+ Metrics/BlockLength:
16
+ Enabled: false
17
+
18
+ Layout/ExtraSpacing:
19
+ AllowForAlignment: false
20
+ ForceEqualSignAlignment: false
21
+
22
+ Style/ExpandPathArguments:
23
+ Enabled: false
24
+
25
+ Metrics/CyclomaticComplexity:
26
+ Enabled: false
27
+
28
+ Naming/VariableName:
29
+ Enabled: false
30
+
31
+ Lint/UnderscorePrefixedVariableName:
32
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,11 +1,30 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-05-12 13:44:44 +0800 using RuboCop version 0.40.0.
3
+ # on 2018-06-22 19:29:12 -0300 using RuboCop version 0.57.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
12
+ # SupportedStylesAlignWith: start_of_line, def
13
+ Layout/DefEndAlignment:
14
+ Exclude:
15
+ - 'lib/fog/aliyun/requests/storage/put_object.rb'
16
+
17
+ # Offense count: 5
18
+ # Cop supports --auto-correct.
19
+ # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
20
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
21
+ Layout/EndAlignment:
22
+ Exclude:
23
+ - 'lib/fog/aliyun/compute.rb'
24
+ - 'lib/fog/aliyun/models/storage/file.rb'
25
+ - 'lib/fog/aliyun/requests/compute/create_server.rb'
26
+ - 'lib/fog/aliyun/storage.rb'
27
+
9
28
  # Offense count: 4
10
29
  # Configuration parameters: AllowSafeAssignment.
11
30
  Lint/AssignmentInCondition:
@@ -13,20 +32,6 @@ Lint/AssignmentInCondition:
13
32
  - 'lib/fog/aliyun/requests/compute/create_server.rb'
14
33
  - 'lib/fog/aliyun/requests/compute/delete_server.rb'
15
34
 
16
- # Offense count: 1
17
- # Cop supports --auto-correct.
18
- # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
19
- # SupportedStyles: start_of_line, def
20
- Lint/DefEndAlignment:
21
- Enabled: false
22
-
23
- # Offense count: 5
24
- # Cop supports --auto-correct.
25
- # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
26
- # SupportedStyles: keyword, variable, start_of_line
27
- Lint/EndAlignment:
28
- Enabled: false
29
-
30
35
  # Offense count: 4
31
36
  Lint/RandOne:
32
37
  Exclude:
@@ -35,19 +40,19 @@ Lint/RandOne:
35
40
  - 'lib/fog/aliyun/requests/compute/list_servers.rb'
36
41
  - 'lib/fog/aliyun/requests/compute/list_vrouters.rb'
37
42
 
38
- # Offense count: 127
39
- Lint/UnderscorePrefixedVariableName:
40
- Enabled: false
41
-
42
43
  # Offense count: 1
43
44
  Lint/UnreachableCode:
44
45
  Exclude:
45
46
  - 'lib/fog/aliyun/models/storage/directory.rb'
46
47
 
47
- # Offense count: 38
48
+ # Offense count: 26
49
+ Lint/UriEscapeUnescape:
50
+ Enabled: false
51
+
52
+ # Offense count: 37
48
53
  Lint/UselessAssignment:
49
54
  Exclude:
50
- - 'lib/fog/aliyun.rb'
55
+ - 'lib/fog/aliyun/requests/compute/create_server.rb'
51
56
  - 'lib/fog/aliyun/requests/compute/list_disks.rb'
52
57
  - 'lib/fog/aliyun/requests/compute/list_security_groups.rb'
53
58
  - 'lib/fog/aliyun/requests/storage/delete_object.rb'
@@ -62,30 +67,17 @@ Lint/UselessAssignment:
62
67
  - 'lib/fog/aliyun/requests/storage/put_object.rb'
63
68
  - 'lib/fog/aliyun/storage.rb'
64
69
 
65
- # Offense count: 78
66
- Metrics/AbcSize:
67
- Max: 100
68
-
69
- # Offense count: 5
70
+ # Offense count: 7
70
71
  # Configuration parameters: CountComments.
71
72
  Metrics/ClassLength:
72
73
  Max: 154
73
74
 
74
- # Offense count: 18
75
- Metrics/CyclomaticComplexity:
76
- Max: 15
77
-
78
- # Offense count: 257
79
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
75
+ # Offense count: 87
76
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
80
77
  # URISchemes: http, https
81
78
  Metrics/LineLength:
82
79
  Max: 247
83
80
 
84
- # Offense count: 110
85
- # Configuration parameters: CountComments.
86
- Metrics/MethodLength:
87
- Max: 97
88
-
89
81
  # Offense count: 1
90
82
  # Configuration parameters: CountKeywordArgs.
91
83
  Metrics/ParameterLists:
@@ -95,20 +87,45 @@ Metrics/ParameterLists:
95
87
  Metrics/PerceivedComplexity:
96
88
  Max: 19
97
89
 
90
+ # Offense count: 7
91
+ # Configuration parameters: EnforcedStyle.
92
+ # SupportedStyles: snake_case, camelCase
93
+ Naming/MethodName:
94
+ Exclude:
95
+ - 'lib/fog/aliyun/compute.rb'
96
+ - 'lib/fog/aliyun/requests/storage/get_bucket.rb'
97
+
98
+ # Offense count: 48
99
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
100
+ # AllowedNames: io, id, to, by, on, in, at
101
+ Naming/UncommunicativeMethodParamName:
102
+ Enabled: false
103
+
104
+ # Offense count: 5
105
+ Performance/Caller:
106
+ Exclude:
107
+ - 'lib/fog/aliyun/models/compute/images.rb'
108
+ - 'lib/fog/aliyun/models/compute/snapshots.rb'
109
+ - 'lib/fog/aliyun/models/compute/volumes.rb'
110
+ - 'lib/fog/aliyun/models/compute/vpcs.rb'
111
+ - 'lib/fog/aliyun/models/compute/vrouters.rb'
112
+
98
113
  # Offense count: 1
99
114
  Style/ClassVars:
100
115
  Exclude:
101
116
  - 'lib/fog/bin/aliyun.rb'
102
117
 
103
- # Offense count: 138
104
- Style/Documentation:
105
- Enabled: false
106
-
107
118
  # Offense count: 7
108
- # Configuration parameters: EnforcedStyle, SupportedStyles.
109
- # SupportedStyles: for, each
119
+ # Configuration parameters: EnforcedStyle.
120
+ # SupportedStyles: each, for
110
121
  Style/For:
111
- Enabled: false
122
+ Exclude:
123
+ - 'lib/fog/aliyun/models/storage/files.rb'
124
+ - 'lib/fog/aliyun/requests/compute/list_images.rb'
125
+ - 'lib/fog/aliyun/requests/compute/list_route_tables.rb'
126
+ - 'lib/fog/aliyun/requests/compute/list_servers.rb'
127
+ - 'lib/fog/aliyun/requests/compute/list_vrouters.rb'
128
+ - 'lib/fog/aliyun/requests/storage/put_object.rb'
112
129
 
113
130
  # Offense count: 4
114
131
  # Configuration parameters: AllowedVariables.
@@ -119,12 +136,21 @@ Style/GlobalVars:
119
136
  - 'lib/fog/aliyun/models/compute/vrouter.rb'
120
137
  - 'lib/fog/aliyun/models/compute/vswitch.rb'
121
138
 
122
- # Offense count: 2
139
+ # Offense count: 11
123
140
  # Configuration parameters: MinBodyLength.
124
141
  Style/GuardClause:
125
142
  Exclude:
143
+ - 'lib/fog/aliyun/models/compute/security_groups.rb'
144
+ - 'lib/fog/aliyun/models/compute/snapshots.rb'
145
+ - 'lib/fog/aliyun/models/compute/volumes.rb'
146
+ - 'lib/fog/aliyun/models/storage/file.rb'
147
+ - 'lib/fog/aliyun/requests/compute/delete_security_group.rb'
148
+ - 'lib/fog/aliyun/requests/compute/delete_server.rb'
126
149
  - 'lib/fog/aliyun/requests/compute/delete_vpc.rb'
150
+ - 'lib/fog/aliyun/requests/compute/delete_vpn_connection.rb'
151
+ - 'lib/fog/aliyun/requests/compute/delete_vpn_customergateway.rb'
127
152
  - 'lib/fog/aliyun/requests/compute/delete_vswitch.rb'
153
+ - 'lib/fog/aliyun/requests/compute/list_security_group_rules.rb'
128
154
 
129
155
  # Offense count: 2
130
156
  Style/IdenticalConditionalBranches:
@@ -136,14 +162,16 @@ Style/IfInsideElse:
136
162
  Exclude:
137
163
  - 'lib/fog/aliyun/models/compute/security_group_rule.rb'
138
164
 
139
- # Offense count: 4
140
- # Configuration parameters: EnforcedStyle, SupportedStyles.
141
- # SupportedStyles: snake_case, camelCase
142
- Style/MethodName:
143
- Enabled: false
165
+ # Offense count: 2
166
+ Style/MultipleComparison:
167
+ Exclude:
168
+ - 'lib/fog/aliyun/requests/storage/get_object_http_url.rb'
169
+ - 'lib/fog/aliyun/requests/storage/get_object_https_url.rb'
144
170
 
145
- # Offense count: 741
146
- # Configuration parameters: EnforcedStyle, SupportedStyles.
147
- # SupportedStyles: snake_case, camelCase
148
- Style/VariableName:
149
- Enabled: false
171
+ # Offense count: 1
172
+ # Cop supports --auto-correct.
173
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
174
+ # SupportedStyles: slashes, percent_r, mixed
175
+ Style/RegexpLiteral:
176
+ Exclude:
177
+ - 'lib/fog/aliyun/models/storage/files.rb'
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in fog-aliyun.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "fog/aliyun"
4
+ require 'bundler/setup'
5
+ require 'fog/aliyun'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "fog/aliyun"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start
data/fog-aliyun.gemspec CHANGED
@@ -1,33 +1,34 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'fog/aliyun/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = 'fog-aliyun'
8
- spec.version = Fog::Aliyun::VERSION
9
- spec.authors = ['Qinsi Deng, Jianxun Li, Jane Han']
10
- spec.email = ['dengqinsi@sina.com']
8
+ spec.name = 'fog-aliyun'
9
+ spec.version = Fog::Aliyun::VERSION
10
+ spec.authors = ['Qinsi Deng, Jianxun Li, Jane Han']
11
+ spec.email = ['dengqinsi@sina.com']
11
12
 
12
- spec.summary = 'Fog provider for Aliyun Web Services.'
13
- spec.description = 'As a FOG provider, fog-aliyun support aliyun OSS/ECS. It will support more aliyun services later.'
14
- spec.homepage = 'https://github.com/fog/fog-aliyun'
15
- spec.license = 'MIT'
13
+ spec.summary = 'Fog provider for Aliyun Web Services.'
14
+ spec.description = 'As a FOG provider, fog-aliyun support aliyun OSS/ECS. It will support more aliyun services later.'
15
+ spec.homepage = 'https://github.com/fog/fog-aliyun'
16
+ spec.license = 'MIT'
16
17
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = 'exe'
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
21
  spec.require_paths = ['lib']
21
22
 
22
- spec.add_development_dependency 'bundler', '~> 1.10'
23
- spec.add_development_dependency 'rake', '~> 10.0'
24
- spec.add_development_dependency 'rspec', '~> 3.3'
25
- spec.add_development_dependency 'rubocop', '~> 0.49.0'
23
+ spec.add_development_dependency 'bundler'
26
24
  spec.add_development_dependency 'mime-types', '~> 2.6', '>= 2.6.2'
27
25
  spec.add_development_dependency 'pry-nav'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'rubocop'
28
29
 
29
- spec.add_dependency 'fog-core', '~> 1.27'
30
- spec.add_dependency 'fog-json', '~> 1.0'
30
+ spec.add_dependency 'fog-core'
31
+ spec.add_dependency 'fog-json'
31
32
  spec.add_dependency 'ipaddress', '~> 0.8'
32
33
  spec.add_dependency 'xml-simple', '~> 1.1'
33
34
  end
data/lib/fog/aliyun.rb CHANGED
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fog/core'
2
4
  require 'fog/json'
3
5
  require 'fog/aliyun/version'
4
6
 
5
7
  module Fog
6
8
  module Compute
7
- ret = autoload :Aliyun, 'fog/aliyun/compute'
9
+ autoload :Aliyun, 'fog/aliyun/compute'
8
10
  end
9
11
 
10
12
  module Storage
11
- ret = autoload :Aliyun, 'fog/aliyun/storage'
13
+ autoload :Aliyun, 'fog/aliyun/storage'
12
14
  end
13
15
 
14
16
  module Aliyun
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun < Fog::Service
@@ -10,30 +12,30 @@ module Fog
10
12
  ## MODELS
11
13
  #
12
14
  model_path 'fog/aliyun/models/compute'
13
- model :server
14
- collection :servers
15
- model :image
16
- collection :images
17
- model :eip_address
18
- collection :eip_addresses
19
- model :security_group
20
- collection :security_groups
21
- model :security_group_rule
22
- collection :security_group_rules
23
- model :volume
24
- collection :volumes
25
- model :snapshot
26
- collection :snapshots
27
- model :vpc
28
- collection :vpcs
29
- model :vswitch
30
- collection :vswitches
31
- model :vrouter
32
- collection :vrouters
33
- model :route_table
34
- collection :route_tables
35
- model :route_entry
36
- collection :route_entrys
15
+ model :server
16
+ collection :servers
17
+ model :image
18
+ collection :images
19
+ model :eip_address
20
+ collection :eip_addresses
21
+ model :security_group
22
+ collection :security_groups
23
+ model :security_group_rule
24
+ collection :security_group_rules
25
+ model :volume
26
+ collection :volumes
27
+ model :snapshot
28
+ collection :snapshots
29
+ model :vpc
30
+ collection :vpcs
31
+ model :vswitch
32
+ collection :vswitches
33
+ model :vrouter
34
+ collection :vrouters
35
+ model :route_table
36
+ collection :route_tables
37
+ model :route_entry
38
+ collection :route_entrys
37
39
 
38
40
  ## REQUESTS
39
41
  #
@@ -194,7 +196,7 @@ module Fog
194
196
  @aliyun_user_domain = options[:aliyun_user_domain] || options[:aliyun_domain]
195
197
  @aliyun_project_domain = options[:aliyun_project_domain] || options[:aliyun_domain] || 'Default'
196
198
 
197
- raise ArgumentError, "Missing required arguments: :aliyun_auth_url" unless options.key?[:aliyun_auth_url]
199
+ raise ArgumentError, 'Missing required arguments: :aliyun_auth_url' unless options.key?[:aliyun_auth_url]
198
200
  @aliyun_auth_uri = URI.parse(options[:aliyun_auth_url])
199
201
 
200
202
  @current_tenant = options[:aliyun_tenant]
@@ -257,11 +259,11 @@ module Fog
257
259
 
258
260
  def initialize(options = {})
259
261
  # initialize the parameters
260
- @aliyun_url = options[:aliyun_url]
261
- @aliyun_accesskey_id = options[:aliyun_accesskey_id]
262
+ @aliyun_url = options[:aliyun_url]
263
+ @aliyun_accesskey_id = options[:aliyun_accesskey_id]
262
264
  @aliyun_accesskey_secret = options[:aliyun_accesskey_secret]
263
- @aliyun_region_id = options[:aliyun_region_id]
264
- @aliyun_zone_id = options[:aliyun_zone_id]
265
+ @aliyun_region_id = options[:aliyun_region_id]
266
+ @aliyun_zone_id = options[:aliyun_zone_id]
265
267
 
266
268
  # check for the parameters
267
269
  missing_credentials = []
@@ -275,17 +277,17 @@ module Fog
275
277
  @connection_options = options[:connection_options] || {}
276
278
 
277
279
  uri = URI.parse(@aliyun_url)
278
- @host = uri.host
279
- @path = uri.path
280
- @port = uri.port
280
+ @host = uri.host
281
+ @path = uri.path
282
+ @port = uri.port
281
283
  @scheme = uri.scheme
282
-
283
- vpcuri = URI.parse("https://vpc.aliyuncs.com")
284
- @vpchost = vpcuri.host
285
- @vpcpath = vpcuri.path
286
- @vpcport = vpcuri.port
287
- @vpcscheme = vpcuri.scheme
288
-
284
+
285
+ vpcuri = URI.parse('https://vpc.aliyuncs.com')
286
+ @vpchost = vpcuri.host
287
+ @vpcpath = vpcuri.path
288
+ @vpcport = vpcuri.port
289
+ @vpcscheme = vpcuri.scheme
290
+
289
291
  @persistent = options[:persistent] || false
290
292
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
291
293
  @VPCconnection = Fog::Core::Connection.new("#{@vpcscheme}://#{@vpchost}:#{@vpcport}", @persistent, @connection_options)
@@ -328,8 +330,8 @@ module Fog
328
330
  'Accept' => 'application/json',
329
331
  'X-Auth-Token' => @auth_token
330
332
  }.merge!(params[:headers] || {}),
331
- path: "#{@path}/#{params[:path]}",
332
- query: params[:query]))
333
+ path: "#{@path}/#{params[:path]}",
334
+ query: params[:query]))
333
335
  rescue Excon::Errors::HTTPStatusError => error
334
336
  raise case error
335
337
  when Excon::Errors::NotFound
@@ -412,8 +414,8 @@ module Fog
412
414
  stringToSign = 'GET&%2F&' + URI.encode(canonicalizedQueryString, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
413
415
  key = accessKeySecret + '&'
414
416
 
415
- digVer = OpenSSL::Digest.new('sha1')
416
- digest = OpenSSL::HMAC.digest(digVer, key, stringToSign)
417
+ digVer = OpenSSL::Digest.new('sha1')
418
+ digest = OpenSSL::HMAC.digest(digVer, key, stringToSign)
417
419
  signature = Base64.encode64(digest)
418
420
  signature[-1] = ''
419
421
  encodedSig = URI.encode(signature, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')