Class: ZoneCreate
Instance Attribute Summary
Attributes inherited from Command
#desc, #name
Instance Method Summary
collapse
Methods inherited from Command
#add_arg, #add_cmd, #add_flow, #add_flow_from_usage, #add_input, #add_option, #add_options, #command_name?, #get_args_used, #init, #initialize, #run, #show_help, #show_help_option
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#create_args ⇒ Object
60
61
62
63
64
65
|
# File 'lib/zone.rb', line 60
def create_args
add_arg("name", "name of zone", /[[:alnum:]\.-]+/)
add_arg("comment", "zone comment", /.*/)
add_arg("status", "zone status", 'zone_statuses')
add_arg("type", "zone type", 'zone_types')
end
|
#create_flows ⇒ Object
67
68
69
|
# File 'lib/zone.rb', line 67
def create_flows
add_flow_from_usage("<name> <status> [<comment>] [<type>='Primary']")
end
|
#execute(arghash, rest) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/zone.rb', line 71
def execute(arghash, rest)
name = arghash["name"]
if name[-1] != '.'
name = name + '.'
end
status = arghash["status"]
= arghash["comment"]
= "" if .nil?
type = arghash["type"]
dputs "name = #{name}, comment=#{}, status=#{status}, type=#{type}"
zone = { "Comment" => , "DomainName" => name, "Status" => status, "ZoneType" => type, "Records" => {"A" => [] } }
puts "creating zone on server"
Route.do.add_zone(zone)
end
|