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.
- checksums.yaml +4 -4
- data/.gitignore +23 -10
- data/.rubocop.yml +31 -4
- data/.rubocop_todo.yml +83 -55
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/bin/console +4 -3
- data/fog-aliyun.gemspec +19 -18
- data/lib/fog/aliyun.rb +4 -2
- data/lib/fog/aliyun/compute.rb +45 -43
- data/lib/fog/aliyun/models/compute/eip_address.rb +10 -8
- data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -3
- data/lib/fog/aliyun/models/compute/image.rb +23 -21
- data/lib/fog/aliyun/models/compute/images.rb +2 -0
- data/lib/fog/aliyun/models/compute/route_entry.rb +7 -5
- data/lib/fog/aliyun/models/compute/route_entrys.rb +2 -0
- data/lib/fog/aliyun/models/compute/route_table.rb +6 -4
- data/lib/fog/aliyun/models/compute/route_tables.rb +3 -3
- data/lib/fog/aliyun/models/compute/security_group.rb +7 -5
- data/lib/fog/aliyun/models/compute/security_group_rule.rb +15 -13
- data/lib/fog/aliyun/models/compute/security_group_rules.rb +2 -0
- data/lib/fog/aliyun/models/compute/security_groups.rb +2 -0
- data/lib/fog/aliyun/models/compute/server.rb +28 -26
- data/lib/fog/aliyun/models/compute/servers.rb +3 -3
- data/lib/fog/aliyun/models/compute/snapshot.rb +12 -10
- data/lib/fog/aliyun/models/compute/snapshots.rb +2 -0
- data/lib/fog/aliyun/models/compute/volume.rb +27 -25
- data/lib/fog/aliyun/models/compute/volumes.rb +2 -0
- data/lib/fog/aliyun/models/compute/vpc.rb +12 -10
- data/lib/fog/aliyun/models/compute/vpcs.rb +3 -3
- data/lib/fog/aliyun/models/compute/vrouter.rb +8 -6
- data/lib/fog/aliyun/models/compute/vrouters.rb +3 -3
- data/lib/fog/aliyun/models/compute/vswitch.rb +11 -9
- data/lib/fog/aliyun/models/compute/vswitches.rb +3 -3
- data/lib/fog/aliyun/models/storage/directories.rb +3 -1
- data/lib/fog/aliyun/models/storage/directory.rb +2 -0
- data/lib/fog/aliyun/models/storage/file.rb +18 -16
- data/lib/fog/aliyun/models/storage/files.rb +13 -19
- data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +5 -3
- data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +4 -2
- data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +4 -2
- data/lib/fog/aliyun/requests/compute/attach_disk.rb +7 -5
- data/lib/fog/aliyun/requests/compute/create_disk.rb +15 -13
- data/lib/fog/aliyun/requests/compute/create_image.rb +3 -1
- data/lib/fog/aliyun/requests/compute/create_security_group.rb +11 -9
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +13 -11
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +12 -10
- data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +13 -11
- data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +12 -10
- data/lib/fog/aliyun/requests/compute/create_server.rb +11 -9
- data/lib/fog/aliyun/requests/compute/create_snapshot.rb +3 -1
- data/lib/fog/aliyun/requests/compute/create_vpc.rb +6 -4
- data/lib/fog/aliyun/requests/compute/create_vpn_connection.rb +8 -6
- data/lib/fog/aliyun/requests/compute/create_vpn_customergateway.rb +6 -6
- data/lib/fog/aliyun/requests/compute/create_vswitch.rb +6 -4
- data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -6
- data/lib/fog/aliyun/requests/compute/delete_image.rb +3 -1
- data/lib/fog/aliyun/requests/compute/delete_security_group.rb +7 -5
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +13 -11
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +12 -10
- data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +13 -11
- data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +12 -10
- data/lib/fog/aliyun/requests/compute/delete_server.rb +2 -0
- data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +3 -1
- data/lib/fog/aliyun/requests/compute/delete_vpc.rb +6 -4
- data/lib/fog/aliyun/requests/compute/delete_vpn_connection.rb +6 -4
- data/lib/fog/aliyun/requests/compute/delete_vpn_customergateway.rb +6 -4
- data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +6 -4
- data/lib/fog/aliyun/requests/compute/detach_disk.rb +6 -4
- data/lib/fog/aliyun/requests/compute/join_security_group.rb +2 -0
- data/lib/fog/aliyun/requests/compute/leave_security_group.rb +2 -0
- data/lib/fog/aliyun/requests/compute/list_disks.rb +5 -3
- data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +5 -3
- data/lib/fog/aliyun/requests/compute/list_images.rb +5 -3
- data/lib/fog/aliyun/requests/compute/list_route_tables.rb +6 -4
- data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +7 -5
- data/lib/fog/aliyun/requests/compute/list_security_groups.rb +10 -8
- data/lib/fog/aliyun/requests/compute/list_server_types.rb +8 -6
- data/lib/fog/aliyun/requests/compute/list_servers.rb +4 -2
- data/lib/fog/aliyun/requests/compute/list_snapshots.rb +4 -2
- data/lib/fog/aliyun/requests/compute/list_vpcs.rb +5 -3
- data/lib/fog/aliyun/requests/compute/list_vpn_connections.rb +49 -49
- data/lib/fog/aliyun/requests/compute/list_vpn_customergateways.rb +42 -43
- data/lib/fog/aliyun/requests/compute/list_vpn_gateways.rb +49 -49
- data/lib/fog/aliyun/requests/compute/list_vrouters.rb +6 -4
- data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +6 -4
- data/lib/fog/aliyun/requests/compute/list_zones.rb +3 -1
- data/lib/fog/aliyun/requests/compute/modify_vpc.rb +7 -5
- data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +6 -4
- data/lib/fog/aliyun/requests/compute/reboot_server.rb +2 -0
- data/lib/fog/aliyun/requests/compute/release_eip_address.rb +4 -2
- data/lib/fog/aliyun/requests/compute/start_server.rb +9 -7
- data/lib/fog/aliyun/requests/compute/stop_server.rb +9 -7
- data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +4 -2
- data/lib/fog/aliyun/requests/storage/copy_object.rb +3 -2
- data/lib/fog/aliyun/requests/storage/delete_bucket.rb +3 -2
- data/lib/fog/aliyun/requests/storage/delete_container.rb +3 -2
- data/lib/fog/aliyun/requests/storage/delete_object.rb +4 -3
- data/lib/fog/aliyun/requests/storage/get_bucket.rb +6 -11
- data/lib/fog/aliyun/requests/storage/get_container.rb +3 -2
- data/lib/fog/aliyun/requests/storage/get_containers.rb +3 -2
- data/lib/fog/aliyun/requests/storage/get_object.rb +4 -3
- data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +5 -4
- data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +5 -4
- data/lib/fog/aliyun/requests/storage/head_object.rb +3 -2
- data/lib/fog/aliyun/requests/storage/list_buckets.rb +3 -2
- data/lib/fog/aliyun/requests/storage/list_objects.rb +5 -4
- data/lib/fog/aliyun/requests/storage/put_bucket.rb +3 -2
- data/lib/fog/aliyun/requests/storage/put_container.rb +3 -2
- data/lib/fog/aliyun/requests/storage/put_object.rb +12 -17
- data/lib/fog/aliyun/storage.rb +41 -52
- data/lib/fog/aliyun/version.rb +3 -1
- data/lib/fog/bin/aliyun.rb +10 -7
- metadata +37 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2f14d1d42f366b42d05bb045478ba66ef8aab6a596826b65acba26ac5bd13ed
|
4
|
+
data.tar.gz: a3dc9fbeadc7f311e202892fe48ee7b5c1647faca657370aa1af4345646b0f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bebef15bc6fc524dd8a050068aa5ebcf75b76341a721b9372cc43b3c6e78ba0c78125086159da7c0dcba3197d56d2e97fb6424c2c4ad87956a66b52ad927b64a
|
7
|
+
data.tar.gz: 548d10c215516f737afd32a1b99b776878265a1cedcdc5adcac07327554d65f882b30c2f478c888effe91df2a34a6bf4a792e2c54d860e06008051e10db08d9d
|
data/.gitignore
CHANGED
@@ -1,10 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
2
|
-
Exclude:
|
3
|
-
- bin/**/*
|
1
|
+
inherit_from: .rubocop_todo.yml
|
4
2
|
|
5
|
-
|
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
|
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:
|
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:
|
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:
|
75
|
-
|
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
|
109
|
-
# SupportedStyles:
|
119
|
+
# Configuration parameters: EnforcedStyle.
|
120
|
+
# SupportedStyles: each, for
|
110
121
|
Style/For:
|
111
|
-
|
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:
|
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:
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
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:
|
146
|
-
#
|
147
|
-
#
|
148
|
-
|
149
|
-
|
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
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
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
|
14
|
+
require 'irb'
|
14
15
|
IRB.start
|
data/fog-aliyun.gemspec
CHANGED
@@ -1,33 +1,34 @@
|
|
1
|
-
#
|
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
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
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
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
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
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
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'
|
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'
|
30
|
-
spec.add_dependency 'fog-json'
|
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
|
-
|
9
|
+
autoload :Aliyun, 'fog/aliyun/compute'
|
8
10
|
end
|
9
11
|
|
10
12
|
module Storage
|
11
|
-
|
13
|
+
autoload :Aliyun, 'fog/aliyun/storage'
|
12
14
|
end
|
13
15
|
|
14
16
|
module Aliyun
|
data/lib/fog/aliyun/compute.rb
CHANGED
@@ -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
|
14
|
-
collection
|
15
|
-
model
|
16
|
-
collection
|
17
|
-
model
|
18
|
-
collection
|
19
|
-
model
|
20
|
-
collection
|
21
|
-
model
|
22
|
-
collection
|
23
|
-
model
|
24
|
-
collection
|
25
|
-
model
|
26
|
-
collection
|
27
|
-
model
|
28
|
-
collection
|
29
|
-
model
|
30
|
-
collection
|
31
|
-
model
|
32
|
-
collection
|
33
|
-
model
|
34
|
-
collection
|
35
|
-
model
|
36
|
-
collection
|
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,
|
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
|
261
|
-
@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
|
264
|
-
@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
|
279
|
-
@path
|
280
|
-
@port
|
280
|
+
@host = uri.host
|
281
|
+
@path = uri.path
|
282
|
+
@port = uri.port
|
281
283
|
@scheme = uri.scheme
|
282
|
-
|
283
|
-
vpcuri = URI.parse(
|
284
|
-
@vpchost
|
285
|
-
@vpcpath
|
286
|
-
@vpcport
|
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
|
-
|
332
|
-
|
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 =
|
416
|
-
digest =
|
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, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
|