Class: ZAWS::Route53Services::HostedZone

Inherits:
Object
  • Object
show all
Defined in:
lib/zaws/route53/hosted_zone.rb

Instance Method Summary collapse

Constructor Details

#initialize(shellout, aws) ⇒ HostedZone

Returns a new instance of HostedZone.



9
10
11
12
# File 'lib/zaws/route53/hosted_zone.rb', line 9

def initialize(shellout,aws)
		@shellout=shellout
		@aws=aws
end

Instance Method Details

#view(viewtype, textout = nil, verbose = nil) ⇒ Object



14
15
16
17
18
19
# File 'lib/zaws/route53/hosted_zone.rb', line 14

def view(viewtype,textout=nil,verbose=nil)
		comline="aws --output #{viewtype} route53 list-hosted-zones"
		zones=@shellout.cli(comline,verbose)
		textout.puts(zones) if textout
		return zones 
end

#view_records(viewtype, textout = nil, verbose = nil, zonename) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/zaws/route53/hosted_zone.rb', line 21

def view_records(viewtype,textout=nil,verbose=nil,zonename)
     zones=JSON.parse(view('json',nil,verbose))
		zone_id=nil
		zones["HostedZones"].each { |x| zone_id = ("#{x["Name"]}"=="#{zonename}") ? x["Id"] : nil }
     if zone_id
 comline="aws --output #{viewtype} route53 list-resource-record-sets --hosted-zone-id #{zone_id}"
 records=@shellout.cli(comline,verbose)
 textout.puts(records) if textout
 return records 
		end
end