Cloud DNS API - Class Google::Cloud::Dns::Record (v0.37.0)

Reference documentation and code samples for the Cloud DNS API class Google::Cloud::Dns::Record.

DNS Record

Represents a set of DNS resource records (RRs) for a given #name and #type in a Zone. Since it is a value object, a newly created Record instance is transient until it is added to a Zone with Zone#update. Note that Zone#add and the Zone#update block parameter can be used instead of Zone#record or Record.new to create new records.

Inherits

  • Object

Example

require "google/cloud/dns"

dns = Google::Cloud::Dns.new
zone = dns.zone "example-com"

zone.records.count #=> 2
record = zone.record "example.com.", "A", 86400, "1.2.3.4"
zone.records.count #=> 2
change = zone.update record
zone.records.count #=> 3

Methods

#data

def data() -> Array<String>

The array of resource record data, as determined by type and defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). For example: ["10 mail.example.com.", "20 mail2.example.com."].

Returns
  • (Array<String>)

#data=

def data=(value) -> Array<String>

The array of resource record data, as determined by type and defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). For example: ["10 mail.example.com.", "20 mail2.example.com."].

Parameter
  • value (Array<String>)
Returns
  • (Array<String>)

#dup

def dup()

Returns a deep copy of the record. Useful for updating records, since the original, unmodified record must be passed for deletion when using Zone#update.

#initialize

def initialize(name, type, ttl, data) -> Record

Creates a Record value object.

Parameters
  • name (String) — The owner of the record. For example: example.com..
  • type (String) — The identifier of a supported record type. For example: A, AAAA, CNAME, MX, or TXT.
  • ttl (Integer) — The number of seconds that the record can be cached by resolvers.
  • data (String, Array<String>) — The resource record data, as determined by type and defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). For example: ["10 mail.example.com.", "20 mail2.example.com."].
Returns
  • (Record) — a new instance of Record
Raises
  • (ArgumentError)

#name

def name() -> String

The owner of the record. For example: example.com..

Returns
  • (String)

#name=

def name=(value) -> String

The owner of the record. For example: example.com..

Parameter
  • value (String)
Returns
  • (String)

#ttl

def ttl() -> Integer

The number of seconds that the record can be cached by resolvers.

Returns
  • (Integer)

#ttl=

def ttl=(value) -> Integer

The number of seconds that the record can be cached by resolvers.

Parameter
  • value (Integer)
Returns
  • (Integer)

#type

def type() -> String

The identifier of a supported record type . For example: A, AAAA, CNAME, MX, or TXT.

Returns
  • (String)

#type=

def type=(value) -> String

The identifier of a supported record type . For example: A, AAAA, CNAME, MX, or TXT.

Parameter
  • value (String)
Returns
  • (String)