From 04cce1faf1b45e5ea650dbcae6a9374e963c901e Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Wed, 11 Dec 2013 23:56:05 -0200 Subject: [PATCH] [xenserver] Adding more XenServer Models --- lib/fog/xenserver/models/compute/blob.rb | 22 ++++++++++++++++ lib/fog/xenserver/models/compute/blobs.rb | 25 +++++++++++++++++++ lib/fog/xenserver/models/compute/bond.rb | 23 +++++++++++++++++ lib/fog/xenserver/models/compute/bonds.rb | 25 +++++++++++++++++++ .../xenserver/models/compute/crash_dump.rb | 19 ++++++++++++++ .../xenserver/models/compute/crash_dumps.rb | 25 +++++++++++++++++++ lib/fog/xenserver/models/compute/dr_task.rb | 17 +++++++++++++ lib/fog/xenserver/models/compute/dr_tasks.rb | 25 +++++++++++++++++++ lib/fog/xenserver/models/compute/gpu_group.rb | 22 ++++++++++++++++ .../xenserver/models/compute/gpu_groups.rb | 25 +++++++++++++++++++ .../models/compute/host_crash_dump.rb | 20 +++++++++++++++ .../models/compute/host_crash_dumps.rb | 25 +++++++++++++++++++ .../xenserver/models/compute/host_patch.rb | 25 +++++++++++++++++++ .../xenserver/models/compute/host_patches.rb | 25 +++++++++++++++++++ 14 files changed, 323 insertions(+) create mode 100644 lib/fog/xenserver/models/compute/blob.rb create mode 100644 lib/fog/xenserver/models/compute/blobs.rb create mode 100644 lib/fog/xenserver/models/compute/bond.rb create mode 100644 lib/fog/xenserver/models/compute/bonds.rb create mode 100644 lib/fog/xenserver/models/compute/crash_dump.rb create mode 100644 lib/fog/xenserver/models/compute/crash_dumps.rb create mode 100644 lib/fog/xenserver/models/compute/dr_task.rb create mode 100644 lib/fog/xenserver/models/compute/dr_tasks.rb create mode 100644 lib/fog/xenserver/models/compute/gpu_group.rb create mode 100644 lib/fog/xenserver/models/compute/gpu_groups.rb create mode 100644 lib/fog/xenserver/models/compute/host_crash_dump.rb create mode 100644 lib/fog/xenserver/models/compute/host_crash_dumps.rb create mode 100644 lib/fog/xenserver/models/compute/host_patch.rb create mode 100644 lib/fog/xenserver/models/compute/host_patches.rb diff --git a/lib/fog/xenserver/models/compute/blob.rb b/lib/fog/xenserver/models/compute/blob.rb new file mode 100644 index 000000000..8813cb44f --- /dev/null +++ b/lib/fog/xenserver/models/compute/blob.rb @@ -0,0 +1,22 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class Blob < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=blob + + identity :reference + + attribute :last_updated + attribute :mime_type + attribute :description, :aliases => :name_description + attribute :name, :aliases => :name_label + attribute :public + attribute :size + attribute :uuid + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/blobs.rb b/lib/fog/xenserver/models/compute/blobs.rb new file mode 100644 index 000000000..d29c8d3d9 --- /dev/null +++ b/lib/fog/xenserver/models/compute/blobs.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/blob' + +module Fog + module Compute + class XenServer + class Blobs < Fog::Collection + model Fog::Compute::XenServer::Blob + + def all(options={}) + data = service.get_records 'blob' + load(data) + end + + def get( blob_ref ) + if blob_ref && blob = service.get_record( blob_ref, 'blob' ) + new(blob) + else + nil + end + end + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/bond.rb b/lib/fog/xenserver/models/compute/bond.rb new file mode 100644 index 000000000..139ead8d1 --- /dev/null +++ b/lib/fog/xenserver/models/compute/bond.rb @@ -0,0 +1,23 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class Bond < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=Bond + + identity :reference + + attribute :links_up + attribute :__master, :aliases => :master + attribute :mode + attribute :other_config + attribute :__primary_slave, :aliases => :primary_slave + attribute :properties + attribute :__slaves, :aliases => :slaves + attribute :uuid + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/bonds.rb b/lib/fog/xenserver/models/compute/bonds.rb new file mode 100644 index 000000000..29fc4ea29 --- /dev/null +++ b/lib/fog/xenserver/models/compute/bonds.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/bond' + +module Fog + module Compute + class XenServer + class Bonds < Fog::Collection + model Fog::Compute::XenServer::Bond + + def all(options={}) + data = service.get_records 'Bond' + load(data) + end + + def get( bond_ref ) + if bond_ref && bond = service.get_record( bond_ref, 'Bond' ) + new(bond) + else + nil + end + end + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/crash_dump.rb b/lib/fog/xenserver/models/compute/crash_dump.rb new file mode 100644 index 000000000..1f63f76e1 --- /dev/null +++ b/lib/fog/xenserver/models/compute/crash_dump.rb @@ -0,0 +1,19 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class CrashDump < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=crashdump + + identity :reference + + attribute :other_config + attribute :__vdi, :aliases => :VDI + attribute :__vm, :aliases => :VM + attribute :uuid + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/crash_dumps.rb b/lib/fog/xenserver/models/compute/crash_dumps.rb new file mode 100644 index 000000000..f8991bbef --- /dev/null +++ b/lib/fog/xenserver/models/compute/crash_dumps.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/crash_dump' + +module Fog + module Compute + class XenServer + class Bonds < Fog::Collection + model Fog::Compute::XenServer::CrashDump + + def all(options={}) + data = service.get_records 'crashdump' + load(data) + end + + def get( crashdump_ref ) + if crashdump_ref && crashdump = service.get_record( crashdump_ref, 'crashdump' ) + new(crashdump) + else + nil + end + end + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/dr_task.rb b/lib/fog/xenserver/models/compute/dr_task.rb new file mode 100644 index 000000000..6269468a7 --- /dev/null +++ b/lib/fog/xenserver/models/compute/dr_task.rb @@ -0,0 +1,17 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class DrTask < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=DR_task + + identity :reference + + attribute :__introduced_srs, :aliases => :introduced_SRs + attribute :uuid + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/dr_tasks.rb b/lib/fog/xenserver/models/compute/dr_tasks.rb new file mode 100644 index 000000000..e147c5b17 --- /dev/null +++ b/lib/fog/xenserver/models/compute/dr_tasks.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/dr_task' + +module Fog + module Compute + class XenServer + class DrTasks < Fog::Collection + model Fog::Compute::XenServer::DrTask + + def all(options={}) + data = service.get_records 'DR_task' + load(data) + end + + def get( dr_task_ref ) + if dr_task_ref && dr_task = service.get_record( dr_task_ref, 'DR_task' ) + new(dr_task) + else + nil + end + end + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/gpu_group.rb b/lib/fog/xenserver/models/compute/gpu_group.rb new file mode 100644 index 000000000..34bb49882 --- /dev/null +++ b/lib/fog/xenserver/models/compute/gpu_group.rb @@ -0,0 +1,22 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class GpuGroup < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=GPU_group + + identity :reference + + attribute :gpu_types, :aliases => :GPU_types + attribute :description, :aliases => :name_description + attribute :name, :aliases => :name_label + attribute :other_config + attribute :__pgpus, :aliases => :PGPUs + attribute :__vgpus, :aliases => :VGPUs + attribute :uuid + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/gpu_groups.rb b/lib/fog/xenserver/models/compute/gpu_groups.rb new file mode 100644 index 000000000..58246b02e --- /dev/null +++ b/lib/fog/xenserver/models/compute/gpu_groups.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/gpu_group' + +module Fog + module Compute + class XenServer + class GpuGroups < Fog::Collection + model Fog::Compute::XenServer::GpuGroup + + def all(options={}) + data = service.get_records 'GPU_group' + load(data) + end + + def get( gpu_group_ref ) + if gpu_group_ref && gpu_group = service.get_record( gpu_group_ref, 'GPU_group' ) + new(gpu_group) + else + nil + end + end + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/host_crash_dump.rb b/lib/fog/xenserver/models/compute/host_crash_dump.rb new file mode 100644 index 000000000..cbe8b7670 --- /dev/null +++ b/lib/fog/xenserver/models/compute/host_crash_dump.rb @@ -0,0 +1,20 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class HostCrashDump < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host_crashdump + + identity :reference + + attribute :__host, :aliases => :host + attribute :other_config + attribute :size + attribute :timestamp + attribute :uuid + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/host_crash_dumps.rb b/lib/fog/xenserver/models/compute/host_crash_dumps.rb new file mode 100644 index 000000000..ac0fb8c44 --- /dev/null +++ b/lib/fog/xenserver/models/compute/host_crash_dumps.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/host_crash_dump' + +module Fog + module Compute + class XenServer + class HostCrashDumps < Fog::Collection + model Fog::Compute::XenServer::HostCrashDump + + def all(options={}) + data = service.get_records 'host_crashdump' + load(data) + end + + def get( host_crashdump_ref ) + if host_crashdump_ref && host_crashdump = service.get_record( host_crashdump_ref, 'host_crashdump' ) + new(host_crashdump) + else + nil + end + end + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/host_patch.rb b/lib/fog/xenserver/models/compute/host_patch.rb new file mode 100644 index 000000000..3f5eb0daa --- /dev/null +++ b/lib/fog/xenserver/models/compute/host_patch.rb @@ -0,0 +1,25 @@ +require 'fog/core/model' + +module Fog + module Compute + class XenServer + class HostPatch < Fog::Model + # API Reference here: + # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=host_patch + + identity :reference + + attribute :applied + attribute :__host, :aliases => :host + attribute :description, :aliases => :name_description + attribute :name, :aliases => :name_label + attribute :other_config + attribute :__pool_patch, :aliases => :pool_patch + attribute :size + attribute :timestamp_applied + attribute :uuid + attribute :version + end + end + end +end diff --git a/lib/fog/xenserver/models/compute/host_patches.rb b/lib/fog/xenserver/models/compute/host_patches.rb new file mode 100644 index 000000000..a1fa7f2ac --- /dev/null +++ b/lib/fog/xenserver/models/compute/host_patches.rb @@ -0,0 +1,25 @@ +require 'fog/core/collection' +require 'fog/xenserver/models/compute/host_patch' + +module Fog + module Compute + class XenServer + class HostPatches < Fog::Collection + model Fog::Compute::XenServer::HostPatch + + def all(options={}) + data = service.get_records 'host_patch' + load(data) + end + + def get( host_patch_ref ) + if host_patch_ref && host_patch = service.get_record( host_patch_ref, 'host_patch' ) + new(host_patch) + else + nil + end + end + end + end + end +end