fog-aliyun 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +114 -0
- data/README.md +61 -3
- data/fog-aliyun.gemspec +9 -4
- data/lib/fog/aliyun/compute.rb +34 -10
- data/lib/fog/aliyun/models/compute/flavor.rb +28 -0
- data/lib/fog/aliyun/models/compute/flavors.rb +13 -0
- data/lib/fog/aliyun/models/compute/image.rb +3 -1
- data/lib/fog/aliyun/models/compute/server.rb +13 -1
- data/lib/fog/aliyun/models/compute/servers.rb +2 -1
- data/lib/fog/aliyun/models/compute/vpcs.rb +1 -1
- data/lib/fog/aliyun/models/storage/directories.rb +34 -17
- data/lib/fog/aliyun/models/storage/directory.rb +102 -14
- data/lib/fog/aliyun/models/storage/file.rb +130 -120
- data/lib/fog/aliyun/models/storage/files.rb +69 -128
- data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +1 -1
- data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +1 -1
- data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +1 -1
- data/lib/fog/aliyun/requests/compute/attach_disk.rb +4 -2
- data/lib/fog/aliyun/requests/compute/create_disk.rb +2 -2
- data/lib/fog/aliyun/requests/compute/create_image.rb +1 -1
- data/lib/fog/aliyun/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +5 -3
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +4 -2
- data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +5 -3
- data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +4 -2
- data/lib/fog/aliyun/requests/compute/create_server.rb +23 -12
- data/lib/fog/aliyun/requests/compute/create_snapshot.rb +1 -1
- data/lib/fog/aliyun/requests/compute/create_vpc.rb +4 -2
- data/lib/fog/aliyun/requests/compute/create_vswitch.rb +4 -2
- data/lib/fog/aliyun/requests/compute/delete_disk.rb +1 -1
- data/lib/fog/aliyun/requests/compute/delete_image.rb +1 -1
- data/lib/fog/aliyun/requests/compute/delete_security_group.rb +1 -1
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +5 -3
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +4 -2
- data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +5 -3
- data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +4 -2
- data/lib/fog/aliyun/requests/compute/delete_server.rb +1 -1
- data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +1 -1
- data/lib/fog/aliyun/requests/compute/delete_vpc.rb +1 -1
- data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +1 -1
- data/lib/fog/aliyun/requests/compute/detach_disk.rb +4 -2
- data/lib/fog/aliyun/requests/compute/join_security_group.rb +1 -1
- data/lib/fog/aliyun/requests/compute/leave_security_group.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_disks.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_images.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_route_tables.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_security_groups.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_server_types.rb +3 -3
- data/lib/fog/aliyun/requests/compute/list_servers.rb +10 -10
- data/lib/fog/aliyun/requests/compute/list_snapshots.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_vpcs.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_vrouters.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +1 -1
- data/lib/fog/aliyun/requests/compute/list_zones.rb +1 -1
- data/lib/fog/aliyun/requests/compute/modify_vpc.rb +4 -2
- data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +4 -2
- data/lib/fog/aliyun/requests/compute/reboot_server.rb +1 -1
- data/lib/fog/aliyun/requests/compute/release_eip_address.rb +1 -1
- data/lib/fog/aliyun/requests/compute/start_server.rb +1 -1
- data/lib/fog/aliyun/requests/compute/stop_server.rb +1 -1
- data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +1 -1
- data/lib/fog/aliyun/requests/storage/abort_multipart_upload.rb +22 -0
- data/lib/fog/aliyun/requests/storage/complete_multipart_upload.rb +21 -0
- data/lib/fog/aliyun/requests/storage/copy_object.rb +16 -23
- data/lib/fog/aliyun/requests/storage/delete_bucket.rb +5 -14
- data/lib/fog/aliyun/requests/storage/delete_multiple_objects.rb +20 -0
- data/lib/fog/aliyun/requests/storage/delete_object.rb +12 -35
- data/lib/fog/aliyun/requests/storage/get_bucket.rb +30 -110
- data/lib/fog/aliyun/requests/storage/get_bucket_location.rb +33 -0
- data/lib/fog/aliyun/requests/storage/get_object.rb +29 -24
- data/lib/fog/aliyun/requests/storage/get_object_acl.rb +30 -0
- data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +14 -15
- data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +14 -15
- data/lib/fog/aliyun/requests/storage/get_service.rb +13 -0
- data/lib/fog/aliyun/requests/storage/head_object.rb +27 -18
- data/lib/fog/aliyun/requests/storage/initiate_multipart_upload.rb +19 -0
- data/lib/fog/aliyun/requests/storage/list_buckets.rb +8 -26
- data/lib/fog/aliyun/requests/storage/list_objects.rb +14 -73
- data/lib/fog/aliyun/requests/storage/put_bucket.rb +4 -10
- data/lib/fog/aliyun/requests/storage/put_object.rb +18 -162
- data/lib/fog/aliyun/requests/storage/upload_part.rb +24 -0
- data/lib/fog/aliyun/storage.rb +57 -29
- data/lib/fog/aliyun/version.rb +1 -1
- data/lib/fog/aliyun.rb +6 -9
- data/lib/fog/bin/aliyun.rb +1 -1
- metadata +118 -47
- data/lib/fog/aliyun/requests/storage/delete_container.rb +0 -33
- data/lib/fog/aliyun/requests/storage/get_container.rb +0 -56
- data/lib/fog/aliyun/requests/storage/get_containers.rb +0 -60
- data/lib/fog/aliyun/requests/storage/put_container.rb +0 -32
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'addressable'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module Compute
|
5
7
|
class Aliyun
|
@@ -10,7 +12,7 @@ module Fog
|
|
10
12
|
sigNonce = randonStr
|
11
13
|
time = Time.new.utc
|
12
14
|
|
13
|
-
parameters =
|
15
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
16
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
17
|
|
16
18
|
parameters['SecurityGroupId'] = securitygroup_id
|
@@ -30,7 +32,7 @@ module Fog
|
|
30
32
|
portRange ||= '-1/-1'
|
31
33
|
parameters['PortRange'] = portRange
|
32
34
|
pathUrl += '&PortRange='
|
33
|
-
pathUrl += URI.
|
35
|
+
pathUrl += Addressable::URI.encode_component(portRange, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
34
36
|
|
35
37
|
protocol = option[:protocol]
|
36
38
|
protocol ||= 'all'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'addressable'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module Compute
|
5
7
|
class Aliyun
|
@@ -10,7 +12,7 @@ module Fog
|
|
10
12
|
sigNonce = randonStr
|
11
13
|
time = Time.new.utc
|
12
14
|
|
13
|
-
parameters =
|
15
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
16
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
17
|
|
16
18
|
parameters['SecurityGroupId'] = securitygroup_id
|
@@ -19,7 +21,7 @@ module Fog
|
|
19
21
|
|
20
22
|
parameters['SourceCidrIp'] = sourceCidrIp
|
21
23
|
pathUrl += '&SourceCidrIp='
|
22
|
-
pathUrl += URI.
|
24
|
+
pathUrl += Addressable::URI.encode_component(sourceCidrIp, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
23
25
|
nicType ||= 'intranet'
|
24
26
|
parameters['NicType'] = nicType
|
25
27
|
pathUrl += '&NicType='
|
@@ -29,7 +31,7 @@ module Fog
|
|
29
31
|
portRange ||= '-1/-1'
|
30
32
|
parameters['PortRange'] = portRange
|
31
33
|
pathUrl += '&PortRange='
|
32
|
-
pathUrl += URI.
|
34
|
+
pathUrl += Addressable::URI.encode_component(portRange, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
33
35
|
|
34
36
|
protocol = option[:protocol]
|
35
37
|
protocol ||= 'all'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'addressable'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module Compute
|
5
7
|
class Aliyun
|
@@ -10,7 +12,7 @@ module Fog
|
|
10
12
|
sigNonce = randonStr
|
11
13
|
time = Time.new.utc
|
12
14
|
|
13
|
-
parameters =
|
15
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
16
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
17
|
|
16
18
|
parameters['SecurityGroupId'] = securitygroup_id
|
@@ -30,7 +32,7 @@ module Fog
|
|
30
32
|
portRange ||= '-1/-1'
|
31
33
|
parameters['PortRange'] = portRange
|
32
34
|
pathUrl += '&PortRange='
|
33
|
-
pathUrl += URI.
|
35
|
+
pathUrl += Addressable::URI.encode_component(portRange, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
34
36
|
|
35
37
|
protocol = option[:protocol]
|
36
38
|
protocol ||= 'all'
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_parameters['InstanceId'] = server_id
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
parameters['SnapshotId'] = snapshotId
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'addressable'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module Compute
|
5
7
|
class Aliyun
|
@@ -10,7 +12,7 @@ module Fog
|
|
10
12
|
sigNonce = randonStr
|
11
13
|
time = Time.new.utc
|
12
14
|
|
13
|
-
parameters =
|
15
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
16
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
17
|
|
16
18
|
parameters['InstanceId'] = instanceId
|
@@ -25,7 +27,7 @@ module Fog
|
|
25
27
|
if device
|
26
28
|
parameters['Device'] = device
|
27
29
|
pathUrl += '&Device='
|
28
|
-
pathUrl += URI.
|
30
|
+
pathUrl += Addressable::URI.encode_component(device, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
29
31
|
end
|
30
32
|
signature = sign(@aliyun_accesskey_secret, parameters)
|
31
33
|
pathUrl += '&Signature='
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_parameters['InstanceId'] = server_id
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_parameters['InstanceId'] = server_id
|
@@ -34,7 +34,7 @@ module Fog
|
|
34
34
|
sigNonce = randonStr
|
35
35
|
time = Time.new.utc
|
36
36
|
|
37
|
-
parameters =
|
37
|
+
parameters = defaultParameters(action, sigNonce, time)
|
38
38
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
39
39
|
|
40
40
|
pageNumber = options[:pageNumber]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_Status = options[:state]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
pageNumber = options[:pageNumber]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
parameters['VRouterId'] = vrouterid
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
parameters['SecurityGroupId'] = securityGroupId
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
pageNumber = options[:pageNumber]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_signature = sign(@aliyun_accesskey_secret, _parameters)
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
_sigNonce = randonStr
|
29
29
|
_time = Time.new.utc
|
30
30
|
|
31
|
-
_parameters =
|
31
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
32
32
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
33
33
|
|
34
34
|
_signature = sign(@aliyun_accesskey_secret, _parameters)
|
@@ -41,7 +41,7 @@ module Fog
|
|
41
41
|
)
|
42
42
|
|
43
43
|
_InstanceTypeId = nil
|
44
|
-
_InstanceTypeList =
|
44
|
+
_InstanceTypeList = response.body['InstanceTypes']['InstanceType']
|
45
45
|
_InstanceTypeList.each do |instance_type|
|
46
46
|
next unless (instance_type['CpuCoreCount'] == cpuCount) && (instance_type['MemorySize'] == memorySize)
|
47
47
|
_InstanceTypeId = instance_type['InstanceTypeId']
|
@@ -10,8 +10,8 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
14
|
-
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
|
+
_query_parameters = defaultAliyunQueryParameters(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_InstanceId = options[:instanceId]
|
17
17
|
_VpcId = options[:vpcId]
|
@@ -22,35 +22,35 @@ module Fog
|
|
22
22
|
unless _InstanceId.nil?
|
23
23
|
_InstanceStr = "[\"#{_InstanceId}\"]"
|
24
24
|
_parameters['InstanceIds'] = _InstanceStr
|
25
|
-
|
25
|
+
_query_parameters[:InstanceIds] = _InstanceStr
|
26
26
|
end
|
27
27
|
|
28
28
|
unless _VpcId.nil?
|
29
29
|
_parameters['VpcId'] = _VpcId
|
30
|
-
|
30
|
+
_query_parameters[:VpcId] = _VpcId
|
31
31
|
end
|
32
32
|
|
33
33
|
unless _SecurityGroupId.nil?
|
34
34
|
_parameters['SecurityGroupId'] = _SecurityGroupId
|
35
|
-
|
35
|
+
_query_parameters[:SecurityGroupId] = _SecurityGroupId
|
36
36
|
end
|
37
37
|
|
38
38
|
unless _PageNumber.nil?
|
39
39
|
_parameters['PageNumber'] = _PageNumber
|
40
|
-
|
40
|
+
_query_parameters[:PageNumber] = _PageNumber
|
41
41
|
end
|
42
42
|
|
43
43
|
_PageSize ||= '50'
|
44
44
|
_parameters['PageSize'] = _PageSize
|
45
|
-
|
45
|
+
_query_parameters[:PageSize] = _PageSize
|
46
46
|
|
47
|
-
_signature =
|
48
|
-
|
47
|
+
_signature = sign_without_encoding(@aliyun_accesskey_secret, _parameters)
|
48
|
+
_query_parameters[:Signature] = _signature
|
49
49
|
|
50
50
|
request(
|
51
51
|
expects: [200, 203],
|
52
52
|
method: 'GET',
|
53
|
-
|
53
|
+
query: _query_parameters
|
54
54
|
)
|
55
55
|
end
|
56
56
|
end
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
pageNumber = options[:pageNumber]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
_VpcId = options[:vpcId]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
_VRouterId = options[:vRouterId]
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
parameters['VpcId'] = vpcid
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
sigNonce = randonStr
|
11
11
|
time = Time.new.utc
|
12
12
|
|
13
|
-
parameters =
|
13
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
14
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
15
|
|
16
16
|
signature = sign(@aliyun_accesskey_secret, parameters)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'addressable'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module Compute
|
5
7
|
class Aliyun
|
@@ -10,12 +12,12 @@ module Fog
|
|
10
12
|
sigNonce = randonStr
|
11
13
|
time = Time.new.utc
|
12
14
|
|
13
|
-
parameters =
|
15
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
16
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
17
|
|
16
18
|
parameters['VpcId'] = vpcId
|
17
19
|
pathUrl += '&VpcId='
|
18
|
-
pathUrl += URI.
|
20
|
+
pathUrl += Addressable::URI.encode_component(vpcId, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
19
21
|
name = options[:name]
|
20
22
|
desc = options[:description]
|
21
23
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'addressable'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module Compute
|
5
7
|
class Aliyun
|
@@ -10,12 +12,12 @@ module Fog
|
|
10
12
|
sigNonce = randonStr
|
11
13
|
time = Time.new.utc
|
12
14
|
|
13
|
-
parameters =
|
15
|
+
parameters = defaultParameters(action, sigNonce, time)
|
14
16
|
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
15
17
|
|
16
18
|
parameters['VSwitchId'] = vSwitchId
|
17
19
|
pathUrl += '&VSwitchId='
|
18
|
-
pathUrl += URI.
|
20
|
+
pathUrl += Addressable::URI.encode_component(vpcId, Addressable::URI::CharacterClasses::UNRESERVED + '|')
|
19
21
|
name = options[:name]
|
20
22
|
desc = options[:description]
|
21
23
|
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_parameters['InstanceId'] = server_id
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
_sigNonce = randonStr
|
11
11
|
_time = Time.new.utc
|
12
12
|
|
13
|
-
_parameters =
|
13
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
14
14
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
15
15
|
|
16
16
|
_parameters['AllocationId'] = allocationId
|
@@ -16,7 +16,7 @@ module Fog
|
|
16
16
|
_sigNonce = randonStr
|
17
17
|
_time = Time.new.utc
|
18
18
|
|
19
|
-
_parameters =
|
19
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
20
20
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
21
21
|
|
22
22
|
_parameters['InstanceId'] = server_id
|
@@ -16,7 +16,7 @@ module Fog
|
|
16
16
|
_sigNonce = randonStr
|
17
17
|
_time = Time.new.utc
|
18
18
|
|
19
|
-
_parameters =
|
19
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
20
20
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
21
21
|
|
22
22
|
_parameters['InstanceId'] = server_id
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
|
23
23
|
type = options['instance_type']
|
24
24
|
|
25
|
-
_parameters =
|
25
|
+
_parameters = defaultParameters(_action, _sigNonce, _time)
|
26
26
|
_pathURL = defaultAliyunUri(_action, _sigNonce, _time)
|
27
27
|
|
28
28
|
_parameters['InstanceId'] = server_id
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module Fog
|
3
|
+
module Aliyun
|
4
|
+
class Storage
|
5
|
+
class Real
|
6
|
+
#
|
7
|
+
# Abort a multipart upload
|
8
|
+
#
|
9
|
+
# @param [String] bucket_name Name of bucket to abort multipart upload on
|
10
|
+
# @param [String] object_name Name of object to abort multipart upload on
|
11
|
+
# @param [String] upload_id Id of upload to add part to
|
12
|
+
#
|
13
|
+
# @see https://help.aliyun.com/document_detail/31996.html
|
14
|
+
#
|
15
|
+
def abort_multipart_upload(bucket_name, object_name, upload_id)
|
16
|
+
@oss_protocol.abort_multipart_upload(bucket_name, object_name, upload_id)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
module Fog
|
3
|
+
module Aliyun
|
4
|
+
class Storage
|
5
|
+
class Real
|
6
|
+
# Complete a multipart upload
|
7
|
+
#
|
8
|
+
# @param [String] bucket_name Name of bucket to complete multipart upload for
|
9
|
+
# @param [String] object_name Name of object to complete multipart upload for
|
10
|
+
# @param [String] upload_id Id of upload to add part to
|
11
|
+
# @param [Array] parts Array of etag and number as Strings for parts
|
12
|
+
#
|
13
|
+
# @see https://help.aliyun.com/document_detail/31995.html
|
14
|
+
#
|
15
|
+
def complete_multipart_upload(bucket_name, object_name, upload_id, parts)
|
16
|
+
@oss_protocol.complete_multipart_upload(bucket_name, object_name, upload_id, parts)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,34 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Fog
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module Aliyun
|
5
|
+
class Storage
|
6
6
|
class Real
|
7
7
|
# Copy object
|
8
8
|
#
|
9
9
|
# ==== Parameters
|
10
|
-
# *
|
11
|
-
# *
|
12
|
-
# *
|
13
|
-
# *
|
10
|
+
# * source_bucket_name<~String> - Name of source bucket
|
11
|
+
# * source_object_name<~String> - Name of source object
|
12
|
+
# * target_bucket_name<~String> - Name of bucket to create copy in
|
13
|
+
# * target_object_name<~String> - Name for new copy of object
|
14
14
|
# * options<~Hash> - Additional headers options={}
|
15
|
-
def copy_object(
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
request(expects: [200, 203],
|
26
|
-
headers: headers,
|
27
|
-
method: 'PUT',
|
28
|
-
path: target_object,
|
29
|
-
bucket: target_bucket,
|
30
|
-
resource: resource,
|
31
|
-
endpoint: endpoint)
|
15
|
+
def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
|
16
|
+
headers = { 'x-oss-copy-source' => "/#{source_bucket_name}#{object_to_path(source_object_name)}" }.merge!(options)
|
17
|
+
resources = {
|
18
|
+
:bucket => target_bucket_name,
|
19
|
+
:object => target_object_name
|
20
|
+
}
|
21
|
+
http_options = {
|
22
|
+
:headers => headers
|
23
|
+
}
|
24
|
+
@oss_http.put(resources, http_options)
|
32
25
|
end
|
33
26
|
end
|
34
27
|
end
|
@@ -1,25 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Fog
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module Aliyun
|
5
|
+
class Storage
|
6
6
|
class Real
|
7
7
|
# Delete an existing bucket
|
8
8
|
#
|
9
9
|
# ==== Parameters
|
10
|
-
# *
|
10
|
+
# * bucket_name<~String> - Name of bucket to delete
|
11
11
|
#
|
12
|
-
def delete_bucket(
|
13
|
-
|
14
|
-
endpoint = 'http://' + location + '.aliyuncs.com'
|
15
|
-
resource = bucket + '/'
|
16
|
-
request(
|
17
|
-
expects: 204,
|
18
|
-
method: 'DELETE',
|
19
|
-
bucket: bucket,
|
20
|
-
resource: resource,
|
21
|
-
endpoint: endpoint
|
22
|
-
)
|
12
|
+
def delete_bucket(bucket_name)
|
13
|
+
@oss_protocol.delete_bucket(bucket_name)
|
23
14
|
end
|
24
15
|
end
|
25
16
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Aliyun
|
3
|
+
class Storage
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Delete multiple objects from OSS
|
7
|
+
#
|
8
|
+
# @param bucket_name [String] Name of bucket containing object to delete
|
9
|
+
# @param object_names [Array] Array of object names to delete
|
10
|
+
#
|
11
|
+
# @see https://help.aliyun.com/document_detail/31983.html
|
12
|
+
|
13
|
+
def delete_multiple_objects(bucket_name, object_names, options = {})
|
14
|
+
bucket = @oss_client.get_bucket(bucket_name)
|
15
|
+
bucket.batch_delete_objects(object_names, options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|