fog-aliyun 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/.rubocop_todo.yml +149 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Rakefile +3 -3
  7. data/fog-aliyun.gemspec +16 -13
  8. data/lib/fog/aliyun.rb +8 -8
  9. data/lib/fog/aliyun/compute.rb +99 -113
  10. data/lib/fog/aliyun/models/compute/eip_address.rb +23 -29
  11. data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -5
  12. data/lib/fog/aliyun/models/compute/image.rb +26 -28
  13. data/lib/fog/aliyun/models/compute/images.rb +2 -6
  14. data/lib/fog/aliyun/models/compute/route_entry.rb +9 -11
  15. data/lib/fog/aliyun/models/compute/route_entrys.rb +7 -7
  16. data/lib/fog/aliyun/models/compute/route_table.rb +10 -11
  17. data/lib/fog/aliyun/models/compute/route_tables.rb +2 -2
  18. data/lib/fog/aliyun/models/compute/security_group.rb +24 -24
  19. data/lib/fog/aliyun/models/compute/security_group_rule.rb +20 -20
  20. data/lib/fog/aliyun/models/compute/security_group_rules.rb +4 -4
  21. data/lib/fog/aliyun/models/compute/security_groups.rb +6 -7
  22. data/lib/fog/aliyun/models/compute/server.rb +42 -43
  23. data/lib/fog/aliyun/models/compute/servers.rb +9 -11
  24. data/lib/fog/aliyun/models/compute/snapshot.rb +15 -15
  25. data/lib/fog/aliyun/models/compute/snapshots.rb +6 -10
  26. data/lib/fog/aliyun/models/compute/volume.rb +36 -40
  27. data/lib/fog/aliyun/models/compute/volumes.rb +7 -11
  28. data/lib/fog/aliyun/models/compute/vpc.rb +18 -19
  29. data/lib/fog/aliyun/models/compute/vpcs.rb +5 -6
  30. data/lib/fog/aliyun/models/compute/vrouter.rb +13 -13
  31. data/lib/fog/aliyun/models/compute/vrouters.rb +4 -5
  32. data/lib/fog/aliyun/models/compute/vswitch.rb +18 -20
  33. data/lib/fog/aliyun/models/compute/vswitches.rb +6 -6
  34. data/lib/fog/aliyun/models/storage/directories.rb +10 -16
  35. data/lib/fog/aliyun/models/storage/directory.rb +8 -8
  36. data/lib/fog/aliyun/models/storage/file.rb +58 -64
  37. data/lib/fog/aliyun/models/storage/files.rb +95 -115
  38. data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +18 -44
  39. data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +12 -36
  40. data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +16 -40
  41. data/lib/fog/aliyun/requests/compute/attach_disk.rb +19 -22
  42. data/lib/fog/aliyun/requests/compute/create_disk.rb +33 -63
  43. data/lib/fog/aliyun/requests/compute/create_image.rb +21 -21
  44. data/lib/fog/aliyun/requests/compute/create_security_group.rb +16 -16
  45. data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +22 -63
  46. data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +23 -61
  47. data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +22 -63
  48. data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +23 -61
  49. data/lib/fog/aliyun/requests/compute/create_server.rb +76 -78
  50. data/lib/fog/aliyun/requests/compute/create_snapshot.rb +12 -26
  51. data/lib/fog/aliyun/requests/compute/create_vpc.rb +11 -38
  52. data/lib/fog/aliyun/requests/compute/create_vswitch.rb +13 -40
  53. data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -35
  54. data/lib/fog/aliyun/requests/compute/delete_image.rb +6 -33
  55. data/lib/fog/aliyun/requests/compute/delete_security_group.rb +13 -13
  56. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +22 -63
  57. data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +23 -61
  58. data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +22 -62
  59. data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +23 -61
  60. data/lib/fog/aliyun/requests/compute/delete_server.rb +15 -15
  61. data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +6 -20
  62. data/lib/fog/aliyun/requests/compute/delete_vpc.rb +9 -26
  63. data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +9 -25
  64. data/lib/fog/aliyun/requests/compute/detach_disk.rb +11 -27
  65. data/lib/fog/aliyun/requests/compute/join_security_group.rb +15 -16
  66. data/lib/fog/aliyun/requests/compute/leave_security_group.rb +15 -16
  67. data/lib/fog/aliyun/requests/compute/list_disks.rb +24 -43
  68. data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +26 -52
  69. data/lib/fog/aliyun/requests/compute/list_images.rb +21 -24
  70. data/lib/fog/aliyun/requests/compute/list_route_tables.rb +16 -19
  71. data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +22 -23
  72. data/lib/fog/aliyun/requests/compute/list_security_groups.rb +21 -24
  73. data/lib/fog/aliyun/requests/compute/list_server_types.rb +50 -50
  74. data/lib/fog/aliyun/requests/compute/list_servers.rb +25 -28
  75. data/lib/fog/aliyun/requests/compute/list_snapshots.rb +20 -37
  76. data/lib/fog/aliyun/requests/compute/list_vpcs.rb +12 -29
  77. data/lib/fog/aliyun/requests/compute/list_vrouters.rb +13 -16
  78. data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +14 -31
  79. data/lib/fog/aliyun/requests/compute/list_zones.rb +16 -16
  80. data/lib/fog/aliyun/requests/compute/modify_vpc.rb +17 -17
  81. data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +11 -39
  82. data/lib/fog/aliyun/requests/compute/reboot_server.rb +15 -16
  83. data/lib/fog/aliyun/requests/compute/release_eip_address.rb +12 -36
  84. data/lib/fog/aliyun/requests/compute/start_server.rb +14 -15
  85. data/lib/fog/aliyun/requests/compute/stop_server.rb +13 -14
  86. data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +16 -41
  87. data/lib/fog/aliyun/requests/storage/copy_object.rb +11 -14
  88. data/lib/fog/aliyun/requests/storage/delete_bucket.rb +30 -30
  89. data/lib/fog/aliyun/requests/storage/delete_container.rb +11 -14
  90. data/lib/fog/aliyun/requests/storage/delete_object.rb +20 -22
  91. data/lib/fog/aliyun/requests/storage/get_bucket.rb +141 -148
  92. data/lib/fog/aliyun/requests/storage/get_container.rb +26 -38
  93. data/lib/fog/aliyun/requests/storage/get_containers.rb +20 -32
  94. data/lib/fog/aliyun/requests/storage/get_object.rb +12 -12
  95. data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +11 -11
  96. data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +11 -11
  97. data/lib/fog/aliyun/requests/storage/head_object.rb +11 -11
  98. data/lib/fog/aliyun/requests/storage/list_buckets.rb +40 -47
  99. data/lib/fog/aliyun/requests/storage/list_objects.rb +91 -104
  100. data/lib/fog/aliyun/requests/storage/put_bucket.rb +22 -23
  101. data/lib/fog/aliyun/requests/storage/put_container.rb +12 -12
  102. data/lib/fog/aliyun/requests/storage/put_object.rb +100 -110
  103. data/lib/fog/aliyun/storage.rb +209 -214
  104. data/lib/fog/aliyun/version.rb +1 -1
  105. data/lib/fog/bin/aliyun.rb +5 -5
  106. metadata +55 -4
