Sha256: 1a6eba51523628ba5e944e9253297caf448562a47adc3df53b529cfcab5d8da3

Contents?: true

Size: 1.81 KB

Versions: 20

Compression:

Stored size: 1.81 KB

Contents

require 'fog/openstack/models/model'

module Fog
  module OpenStack
    class Image
      class V1
        class Image < Fog::OpenStack::Model
          identity :id

          attribute :name
          attribute :size
          attribute :disk_format
          attribute :container_format
          attribute :id
          attribute :checksum

          # detailed
          attribute :min_disk
          attribute :created_at
          attribute :deleted_at
          attribute :updated_at
          attribute :deleted
          attribute :protected
          attribute :is_public
          attribute :status
          attribute :min_ram
          attribute :owner
          attribute :properties
          attribute :location
          attribute :copy_from

          def create
            requires :name
            merge_attributes(service.create_image(attributes).body['image'])
            self
          end

          def update
            requires :name
            merge_attributes(service.update_image(attributes).body['image'])
            self
          end

          def destroy
            requires :id
            service.delete_image(id)
            true
          end

          def add_member(member_id)
            requires :id
            service.add_member_to_image(id, member_id)
          end

          def remove_member(member_id)
            requires :id
            service.remove_member_from_image(id, member_id)
          end

          def update_members(members)
            requires :id
            service.update_image_members(id, members)
          end

          def members
            requires :id
            service.get_image_members(id).body['members']
          end

          def metadata
            requires :id
            service.get_image(id).headers
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.1.2 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-fork-99 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.1.0 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.1.0.pre lib/fog/openstack/image/v1/models/image.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.11 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.10 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.9 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.8 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.7 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.6 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.5 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.4 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.3 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.2 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.1 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-1.0.0 lib/fog/openstack/image/v1/models/image.rb
fog-openstack-0.3.1 lib/fog/openstack/image/v1/models/image.rb