fog-xiaozhu 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +5 -0
  5. data/.rubocop_todo.yml +149 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +4 -0
  9. data/CODE_OF_CONDUCT.md +13 -0
  10. data/Gemfile +4 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +312 -0
  13. data/Rakefile +6 -0
  14. data/bin/console +14 -0
  15. data/bin/setup +7 -0
  16. data/fog-aliyun.gemspec +33 -0
  17. data/lib/fog/aliyun/compute.rb +424 -0
  18. data/lib/fog/aliyun/models/compute/eip_address.rb +57 -0
  19. data/lib/fog/aliyun/models/compute/eip_addresses.rb +28 -0
  20. data/lib/fog/aliyun/models/compute/image.rb +66 -0
  21. data/lib/fog/aliyun/models/compute/images.rb +25 -0
  22. data/lib/fog/aliyun/models/compute/route_entry.rb +26 -0
  23. data/lib/fog/aliyun/models/compute/route_entrys.rb +41 -0
  24. data/lib/fog/aliyun/models/compute/route_table.rb +30 -0
  25. data/lib/fog/aliyun/models/compute/route_tables.rb +27 -0
  26. data/lib/fog/aliyun/models/compute/security_group.rb +81 -0
  27. data/lib/fog/aliyun/models/compute/security_group_rule.rb +47 -0
  28. data/lib/fog/aliyun/models/compute/security_group_rules.rb +23 -0
  29. data/lib/fog/aliyun/models/compute/security_groups.rb +32 -0
  30. data/lib/fog/aliyun/models/compute/server.rb +70 -0
  31. data/lib/fog/aliyun/models/compute/servers.rb +42 -0
  32. data/lib/fog/aliyun/models/compute/snapshot.rb +52 -0
  33. data/lib/fog/aliyun/models/compute/snapshots.rb +38 -0
  34. data/lib/fog/aliyun/models/compute/volume.rb +101 -0
  35. data/lib/fog/aliyun/models/compute/volumes.rb +135 -0
  36. data/lib/fog/aliyun/models/compute/vpc.rb +77 -0
  37. data/lib/fog/aliyun/models/compute/vpcs.rb +80 -0
  38. data/lib/fog/aliyun/models/compute/vrouter.rb +35 -0
  39. data/lib/fog/aliyun/models/compute/vrouters.rb +61 -0
  40. data/lib/fog/aliyun/models/compute/vswitch.rb +70 -0
  41. data/lib/fog/aliyun/models/compute/vswitches.rb +80 -0
  42. data/lib/fog/aliyun/models/storage/directories.rb +39 -0
  43. data/lib/fog/aliyun/models/storage/directory.rb +48 -0
  44. data/lib/fog/aliyun/models/storage/file.rb +192 -0
  45. data/lib/fog/aliyun/models/storage/files.rb +193 -0
  46. data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +54 -0
  47. data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +39 -0
  48. data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +49 -0
  49. data/lib/fog/aliyun/requests/compute/attach_disk.rb +79 -0
  50. data/lib/fog/aliyun/requests/compute/create_disk.rb +137 -0
  51. data/lib/fog/aliyun/requests/compute/create_image.rb +79 -0
  52. data/lib/fog/aliyun/requests/compute/create_security_group.rb +77 -0
  53. data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +63 -0
  54. data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +71 -0
  55. data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +63 -0
  56. data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +71 -0
  57. data/lib/fog/aliyun/requests/compute/create_server.rb +186 -0
  58. data/lib/fog/aliyun/requests/compute/create_snapshot.rb +46 -0
  59. data/lib/fog/aliyun/requests/compute/create_vpc.rb +46 -0
  60. data/lib/fog/aliyun/requests/compute/create_vpn_connection.rb +58 -0
  61. data/lib/fog/aliyun/requests/compute/create_vpn_customergateway.rb +48 -0
  62. data/lib/fog/aliyun/requests/compute/create_vswitch.rb +54 -0
  63. data/lib/fog/aliyun/requests/compute/delete_disk.rb +41 -0
  64. data/lib/fog/aliyun/requests/compute/delete_image.rb +31 -0
  65. data/lib/fog/aliyun/requests/compute/delete_security_group.rb +51 -0
  66. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +63 -0
  67. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +71 -0
  68. data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +63 -0
  69. data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +71 -0
  70. data/lib/fog/aliyun/requests/compute/delete_server.rb +48 -0
  71. data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +31 -0
  72. data/lib/fog/aliyun/requests/compute/delete_vpc.rb +35 -0
  73. data/lib/fog/aliyun/requests/compute/delete_vpn_connection.rb +35 -0
  74. data/lib/fog/aliyun/requests/compute/delete_vpn_customergateway.rb +35 -0
  75. data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +35 -0
  76. data/lib/fog/aliyun/requests/compute/detach_disk.rb +41 -0
  77. data/lib/fog/aliyun/requests/compute/join_security_group.rb +40 -0
  78. data/lib/fog/aliyun/requests/compute/leave_security_group.rb +40 -0
  79. data/lib/fog/aliyun/requests/compute/list_disks.rb +150 -0
  80. data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +55 -0
  81. data/lib/fog/aliyun/requests/compute/list_images.rb +82 -0
  82. data/lib/fog/aliyun/requests/compute/list_route_tables.rb +64 -0
  83. data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +73 -0
  84. data/lib/fog/aliyun/requests/compute/list_security_groups.rb +78 -0
  85. data/lib/fog/aliyun/requests/compute/list_server_types.rb +77 -0
  86. data/lib/fog/aliyun/requests/compute/list_servers.rb +71 -0
  87. data/lib/fog/aliyun/requests/compute/list_snapshots.rb +97 -0
  88. data/lib/fog/aliyun/requests/compute/list_vpcs.rb +47 -0
  89. data/lib/fog/aliyun/requests/compute/list_vpn_connections.rb +49 -0
  90. data/lib/fog/aliyun/requests/compute/list_vpn_customergateways.rb +43 -0
  91. data/lib/fog/aliyun/requests/compute/list_vpn_gateways.rb +49 -0
  92. data/lib/fog/aliyun/requests/compute/list_vrouters.rb +61 -0
  93. data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +50 -0
  94. data/lib/fog/aliyun/requests/compute/list_zones.rb +44 -0
  95. data/lib/fog/aliyun/requests/compute/modify_vpc.rb +73 -0
  96. data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +45 -0
  97. data/lib/fog/aliyun/requests/compute/reboot_server.rb +43 -0
  98. data/lib/fog/aliyun/requests/compute/release_eip_address.rb +29 -0
  99. data/lib/fog/aliyun/requests/compute/start_server.rb +41 -0
  100. data/lib/fog/aliyun/requests/compute/stop_server.rb +41 -0
  101. data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +49 -0
  102. data/lib/fog/aliyun/requests/storage/copy_object.rb +39 -0
  103. data/lib/fog/aliyun/requests/storage/delete_bucket.rb +30 -0
  104. data/lib/fog/aliyun/requests/storage/delete_container.rb +35 -0
  105. data/lib/fog/aliyun/requests/storage/delete_object.rb +51 -0
  106. data/lib/fog/aliyun/requests/storage/get_bucket.rb +141 -0
  107. data/lib/fog/aliyun/requests/storage/get_container.rb +60 -0
  108. data/lib/fog/aliyun/requests/storage/get_containers.rb +64 -0
  109. data/lib/fog/aliyun/requests/storage/get_object.rb +45 -0
  110. data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +43 -0
  111. data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +43 -0
  112. data/lib/fog/aliyun/requests/storage/head_object.rb +34 -0
  113. data/lib/fog/aliyun/requests/storage/list_buckets.rb +40 -0
  114. data/lib/fog/aliyun/requests/storage/list_objects.rb +91 -0
  115. data/lib/fog/aliyun/requests/storage/put_bucket.rb +22 -0
  116. data/lib/fog/aliyun/requests/storage/put_container.rb +35 -0
  117. data/lib/fog/aliyun/requests/storage/put_object.rb +189 -0
  118. data/lib/fog/aliyun/storage.rb +233 -0
  119. data/lib/fog/aliyun/version.rb +5 -0
  120. data/lib/fog/aliyun.rb +19 -0
  121. data/lib/fog/bin/aliyun.rb +31 -0
  122. metadata +311 -0