@@ -3,17 +3,16 @@ module Fog
3
3
  module Compute
4
4
  class Aliyun
5
5
  class EipAddress < Fog::Model
6
+ identity :id, aliases: 'AllocationId'
6
7
 
7
- identity :id, :aliases => 'AllocationId'
8
-
9
- attribute :allocated_at, :aliases => 'AllocationTime'
10
- attribute :bandwidth, :aliases => 'Bandwidth'
11
- attribute :server_id, :aliases => 'InstanceId'
12
- attribute :charge_type, :aliases => 'InternetChargeType'
13
- attribute :ip_address, :aliases => ['IpAddress','EipAddress']
14
- attribute :opertion_locks,:aliases => 'OperationLocks'
15
- attribute :region_id, :aliases => 'RegionId'
16
- attribute :state, :aliases => 'Status'
8
+ attribute :allocated_at, aliases: 'AllocationTime'
9
+ attribute :bandwidth, aliases: 'Bandwidth'
10
+ attribute :server_id, aliases: 'InstanceId'
11
+ attribute :charge_type, aliases: 'InternetChargeType'
12
+ attribute :ip_address, aliases: %w(IpAddress EipAddress)
13
+ attribute :opertion_locks, aliases: 'OperationLocks'
14
+ attribute :region_id, aliases: 'RegionId'
15
+ attribute :state, aliases: 'Status'
17
16
 
