Sha256: f7c6eb78c93226028b6bd0fa37c9aae67c9f3bbfabb517abb9945e74192fccc6

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 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 clean_name 
	      	name.sub %r{\/.*\/}, ''
	      end

 				def save
          #identity ? update : create
          create
        end

        def create
        	requires :name, :shape, :imagelist, :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

2 entries across 2 versions & 1 rubygems

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