Class: Glare::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/glare/domain.rb,
lib/glare/domain/zone.rb,
lib/glare/domain/record.rb,
lib/glare/domain/cf_zones.rb

Defined Under Namespace

Classes: CfZone, CfZones, Record, Zone

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Domain

Returns a new instance of Domain.



6
7
8
# File 'lib/glare/domain.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#deregister(fqdn, type) ⇒ Object



25
26
27
28
29
# File 'lib/glare/domain.rb', line 25

def deregister(fqdn, type)
  zone = Zone.new(@client, fqdn)
  dns_records = zone.records(type)
  Record.deregister(@client, zone, dns_records)
end

#proxied?(fqdn, type) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
# File 'lib/glare/domain.rb', line 31

def proxied?(fqdn, type)
  zone = Zone.new(@client, fqdn)
  records = zone.records(type)
  records.all_proxied?
end

#records(fqdn, type) ⇒ Object



37
38
39
40
# File 'lib/glare/domain.rb', line 37

def records(fqdn, type)
  zone = Zone.new(@client, fqdn)
  zone.records(type)
end

#register(fqdn, destinations, type, proxied:, ttl:) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/glare/domain.rb', line 10

def register(fqdn, destinations, type, proxied:, ttl:)
  dns_records = Array(destinations).map do |destination|
    DnsRecord.new(type: type, name: fqdn, content: destination, proxied: proxied, ttl: ttl)
  end

  zone = Zone.new(@client, fqdn)
  Record.register(@client, zone, dns_records)
end

#resolve(fqdn, type) ⇒ Object



19
20
21
22
23
# File 'lib/glare/domain.rb', line 19

def resolve(fqdn, type)
  zone = Zone.new(@client, fqdn)
  records = zone.records(type)
  records.contents
end