Sha256: 668ee95f6960ce98dd6ee015fc5d339ff2966e03650ff8f960fb5ec94d652f6f

Contents?: true

Size: 654 Bytes

Versions: 43

Compression:

Stored size: 654 Bytes

Contents

require 'fog/core/collection'
require 'fog/go_grid/models/compute/image'

module Fog
  module Compute
    class GoGrid
      class Images < Fog::Collection
        model Fog::Compute::GoGrid::Image

        attribute :server

        def all
          data = service.grid_image_list.body['list']
          load(data)
          if server
            self.replace(self.select {|image| image.server_id == server.id})
          end
        end

        def get(image_id)
          response = service.grid_image_get.body['list'][image_id]
          new(data)
        rescue Fog::Compute::GoGrid::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
ns-fog-1.22.3 lib/fog/go_grid/models/compute/images.rb
ns-fog-1.22.2 lib/fog/go_grid/models/compute/images.rb
fog-1.22.1 lib/fog/go_grid/models/compute/images.rb