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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +23 -10
  3. data/.rubocop.yml +31 -4
  4. data/.rubocop_todo.yml +83 -55
  5. data/Gemfile +2 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +4 -3
  8. data/fog-aliyun.gemspec +19 -18
  9. data/lib/fog/aliyun.rb +4 -2
  10. data/lib/fog/aliyun/compute.rb +45 -43
  11. data/lib/fog/aliyun/models/compute/eip_address.rb +10 -8
  12. data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -3
  13. data/lib/fog/aliyun/models/compute/image.rb +23 -21
  14. data/lib/fog/aliyun/models/compute/images.rb +2 -0
  15. data/lib/fog/aliyun/models/compute/route_entry.rb +7 -5
  16. data/lib/fog/aliyun/models/compute/route_entrys.rb +2 -0
  17. data/lib/fog/aliyun/models/compute/route_table.rb +6 -4
  18. data/lib/fog/aliyun/models/compute/route_tables.rb +3 -3
  19. data/lib/fog/aliyun/models/compute/security_group.rb +7 -5
  20. data/lib/fog/aliyun/models/compute/security_group_rule.rb +15 -13
  21. data/lib/fog/aliyun/models/compute/security_group_rules.rb +2 -0
  22. data/lib/fog/aliyun/models/compute/security_groups.rb +2 -0
  23. data/lib/fog/aliyun/models/compute/server.rb +28 -26
  24. data/lib/fog/aliyun/models/compute/servers.rb +3 -3
  25. data/lib/fog/aliyun/models/compute/snapshot.rb +12 -10
  26. data/lib/fog/aliyun/models/compute/snapshots.rb +2 -0
  27. data/lib/fog/aliyun/models/compute/volume.rb +27 -25
  28. data/lib/fog/aliyun/models/compute/volumes.rb +2 -0
  29. data/lib/fog/aliyun/models/compute/vpc.rb +12 -10
  30. data/lib/fog/aliyun/models/compute/vpcs.rb +3 -3
  31. data/lib/fog/aliyun/models/compute/vrouter.rb +8 -6
  32. data/lib/fog/aliyun/models/compute/vrouters.rb +3 -3
  33. data/lib/fog/aliyun/models/compute/vswitch.rb +11 -9
  34. data/lib/fog/aliyun/models/compute/vswitches.rb +3 -3
  35. data/lib/fog/aliyun/models/storage/directories.rb +3 -1
  36. data/lib/fog/aliyun/models/storage/directory.rb +2 -0
  37. data/lib/fog/aliyun/models/storage/file.rb +18 -16
  38. data/lib/fog/aliyun/models/storage/files.rb +13 -19
  39. data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +5 -3
  40. data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +4 -2
  41. data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +4 -2
  42. data/lib/fog/aliyun/requests/compute/attach_disk.rb +7 -5
  43. data/lib/fog/aliyun/requests/compute/create_disk.rb +15 -13
  44. data/lib/fog/aliyun/requests/compute/create_image.rb +3 -1
  45. data/lib/fog/aliyun/requests/compute/create_security_group.rb +11 -9
  46. data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +13 -11
  47. data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +12 -10
  48. data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +13 -11
  49. data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +12 -10
  50. data/lib/fog/aliyun/requests/compute/create_server.rb +11 -9
  51. data/lib/fog/aliyun/requests/compute/create_snapshot.rb +3 -1
  52. data/lib/fog/aliyun/requests/compute/create_vpc.rb +6 -4
  53. data/lib/fog/aliyun/requests/compute/create_vpn_connection.rb +8 -6
  54. data/lib/fog/aliyun/requests/compute/create_vpn_customergateway.rb +6 -6
  55. data/lib/fog/aliyun/requests/compute/create_vswitch.rb +6 -4
  56. data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -6
  57. data/lib/fog/aliyun/requests/compute/delete_image.rb +3 -1
  58. data/lib/fog/aliyun/requests/compute/delete_security_group.rb +7 -5
  59. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +13 -11
  60. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +12 -10
  61. data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +13 -11
  62. data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +12 -10
  63. data/lib/fog/aliyun/requests/compute/delete_server.rb +2 -0
  64. data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +3 -1
  65. data/lib/fog/aliyun/requests/compute/delete_vpc.rb +6 -4
  66. data/lib/fog/aliyun/requests/compute/delete_vpn_connection.rb +6 -4
  67. data/lib/fog/aliyun/requests/compute/delete_vpn_customergateway.rb +6 -4
  68. data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +6 -4
  69. data/lib/fog/aliyun/requests/compute/detach_disk.rb +6 -4
  70. data/lib/fog/aliyun/requests/compute/join_security_group.rb +2 -0
  71. data/lib/fog/aliyun/requests/compute/leave_security_group.rb +2 -0
  72. data/lib/fog/aliyun/requests/compute/list_disks.rb +5 -3
  73. data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +5 -3
  74. data/lib/fog/aliyun/requests/compute/list_images.rb +5 -3
  75. data/lib/fog/aliyun/requests/compute/list_route_tables.rb +6 -4
  76. data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +7 -5
  77. data/lib/fog/aliyun/requests/compute/list_security_groups.rb +10 -8
  78. data/lib/fog/aliyun/requests/compute/list_server_types.rb +8 -6
  79. data/lib/fog/aliyun/requests/compute/list_servers.rb +4 -2
  80. data/lib/fog/aliyun/requests/compute/list_snapshots.rb +4 -2
  81. data/lib/fog/aliyun/requests/compute/list_vpcs.rb +5 -3
  82. data/lib/fog/aliyun/requests/compute/list_vpn_connections.rb +49 -49
  83. data/lib/fog/aliyun/requests/compute/list_vpn_customergateways.rb +42 -43
  84. data/lib/fog/aliyun/requests/compute/list_vpn_gateways.rb +49 -49
  85. data/lib/fog/aliyun/requests/compute/list_vrouters.rb +6 -4
  86. data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +6 -4
  87. data/lib/fog/aliyun/requests/compute/list_zones.rb +3 -1
  88. data/lib/fog/aliyun/requests/compute/modify_vpc.rb +7 -5
  89. data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +6 -4
  90. data/lib/fog/aliyun/requests/compute/reboot_server.rb +2 -0
  91. data/lib/fog/aliyun/requests/compute/release_eip_address.rb +4 -2
  92. data/lib/fog/aliyun/requests/compute/start_server.rb +9 -7
  93. data/lib/fog/aliyun/requests/compute/stop_server.rb +9 -7
  94. data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +4 -2
  95. data/lib/fog/aliyun/requests/storage/copy_object.rb +3 -2
  96. data/lib/fog/aliyun/requests/storage/delete_bucket.rb +3 -2
  97. data/lib/fog/aliyun/requests/storage/delete_container.rb +3 -2
  98. data/lib/fog/aliyun/requests/storage/delete_object.rb +4 -3
  99. data/lib/fog/aliyun/requests/storage/get_bucket.rb +6 -11
  100. data/lib/fog/aliyun/requests/storage/get_container.rb +3 -2
  101. data/lib/fog/aliyun/requests/storage/get_containers.rb +3 -2
  102. data/lib/fog/aliyun/requests/storage/get_object.rb +4 -3
  103. data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +5 -4
  104. data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +5 -4
  105. data/lib/fog/aliyun/requests/storage/head_object.rb +3 -2
  106. data/lib/fog/aliyun/requests/storage/list_buckets.rb +3 -2
  107. data/lib/fog/aliyun/requests/storage/list_objects.rb +5 -4
  108. data/lib/fog/aliyun/requests/storage/put_bucket.rb +3 -2
  109. data/lib/fog/aliyun/requests/storage/put_container.rb +3 -2
  110. data/lib/fog/aliyun/requests/storage/put_object.rb +12 -17
  111. data/lib/fog/aliyun/storage.rb +41 -52
  112. data/lib/fog/aliyun/version.rb +3 -1
  113. data/lib/fog/bin/aliyun.rb +10 -7
  114. 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 :id, aliases: 'VpcId'
