Class: Vultr::DnsResource

Inherits:
Resource show all
Defined in:
lib/vultr/resources/dns.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Vultr::Resource

Instance Method Details

#create(**attributes) ⇒ Object



8
9
10
# File 'lib/vultr/resources/dns.rb', line 8

def create(**attributes)
  Domain.new post_request("domains", body: attributes).body.dig("domain")
end

#create_record(dns_domain:, **attributes) ⇒ Object



42
43
44
# File 'lib/vultr/resources/dns.rb', line 42

def create_record(dns_domain:, **attributes)
  Object.new post_request("domains/#{dns_domain}/records", body: attributes).body.dig("record")
end

#delete(dns_domain:) ⇒ Object



20
21
22
# File 'lib/vultr/resources/dns.rb', line 20

def delete(dns_domain:)
  delete_request("domains/#{dns_domain}")
end

#delete_record(dns_domain:, record_id:) ⇒ Object



54
55
56
# File 'lib/vultr/resources/dns.rb', line 54

def delete_record(dns_domain:, record_id:)
  delete_request("domains/#{dns_domain}/records/#{record_id}")
end

#dnssec(dns_domain:) ⇒ Object

Returns an Array of strings



33
34
35
# File 'lib/vultr/resources/dns.rb', line 33

def dnssec(dns_domain:)
  get_request("domains/#{dns_domain}/dnssec").body.dig("dns_sec")
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/vultr/resources/dns.rb', line 3

def list(**params)
  response = get_request("domains", params: params)
  Collection.from_response(response, key: "domains", type: Domain)
end

#list_records(dns_domain:, **params) ⇒ Object



37
38
39
40
# File 'lib/vultr/resources/dns.rb', line 37

def list_records(dns_domain:, **params)
  response = get_request("domains/#{dns_domain}/records", params: params)
  Collection.from_response(response, key: "records", type: Object)
end

#retrieve(dns_domain:) ⇒ Object



12
13
14
# File 'lib/vultr/resources/dns.rb', line 12

def retrieve(dns_domain:)
  Domain.new get_request("domains/#{dns_domain}").body.dig("domain")
end

#retrieve_record(dns_domain:, record_id:) ⇒ Object



46
47
48
# File 'lib/vultr/resources/dns.rb', line 46

def retrieve_record(dns_domain:, record_id:)
  Object.new get_request("domains/#{dns_domain}/records/#{record_id}").body.dig("record")
end

#soa(dns_domain:) ⇒ Object



24
25
26
# File 'lib/vultr/resources/dns.rb', line 24

def soa(dns_domain:)
  Object.new get_request("domains/#{dns_domain}/soa").body.dig("dns_soa")
end

#update(dns_domain:, **attributes) ⇒ Object



16
17
18
# File 'lib/vultr/resources/dns.rb', line 16

def update(dns_domain:, **attributes)
  put_request("domains/#{dns_domain}", body: attributes)
end

#update_record(dns_domain:, record_id:, **attributes) ⇒ Object



50
51
52
# File 'lib/vultr/resources/dns.rb', line 50

def update_record(dns_domain:, record_id:, **attributes)
  patch_request("domains/#{dns_domain}/records/#{record_id}", body: attributes)
end

#update_soa(dns_domain:, **attributes) ⇒ Object



28
29
30
# File 'lib/vultr/resources/dns.rb', line 28

def update_soa(dns_domain:, **attributes)
  patch_request("domains/#{dns_domain}/soa", body: attributes)
end