@@ -0,0 +1,71 @@
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/securitygroup&authorizesecuritygroup]
6
+ def delete_security_group_egress_sg_rule(securitygroup_id, dest_group_id, option = {})
7
+ action = 'RevokeSecurityGroupEgress'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ parameters['SecurityGroupId'] = securitygroup_id
15
+ pathUrl += '&SecurityGroupId='
16
+ pathUrl += securitygroup_id
17
+
18
+ parameters['DestGroupId'] = dest_group_id
19
+ pathUrl += '&DestGroupId='
20
+ pathUrl += dest_group_id
21
+
22
+ nicType = 'intranet'
23
+ parameters['NicType'] = nicType
24
+ pathUrl += '&NicType='
25
+ pathUrl += nicType
26
+
27
+ portRange = option[:portRange]
28
+ portRange = '-1/-1' unless portRange
29
+ parameters['PortRange'] = portRange
30
+ pathUrl += '&PortRange='
31
+ pathUrl += URI.encode(portRange, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
32
+
33
+ protocol = option[:protocol]
34
+ protocol = 'all' unless protocol
35
+ parameters['IpProtocol'] = protocol
36
+ pathUrl += '&IpProtocol='
37
+ pathUrl += protocol
38
+
39
+ destGOAccount = option[:destGroupOwnerAccount]
40
+ if sourceGOAccount
41
+ parameters['DestGroupOwnerAccount'] = destGOAccount
42
+ pathUrl += '&DestGroupOwnerAccount='
43
+ pathUrl += destGOAccount
44
+ end
45
+
46
+ policy = option[:policy]
47
+ policy = 'accept' unless policy
48
+ parameters['Policy'] = policy
49
+ pathUrl += '&Policy='
50
+ pathUrl += policy
51
+
52
+ priority = option[:priority]
53
+ priority = '1' unless priority
54
+ parameters['Priority'] = priority
55
+ pathUrl += '&Priority='
56
+ pathUrl += priority
57
+
58
+ signature = sign(@aliyun_accesskey_secret, parameters)
59
+ pathUrl += '&Signature='
60
+ pathUrl += signature
61
+
62
+ request(
63
+ expects: [200, 203],
64
+ method: 'GET',
65
+ path: pathUrl
66
+ )
67
+ end
68
+ end
69
+ end # aliyun
70
+ end # compute
71
+ end # fog
@@ -0,0 +1,63 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_security_group_ip_rule(securitygroup_id, sourceCidrIp, nicType, option = {})
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/securitygroup&revokesecuritygroup]
7
+ action = 'RevokeSecurityGroup'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ parameters['SecurityGroupId'] = securitygroup_id
15
+ pathUrl += '&SecurityGroupId='
16
+ pathUrl += securitygroup_id
17
+
18
+ parameters['SourceCidrIp'] = sourceCidrIp
19
+ pathUrl += '&SourceCidrIp='
20
+ pathUrl += URI.encode(sourceCidrIp, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
21
+ nicType = 'intranet' unless nicType
22
+ parameters['NicType'] = nicType
23
+ pathUrl += '&NicType='
24
+ pathUrl += nicType
25
+
26
+ portRange = option[:portRange]
27
+ portRange = '-1/-1' unless portRange
28
+ parameters['PortRange'] = portRange
29
+ pathUrl += '&PortRange='
30
+ pathUrl += URI.encode(portRange, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
31
+
32
+ protocol = option[:protocol]
33
+ protocol = 'all' unless protocol
34
+ parameters['IpProtocol'] = protocol
35
+ pathUrl += '&IpProtocol='
36
+ pathUrl += protocol
37
+
38
+ policy = option[:policy]
39
+ policy = 'accept' unless policy
40
+ parameters['Policy'] = policy
41
+ pathUrl += '&Policy='
42
+ pathUrl += policy
43
+
44
+ priority = option[:priority]
45
+ priority = '1' unless priority
46
+ parameters['Priority'] = priority
47
+ pathUrl += '&Priority='
48
+ pathUrl += priority
49
+
50
+ signature = sign(@aliyun_accesskey_secret, parameters)
51
+ pathUrl += '&Signature='
52
+ pathUrl += signature
53
+
54
+ request(
55
+ expects: [200, 203],
56
+ method: 'GET',
57
+ path: pathUrl
58
+ )
59
+ end
60
+ end
61
+ end # aliyun
62
+ end # compute
63
+ end # fog
@@ -0,0 +1,71 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_security_group_sg_rule(securitygroup_id, source_securitygroup_id, option = {})
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/securitygroup&revokesecuritygroup]
7
+ action = 'RevokeSecurityGroup'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ parameters['SecurityGroupId'] = securitygroup_id
15
+ pathUrl += '&SecurityGroupId='
16
+ pathUrl += securitygroup_id
17
+
18
+ parameters['SourceGroupId'] = source_securitygroup_id
19
+ pathUrl += '&SourceGroupId='
20
+ pathUrl += source_securitygroup_id
21
+
22
+ nicType = 'intranet'
23
+ parameters['NicType'] = nicType
24
+ pathUrl += '&NicType='
25
+ pathUrl += nicType
26
+
27
+ portRange = option[:portRange]
28
+ portRange = '-1/-1' unless portRange
29
+ parameters['PortRange'] = portRange
30
+ pathUrl += '&PortRange='
31
+ pathUrl += URI.encode(portRange, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
32
+
33
+ protocol = option[:protocol]
34
+ protocol = 'all' unless protocol
35
+ parameters['IpProtocol'] = protocol
36
+ pathUrl += '&IpProtocol='
37
+ pathUrl += protocol
38
+
39
+ sourceGOAccount = option[:sourceGroupOwnerAccount]
40
+ if sourceGOAccount
41
+ parameters['SourceGroupOwnerAccount'] = sourceGOAccount
42
+ pathUrl += '&SourceGroupOwnerAccount='
43
+ pathUrl += sourceGOAccount
44
+ end
45
+
46
+ policy = option[:policy]
47
+ policy = 'accept' unless policy
48
+ parameters['Policy'] = policy
49
+ pathUrl += '&Policy='
50
+ pathUrl += policy
51
+
52
+ priority = option[:priority]
53
+ priority = '1' unless priority
54
+ parameters['Priority'] = priority
55
+ pathUrl += '&Priority='
56
+ pathUrl += priority
57
+
58
+ signature = sign(@aliyun_accesskey_secret, parameters)
59
+ pathUrl += '&Signature='
60
+ pathUrl += signature
61
+
62
+ request(
63
+ expects: [200, 203],
64
+ method: 'GET',
65
+ path: pathUrl
66
+ )
67
+ end
68
+ end
69
+ end # aliyun
70
+ end # compute
71
+ end # fog
@@ -0,0 +1,48 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_server(server_id)
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&deleteinstance]
7
+ _action = 'DeleteInstance'
8
+ _sigNonce = randonStr
9
+ _time = Time.new.utc
10
+
11
+ _parameters = defalutParameters(_action, _sigNonce, _time)
12
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
13
+
14
+ _parameters['InstanceId'] = server_id
15
+ _pathURL += '&InstanceId=' + server_id
16
+
17
+ _signature = sign(@aliyun_accesskey_secret, _parameters)
18
+ _pathURL += '&Signature=' + _signature
19
+
20
+ request(
21
+ expects: [200, 204],
22
+ method: 'GET',
23
+ path: _pathURL
24
+ )
25
+ end
26
+ end
27
+
28
+ class Mock
29
+ def delete_server(server_id)
30
+ response = Excon::Response.new
31
+ if server = list_servers_detail.body['servers'].find { |_| _['id'] == server_id }
32
+ if server['status'] == 'BUILD'
33
+ response.status = 409
34
+ raise(Excon::Errors.status_error({ expects: 204 }, response))
35
+ else
36
+ data[:last_modified][:servers].delete(server_id)
37
+ data[:servers].delete(server_id)
38
+ response.status = 204
39
+ end
40
+ response
41
+ else
42
+ raise Fog::Compute::OpenStack::NotFound
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_snapshot(snapshotId)
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/snapshot&deletesnapshot]
7
+ action = 'DeleteSnapshot'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ parameters['SnapshotId'] = snapshotId
15
+ pathUrl += '&SnapshotId='
16
+ pathUrl += snapshotId
17
+
18
+ signature = sign(@aliyun_accesskey_secret, parameters)
19
+ pathUrl += '&Signature='
20
+ pathUrl += signature
21
+
22
+ request(
23
+ expects: [200, 203],
24
+ method: 'GET',
25
+ path: pathUrl
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,35 @@
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&deletevpc]
6
+ def delete_vpc(vpc_id)
7
+ action = 'DeleteVpc'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ if vpc_id
15
+ parameters['VpcId'] = vpc_id
16
+ pathUrl += '&VpcId='
17
+ pathUrl += vpc_id
18
+ else
19
+ raise ArgumentError, 'Missing required vpc_id'
20
+ end
21
+
22
+ signature = sign(@aliyun_accesskey_secret, parameters)
23
+ pathUrl += '&Signature='
24
+ pathUrl += signature
25
+
26
+ request(
27
+ expects: [200, 203],
28
+ method: 'GET',
29
+ path: pathUrl
30
+ )
31
+ end
32
+ end
33
+ end # aliyun
34
+ end # compute
35
+ end # fog
@@ -0,0 +1,35 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_vpn_connection(vpn_connectionid)
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vswitch&deletevswitch]
7
+ action = 'DeleteVpnConnection'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutVPCParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
13
+
14
+ if vpn_connectionid
15
+ parameters['VpnConnectionId'] = vpn_connectionid
16
+ pathUrl += '&VpnConnectionId='
17
+ pathUrl += vpn_connectionid
18
+ else
19
+ raise ArgumentError, 'Missing required vpn_connectionid'
20
+ end
21
+
22
+ signature = sign(@aliyun_accesskey_secret, parameters)
23
+ pathUrl += '&Signature='
24
+ pathUrl += signature
25
+
26
+ VPCrequest(
27
+ expects: [200, 203],
28
+ method: 'GET',
29
+ path: pathUrl
30
+ )
31
+ end
32
+ end
33
+ end # aliyun
34
+ end # compute
35
+ end # fog
@@ -0,0 +1,35 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_vpn_customergateway(vpn_customergatewayid)
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vswitch&deletevswitch]
7
+ action = 'DeleteCustomerGateway'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutVPCParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunVPCUri(action, sigNonce, time)
13
+
14
+ if vpn_customergatewayid
15
+ parameters['CustomerGatewayId'] = vpn_customergatewayid
16
+ pathUrl += '&CustomerGatewayId='
17
+ pathUrl += vpn_customergatewayid
18
+ else
19
+ raise ArgumentError, 'Missing required vpn_customergatewayid'
20
+ end
21
+
22
+ signature = sign(@aliyun_accesskey_secret, parameters)
23
+ pathUrl += '&Signature='
24
+ pathUrl += signature
25
+
26
+ VPCrequest(
27
+ expects: [200, 203],
28
+ method: 'GET',
29
+ path: pathUrl
30
+ )
31
+ end
32
+ end
33
+ end # aliyun
34
+ end # compute
35
+ end # fog
@@ -0,0 +1,35 @@
1
+ module Fog
2
+ module Compute
3
+ class Aliyun
4
+ class Real
5
+ def delete_vswitch(vswitch_id)
6
+ # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/vswitch&deletevswitch]
7
+ action = 'DeleteVSwitch'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ if vswitch_id
15
+ parameters['VSwitchId'] = vswitch_id
16
+ pathUrl += '&VSwitchId='
17
+ pathUrl += vswitch_id
18
+ else
19
+ raise ArgumentError, 'Missing required vswitch_id'
20
+ end
21
+
22
+ signature = sign(@aliyun_accesskey_secret, parameters)
23
+ pathUrl += '&Signature='
24
+ pathUrl += signature
25
+
26
+ request(
27
+ expects: [200, 203],
28
+ method: 'GET',
29
+ path: pathUrl
30
+ )
31
+ end
32
+ end
33
+ end # aliyun
34
+ end # compute
35
+ end # fog
@@ -0,0 +1,41 @@
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/disk&detachdisk]
6
+ def detach_disk(instanceId, diskId, _options = {})
7
+ action = 'DetachDisk'
8
+ sigNonce = randonStr
9
+ time = Time.new.utc
10
+
11
+ parameters = defalutParameters(action, sigNonce, time)
12
+ pathUrl = defaultAliyunUri(action, sigNonce, time)
13
+
14
+ parameters['InstanceId'] = instanceId
15
+ pathUrl += '&InstanceId='
16
+ pathUrl += instanceId
17
+
18
+ parameters['DiskId'] = diskId
19
+ pathUrl += '&DiskId='
20
+ pathUrl += diskId
21
+
22
+ device = _options[:device]
23
+ if device
24
+ parameters['Device'] = device
25
+ pathUrl += '&Device='
26
+ pathUrl += URI.encode(device, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
27
+ end
28
+ signature = sign(@aliyun_accesskey_secret, parameters)
29
+ pathUrl += '&Signature='
30
+ pathUrl += signature
31
+
32
+ request(
33
+ expects: [200, 203],
34
+ method: 'GET',
35
+ path: pathUrl
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,40 @@
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/instance&joinsecuritygroup]
6
+ def join_security_group(server_id, group_id)
7
+ _action = 'JoinSecurityGroup'
8
+ _sigNonce = randonStr
9
+ _time = Time.new.utc
10
+
11
+ _parameters = defalutParameters(_action, _sigNonce, _time)
12
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
13
+
14
+ _parameters['InstanceId'] = server_id
15
+ _pathURL += '&InstanceId=' + server_id
16
+
17
+ _parameters['SecurityGroupId'] = group_id
18
+ _pathURL += '&SecurityGroupId=' + group_id
19
+
20
+ _signature = sign(@aliyun_accesskey_secret, _parameters)
21
+ _pathURL += '&Signature=' + _signature
22
+
23
+ request(
24
+ expects: [200, 204],
25
+ method: 'GET',
26
+ path: _pathURL
27
+ )
28
+ end
29
+ end
30
+
31
+ class Mock
32
+ def join_security_group(_server_id, _group_id)
33
+ response = Excon::Response.new
34
+ response.status = 200
35
+ response
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
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/instance&leavesecuritygroup]
6
+ def leave_security_group(server_id, group_id)
7
+ _action = 'LeaveSecurityGroup'
8
+ _sigNonce = randonStr
9
+ _time = Time.new.utc
10
+
11
+ _parameters = defalutParameters(_action, _sigNonce, _time)
12
+ _pathURL = defaultAliyunUri(_action, _sigNonce, _time)
13
+
14
+ _parameters['InstanceId'] = server_id
15
+ _pathURL += '&InstanceId=' + server_id
16
+
17
+ _parameters['SecurityGroupId'] = group_id
18
+ _pathURL += '&SecurityGroupId=' + group_id
19
+
20
+ _signature = sign(@aliyun_accesskey_secret, _parameters)
21
+ _pathURL += '&Signature=' + _signature
22
+
23
+ request(
24
+ expects: [200, 204],
25
+ method: 'GET',
26
+ path: _pathURL
27
+ )
28
+ end
29
+ end
30
+
31
+ class Mock
32
+ def add_security_group(_server_id, _group_name)
33
+ response = Excon::Response.new
34
+ response.status = 200
35
+ response
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end