Module: Idcf::Dns::ClientExtensions::Zone

Included in:
Idcf::Dns::Client
Defined in:
lib/idcf/dns/client_extensions/zone.rb

Overview

SDK APIs for zone resource

Instance Method Summary collapse

Instance Method Details

#create_zone(attributes, headers = {}) ⇒ Response

Create a new zone.

Options Hash (attributes):

  • :name (String)

    unique name of zone (required)

  • :email (String)

    e-mail address (required)

  • :description (String)

    description

  • :default_ttl (Integer)

    default TTL (required)



15
16
17
18
# File 'lib/idcf/dns/client_extensions/zone.rb', line 15

def create_zone(attributes, headers = {})
  Validators::Zone.validate_attributes!(attributes, :create)
  post!("zones", attributes, headers)
end

#delete_zone(uuid, headers = {}) ⇒ Response

Delete a zone.



25
26
27
# File 'lib/idcf/dns/client_extensions/zone.rb', line 25

def delete_zone(uuid, headers = {})
  delete!("zones/#{uuid}", {}, headers)
end

#get_zone(uuid, headers = {}) ⇒ Response

Get a zone.



34
35
36
# File 'lib/idcf/dns/client_extensions/zone.rb', line 34

def get_zone(uuid, headers = {})
  get!("zones/#{uuid}", {}, headers)
end

#list_zones(headers = {}) ⇒ Response

Get list of existing zones



42
43
44
# File 'lib/idcf/dns/client_extensions/zone.rb', line 42

def list_zones(headers = {})
  get!("zones", {}, headers)
end

#update_zone(uuid, attributes, headers = {}) ⇒ Response

Update a zone.

Options Hash (attributes):

  • :email (String)

    e-mail address

  • :description (String)

    description

  • :default_ttl (Integer)

    default TTL



54
55
56
57
# File 'lib/idcf/dns/client_extensions/zone.rb', line 54

def update_zone(uuid, attributes, headers = {})
  Validators::Zone.validate_attributes!(attributes, :update)
  put!("zones/#{uuid}", attributes, headers)
end

#zone(uuid, headers = {}) ⇒ Resources::Zone

Get a zone object.



64
65
66
# File 'lib/idcf/dns/client_extensions/zone.rb', line 64

def zone(uuid, headers = {})
  Resources::Zone.new(self, get_zone(uuid, headers).body)
end

#zones(headers = {}) ⇒ Array<Resources::Zone>

Get an array of existing zone objects.



72
73
74
75
76
# File 'lib/idcf/dns/client_extensions/zone.rb', line 72

def zones(headers = {})
  list_zones(headers).resources.map do |zone|
    Resources::Zone.new(self, zone)
  end
end