Class: Fog::Compute::Aliyun::RouteEntrys

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/aliyun/models/compute/route_entrys.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/fog/aliyun/models/compute/route_entrys.rb', line 14

def all(options = {})
  requires :route_table
  options[:routeTableId] = route_table.id
  data = Fog::JSON.decode(service.list_route_tables(route_table.v_router_id, options).body)['RouteTables']['RouteTable'][0]['RouteEntrys']['RouteEntry']
  load(data)
end

#get(cidr_block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aliyun/models/compute/route_entrys.rb', line 21

def get(cidr_block)
  requires :route_table
  data = self.class.new(service: service, route_table: route_table).all
  result = nil
  data.each do |i|
    if i.cidr_block == cidr_block
      result = i
      break
    end
  end
  result
end