class OpsviewRest::Hostgroup

Attributes

opsview[RW]
options[RW]
resource_type[RW]

Public Class Methods

new(opsview, options = {}) click to toggle source
# File lib/opsview_rest/hostgroup.rb, line 9
def initialize(opsview, options = {})
  @options = {
    parent: 'Opsview',
    name: 'unknown',
    save: true,
    replace: false
  }.update options

  @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