Module: Idcf::Dns::ClientExtensions::Template

Defined in:
lib/idcf/dns/client_extensions/template.rb

Overview

SDK APIs for template resource

Instance Method Summary collapse

Instance Method Details

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

Create a new template.

Parameters:

  • attributes (Hash)

    request attributes

  • headers (Hash) (defaults to: {})

    HTTP request headers

Options Hash (attributes):

  • :name (String)

    unique name of template (required)

  • :description (String)

    description

  • :default_ttl (Integer)

    default TTL (required)

Returns:



14
15
16
17
# File 'lib/idcf/dns/client_extensions/template.rb', line 14

def create_template(attributes, headers = {})
  Validators::Template.validate_attributes!(attributes, :create)
  post!("templates", attributes, headers)
end

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

Delete a template.

Parameters:

  • uuid (String)

    UUID of the target template

  • headers (Hash) (defaults to: {})

    HTTP request headers

Returns:



24
25
26
# File 'lib/idcf/dns/client_extensions/template.rb', line 24

def delete_template(uuid, headers = {})
  delete!("templates/#{uuid}", {}, headers)
end

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

Get a template.

Parameters:

  • uuid (String)

    UUID of the target template

  • headers (Hash) (defaults to: {})

    HTTP request headers

Returns:



33
34
35
# File 'lib/idcf/dns/client_extensions/template.rb', line 33

def get_template(uuid, headers = {})
  get!("templates/#{uuid}", {}, headers)
end

#list_templates(headers = {}) ⇒ Response

Get list of existing templates.

Parameters:

  • headers (Hash) (defaults to: {})

    HTTP request headers

Returns:



41
42
43
# File 'lib/idcf/dns/client_extensions/template.rb', line 41

def list_templates(headers = {})
  get!("templates", {}, headers)
end

#update_template(uuid, attributes, headers = {}) ⇒ Reponse

Update a template.

Parameters:

  • uuid (String)

    UUID of the target template

  • attributes (Hash)

    request attributes

Options Hash (attributes):

  • :description (String)
  • :default_ttl (Integer)

    default TTL

Returns:

  • (Reponse)

    HTTP response object



52
53
54
55
# File 'lib/idcf/dns/client_extensions/template.rb', line 52

def update_template(uuid, attributes, headers = {})
  Validators::Template.validate_attributes!(attributes, :update)
  put!("templates/#{uuid}", attributes, headers)
end