Sha256: 2ad035f6b7284e9203e9d2521aba787997c12b5a5358ba8679dcd5573a0dead4

Contents?: true

Size: 1.61 KB

Versions: 22

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

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

module Fog
  module Compute
    class Aliyun
      class Vrouters < Fog::Collection
        model Fog::Compute::Aliyun::VRouter

        # Returns an array of all VPCs that have been created
        #
        # Aliyun.vrouters.all
        #
        # ==== Returns
        #
        # Returns an array of all VPCs
        #
        # >> Aliyun.vrouters.all
        # <Fog::Aliyun::Compute::VRouters
        # [
        # <Fog::Aliyun::Compute::VRouter
        # id="vpc-12345678",
        # TODO
        # >
        # ]
        # >
        #

        def all(filters_arg = {})
          unless filters_arg.is_a?(Hash)
            Fog::Logger.warning("all with #{filters_arg.class} param is deprecated, use all('vRouterId' => "") instead [light_black](#{caller.first})[/]")
            filters_arg = { 'vRouterId' => filters_arg }
          end
          data = Fog::JSON.decode(service.list_vrouters(filters_arg).body)['VRouters']['VRouter']
          load(data)
        end

        # Used to retrieve a VPC
        # vpc_id is required to get the associated VPC information.
        #
        # You can run the following command to get the details:
        # Aliyun.vpcs.get("vpc-12345678")
        #
        # ==== Returns
        #
        # >> Aliyun.vpcs.get("vpc-12345678")
        # <Fog::Aliyun::Compute::VPC
        # id="vpc-12345678",
        # TODO
        # >
        #

        def get(vRouterId)
          self.class.new(service: service).all('vRouterId' => vRouterId)[0] if vRouterId
        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/vrouters.rb
fog-aliyun-0.3.19 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.18 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.17 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.16 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.15 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.13 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.12 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.11 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.10 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.9 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.8 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.7 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.6 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.5 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.4 lib/fog/aliyun/models/compute/vrouters.rb
fog-aliyun-0.3.3 lib/fog/aliyun/models/compute/vrouters.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/models/compute/vrouters.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/models/compute/vrouters.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/models/compute/vrouters.rb