Module: Occi::Api::Client::Base::Stubs

Included in:
ClientBase
Defined in:
lib/occi/api/client/base/stubs.rb

Instance Method Summary collapse

Instance Method Details

#create(entity) ⇒ String

Creates a new resource on the server. Resource must be provided as an instance of Occi::Core::Entity, e.g. instantiated using the get_resource method.

Examples:

res = client.get_resource "compute"

res.title = "MyComputeResource1"
res.mixins << client.get_mixin('small', "resource_tpl")
res.mixins << client.get_mixin('debian6', "os_tpl")

client.create res # => "http://localhost:3300/compute/df7698...f987fa"

Raises:


63
64
65
# File 'lib/occi/api/client/base/stubs.rb', line 63

def create(entity)
  raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
end

#delete(resource_type_identifier) ⇒ Boolean

Deletes a resource or all resource of a certain resource type from the server.

Examples:

client.delete "compute" # => true
client.delete "http://schemas.ogf.org/occi/infrastructure#compute" # => true
client.delete "http://localhost:3300/compute/245j42594...98s9df8s9f" # => true

Raises:


77
78
79
# File 'lib/occi/api/client/base/stubs.rb', line 77

def delete(resource_type_identifier)
  raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
end

#describe(resource_type_identifier = nil) ⇒ Occi::Core::Resources, Occi::Core::Links

Retrieves descriptions for available resources specified by a type identifier or resource location. If no type identifier or location is specified, all available resources in all available resource types will be described.

Examples:

client.describe
 # => #<Occi::Core::Resources>
client.describe "compute"
 # => #<Occi::Core::Resources>
client.describe "http://schemas.ogf.org/occi/infrastructure#compute"
 # => #<Occi::Core::Resources>
client.describe "http://localhost:3300/compute/j5hk1234jk2524-2j3j2k34jjh234-adfaf1234"
 # => #<Occi::Core::Resources>

Raises:


44
45
46
# File 'lib/occi/api/client/base/stubs.rb', line 44

def describe(resource_type_identifier=nil)
  raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
end

#list(resource_type_identifier = nil) ⇒ Array<String>

Retrieves available resources represented by resource locations (URIs). If no type identifier is specified, all available resource are listed. Type identifier can be specified in its shortened format (e.g. "compute", "storage", "network").

Examples:

client.list
 # => [ "http://localhost:3300/compute/jh425jhj3h413-7dj29d7djd9e3-djh2jh4j4j",
 #      "http://localhost:3300/network/kh425jhj3h413-7dj29d7djd9e3-djh2jh4j4j",
 #      "http://localhost:3300/storage/lh425jhj3h413-7dj29d7djd9e3-djh2jh4j4j" ]
client.list "compute"
 # => [ "http://localhost:3300/compute/jh425jhj3h413-7dj29d7djd9e3-djh2jh4j4j" ]
client.list "http://schemas.ogf.org/occi/infrastructure#compute"
 # => [ "http://localhost:3300/compute/jh425jhj3h413-7dj29d7djd9e3-djh2jh4j4j" ]

Raises:


23
24
25
# File 'lib/occi/api/client/base/stubs.rb', line 23

def list(resource_type_identifier=nil)
  raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
end

#refreshObject

Refreshes the Occi::Model used inside the client. Useful for updating the model without creating a new instance or reconnecting. Saves a lot of time in an interactive mode.

Examples:

client.refresh

Raises:


99
100
101
# File 'lib/occi/api/client/base/stubs.rb', line 99

def refresh
  raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
end

#trigger(resource_type_identifier, action_instance) ⇒ Boolean

Triggers given action on a specific resource.

Examples:

TODO: add examples

Raises:


89
90
91
# File 'lib/occi/api/client/base/stubs.rb', line 89

def trigger(resource_type_identifier, action_instance)
  raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
end