Sha256: 5d0596fc88233d7e2f6540b4f826f1908604e33a5bf5c1e0456d2e6d146e9c97

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
  	class OracleCloud
	    class Instance < Fog::Model
	      identity  :name

	      attribute :account
	      attribute :boot_order
	      attribute :disk_attach
	      attribute :domain
	     	attribute :entry
	      attribute :error_reason
	      attribute :fingerprint
	      attribute :hostname
	      attribute :hypervisor
	      attribute :image_format
	      attribute :imagelist
	      attribute :ip
	      attribute :label
	      attribute :networking
	      attribute :placement_requirements
	      attribute :platform
	      attribute :priority
	      attribute :quota
	      attribute :quota_reservation
	      attribute :resolvers
	      attribute :reverse_dns
	      attribute :shape
	      attribute :site
	      attribute :sshkeys
	      attribute :start_time
	      attribute :state
	      attribute :storage_attachments
	      attribute :tags
	      attribute :uri
	      attribute :vcable_id
	      attribute :virtio
	      attribute :vnc
	       
	      def ready?
	      	state == 'running'
	      end

 				def save
          #identity ? update : create
          create
        end

        def create
        	requires :name, :shape, :imagelist, :label, :sshkeys
          
          data = service.create_instance(name, shape, imagelist, label, sshkeys)
          merge_attributes(data.body['instances'][0])
        end

        def destroy
        	requires :name
        	service.delete_instance(name)
        end
	    end
	  end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.1 lib/fog/oraclecloud/models/compute/instance.rb