7
- attribute :name, aliases: 'VpcName'
8
- attribute :state, aliases: 'Status'
9
- attribute :cidr_block, aliases: 'CidrBlock'
10
- attribute :v_switch_ids, aliases: 'VSwitchIds'
11
- attribute :description, aliases: 'Description'
12
- attribute :user_cidrs, aliases: 'UserCidrs'
13
- attribute :region_id, aliases: 'RegionId'
14
- attribute :v_router_id, aliases: 'VRouterId'
15
- attribute :create_at, aliases: 'CreationTime'
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, aliases: 'VRouterId'
8
+ identity :id, aliases: 'VRouterId'
7
9
 
8
- attribute :name, aliases: 'VRouterName'
10
+ attribute :name, aliases: 'VRouterName'
9
11
  attribute :route_table_ids, aliases: 'RouteTableIds'
10
- attribute :created_at, aliases: 'CreationTime'
11
- attribute :description, aliases: 'Description'
12
- attribute :region_id, aliases: 'RegionId'
13
- attribute :vpc_id, aliases: 'VpcId'
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 :id, aliases: 'VSwitchId'
7
- attribute :vpc_id, aliases: 'VpcId'
8
- attribute :zone_id, aliases: 'ZoneId'
9
- attribute :name, aliases: 'VSwitchName'
10
- attribute :available_ip_count, aliases: 'AvailableIpAddressCount'
11
- attribute :state, aliases: 'Status'
12
- attribute :cidr_block, aliases: 'CidrBlock'
13
- attribute :description, aliases: 'Description'
14
- attribute :region_id, aliases: 'RegionId'
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 == containers
14
+ return nil if containers.nil?
13
15
  data = []
