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
@@ -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
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
if vswitch_id
|
15
17
|
parameters['VSwitchId'] = vswitch_id
|
@@ -30,6 +32,6 @@ module Fog
|
|
30
32
|
)
|
31
33
|
end
|
32
34
|
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
4
6
|
class Real
|
5
7
|
# {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/disk&detachdisk]
|
6
8
|
def detach_disk(instanceId, diskId, _options = {})
|
7
|
-
action
|
9
|
+
action = 'DetachDisk'
|
8
10
|
sigNonce = randonStr
|
9
|
-
time
|
11
|
+
time = Time.new.utc
|
10
12
|
|
11
13
|
parameters = defalutParameters(action, sigNonce, time)
|
12
|
-
pathUrl
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
parameters['InstanceId'] = instanceId
|
15
17
|
pathUrl += '&InstanceId='
|
@@ -18,7 +20,7 @@ module Fog
|
|
18
20
|
parameters['DiskId'] = diskId
|
19
21
|
pathUrl += '&DiskId='
|
20
22
|
pathUrl += diskId
|
21
|
-
|
23
|
+
|
22
24
|
device = _options[:device]
|
23
25
|
if device
|
24
26
|
parameters['Device'] = device
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -33,10 +35,10 @@ module Fog
|
|
33
35
|
time = Time.new.utc
|
34
36
|
|
35
37
|
parameters = defalutParameters(action, sigNonce, time)
|
36
|
-
pathUrl
|
38
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
37
39
|
|
38
40
|
pageNumber = options[:pageNumber]
|
39
|
-
pageSize
|
41
|
+
pageSize = options[:pageSize]
|
40
42
|
instanceId = options[:instanceId]
|
41
43
|
diskIds = options[:diskIds]
|
42
44
|
diskType = options[:diskType]
|
@@ -129,7 +131,7 @@ module Fog
|
|
129
131
|
end
|
130
132
|
|
131
133
|
pageSize = options[:pageSize]
|
132
|
-
pageSize
|
134
|
+
pageSize ||= '50'
|
133
135
|
parameters['PageSize'] = pageSize
|
134
136
|
pathUrl += '&PageSize='
|
135
137
|
pathUrl += pageSize
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -36,7 +38,7 @@ module Fog
|
|
36
38
|
end
|
37
39
|
|
38
40
|
_PageSize = options[:page_size]
|
39
|
-
_PageSize
|
41
|
+
_PageSize ||= '50'
|
40
42
|
_parameters['PageSize'] = _PageSize
|
41
43
|
_pathURL += '&PageSize=' + _PageSize
|
42
44
|
|
@@ -50,6 +52,6 @@ module Fog
|
|
50
52
|
)
|
51
53
|
end
|
52
54
|
end
|
53
|
-
end
|
54
|
-
end
|
55
|
+
end
|
56
|
+
end
|
55
57
|
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
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
pageNumber = options[:pageNumber]
|
15
17
|
if pageNumber
|
@@ -19,7 +21,7 @@ module Fog
|
|
19
21
|
end
|
20
22
|
|
21
23
|
pageSize = options[:pageSize]
|
22
|
-
pageSize
|
24
|
+
pageSize ||= '50'
|
23
25
|
parameters['PageSize'] = pageSize
|
24
26
|
pathUrl += '&PageSize='
|
25
27
|
pathUrl += pageSize
|
@@ -70,7 +72,7 @@ module Fog
|
|
70
72
|
data = list_images_detail.body['images']
|
71
73
|
images = []
|
72
74
|
for image in data
|
73
|
-
images << image.
|
75
|
+
images << image.select { |key, _value| %w[id name links].include?(key) }
|
74
76
|
end
|
75
77
|
response.status = [200, 203][rand(1)]
|
76
78
|
response.body = { 'images' => images }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -9,14 +11,14 @@ module Fog
|
|
9
11
|
time = Time.new.utc
|
10
12
|
|
11
13
|
parameters = defalutParameters(action, sigNonce, time)
|
12
|
-
pathUrl
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
parameters['VRouterId'] = vrouterid
|
15
17
|
pathUrl += '&VRouterId='
|
16
18
|
pathUrl += vrouterid
|
17
19
|
|
18
20
|
pageNumber = options[:pageNumber]
|
19
|
-
pageSize
|
21
|
+
pageSize = options[:pageSize]
|
20
22
|
routeTableId = options[:routeTableId]
|
21
23
|
if routeTableId
|
22
24
|
parameters['RouteTableId'] = routeTableId
|
@@ -29,7 +31,7 @@ module Fog
|
|
29
31
|
pathUrl += pageNumber
|
30
32
|
end
|
31
33
|
|
32
|
-
pageSize
|
34
|
+
pageSize ||= '50'
|
33
35
|
parameters['PageSize'] = pageSize
|
34
36
|
pathUrl += '&PageSize='
|
35
37
|
pathUrl += pageSize
|
@@ -52,7 +54,7 @@ module Fog
|
|
52
54
|
data = list_images_detail.body['images']
|
53
55
|
images = []
|
54
56
|
for image in data
|
55
|
-
images << image.
|
57
|
+
images << image.select { |key, _value| %w[id name links].include?(key) }
|
56
58
|
end
|
57
59
|
response.status = [200, 203][rand(1)]
|
58
60
|
response.body = { 'images' => images }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -22,7 +24,7 @@ module Fog
|
|
22
24
|
pathUrl += nicType
|
23
25
|
end
|
24
26
|
pageNumber = options[:pageNumber]
|
25
|
-
pageSize
|
27
|
+
pageSize = options[:pageSize]
|
26
28
|
if pageNumber
|
27
29
|
parameters['PageNumber'] = pageNumber
|
28
30
|
pathUrl += '&PageNumber='
|
@@ -67,7 +69,7 @@ module Fog
|
|
67
69
|
end
|
68
70
|
response
|
69
71
|
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
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,11 +11,11 @@ module Fog
|
|
9
11
|
time = Time.new.utc
|
10
12
|
|
11
13
|
parameters = defalutParameters(action, sigNonce, time)
|
12
|
-
pathUrl
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
pageNumber = options[:pageNumber]
|
15
|
-
pageSize
|
16
|
-
vpcId
|
17
|
+
pageSize = options[:pageSize]
|
18
|
+
vpcId = options[:vpcId]
|
17
19
|
|
18
20
|
if vpcId
|
19
21
|
parameters['VpcId'] = vpcId
|
@@ -28,7 +30,7 @@ module Fog
|
|
28
30
|
end
|
29
31
|
|
30
32
|
pageSize = options[:pageSize]
|
31
|
-
pageSize
|
33
|
+
pageSize ||= '50'
|
32
34
|
parameters['PageSize'] = pageSize
|
33
35
|
pathUrl += '&PageSize='
|
34
36
|
pathUrl += pageSize
|
@@ -72,7 +74,7 @@ module Fog
|
|
72
74
|
status: 200
|
73
75
|
)
|
74
76
|
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -26,7 +28,7 @@ module Fog
|
|
26
28
|
# _InstanceType[[instanceType["CpuCoreCount"], instanceType["MemorySize"]]] = instanceType["InstanceTypeId"]
|
27
29
|
# end
|
28
30
|
# _InstanceType
|
29
|
-
end
|
31
|
+
end list_server_types
|
30
32
|
|
31
33
|
def get_instance_type(cpuCount, memorySize)
|
32
34
|
_action = 'DescribeInstanceTypes'
|
@@ -53,10 +55,10 @@ module Fog
|
|
53
55
|
puts '_instanceTypeId: ' + _InstanceTypeId
|
54
56
|
break
|
55
57
|
# end if
|
56
|
-
end
|
58
|
+
end each
|
57
59
|
_InstanceTypeId
|
58
|
-
end
|
59
|
-
end
|
60
|
+
end get_instance_type
|
61
|
+
end class Real
|
60
62
|
|
61
63
|
# class Mock
|
62
64
|
# def list_servers(options = {})
|
@@ -71,7 +73,7 @@ module Fog
|
|
71
73
|
# response
|
72
74
|
# end
|
73
75
|
# end
|
74
|
-
end
|
75
|
-
end
|
76
|
+
end class Aliyun
|
77
|
+
end module Compute
|
76
78
|
# end module Fog
|
77
79
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -38,7 +40,7 @@ module Fog
|
|
38
40
|
_pathURL += '&PageNumber=' + _PageNumber
|
39
41
|
end
|
40
42
|
|
41
|
-
_PageSize
|
43
|
+
_PageSize ||= '50'
|
42
44
|
_parameters['PageSize'] = _PageSize
|
43
45
|
_pathURL += '&PageSize=' + _PageSize
|
44
46
|
|
@@ -59,7 +61,7 @@ module Fog
|
|
59
61
|
data = list_servers_detail.body['servers']
|
60
62
|
servers = []
|
61
63
|
for server in data
|
62
|
-
servers << server.
|
64
|
+
servers << server.select { |key, _value| %w[id name links].include?(key) }
|
63
65
|
end
|
64
66
|
response.status = [200, 203][rand(1)]
|
65
67
|
response.body = { 'servers' => servers }
|
@@ -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
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
pageNumber = options[:pageNumber]
|
15
17
|
pageSize = options[:pageSize]
|
@@ -76,7 +78,7 @@ module Fog
|
|
76
78
|
pathUrl += pageNumber
|
77
79
|
end
|
78
80
|
|
79
|
-
pageSize
|
81
|
+
pageSize ||= '50'
|
80
82
|
parameters['PageSize'] = pageSize
|
81
83
|
pathUrl += '&PageSize='
|
82
84
|
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
|
14
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
13
15
|
|
14
16
|
_VpcId = options[:vpcId]
|
15
17
|
if _VpcId
|
@@ -19,14 +21,14 @@ module Fog
|
|
19
21
|
end
|
20
22
|
|
21
23
|
pageNumber = options[:pageNumber]
|
22
|
-
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
|
31
|
+
pageSize ||= '50'
|
30
32
|
parameters['PageSize'] = pageSize
|
31
33
|
pathUrl += '&PageSize='
|
32
34
|
pathUrl += pageSize
|
@@ -1,49 +1,49 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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_connections(options = {})
|
9
|
+
action = 'DescribeVpnConnections'
|
10
|
+
sigNonce = randonStr
|
11
|
+
time = Time.new.utc
|
12
|
+
|
13
|
+
parameters = defalutVPCParameters(action, sigNonce, time)
|
14
|
+
pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
|
15
|
+
|
16
|
+
_VpnGatewayId = options[:vpngatewayId]
|
17
|
+
if _VpnGatewayId
|
18
|
+
parameters['VpnGatewayId'] = _VpnGatewayId
|
19
|
+
pathUrl += '&VpnGatewayId='
|
20
|
+
pathUrl += _VpnGatewayId
|
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
|