Class: Infoblox::Grid

Inherits:
Resource show all
Defined in:
lib/infoblox/resource/grid.rb

Instance Attribute Summary

Attributes inherited from Resource

#_ref, #connection

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

_return_fields, all, default_params, find, #get, #initialize, #post, #put, remote_attr_accessor, remote_attr_reader, remote_attr_writer, #remote_attribute_hash, remote_attrs, remote_post_accessor, remote_post_attrs, remote_read_only_attrs, remote_write_only_attrs, resource_map, resource_uri, #resource_uri, wapi_object

Constructor Details

This class inherits a constructor from Infoblox::Resource

Class Method Details

.get(connection) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/infoblox/resource/grid.rb', line 30

def self.get(connection)
  JSON.parse(connection.get(resource_uri).body).map do |jobj|
    klass = resource_map[jobj["_ref"].split("/").first]
    if klass.nil?
      puts jobj['_ref']
      warn "umapped resource: #{jobj["_ref"]}"
    else
      klass.new(jobj.merge({:connection => connection}))
    end
  end.compact
end

Instance Method Details

#createObject



22
23
24
# File 'lib/infoblox/resource/grid.rb', line 22

def create
  raise "Not supported"
end

#deleteObject



18
19
20
# File 'lib/infoblox/resource/grid.rb', line 18

def delete
  raise "Not supported"
end

#modifyObject



26
27
28
# File 'lib/infoblox/resource/grid.rb', line 26

def modify
  raise "Not supported"
end

#restartservices(member_order = "SEQUENTIALLY", restart_option = "RESTART_IF_NEEDED", sequential_delay = 15, service_option = "DHCP") ⇒ Object

Example of a working post for restartservices POST /wapi/v1.4/grid/b25lLmNsdXN0ZXIkMA:DNSone?_function=restartservices &member_order=SEQUENTIALLY &restart_option=RESTART_IF_NEEDED &sequential_delay=15 &service_option=DHCP



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/infoblox/resource/grid.rb', line 48

def restartservices(member_order="SEQUENTIALLY",
  restart_option="RESTART_IF_NEEDED",
  sequential_delay=15,
  service_option="DHCP")

  post_body = {
    :member_order =>      member_order,
    :restart_option =>    restart_option,
    :sequential_delay =>  sequential_delay.to_i,
    :service_option =>    service_option
  }
  JSON.parse(connection.post(resource_uri + "?_function=restartservices", post_body).body);
end