18
17
  def destroy
19
18
  requires :id
@@ -26,38 +25,33 @@ module Fog
26
25
  state == 'Available'
27
26
  end
28
27
 
29
- def save(options={})
28
+ def save(options = {})
30
29
  # raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
31
30
  # requires :availability_zone
32
31
  options[:bandwidth] = bandwidth if bandwidth
33
- options[:internet_charge_type]=charge_type if charge_type
34
-
32
+ options[:internet_charge_type] = charge_type if charge_type
33
+
35
34
  data = Fog::JSON.decode(service.allocate_eip_address(options).body)
36
- merge_attributes(data)
35
+ merge_attributes(data)
37
36
  true
38
37
  end
39
38
 
40
-
41
- def associate(new_server,options={})
42
- unless persisted?
43
- @server = new_server
44
- else
39
+ def associate(new_server, options = {})
40
+ if persisted?
45
41
  @server = nil
46
42
  self.server_id = new_server.id
47
- service.associate_eip_address(server_id,id,options)
43
+ service.associate_eip_address(server_id, id, options)
44
+ else
45
+ @server = new_server
48
46
  end
49
47
  end
50
48
 
51
- def disassociate(new_server,options={})
52
- @server = nil
53
- self.server_id = new_server.id
54
- if persisted?
55
- service.unassociate_eip_address(server_id,id,options)
56
- end
57
-
49
+ def disassociate(new_server, options = {})
50
+ @server = nil
51
+ self.server_id = new_server.id
52
+ service.unassociate_eip_address(server_id, id, options) if persisted?
58
53
  end
59
-
60
54
  end
61
55
  end
62
56
  end
63
- end
57
+ end
@@ -5,8 +5,7 @@ module Fog
5
5
  module Compute
6
6
  class Aliyun
7
7
  class EipAddresses < Fog::Collection
8
-
9
- model Fog::Compute::Aliyun::EipAddress
8
+ model Fog::Compute::Aliyun::EipAddress
10
9
 
11
10
  def all(filters_arg = {})
12
11
  data = Fog::JSON.decode(service.list_eip_addresses(filters_arg).body)['EipAddresses']['EipAddress']
@@ -20,11 +19,10 @@ module Fog
20
19
 
21
20
  def get(allocation_id)
22
21
  if allocation_id
23
- self.class.new(:service => service).all(:allocation_id => allocation_id)[0]
22
+ self.class.new(service: service).all(allocation_id: allocation_id)[0]
24
23
  end
25
24
  end
26
-
27
25
  end
28
26
  end
29
27
  end
30
- end
28
+ end
@@ -3,40 +3,39 @@ module Fog
3
3
  module Compute
4
4
  class Aliyun
5
5
  class Image < Fog::Model
6
+ identity :id, aliases: 'ImageId'
6
7
 
7
- identity :id, :aliases => 'ImageId'
8
-
9
- attribute :description, :aliases => 'Description'
10
- attribute :product_code, :aliases => 'ProductCode'
11
- attribute :os_type, :aliases => 'OSType'
12
- attribute :architecture, :aliases => 'Architecture'
13
- attribute :os_name, :aliases => 'OSName'
14
- attribute :disk_device_mappings, :aliases => 'DiskDeviceMappings'
15
- attribute :owner_alias, :aliases => 'ImageOwnerAlias'
16
- attribute :progress, :aliases => 'Progress'
17
- attribute :usage, :aliases => 'Usage'
18
- attribute :created_at, :aliases => 'CreationTime'
19
- attribute :tags, :aliases => 'Tags'
20
- attribute :version, :aliases => 'ImageVersion'
21
- attribute :state, :aliases => 'Status'
22
- attribute :name, :aliases => 'ImageName'
23
- attribute :is_self_shared, :aliases => 'IsSelfShared'
24
- attribute :is_copied, :aliases => 'IsCopied'
25
- attribute :is_subscribed, :aliases => 'IsSubscribed'
26
- attribute :platform, :aliases => 'Platform'
27
- attribute :size, :aliases => 'Size'
28
- attribute :snapshot_id, :aliases => 'SnapshotId'
8
+ attribute :description, aliases: 'Description'
9
+ attribute :product_code, aliases: 'ProductCode'
10
+ attribute :os_type, aliases: 'OSType'
11
+ attribute :architecture, aliases: 'Architecture'
12
+ attribute :os_name, aliases: 'OSName'
13
+ attribute :disk_device_mappings, aliases: 'DiskDeviceMappings'
14
+ attribute :owner_alias, aliases: 'ImageOwnerAlias'
15
+ attribute :progress, aliases: 'Progress'
16
+ attribute :usage, aliases: 'Usage'
17
+ attribute :created_at, aliases: 'CreationTime'
18
+ attribute :tags, aliases: 'Tags'
19
+ attribute :version, aliases: 'ImageVersion'
20
+ attribute :state, aliases: 'Status'
21
+ attribute :name, aliases: 'ImageName'
22
+ attribute :is_self_shared, aliases: 'IsSelfShared'
23
+ attribute :is_copied, aliases: 'IsCopied'
24
+ attribute :is_subscribed, aliases: 'IsSubscribed'
25
+ attribute :platform, aliases: 'Platform'
26
+ attribute :size, aliases: 'Size'
27
+ attribute :snapshot_id, aliases: 'SnapshotId'
29
28
 