14
16
  i = 0
15
17
  containers.each do |entry|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fog/core/model'
2
4
  require 'fog/aliyun/models/storage/files'
3
5
 
@@ -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 :key, aliases: 'name'
8
- attribute :date, aliases: 'Date'
9
- attribute :content_length, aliases: 'Content-Length', type: :integer
10
- attribute :content_type, aliases: 'Content-Type'
11
- attribute :connection, aliases: '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, aliases: 'Etag'
14
- attribute :last_modified, aliases: 'Last-Modified', type: :time
15
- attribute :accept_ranges, aliases: 'Accept-Ranges'
16
- attribute :server, aliases: 'Server'
17
- attribute :object_type, aliases: 'x-oss-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
- target_object = target_file_key
42
- else
43
- target_object = target_directory_key + '/' + target_file_key
44
- end
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.reject! { |k, _v| !metadata_attribute?(k) }
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 == files
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
- data = service.get_object(object)
71
- rescue => error
68
+ data = service.get_object(object)
69
+ rescue StandardError => error
72
70
  case error.response.body
73
- when /<Code>NoSuchKey<\/Code>/
74
- nil
75
- else
76
- raise(error)
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 = 'PayByTraffic' unless _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 # aliyun
53
- end # compute
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
@@ -34,6 +36,6 @@ module Fog
34
36
  )
35
37
  end
36
38
  end
37
- end # aliyun
38
- end # compute
39
+ end
40
+ end
39
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Aliyun
@@ -44,6 +46,6 @@ module Fog
44
46
  )
45
47
  end
46
48
  end
47
- end # aliyun
48
- end # compute
49
+ end
50
+ end
49
51
  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 = 'AttachDisk'
22
+ action = 'AttachDisk'
21
23
  sigNonce = randonStr
22
- time = Time.new.utc
24
+ time = Time.new.utc
23
25
 
24
26
  parameters = defalutParameters(action, sigNonce, time)
25
- pathUrl = defaultAliyunUri(action, sigNonce, time)
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 = options[:device]
38
+ device = options[:device]
37
39
 
38
- deleteWithInstance = 'true' unless 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 = 'CreateDisk'
24
+ action = 'CreateDisk'
23
25
  sigNonce = randonStr
24
- time = Time.new.utc
26
+ time = Time.new.utc
25
27
 
26
28
  parameters = defalutParameters(action, sigNonce, time)
27
- pathUrl = defaultAliyunUri(action, sigNonce, time)
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 = options[:name]
38
- desc = options[:description]
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 = 'CreateDisk'
89
+ action = 'CreateDisk'
88
90
  sigNonce = randonStr
89
- time = Time.new.utc
91
+ time = Time.new.utc
90
92
 
91
93
  parameters = defalutParameters(action, sigNonce, time)
92
- pathUrl = defaultAliyunUri(action, sigNonce, time)
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 = options[:name]
103
- desc = options[:description]
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 # aliyun
136
- end # compute
137
- end # fog
137
+ end
138
+ end
139
+ end