Class: Zenoss::Model::System
- Inherits:
-
Object
- Object
- Zenoss::Model::System
- Includes:
- Zenoss, Zenoss::Model
- Defined in:
- lib/model/systems/system.rb
Instance Attribute Summary (collapse)
-
- (Object) organizer_name
readonly
Returns the value of attribute organizer_name.
Instance Method Summary (collapse)
-
- (Object) add_subsystem(sys_name)
Add a device beneath this Device Class.
-
- (Object) delete!
Delete this System.
-
- (Object) delete_subsystem(sys_name)
TODO: Need to add some error checking.
-
- (Object) get_id
Instead of calling the /getId REST method, this method simply returns the @id value since it is the same anyway.
-
- (System) initialize(devclass)
constructor
A new instance of System.
Methods included from Zenoss::Model
Methods included from Zenoss
devices, services, set_auth, systems, uri
Constructor Details
- (System) initialize(devclass)
A new instance of System
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/model/systems/system.rb', line 28 def initialize(devclass) @base_id = 'Systems' # This confusing little ditty lets us accept a System in a number of ways: # Like, '/zport/dmd/Systems/MyService' # or, '/Systems/MyService' # or, '/MyService' path = devclass.sub(/^(\/zport\/dmd\/)?(#{@base_id}\/)?([\w\/]+)\/?$/,'\3') @id = path.split('/').last @organizer_name = rest('getOrganizerName', "#{@base_id}/#{path}") end |
Instance Attribute Details
- (Object) organizer_name (readonly)
Returns the value of attribute organizer_name
26 27 28 |
# File 'lib/model/systems/system.rb', line 26 def organizer_name @organizer_name end |
Instance Method Details
- (Object) add_subsystem(sys_name)
Add a device beneath this Device Class. It is also typically best to use the fully qualified version of the device name. It returns true if the device is added, false otherwise.
50 51 52 53 |
# File 'lib/model/systems/system.rb', line 50 def add_subsystem(sys_name) loader = ZDeviceLoader.instance loader.add_system("#{@organizer_name}/#{sys_name}") end |
- (Object) delete!
Delete this System
62 63 64 |
# File 'lib/model/systems/system.rb', line 62 def delete! Zenoss.systems.delete_subsystem(@organizer_name) end |
- (Object) delete_subsystem(sys_name)
TODO: Need to add some error checking. For now we are just returning true
56 57 58 59 |
# File 'lib/model/systems/system.rb', line 56 def delete_subsystem(sys_name) rest("manage_deleteOrganizer?orgname=#{sys_name}") true end |
- (Object) get_id
Instead of calling the /getId REST method, this method simply returns the @id value since it is the same anyway.
71 72 73 |
# File 'lib/model/systems/system.rb', line 71 def get_id @id end |