30
29
  def initialize(attributes)
31
- self.snapshot_id=attributes["DiskDeviceMappings"]["DiskDeviceMapping"][0]["SnapshotId"]
30
+ self.snapshot_id = attributes['DiskDeviceMappings']['DiskDeviceMapping'][0]['SnapshotId']
32
31
  super
33
32
  end
34
33
 
35
- def save (options={})
34
+ def save(options = {})
36
35
  requires :snapshot_id
37
36
  options[:name] = name if name
38
- options[:description]=description if description
39
- data=Fog::JSON.decode(service.create_image(snapshot_id,options).body)
37
+ options[:description] = description if description
38
+ data = Fog::JSON.decode(service.create_image(snapshot_id, options).body)
40
39
  merge_attributes(data)
41
40
  true
42
41
  end
@@ -53,7 +52,7 @@ module Fog
53
52
 
54
53
  def snapshot
55
54
  requires :snapshot_id
56
- Fog::Compute::Aliyun::Snapshots.new(:service=>service).all(:snapshotIds=>[snapshot_id])[0]
55
+ Fog::Compute::Aliyun::Snapshots.new(service: service).all(snapshotIds: [snapshot_id])[0]
57
56
  end
58
57
 
59
58
  private
@@ -61,7 +60,6 @@ module Fog
61
60
  def snapshot=(new_snapshot)
62
61
  self.snapshot_id = new_snapshot.id
63
62
  end
64
-
65
63
  end
66
64
  end
67
65
  end
@@ -5,23 +5,19 @@ module Fog
5
5
  module Compute
6
6
  class Aliyun
7
7
  class Images < Fog::Collection
8
-
9
8
  model Fog::Compute::Aliyun::Image
10
9
 
11
-
12
10
  def all(filters_arg = {})
13
11
  unless filters_arg.is_a?(Hash)
14
12
  Fog::Logger.deprecation("all with #{filters_arg.class} param is deprecated, use all('diskIds' => []) instead [light_black](#{caller.first})[/]")
15
- filters_arg = {:imageId => filters_arg}
13
+ filters_arg = { imageId: filters_arg }
16
14
  end
17
15
  data = Fog::JSON.decode(service.list_images(filters_arg).body)['Images']['Image']
18
16
  load(data)
19
17
  end
20
18
 
21
19
  def get(image_id)
22
- if image_id
23
- self.class.new(:service => service).all(:imageId => image_id)[0]
24
- end
20
+ self.class.new(service: service).all(imageId: image_id)[0] if image_id
25
21
  end
26
22
  end
27
23
  end
@@ -3,26 +3,24 @@ module Fog
3
3
  module Compute
4
4
  class Aliyun
5
5
  class RouteEntry < Fog::Model
6
-
7
6
  # "RouteTables"=>{"RouteTable"=>[
8
7
  # {"CreationTime"=>"2015-08-03T11:23:35Z", "RouteEntrys"=>{"RouteEntry"=>[
9
8
  # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.0.0/24"},
10
- # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.1.0/24"},
11
- # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.2.0/24"},
12
- # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"100.64.0.0/10"},
9
+ # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.1.0/24"},
10
+ # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.2.0/24"},
11
+ # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"100.64.0.0/10"},
13
12
  # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"10.0.0.0/8"}]},
