Sha256: 32d5f959ec8ebd2b7ed116f433a51ba23efe5dfedf4d385e8c1f0b716b0b48be

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

require 'fog/huaweicloud/models/collection'
require 'fog/compute/huaweicloud/models/host'

module Fog
  module Compute
    class HuaweiCloud
      class Hosts < Fog::HuaweiCloud::Collection
        model Fog::Compute::HuaweiCloud::Host

        def all(options = {})
          data = service.list_hosts(options)
          load_response(data, 'hosts')
        end

        def get(host_name)
          if host = service.get_host_details(host_name).body['host']
            new('host_name' => host_name,
                'details'   => host)
          end
        rescue Fog::Compute::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/compute/huaweicloud/models/hosts.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/models/hosts.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/models/hosts.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/models/hosts.rb