Module: RegApi2::Zone

Extended by:
Zone
Includes:
Builder
Included in:
Zone
Defined in:
lib/reg_api2/zone.rb

Overview

REG.API zone category

Instance Method Summary (collapse)

Methods included from Builder

included

Instance Method Details

- (Hash(domains)) add_aaaa(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to tie subdomains to IPv6 addresses.

Examples:

Assign the IPv6 address aa11::a111:11aa:aaa1:aa1a to the domains test.ru and test.com.

RegApi2.zone.add_aaaa domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: '@', ipaddr: IPAddr.new("aa11::a111:11aa:aaa1:aa1a")

Same with ipv6 addresses as strings.

RegApi2.zone.add_aaaa domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: '@', ipaddr: "aa11::a111:11aa:aaa1:aa1a"

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Name of the subdomain assigned an IP address. To assign an IP address to a domain, transfer the “@” value. To assign an IP address to all subdomains, which are not explicitly defined in other records, use the “*” value.

  • :ipaddr (String or IPAddr)

    The IPv6 address assigned to the subdomain.

Returns:

  • (Hash(domains))

    A list of domains with results.



47
# File 'lib/reg_api2/zone.rb', line 47

define :add_aaaa, required: { ipaddr: { ipaddr: true }, subdomain: {} }

- (Hash(domains)) add_alias(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to tie subdomains to IP addresses.

Examples:

Assign the IP address 111.111.111.111 to the domains test.ru and test.com.

RegApi2.zone.add_alias domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: '@', ipaddr: IPAddr.new("111.111.111.111")

Same with ip addresses as strings.

RegApi2.zone.add_alias domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: '@', ipaddr: "111.111.111.111"

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Name of the subdomain assigned an IP address. To assign an IP address to a domain, transfer the “@” value. To assign an IP address to all subdomains, which are not explicitly defined in other records, use the “*” value.

  • :ipaddr (String or IPAddr)

    IP address assigned to the subdomain.

Returns:

  • (Hash(domains))

    A list of domains with results.



33
# File 'lib/reg_api2/zone.rb', line 33

define :add_alias, required: { ipaddr: { ipaddr: true }, subdomain: {} }

- (Hash(domains)) add_cname(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to tie a subdomain to another’s domain name.

Examples:

Tie the third-level domains mail.test.ru and mail.test.com to mx10.test.ru.

RegApi2.zone.add_cname domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: "mail", canonical_name: "mx10.test.ru"

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Name of the subdomain assigned an IP address. To assign an IP address to a domain, transfer the “@” value. To assign an IP address to all subdomains, which are not explicitly defined in other records, use the “*” value.

  • :canonical_name (String)

    Name of the domain assigned a synonym.

Returns:

  • (Hash(domains))

    A list of domains with results.



59
# File 'lib/reg_api2/zone.rb', line 59

define :add_cname, required: { canonical_name: {}, subdomain: {} }

- (Hash(domains)) add_mx(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to define the IP address or domain name of the mail server, which will received email destined to your domain.

Examples:

Tie the the domains test.ru and test.com to the mail servers mail.test.ru and mail.test.com.

RegApi2.zone.add_mx domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: "@", mail_server: "mail"

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Name of the subdomain, to which the address is assigned. The default value is “@”, i.e. the main domain.

  • :priority (Fixnum)

    Mail server priority: from 0 (highest) through 10 (lowest).

  • :mail_server (String or IPAddr)

    Domain name or IP address of the mail server (domain name is more preferable because not all mail servers admit IP addresses).

Returns:

  • (Hash(domains))

    A list of domains with results.



72
# File 'lib/reg_api2/zone.rb', line 72

define :add_mx, required: { mail_server: { ipaddr: :optional } }, optional: %w[ subdomain ]

- (Hash(domains)) add_ns(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

You can use this function to hand over a subdomain to other DNS servers.

Examples:

Hand over domains tt.test.ru and tt.test.com to the DNS server ns1.test.ru.

RegApi2.zone.add_ns domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: "tt", dns_server: "ns1.test.ru", record_number: 10

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Name of the subdomain that will be handed over to other DNS servers.

  • :dns_server (String)

    Domain name of the DNS-server.

  • :record_number (Fixnum)

    Order number of the NS record that determines relative arrangement of NS records for the subdomain.

Returns:

  • (Hash(domains))

    A list of domains with results.



85
# File 'lib/reg_api2/zone.rb', line 85

define :add_ns, required: { dns_server: {}, subdomain: {}, record_number: { re: /\d\d?/ } }

- (Hash(domains)) add_spf(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Creates a SPF (sender policy framework) resource record up to 512 octets in length.

Examples:

Create SPF record.

RegApi2.zone.add_spf domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: "@", text: 'v=spf1 include:_spf.google.com ~all'

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Subdomain name.

  • :text (String)

    SPF record text.

Returns:

  • (Hash(domains))

    A list of domains with results.



124
# File 'lib/reg_api2/zone.rb', line 124

define :add_spf, required: { subdomain: {}, text: { re: /\Av=spf1/ } }

- (Hash(domains)) add_srv(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Add service record.

Examples:

Make the sip.test.ru server handle SIP calls destined to xxx@test.ru and xxx@test.com on port 5060 over UDP.

RegApi2.zone.add_srv domains: [ { dname: "test.ru" }, { dname: "test.com" } ], service: "_sip._udp", priority: 0, port: 5060, target: "sip.test.ru"

Parameters:

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

Options Hash (opts):

  • :service (String)

    The service that will be matched against the defined server. For example, to make the sip.test.ru server handle SIP calls over UDP, you should specify the following string: _sip._udp.

  • :priority (Fixnum)

    Record priority.

  • :weight (Fixnum)

    The load that the servers can handle. Optional field. Default value: 0.

  • :target (String)

    The server used by the service.

  • :port (Fixnum)

    The port used by the service.

Returns:

  • (Hash(domains))

    A list of domains with results.



112
# File 'lib/reg_api2/zone.rb', line 112

define :add_srv, required: { service: {}, priority: { re: /\A\d+\z/ }, target: {}, port: { re: /\A\d+\z/ } }, optional: { weight: { re: /\A\d+\z/ } }

- (Hash(domains)) add_txt(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Add an arbitrary note about the subdomain.

Examples:

Add notes about the mail.test.ru and mail.test.com domains.

RegApi2.zone.add_txt domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: "mail", text: "testmail"

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    Name of the subdomain, about which the record is added.

  • :text (String)

    Text of the note. Only ASCII alphanumeric characters are allowed.

Returns:

  • (Hash(domains))

    A list of domains with results.



97
# File 'lib/reg_api2/zone.rb', line 97

define :add_txt, required: { text: {}, subdomain: {} }

- (Hash(domains)) clear(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Delete all resource records.

Examples:

Delete all resource records.

RegApi2.zone.clear domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Returns:

  • (Hash(domains))

    A list of domains with results.



244
# File 'lib/reg_api2/zone.rb', line 244

define :clear

- (Hash(domains)) clear_forwarding(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to delete resource records required for web forwarding.

Examples:

Delete resource records required for web forwarding.

RegApi2.zone.clear_forwarding domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Returns:

  • (Hash(domains))

    A list of domains with results.

See Also:



198
# File 'lib/reg_api2/zone.rb', line 198

define :clear_forwarding

- (Hash(domains)) clear_parking(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to delete resource records required for domain parking.

Examples:

Delete resource records required for domain parking.

RegApi2.zone.clear_parking domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Returns:

  • (Hash(domains))

    A list of domains with results.

See Also:



220
# File 'lib/reg_api2/zone.rb', line 220

define :clear_parking

- (Hash(domains)) get_resource_records(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this fuction to get zone resource records for each domains.

Examples:

Request records for test.ru and test.com.

RegApi2.zone.get_resource_records domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Options Hash (opts):

  • :domains (Array(Hash(dname)))

    A list of domains, where domains that allow zone management will have the “success” value in the “result” field. Otherwise the “result” field will include the error code explaining the reason of error.

Returns:

  • (Hash(domains))

    A list of domains with results.



135
# File 'lib/reg_api2/zone.rb', line 135

define :get_resource_records

- (Hash(domains)) nop(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

This function serves for testing purposes. You can check if you can manage DNS zones of domains. DNS zone management is possible only with domains associated with REG.RU DNS servers.

Examples:

Get domains

RegApi2.zone.nop domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Options Hash (opts):

  • :domains (Array(dname:String))

    A list if domains.

Returns:

  • (Hash(domains))

    A list of domains. Domains that allow DNS zone management will have the “success” value in the “result” field, otherwise the “result” field will feature an error code explaining the error reason.



19
# File 'lib/reg_api2/zone.rb', line 19

define :nop

- (Hash(domains)) remove_record(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to delete resource records.

Examples:

Delete A record with 111.111.111.111 ip from @.

RegApi2.zone.remove_record domains: [ { dname: "test.ru" }, { dname: "test.com" } ], subdomain: '@', content: '111.111.111.111', record_type: :A

Parameters:

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

Options Hash (opts):

  • :subdomain (String)

    The subdomain for which the resource record will be deleted.

  • :record_type (String or Symbol)

    The class/type of the deleted record. Mandatory field.

  • :priority (Fixnum)

    Optional field. Default value: 0. Not applicable to the request for removal of an A-record (and similar records).

  • :content (String)

    The content of the record. Optional field. If it is not available, all records satisfying the settings of the rest of parameters will be deleted.

Returns:

  • (Hash(domains))

    A list of domains with results.



234
# File 'lib/reg_api2/zone.rb', line 234

define :remove_record, required: %w[ subdomain record_type ]

- (Hash(domains)) tune_forwarding(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to add resource records required for web forwarding.

Examples:

Add resource records required for web forwarding.

RegApi2.zone.tune_forwarding domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Returns:

  • (Hash(domains))

    A list of domains with results.

See Also:



187
# File 'lib/reg_api2/zone.rb', line 187

define :tune_forwarding

- (Hash(domains)) tune_parking(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

Use this function to add resource records required for domain parking.

Examples:

Add resource records required for domain parking.

RegApi2.zone.tune_parking domains: [ { dname: "test.ru" }, { dname: "test.com" } ]

Parameters:

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

Returns:

  • (Hash(domains))

    A list of domains with results.

See Also:



209
# File 'lib/reg_api2/zone.rb', line 209

define :tune_parking

- (Hash(domains)) update_records(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: partners

You can use this function to add and/or delete several resource records by means of a single request. The order of elements in the transferred array is important. Records can interrelate with each other, and if an error is found in one of the records from the action_list fields, the rest of the records will be ignored.

Examples:

Tie the IP address 11.22.33.44 to the www.test.ru domain and assign the test.ru alias to it.

RegApi2.zone.update_records domain_name: "test.ru", action_list: [
  { action: :add_alias, subdomain: "www", ipaddr: "11.22.33.44" },
  { action: :add_cname, subdomain: "@", canonical_name: "www.test.ru" }
]

Parameters:

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

Options Hash (opts):

  • :action_list (Array(Hash))

    A hash array, where every hash provides parameters for creation/deletion of a resource record. The class/type of the created records is defined in the “action” field, allowed values are: add_alias, add_aaaa, add_cname, add_mx, add_ns, add_txt, add_srv, remove_record. The rest of hash fields depend on the “action” value and correspond to the functions described above. For the example given below the structure of action_list will look as follows: action_list => [ { action => 'add_alias', subdomain => 'www', ipaddr => '11.22.33.44' }, { action => 'add_cname', subdomain => '@', canonical_name => 'www.test.ru' } ]

Returns:

  • (Hash(domains))

    A list of domains with results.



164
# File 'lib/reg_api2/zone.rb', line 164

define :update_records

- (Hash(domains)) update_soa(opts = {})

Note:

Support of service lists: yes

Note:

Accessibility: clients

You can use this function to change a zone cache TTL.

Examples:

Set TTL.

RegApi2.zone.update_soa domains: [ { dname: "test.ru" }, { dname: "test.com" } ], ttl: "1d", minimum_ttl: "4h"

Parameters:

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

Options Hash (opts):

  • :ttl (Fixnum or String)

    Cache TTL of a zone. Valid values: a number for seconds or a number with a suffix (m – for months, w – for weeks, d – for days, h – for hours). Example: 600 (seconds), 5m (months).

  • :minimum_ttl (Fixnum or String)

    Cache TTL for negative responses. The format is the same as for the “ttl” field.

Returns:

  • (Hash(domains))

    A list of domains with results.



176
# File 'lib/reg_api2/zone.rb', line 176

define :update_soa, required: %w[ ttl minimum_ttl ]