14
13
  # "RouteTableId"=>"vtb-2504onoxh", "RouteTableType"=>"System", "VRouterId"=>"vrt-25azmd2wm"}]}
15
- identity :cidr_block, :aliases => 'DestinationCidrBlock'
16
- attribute :state, :aliases => 'Status'
17
- attribute :server_id, :aliases => 'InstanceId'
18
- attribute :type, :aliases => 'Type'
19
- attribute :route_table_id, :aliases => 'RouteTableId'
14
+ identity :cidr_block, aliases: 'DestinationCidrBlock'
15
+ attribute :state, aliases: 'Status'
16
+ attribute :server_id, aliases: 'InstanceId'
17
+ attribute :type, aliases: 'Type'
18
+ attribute :route_table_id, aliases: 'RouteTableId'
20
19
 
21
20
  # def save
22
21
  # requires :cidr_block,:route_table_id
23
22
  # if(cidr_block)
24
-
25
23
  end
26
24
  end
27
25
  end
28
- end
26
+ end
@@ -9,20 +9,20 @@ module Fog
9
9
 
10
10
  model Fog::Compute::Aliyun::RouteEntry
11
11
 
12
- def all(options={})
12
+ def all(options = {})
13
13
  requires :route_table
14
- options[:routeTableId]=route_table.id
15
- data = Fog::JSON.decode(service.list_route_tables(route_table.v_router_id, options).body)['RouteTables']['RouteTable'][0]["RouteEntrys"]["RouteEntry"]
14
+ options[:routeTableId] = route_table.id
15
+ data = Fog::JSON.decode(service.list_route_tables(route_table.v_router_id, options).body)['RouteTables']['RouteTable'][0]['RouteEntrys']['RouteEntry']
16
16
  load(data)
17
17
  end
18
18
 
19
19
  def get(cidr_block)
20
20
  requires :route_table
21
- data=self.class.new(:service=>service,:route_table=>route_table).all()
22
- result=nil
21
+ data = self.class.new(service: service, route_table: route_table).all
22
+ result = nil
23
23
  data.each do |i|
24
- if i.cidr_block==cidr_block
25
- result=i
24
+ if i.cidr_block == cidr_block
25
+ result = i
26
26
  break
27
27
  end
28
28
  end
@@ -3,29 +3,28 @@ module Fog
3
3
  module Compute
4
4
  class Aliyun
5
5
  class RouteTable < Fog::Model
6
-
7
6
  # "RouteTables"=>{"RouteTable"=>[
8
7
  # {"CreationTime"=>"2015-08-03T11:23:35Z", "RouteEntrys"=>{"RouteEntry"=>[
9
8
  # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.0.0/24"},
10
- # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.1.0/24"},
11
- # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.2.0/24"},
12
- # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"100.64.0.0/10"},
9
+ # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.1.0/24"},
10
+ # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"172.16.2.0/24"},
11
+ # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"100.64.0.0/10"},
13
12
  # {"Status"=>"Available", "Type"=>"System", "InstanceId"=>"", "RouteTableId"=>"vtb-2504onoxh", "DestinationCidrBlock"=>"10.0.0.0/8"}]},
14
13
  # "RouteTableId"=>"vtb-2504onoxh", "RouteTableType"=>"System", "VRouterId"=>"vrt-25azmd2wm"}]}
15
- identity :id, :aliases => 'RouteTableId'
16
- attribute :created_at, :aliases => 'CreationTime'
17
- attribute :type, :aliases => 'RouteTableType'
18
- attribute :v_router_id, :aliases => 'VRouterId'
14
+ identity :id, aliases: 'RouteTableId'
15
+ attribute :created_at, aliases: 'CreationTime'
16
+ attribute :type, aliases: 'RouteTableType'
17
+ attribute :v_router_id, aliases: 'VRouterId'
19
18
  # collection Fog::Compute::Aliyun::RouteEntrys
20
19
  def route_entrys
21
20
  @route_entrys ||= begin
22
21
  Fog::Compute::Aliyun::RouteEntrys.new(
23
- :route_table => self,
24
- :service => service
22
+ route_table: self,
23
+ service: service
25
24
  )
26
25
  end
27
26
  end
28
27
  end
29
28
  end
30
29
  end
