-
Notifications
You must be signed in to change notification settings - Fork 3
/
host_record.rb
30 lines (26 loc) · 1.02 KB
/
host_record.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#
# Author:: Prabhu Das (<[email protected]>)
# Author:: Ramesh Sencha (<[email protected]>)
# Copyright:: Infoblox
# Maintainer:: Infoblox
# License:: Apache License, Version 2.0
#
include Infoblox::Api
use_inline_resources
action :create do
request_params = {}
request_params[:name] = new_resource.name
request_params[:aliases] = new_resource.aliases unless new_resource.aliases.nil?
request_params[:comment] = new_resource.comment unless new_resource.comment.nil?
request_params[:disable] = new_resource.disable
request_params[:extattrs] = new_resource.extattrs unless new_resource.extattrs.nil?
request_params[:view] = new_resource.view unless new_resource.view.nil?
request_params[:ipv4addrs] = [{ ipv4addr: new_resource.ipv4addr, mac: new_resource.mac }]
create_host_record(request_params)
end
action :remove do
request_params = {}
request_params[:name] = new_resource.name
request_params[:ipv4addr] = new_resource.ipv4addr unless new_resource.ipv4addr.nil?
remove_host_record(request_params)
end