Class: OpsviewRest::Hostgroup
- Inherits:
-
Object
- Object
- OpsviewRest::Hostgroup
- Includes:
- Mixin
- Defined in:
- lib/opsview_rest/hostgroup.rb
Instance Attribute Summary collapse
-
#opsview ⇒ Object
Returns the value of attribute opsview.
-
#options ⇒ Object
Returns the value of attribute options.
-
#resource_type ⇒ Object
Returns the value of attribute resource_type.
Instance Method Summary collapse
-
#initialize(opsview, options = {}) ⇒ Hostgroup
constructor
A new instance of Hostgroup.
Methods included from Mixin
#resource_path, #save, #to_json
Constructor Details
#initialize(opsview, options = {}) ⇒ Hostgroup
Returns a new instance of Hostgroup.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/opsview_rest/hostgroup.rb', line 10 def initialize(opsview, = {}) @options = { :parent => "Opsview", :name => "unknown", :save => true, :replace => false }.update @opsview = opsview @resource_type = @options[:type] @options[:parent] = { "name" => @options[:parent] } @options[:hosts] = @options[:hosts].map { |x| { "name" => x } } @options[:children] = @options[:children].map { |x| { "name" => x } } save(@options[:replace]) if @options[:save] end |
Instance Attribute Details
#opsview ⇒ Object
Returns the value of attribute opsview.
8 9 10 |
# File 'lib/opsview_rest/hostgroup.rb', line 8 def opsview @opsview end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/opsview_rest/hostgroup.rb', line 8 def @options end |
#resource_type ⇒ Object
Returns the value of attribute resource_type.
8 9 10 |
# File 'lib/opsview_rest/hostgroup.rb', line 8 def resource_type @resource_type end |