Class: ZAWS::Services::Route53::HostedZone

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

Instance Method Summary collapse

Constructor Details

#initialize(shellout, aws) ⇒ HostedZone

Returns a new instance of HostedZone.



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

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

Instance Method Details

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



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

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



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

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