Class: VMCreate::WinSrv
- Inherits:
-
Object
- Object
- VMCreate::WinSrv
- Defined in:
- lib/puppet/provider/ntx_create_vm/vm-win.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#proj ⇒ Object
Returns the value of attribute proj.
Instance Method Summary collapse
- #addDisk(device_type, adapter_type, device_index, disk_size) ⇒ Object
- #addNic(nic_tpye, kind, uuid) ⇒ Object
- #apiVersionCreate(api_version) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize ⇒ WinSrv
constructor
A new instance of WinSrv.
- #metadataCreate(kind, proj) ⇒ Object
- #specAddClusterReference(kind, uuid) ⇒ Object
- #specAddResources(cpus, cores, memory) ⇒ Object
- #specFinish ⇒ Object
- #specInit(vm_name) ⇒ Object
- #to_json(*options) ⇒ Object
Constructor Details
#initialize ⇒ WinSrv
Returns a new instance of WinSrv.
12 13 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 12 def initialize() end |
Instance Attribute Details
#api_version ⇒ Object
Returns the value of attribute api_version.
10 11 12 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 10 def api_version @api_version end |
#proj ⇒ Object
Returns the value of attribute proj.
10 11 12 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 10 def proj @proj end |
Instance Method Details
#addDisk(device_type, adapter_type, device_index, disk_size) ⇒ Object
38 39 40 41 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 38 def addDisk(device_type, adapter_type, device_index, disk_size) disk = WinRes::Disk.new(device_type, adapter_type, device_index, disk_size); @res.addDisk(disk); end |
#addNic(nic_tpye, kind, uuid) ⇒ Object
43 44 45 46 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 43 def addNic(nic_tpye, kind, uuid) nic = WinRes::Nic.new(nic_tpye, kind, uuid); @res.addNic(nic); end |
#apiVersionCreate(api_version) ⇒ Object
15 16 17 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 15 def apiVersionCreate(api_version) @apiVersion = api_version; end |
#as_json(options = {}) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 57 def as_json(={}) { api_version: @apiVersion, metadata: @metaData, spec: @specData } end |
#metadataCreate(kind, proj) ⇒ Object
19 20 21 22 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 19 def (kind, proj) = WinRes::MetaData.new(kind,proj); @metaData = .getMetaData(); end |
#specAddClusterReference(kind, uuid) ⇒ Object
32 33 34 35 36 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 32 def specAddClusterReference(kind, uuid) clust = WinRes::ClusterReference.new(kind, uuid) clustData = clust.getClusterReferenceData(); @spec.addClusterReference(clustData); end |
#specAddResources(cpus, cores, memory) ⇒ Object
28 29 30 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 28 def specAddResources(cpus,cores,memory) @res = WinRes::Resources.new(cpus,cores,memory); end |
#specFinish ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 48 def specFinish() # we gether resource data, which includes disk_list and nic_list resData = @res.getResourcesData(); # we add it to specifications since this is our root for resources @spec.addResources(resData); # we gether all data from specifications including resources and cluster reference data @specData = @spec.getSpecificationsData(); end |
#specInit(vm_name) ⇒ Object
24 25 26 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 24 def specInit(vm_name) @spec = WinRes::Specification.new(vm_name) end |
#to_json(*options) ⇒ Object
66 67 68 |
# File 'lib/puppet/provider/ntx_create_vm/vm-win.rb', line 66 def to_json(*) as_json(*).to_json(*) end |