Sha256: 03e1a57e24cc99297af7b2a3ce4197f28223d9d42a4d1a3ae3a88acc7da15d71

Contents?: true

Size: 1.15 KB

Versions: 22

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'fog/core/collection'
require 'fog/aliyun/models/compute/route_entry'

module Fog
  module Compute
    class Aliyun
      class RouteEntrys < Fog::Collection
        attribute :route_table

        model Fog::Compute::Aliyun::RouteEntry

        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

        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

        # def get(routeTableId)
        #   requires :v_router
        #   if routeTableId
        #     self.class.new(:service => service,:v_router=>v_router).all(:routeTableId=>routeTableId)[0]
        #   end
        # end
      end
    end
  end
end

Version data entries

22 entries across 20 versions & 2 rubygems

Version Path
fog-aliyun-0.4.0 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.19 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.18 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.17 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.16 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.15 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.13 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.12 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.11 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.10 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.9 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.8 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.7 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.6 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.5 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.4 lib/fog/aliyun/models/compute/route_entrys.rb
fog-aliyun-0.3.3 lib/fog/aliyun/models/compute/route_entrys.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/models/compute/route_entrys.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/models/compute/route_entrys.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/models/compute/route_entrys.rb