Sha256: c6afe8671d2007a790752dfc9dde98619d553b95fe6c46c3b6086aa9d50aa2db

Contents?: true

Size: 752 Bytes

Versions: 4

Compression:

Stored size: 752 Bytes

Contents

require 'fog/huaweicloud/models/collection'
require 'fog/network/huaweicloud/models/router'

module Fog
  module Network
    class HuaweiCloud
      class Routers < Fog::HuaweiCloud::Collection
        attribute :filters

        model Fog::Network::HuaweiCloud::Router

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters_arg = filters)
          filters = filters_arg
          load_response(service.list_routers(filters), 'routers')
        end

        def get(router_id)
          if router = service.get_router(router_id).body['router']
            new(router)
          end
        rescue Fog::Network::HuaweiCloud::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/network/huaweicloud/models/routers.rb
fog-huaweicloud-0.0.2 lib/fog/network/huaweicloud/models/routers.rb
fog-huaweicloud-0.1.3 lib/fog/network/huaweicloud/models/routers.rb
fog-huaweicloud-0.1.2 lib/fog/network/huaweicloud/models/routers.rb