31
- end
30
+ end
@@ -9,7 +9,7 @@ module Fog
9
9
 
10
10
  model Fog::Compute::Aliyun::RouteTable
11
11
 
12
- def all(options={})
12
+ def all(options = {})
13
13
  requires :v_router
14
14
  data = Fog::JSON.decode(service.list_route_tables(v_router.id, options).body)['RouteTables']['RouteTable']
15
15
  load(data)
@@ -18,7 +18,7 @@ module Fog
18
18
  def get(routeTableId)
19
19
  requires :v_router
20
20
  if routeTableId
21
- self.class.new(:service => service,:v_router=>v_router).all(:routeTableId=>routeTableId)[0]
21
+ self.class.new(service: service, v_router: v_router).all(routeTableId: routeTableId)[0]
22
22
  end
23
23
  end
24
24
  end
@@ -4,11 +4,11 @@ module Fog
4
4
  module Compute
5
5
  class Aliyun
6
6
  class SecurityGroup < Fog::Model
7
- identity :id, :aliases =>"SecurityGroupId"
8
- attribute :name, :aliases => "SecurityGroupName"
9
- attribute :description, :aliases => "Description"
10
- attribute :created_at, :aliases => "CreationTime"
11
- attribute :vpc_id, :aliases => "VpcId"
7
+ identity :id, aliases: 'SecurityGroupId'
8
+ attribute :name, aliases: 'SecurityGroupName'
9
+ attribute :description, aliases: 'Description'
10
+ attribute :created_at, aliases: 'CreationTime'
11
+ attribute :vpc_id, aliases: 'VpcId'
12
12
 
13
13
  def vpc
14
14
  requires :vpc_id
@@ -20,7 +20,7 @@ module Fog
20
20
  service.security_group_rules.get(id)
21
21
  end
22
22
 
23
- def save(options={})
23
+ def save(options = {})
24
24
  options[:vpcId] = vpc_id if vpc_id
25
25
  options[:name] = name if name
26
26
  options[:description] = description if description
@@ -34,44 +34,44 @@ module Fog
34
34
  true
35
35
  end
36
36
 
37
- def authorize_security_group_sg_rule(group_id,direction="ingress",options={})
37
+ def authorize_security_group_sg_rule(group_id, direction = 'ingress', options = {})
38
38
  requires :id
39
- if direction=="egress"
40
- service.create_security_group_egress_sg_rule(id,group_id,options)
39
+ if direction == 'egress'
40
+ service.create_security_group_egress_sg_rule(id, group_id, options)
41
41
  else
42
- service.create_security_group_sg_rule(id,group_id,options)
42
+ service.create_security_group_sg_rule(id, group_id, options)
43
43
  end
44
44
  true
45
45
  end
46
46
 
47
- def authorize_security_group_ip_rule(cidr_ip,direction="ingress",options={})
47
+ def authorize_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {})
48
48
  requires :id
49
- nic_type = options.fetch(:nic_type, "internet")
50
- if direction=="egress"
51
- service.create_security_group_egress_ip_rule(id,cidr_ip,nic_type,options)
49
+ nic_type = options.fetch(:nic_type, 'internet')
50
+ if direction == 'egress'
51
+ service.create_security_group_egress_ip_rule(id, cidr_ip, nic_type, options)
52
52
  else
53
- service.create_security_group_ip_rule(id,cidr_ip,nic_type,options)
53
+ service.create_security_group_ip_rule(id, cidr_ip, nic_type, options)
54
54
  end
55
55
  true
56
56
  end
57
57
 
58
- def revoke_seurity_group_sg_rule(group_id,direction="ingress",options={})
58
+ def revoke_seurity_group_sg_rule(group_id, direction = 'ingress', options = {})
59
59
  requires :id
60
- if direction=="egress"
61
- service.delete_security_group_egress_sg_rule(id,group_id,options)
60
+ if direction == 'egress'
61
+ service.delete_security_group_egress_sg_rule(id, group_id, options)
62
62
  else
63
- service.delete_security_group_sg_rule(id,group_id,options)
63
+ service.delete_security_group_sg_rule(id, group_id, options)
64
64
  end
65
65
  true
66
66
  end
67
67
 
68
- def revoke_security_group_ip_rule(cidr_ip,direction="ingress",options={})
68
+ def revoke_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {})
69
69
  requires :id
