Class: TcServer::Instances
- Inherits:
-
Shared::MutableCollection
- Object
- Shared::Resource
- Shared::Collection
- Shared::MutableCollection
- TcServer::Instances
- Defined in:
- lib/vas/tc_server/instances.rb
Overview
Used to enumerate, create, and delete tc Server instances.
Instance Attribute Summary
Attributes inherited from Shared::Resource
Instance Method Summary collapse
-
#create(installation, name, options = {}) ⇒ Object
Creates a new instance named
name
, using the Installationinstallation
. -
#initialize(location, client) ⇒ Instances
constructor
:nodoc:.
Methods inherited from Shared::MutableCollection
Methods inherited from Shared::Collection
Constructor Details
Instance Method Details
#create(installation, name, options = {}) ⇒ Object
Creates a new instance named name
, using the Installation installation
. Creation can be customized using options
.
Recognized options are:
- properties
-
A hash of properties
- runtime_version
-
The version of the runtime to be used by the instance. Must be one of the runtime_versions available in the Installation. Defaults to the latest available version.
- templates
-
An array of templates to use when creating the instance. Each Template must be present in the Installation.
- layout
-
The layout to use when creating the instance. Valid values are
COMBINED
andSEPARATE
. Defaults toSEPARATE
.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/vas/tc_server/instances.rb', line 40 def create(installation, name, = {}) payload = { :installation => installation.location, :name => name } if .has_key?(:properties) payload[:properties] = [:properties] end if .has_key?(:runtime_version) payload["runtime-version"] = [:runtime_version] end if .has_key?(:templates) template_locations = [] [:templates].each { |template| template_locations << template.location } payload[:templates] = template_locations end if .has_key?(:layout) payload[:layout] = [:layout] end Instance.new(client.post(location, payload, "group-instance"), client) end |