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.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +149 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Rakefile +3 -3
- data/fog-aliyun.gemspec +16 -13
- data/lib/fog/aliyun.rb +8 -8
- data/lib/fog/aliyun/compute.rb +99 -113
- data/lib/fog/aliyun/models/compute/eip_address.rb +23 -29
- data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -5
- data/lib/fog/aliyun/models/compute/image.rb +26 -28
- data/lib/fog/aliyun/models/compute/images.rb +2 -6
- data/lib/fog/aliyun/models/compute/route_entry.rb +9 -11
- data/lib/fog/aliyun/models/compute/route_entrys.rb +7 -7
- data/lib/fog/aliyun/models/compute/route_table.rb +10 -11
- data/lib/fog/aliyun/models/compute/route_tables.rb +2 -2
- data/lib/fog/aliyun/models/compute/security_group.rb +24 -24
- data/lib/fog/aliyun/models/compute/security_group_rule.rb +20 -20
- data/lib/fog/aliyun/models/compute/security_group_rules.rb +4 -4
- data/lib/fog/aliyun/models/compute/security_groups.rb +6 -7
- data/lib/fog/aliyun/models/compute/server.rb +42 -43
- data/lib/fog/aliyun/models/compute/servers.rb +9 -11
- data/lib/fog/aliyun/models/compute/snapshot.rb +15 -15
- data/lib/fog/aliyun/models/compute/snapshots.rb +6 -10
- data/lib/fog/aliyun/models/compute/volume.rb +36 -40
- data/lib/fog/aliyun/models/compute/volumes.rb +7 -11
- data/lib/fog/aliyun/models/compute/vpc.rb +18 -19
- data/lib/fog/aliyun/models/compute/vpcs.rb +5 -6
- data/lib/fog/aliyun/models/compute/vrouter.rb +13 -13
- data/lib/fog/aliyun/models/compute/vrouters.rb +4 -5
- data/lib/fog/aliyun/models/compute/vswitch.rb +18 -20
- data/lib/fog/aliyun/models/compute/vswitches.rb +6 -6
- data/lib/fog/aliyun/models/storage/directories.rb +10 -16
- data/lib/fog/aliyun/models/storage/directory.rb +8 -8
- data/lib/fog/aliyun/models/storage/file.rb +58 -64
- data/lib/fog/aliyun/models/storage/files.rb +95 -115
- data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +18 -44
- data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +12 -36
- data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +16 -40
- data/lib/fog/aliyun/requests/compute/attach_disk.rb +19 -22
- data/lib/fog/aliyun/requests/compute/create_disk.rb +33 -63
- data/lib/fog/aliyun/requests/compute/create_image.rb +21 -21
- data/lib/fog/aliyun/requests/compute/create_security_group.rb +16 -16
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +22 -63
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +22 -63
- data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/create_server.rb +76 -78
- data/lib/fog/aliyun/requests/compute/create_snapshot.rb +12 -26
- data/lib/fog/aliyun/requests/compute/create_vpc.rb +11 -38
- data/lib/fog/aliyun/requests/compute/create_vswitch.rb +13 -40
- data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -35
- data/lib/fog/aliyun/requests/compute/delete_image.rb +6 -33
- data/lib/fog/aliyun/requests/compute/delete_security_group.rb +13 -13
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +22 -63
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +22 -62
- data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/delete_server.rb +15 -15
- data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +6 -20
- data/lib/fog/aliyun/requests/compute/delete_vpc.rb +9 -26
- data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +9 -25
- data/lib/fog/aliyun/requests/compute/detach_disk.rb +11 -27
- data/lib/fog/aliyun/requests/compute/join_security_group.rb +15 -16
- data/lib/fog/aliyun/requests/compute/leave_security_group.rb +15 -16
- data/lib/fog/aliyun/requests/compute/list_disks.rb +24 -43
- data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +26 -52
- data/lib/fog/aliyun/requests/compute/list_images.rb +21 -24
- data/lib/fog/aliyun/requests/compute/list_route_tables.rb +16 -19
- data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +22 -23
- data/lib/fog/aliyun/requests/compute/list_security_groups.rb +21 -24
- data/lib/fog/aliyun/requests/compute/list_server_types.rb +50 -50
- data/lib/fog/aliyun/requests/compute/list_servers.rb +25 -28
- data/lib/fog/aliyun/requests/compute/list_snapshots.rb +20 -37
- data/lib/fog/aliyun/requests/compute/list_vpcs.rb +12 -29
- data/lib/fog/aliyun/requests/compute/list_vrouters.rb +13 -16
- data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +14 -31
- data/lib/fog/aliyun/requests/compute/list_zones.rb +16 -16
- data/lib/fog/aliyun/requests/compute/modify_vpc.rb +17 -17
- data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +11 -39
- data/lib/fog/aliyun/requests/compute/reboot_server.rb +15 -16
- data/lib/fog/aliyun/requests/compute/release_eip_address.rb +12 -36
- data/lib/fog/aliyun/requests/compute/start_server.rb +14 -15
- data/lib/fog/aliyun/requests/compute/stop_server.rb +13 -14
- data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +16 -41
- data/lib/fog/aliyun/requests/storage/copy_object.rb +11 -14
- data/lib/fog/aliyun/requests/storage/delete_bucket.rb +30 -30
- data/lib/fog/aliyun/requests/storage/delete_container.rb +11 -14
- data/lib/fog/aliyun/requests/storage/delete_object.rb +20 -22
- data/lib/fog/aliyun/requests/storage/get_bucket.rb +141 -148
- data/lib/fog/aliyun/requests/storage/get_container.rb +26 -38
- data/lib/fog/aliyun/requests/storage/get_containers.rb +20 -32
- data/lib/fog/aliyun/requests/storage/get_object.rb +12 -12
- data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +11 -11
- data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +11 -11
- data/lib/fog/aliyun/requests/storage/head_object.rb +11 -11
- data/lib/fog/aliyun/requests/storage/list_buckets.rb +40 -47
- data/lib/fog/aliyun/requests/storage/list_objects.rb +91 -104
- data/lib/fog/aliyun/requests/storage/put_bucket.rb +22 -23
- data/lib/fog/aliyun/requests/storage/put_container.rb +12 -12
- data/lib/fog/aliyun/requests/storage/put_object.rb +100 -110
- data/lib/fog/aliyun/storage.rb +209 -214
- data/lib/fog/aliyun/version.rb +1 -1
- data/lib/fog/bin/aliyun.rb +5 -5
- 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
|
-
|
8
|
-
|
9
|
-
attribute :
|
10
|
-
attribute :
|
11
|
-
attribute :
|
12
|
-
attribute :
|
13
|
-
attribute :
|
14
|
-
attribute :
|
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
|
-
|
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
|
-
|
53
|
-
|
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(:
|
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
|
-
|
8
|
-
|
9
|
-
attribute :
|
10
|
-
attribute :
|
11
|
-
attribute :
|
12
|
-
attribute :
|
13
|
-
attribute :
|
14
|
-
attribute :
|
15
|
-
attribute :
|
16
|
-
attribute :
|
17
|
-
attribute :
|
18
|
-
attribute :
|
19
|
-
attribute :
|
20
|
-
attribute :
|
21
|
-
attribute :
|
22
|
-
attribute :
|
23
|
-
attribute :
|
24
|
-
attribute :
|
25
|
-
attribute :
|
26
|
-
attribute :
|
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[
|
30
|
+
self.snapshot_id = attributes['DiskDeviceMappings']['DiskDeviceMapping'][0]['SnapshotId']
|
32
31
|
super
|
33
32
|
end
|
34
33
|
|
35
|
-
def save
|
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
|
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 = {:
|
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, :
|
16
|
-
attribute :state, :
|
17
|
-
attribute :server_id, :
|
18
|
-
attribute :type, :
|
19
|
-
attribute :route_table_id, :
|
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][
|
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
|
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, :
|
16
|
-
attribute :created_at, :
|
17
|
-
attribute :type, :
|
18
|
-
attribute :v_router_id, :
|
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
|
-
:
|
24
|
-
:
|
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
|
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, :
|
8
|
-
attribute :name, :
|
9
|
-
attribute :description, :
|
10
|
-
attribute :created_at, :
|
11
|
-
attribute :vpc_id, :
|
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=
|
37
|
+
def authorize_security_group_sg_rule(group_id, direction = 'ingress', options = {})
|
38
38
|
requires :id
|
39
|
-
if direction==
|
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=
|
47
|
+
def authorize_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {})
|
48
48
|
requires :id
|
49
|
-
nic_type = options.fetch(:nic_type,
|
50
|
-
if direction==
|
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=
|
58
|
+
def revoke_seurity_group_sg_rule(group_id, direction = 'ingress', options = {})
|
59
59
|
requires :id
|
60
|
-
if direction==
|
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=
|
68
|
+
def revoke_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {})
|
69
69
|
requires :id
|
70
|
-
nic_type = options.fetch(:nic_type,
|
71
|
-
if direction==
|
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, :
|
8
|
-
attribute :source_cidr_ip, :
|
9
|
-
attribute :source_owner, :
|
10
|
-
attribute :source_group_id, :
|
11
|
-
attribute :ip_protocol, :
|
12
|
-
attribute :dest_cidr_ip, :
|
13
|
-
attribute :dest_owner, :
|
14
|
-
attribute :dest_group_id, :
|
15
|
-
attribute :nic_type, :
|
16
|
-
attribute :policy, :
|
17
|
-
attribute :port_range, :
|
18
|
-
attribute :direction, :
|
19
|
-
attribute :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
|
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==
|
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
|