Sha256: 3f1ccae89705a45be36e367c29702cc65705fb11c1fa73ad191ba5cef314cdc9

Contents?: true

Size: 1.66 KB

Versions: 4

Compression:

Stored size: 1.66 KB

Contents

require 'fog/compute/gridscale/models/storage'

module Fog
  module Compute
    class Gridscale
      class Isoimage < Fog::Model
        identity :object_uuid

        attribute :capacity
        attribute :change_time
        attribute :create_time
        attribute :current_price
        attribute :description
        attribute :labels
        attribute :location_country
        attribute :location_iata
        attribute :location_name
        attribute :location_uuid
        attribute :name
        attribute :object_uuid
        attribute :private
        attribute :relations
        attribute :source_url
        attribute :status
        attribute :usage_in_minutes
        attribute :version

        def delete
          requires :object_uuid
          response = service.isoimage_delete object_uuid
          response.body
        end

        def destroy
          requires :object_uuid
          response = service.isoimage_delete object_uuid
          response.body
        end

        def save
          raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
          requires :name, :source_url

          options = {}
          options[:labels] = labels
          if attributes[:location_uuid]
            options[:location_uuid] = location_uuid
          end

          data = service.isoimage_create(name, source_url, options)

          merge_attributes(data.body)
          true
        end

        def update
          requires :object_uuid

          payload = {}

          data = service.isoimage_update(object_uuid, payload)
          merge_attributes(data.body)
          true
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-gridscale-0.1.5 lib/fog/compute/gridscale/models/isoimage.rb
fog-gridscale-0.1.4 lib/fog/compute/gridscale/models/isoimage.rb
fog-gridscale-0.1.3 lib/fog/compute/gridscale/models/isoimage.rb
fog-gridscale-0.1.2 lib/fog/compute/gridscale/models/isoimage.rb