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,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/model'
|
2
4
|
module Fog
|
3
5
|
module Compute
|
4
6
|
class Aliyun
|
5
7
|
class VPC < Fog::Model
|
6
|
-
identity
|
7
|
-
attribute :name,
|
8
|
-
attribute :state,
|
9
|
-
attribute :cidr_block,
|
10
|
-
attribute :v_switch_ids,
|
11
|
-
attribute :description,
|
12
|
-
attribute :user_cidrs,
|
13
|
-
attribute :region_id,
|
14
|
-
attribute :v_router_id,
|
15
|
-
attribute :create_at,
|
8
|
+
identity :id, aliases: 'VpcId'
|
9
|
+
attribute :name, aliases: 'VpcName'
|
10
|
+
attribute :state, aliases: 'Status'
|
11
|
+
attribute :cidr_block, aliases: 'CidrBlock'
|
12
|
+
attribute :v_switch_ids, aliases: 'VSwitchIds'
|
13
|
+
attribute :description, aliases: 'Description'
|
14
|
+
attribute :user_cidrs, aliases: 'UserCidrs'
|
15
|
+
attribute :region_id, aliases: 'RegionId'
|
16
|
+
attribute :v_router_id, aliases: 'VRouterId'
|
17
|
+
attribute :create_at, aliases: 'CreationTime'
|
16
18
|
|
17
19
|
def ready?
|
18
20
|
requires :state
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
4
|
require 'fog/aliyun/models/compute/vpc'
|
3
5
|
|
@@ -70,9 +72,7 @@ module Fog
|
|
70
72
|
#
|
71
73
|
|
72
74
|
def get(vpcId)
|
73
|
-
if vpcId
|
74
|
-
$vpc = self.class.new(service: service).all('vpcId' => vpcId)[0]
|
75
|
-
end
|
75
|
+
$vpc = self.class.new(service: service).all('vpcId' => vpcId)[0] if vpcId
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/model'
|
2
4
|
module Fog
|
3
5
|
module Compute
|
4
6
|
class Aliyun
|
5
7
|
class VRouter < Fog::Model
|
6
|
-
identity :id,
|
8
|
+
identity :id, aliases: 'VRouterId'
|
7
9
|
|
8
|
-
attribute :name,
|
10
|
+
attribute :name, aliases: 'VRouterName'
|
9
11
|
attribute :route_table_ids, aliases: 'RouteTableIds'
|
10
|
-
attribute :created_at,
|
11
|
-
attribute :description,
|
12
|
-
attribute :region_id,
|
13
|
-
attribute :vpc_id,
|
12
|
+
attribute :created_at, aliases: 'CreationTime'
|
13
|
+
attribute :description, aliases: 'Description'
|
14
|
+
attribute :region_id, aliases: 'RegionId'
|
15
|
+
attribute :vpc_id, aliases: 'VpcId'
|
14
16
|
|
15
17
|
def vpc
|
16
18
|
requires :vpc_id
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
4
|
require 'fog/aliyun/models/compute/vrouter'
|
3
5
|
|
@@ -51,9 +53,7 @@ module Fog
|
|
51
53
|
#
|
52
54
|
|
53
55
|
def get(vRouterId)
|
54
|
-
if vRouterId
|
55
|
-
self.class.new(service: service).all('vRouterId' => vRouterId)[0]
|
56
|
-
end
|
56
|
+
self.class.new(service: service).all('vRouterId' => vRouterId)[0] if vRouterId
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/model'
|
2
4
|
module Fog
|
3
5
|
module Compute
|
4
6
|
class Aliyun
|
5
7
|
class Vswitch < Fog::Model
|
6
|
-
identity
|
7
|
-
attribute :vpc_id,
|
8
|
-
attribute :zone_id,
|
9
|
-
attribute :name,
|
10
|
-
attribute :available_ip_count,
|
11
|
-
attribute :state,
|
12
|
-
attribute :cidr_block,
|
13
|
-
attribute :description,
|
14
|
-
attribute :region_id,
|
8
|
+
identity :id, aliases: 'VSwitchId'
|
9
|
+
attribute :vpc_id, aliases: 'VpcId'
|
10
|
+
attribute :zone_id, aliases: 'ZoneId'
|
11
|
+
attribute :name, aliases: 'VSwitchName'
|
12
|
+
attribute :available_ip_count, aliases: 'AvailableIpAddressCount'
|
13
|
+
attribute :state, aliases: 'Status'
|
14
|
+
attribute :cidr_block, aliases: 'CidrBlock'
|
15
|
+
attribute :description, aliases: 'Description'
|
16
|
+
attribute :region_id, aliases: 'RegionId'
|
15
17
|
attribute :create_at, aliases: 'CreationTime'
|
16
18
|
def initialize(attributes = {})
|
17
19
|
super
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
4
|
require 'fog/aliyun/models/compute/vswitch'
|
3
5
|
|
@@ -70,9 +72,7 @@ module Fog
|
|
70
72
|
|
71
73
|
def get(vswitchId)
|
72
74
|
requires :vpc
|
73
|
-
if vswitchId
|
74
|
-
self.class.new(service: service, vpc: vpc).all(vSwitchId: vswitchId)[0]
|
75
|
-
end
|
75
|
+
self.class.new(service: service, vpc: vpc).all(vSwitchId: vswitchId)[0] if vswitchId
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
4
|
require 'fog/aliyun/models/storage/directory'
|
3
5
|
|
@@ -9,7 +11,7 @@ module Fog
|
|
9
11
|
|
10
12
|
def all
|
11
13
|
containers = service.get_containers
|
12
|
-
return nil if nil
|
14
|
+
return nil if containers.nil?
|
13
15
|
data = []
|
14
16
|
i = 0
|
15
17
|
containers.each do |entry|
|
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/model'
|
2
4
|
|
3
5
|
module Fog
|
4
6
|
module Storage
|
5
7
|
class Aliyun
|
6
8
|
class File < Fog::Model
|
7
|
-
identity
|
8
|
-
attribute :date,
|
9
|
-
attribute :content_length,
|
10
|
-
attribute :content_type,
|
11
|
-
attribute :connection,
|
9
|
+
identity :key, aliases: 'name'
|
10
|
+
attribute :date, aliases: 'Date'
|
11
|
+
attribute :content_length, aliases: 'Content-Length', type: :integer
|
12
|
+
attribute :content_type, aliases: 'Content-Type'
|
13
|
+
attribute :connection, aliases: 'Connection'
|
12
14
|
attribute :content_disposition, aliases: 'Content-Disposition'
|
13
|
-
attribute :etag,
|
14
|
-
attribute :last_modified,
|
15
|
-
attribute :accept_ranges,
|
16
|
-
attribute :server,
|
17
|
-
attribute :object_type,
|
15
|
+
attribute :etag, aliases: 'Etag'
|
16
|
+
attribute :last_modified, aliases: 'Last-Modified', type: :time
|
17
|
+
attribute :accept_ranges, aliases: 'Accept-Ranges'
|
18
|
+
attribute :server, aliases: 'Server'
|
19
|
+
attribute :object_type, aliases: 'x-oss-object-type'
|
18
20
|
|
19
21
|
def body
|
20
22
|
attributes[:body] ||= if last_modified
|
@@ -37,11 +39,11 @@ module Fog
|
|
37
39
|
else
|
38
40
|
directory.key + '/' + key
|
39
41
|
end
|
40
|
-
if target_directory_key == ''
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
target_object = if target_directory_key == ''
|
43
|
+
target_file_key
|
44
|
+
else
|
45
|
+
target_directory_key + '/' + target_file_key
|
46
|
+
end
|
45
47
|
service.copy_object(nil, source_object, nil, target_object, options)
|
46
48
|
target_directory = service.directories.new(key: target_directory_key)
|
47
49
|
target_directory.files.get(target_file_key)
|
@@ -169,7 +171,7 @@ module Fog
|
|
169
171
|
end
|
170
172
|
|
171
173
|
headers = service.head_object(object).data[:headers]
|
172
|
-
headers.
|
174
|
+
headers.select! { |k, _v| metadata_attribute?(k) }
|
173
175
|
else
|
174
176
|
{}
|
175
177
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fog/core/collection'
|
2
4
|
require 'fog/aliyun/models/storage/file'
|
3
5
|
|
@@ -15,11 +17,9 @@ module Fog
|
|
15
17
|
|
16
18
|
def all(_options = {})
|
17
19
|
requires :directory
|
18
|
-
if directory.key != '' && directory.key != '.' && !directory.key.nil?
|
19
|
-
prefix = directory.key + '/'
|
20
|
-
end
|
20
|
+
prefix = directory.key + '/' if directory.key != '' && directory.key != '.' && !directory.key.nil?
|
21
21
|
files = service.list_objects(prefix: prefix)['Contents']
|
22
|
-
return if nil
|
22
|
+
return if files.nil?
|
23
23
|
data = []
|
24
24
|
i = 0
|
25
25
|
files.each do |file|
|
@@ -27,9 +27,7 @@ module Fog
|
|
27
27
|
content_length = file['Size'][0].to_i
|
28
28
|
key = file['Key'][0]
|
29
29
|
lastModified = file['LastModified'][0]
|
30
|
-
last_modified = if !lastModified.nil? && lastModified != ''
|
31
|
-
Time.parse(lastModified).localtime
|
32
|
-
end
|
30
|
+
last_modified = (Time.parse(lastModified).localtime if !lastModified.nil? && lastModified != '')
|
33
31
|
type = file['Type'][0]
|
34
32
|
data[i] = { content_length: content_length,
|
35
33
|
key: key,
|
@@ -67,13 +65,13 @@ module Fog
|
|
67
65
|
directory.key + '/' + key
|
68
66
|
end
|
69
67
|
begin
|
70
|
-
|
71
|
-
rescue => error
|
68
|
+
data = service.get_object(object)
|
69
|
+
rescue StandardError => error
|
72
70
|
case error.response.body
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
when /<Code>NoSuchKey<\/Code>/
|
72
|
+
nil
|
73
|
+
else
|
74
|
+
raise(error)
|
77
75
|
end
|
78
76
|
end
|
79
77
|
|
@@ -96,9 +94,7 @@ module Fog
|
|
96
94
|
end
|
97
95
|
|
98
96
|
lastModified = data[:headers]['Last-Modified']
|
99
|
-
last_modified = if !lastModified.nil? && lastModified != ''
|
100
|
-
Time.parse(lastModified).localtime
|
101
|
-
end
|
97
|
+
last_modified = (Time.parse(lastModified).localtime if !lastModified.nil? && lastModified != '')
|
102
98
|
|
103
99
|
date = data[:headers]['Date']
|
104
100
|
date = (Time.parse(date).localtime if !date.nil? && date != '')
|
@@ -159,9 +155,7 @@ module Fog
|
|
159
155
|
end
|
160
156
|
data = service.head_object(object).data
|
161
157
|
lastModified = data[:headers]['Last-Modified']
|
162
|
-
last_modified = if !lastModified.nil? && lastModified != ''
|
163
|
-
Time.parse(lastModified).localtime
|
164
|
-
end
|
158
|
+
last_modified = (Time.parse(lastModified).localtime if !lastModified.nil? && lastModified != '')
|
165
159
|
|
166
160
|
date = data[:headers]['Date']
|
167
161
|
date = (Time.parse(date).localtime if !date.nil? && date != '')
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -35,7 +37,7 @@ module Fog
|
|
35
37
|
end
|
36
38
|
|
37
39
|
_InternetChargeType = options[:internet_charge_type]
|
38
|
-
_InternetChargeType
|
40
|
+
_InternetChargeType ||= 'PayByTraffic'
|
39
41
|
_parameters['InternetChargeType'] = _InternetChargeType
|
40
42
|
_pathURL += '&InternetChargeType=' + _InternetChargeType
|
41
43
|
|
@@ -49,6 +51,6 @@ module Fog
|
|
49
51
|
)
|
50
52
|
end
|
51
53
|
end
|
52
|
-
end
|
53
|
-
end
|
54
|
+
end
|
55
|
+
end
|
54
56
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -17,12 +19,12 @@ module Fog
|
|
17
19
|
#
|
18
20
|
# {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.201.106.DGkmH7#/pub/ecs/open-api/disk&attachdisk]
|
19
21
|
def attach_disk(instanceId, diskId, options = {})
|
20
|
-
action
|
22
|
+
action = 'AttachDisk'
|
21
23
|
sigNonce = randonStr
|
22
|
-
time
|
24
|
+
time = Time.new.utc
|
23
25
|
|
24
26
|
parameters = defalutParameters(action, sigNonce, time)
|
25
|
-
pathUrl
|
27
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
26
28
|
|
27
29
|
parameters['InstanceId'] = instanceId
|
28
30
|
pathUrl += '&InstanceId='
|
@@ -33,9 +35,9 @@ module Fog
|
|
33
35
|
pathUrl += diskId
|
34
36
|
|
35
37
|
deleteWithInstance = options[:deleteWithInstance]
|
36
|
-
device
|
38
|
+
device = options[:device]
|
37
39
|
|
38
|
-
deleteWithInstance
|
40
|
+
deleteWithInstance ||= 'true'
|
39
41
|
|
40
42
|
parameters['DeleteWithInstance'] = deleteWithInstance
|
41
43
|
pathUrl += '&DeleteWithInstance='
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class Aliyun
|
@@ -19,12 +21,12 @@ module Fog
|
|
19
21
|
#
|
20
22
|
# {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.201.106.DGkmH7#/pub/ecs/open-api/disk&createdisk]
|
21
23
|
def create_disk(size, options = {})
|
22
|
-
action
|
24
|
+
action = 'CreateDisk'
|
23
25
|
sigNonce = randonStr
|
24
|
-
time
|
26
|
+
time = Time.new.utc
|
25
27
|
|
26
28
|
parameters = defalutParameters(action, sigNonce, time)
|
27
|
-
pathUrl
|
29
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
28
30
|
|
29
31
|
parameters['ZoneId'] = @aliyun_zone_id
|
30
32
|
pathUrl += '&ZoneId='
|
@@ -34,8 +36,8 @@ module Fog
|
|
34
36
|
pathUrl += '&Size='
|
35
37
|
pathUrl += size
|
36
38
|
|
37
|
-
name
|
38
|
-
desc
|
39
|
+
name = options[:name]
|
40
|
+
desc = options[:description]
|
39
41
|
category = options[:category]
|
40
42
|
|
41
43
|
if name
|
@@ -84,12 +86,12 @@ module Fog
|
|
84
86
|
#
|
85
87
|
# {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.201.106.DGkmH7#/pub/ecs/open-api/disk&createdisk]
|
86
88
|
def create_disk_by_snapshot(snapshotId, options = {})
|
87
|
-
action
|
89
|
+
action = 'CreateDisk'
|
88
90
|
sigNonce = randonStr
|
89
|
-
time
|
91
|
+
time = Time.new.utc
|
90
92
|
|
91
93
|
parameters = defalutParameters(action, sigNonce, time)
|
92
|
-
pathUrl
|
94
|
+
pathUrl = defaultAliyunUri(action, sigNonce, time)
|
93
95
|
|
94
96
|
parameters['ZoneId'] = @aliyun_zone_id
|
95
97
|
pathUrl += '&ZoneId='
|
@@ -99,8 +101,8 @@ module Fog
|
|
99
101
|
pathUrl += '&SnapshotId='
|
100
102
|
pathUrl += snapshotId
|
101
103
|
|
102
|
-
name
|
103
|
-
desc
|
104
|
+
name = options[:name]
|
105
|
+
desc = options[:description]
|
104
106
|
category = options[:category]
|
105
107
|
|
106
108
|
if name
|
@@ -132,6 +134,6 @@ module Fog
|
|
132
134
|
)
|
133
135
|
end
|
134
136
|
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|