70
- nic_type = options.fetch(:nic_type, "internet")
71
- if direction=="egress"
72
- service.delete_security_group_egress_ip_rule(id,cidr_ip,nic_type,options)
70
+ nic_type = options.fetch(:nic_type, 'internet')
71
+ if direction == 'egress'
72
+ service.delete_security_group_egress_ip_rule(id, cidr_ip, nic_type, options)
73
73
  else
74
- service.delete_security_group_ip_rule(id,cidr_ip,nic_type,options)
74
+ service.delete_security_group_ip_rule(id, cidr_ip, nic_type, options)
75
75
  end
76
76
  true
77
77
  end
@@ -4,40 +4,40 @@ module Fog
4
4
  module Compute
5
5
  class Aliyun
6
6
  class SecurityGroupRule < Fog::Model
7
- attribute :security_group_id, :aliases => 'SecurityGroupId'
8
- attribute :source_cidr_ip, :aliases => 'SourceCidrIp'
9
- attribute :source_owner, :aliases => 'SourceGroupOwnerAccount'
10
- attribute :source_group_id, :aliases => 'SourceGroupId'
11
- attribute :ip_protocol, :aliases => 'IpProtocol'
12
- attribute :dest_cidr_ip, :aliases => 'DestCidrIp'
13
- attribute :dest_owner, :aliases => 'DestGroupOwnerAccount'
14
- attribute :dest_group_id, :aliases => 'DestGroupId'
15
- attribute :nic_type, :aliases => 'NicType'
16
- attribute :policy, :aliases => 'Policy'
17
- attribute :port_range, :aliases => 'PortRange'
18
- attribute :direction, :aliases => 'Direction'
19
- attribute :priority, :aliases => 'Priority'
7
+ attribute :security_group_id, aliases: 'SecurityGroupId'
8
+ attribute :source_cidr_ip, aliases: 'SourceCidrIp'
9
+ attribute :source_owner, aliases: 'SourceGroupOwnerAccount'
10
+ attribute :source_group_id, aliases: 'SourceGroupId'
11
+ attribute :ip_protocol, aliases: 'IpProtocol'
12
+ attribute :dest_cidr_ip, aliases: 'DestCidrIp'
13
+ attribute :dest_owner, aliases: 'DestGroupOwnerAccount'
14
+ attribute :dest_group_id, aliases: 'DestGroupId'
15
+ attribute :nic_type, aliases: 'NicType'
16
+ attribute :policy, aliases: 'Policy'
17
+ attribute :port_range, aliases: 'PortRange'
18
+ attribute :direction, aliases: 'Direction'
19
+ attribute :priority, aliases: 'Priority'
20
20
 
21
21
  def save
22
- requires :security_group_id,:ip_protocol,:port_range,:direction
23
- options={}
22
+ requires :security_group_id, :ip_protocol, :port_range, :direction
23
+ options = {}
24
24
  options[:portRange] = port_range if port_range
25
25
  options[:policy] = policy if policy
26
26
  options[:priority] = priority if port_range
27
27
  options[:protocol] = ip_protocol if ip_protocol
28
- if direction=="egress"
28
+ if direction == 'egress'
29
29
  if dest_cidr_ip
30
- service.create_security_group_egress_ip_rule(security_group_id,dest_cidr_ip,nic_type,options)
30
+ service.create_security_group_egress_ip_rule(security_group_id, dest_cidr_ip, nic_type, options)
31
31
  elsif dest_group_id
32
32
  options[:destGroupOwnerAccount] = dest_owner if dest_owner
33
- service.create_security_group_egress_sg_rule(security_group_id,dest_group_id,options)
33
+ service.create_security_group_egress_sg_rule(security_group_id, dest_group_id, options)
34
34
  end
35
35
  else
36
36
  if source_cidr_ip
37
- service.create_security_group_ip_rule(security_group_id,source_cidr_ip,nic_type,options)
37
+ service.create_security_group_ip_rule(security_group_id, source_cidr_ip, nic_type, options)
38
38
  elsif source_group_id
39
39
  options[:sourceGroupOwnerAccount] = source_owner if source_owner
40
- service.create_security_group_sg_rule(security_group_id,source_group_id,options)
40
+ service.create_security_group_sg_rule(security_group_id, source_group_id, options)
41
41
  end
42
42
  end
43
43
  end