Class: Google::Cloud::Dns::Record
- Inherits:
-
Object
- Object
- Google::Cloud::Dns::Record
- Defined in:
- lib/google/cloud/dns/record.rb,
lib/google/cloud/dns/record/list.rb
Overview
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.
Defined Under Namespace
Classes: List
Instance Attribute Summary collapse
-
#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). -
#name ⇒ String
The owner of the record.
-
#ttl ⇒ Integer
The number of seconds that the record can be cached by resolvers.
-
#type ⇒ String
The identifier of a supported record type .
Instance Method Summary collapse
-
#dup ⇒ Object
Returns a deep copy of the record.
-
#initialize(name, type, ttl, data) ⇒ Record
constructor
Creates a Record value object.
Constructor Details
#initialize(name, type, ttl, data) ⇒ Record
Creates a Record value object.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/google/cloud/dns/record.rb', line 97 def initialize name, type, ttl, data fail ArgumentError, "name is required" unless name fail ArgumentError, "type is required" unless type fail ArgumentError, "ttl is required" unless ttl fail ArgumentError, "data is required" unless data @name = name.to_s @type = type.to_s.upcase @ttl = Integer(ttl) @data = Array(data) end |
Instance Attribute Details
#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."].
78 79 80 |
# File 'lib/google/cloud/dns/record.rb', line 78 def data @data end |
#name ⇒ String
The owner of the record. For example: example.com.
.
51 52 53 |
# File 'lib/google/cloud/dns/record.rb', line 51 def name @name end |
#ttl ⇒ Integer
The number of seconds that the record can be cached by resolvers.
67 68 69 |
# File 'lib/google/cloud/dns/record.rb', line 67 def ttl @ttl end |
#type ⇒ String
The identifier of a supported record type
.
For example: A
, AAAA
, CNAME
, MX
, or TXT
.
60 61 62 |
# File 'lib/google/cloud/dns/record.rb', line 60 def type @type end |
Instance Method Details
#dup ⇒ Object
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.
122 123 124 125 126 |
# File 'lib/google/cloud/dns/record.rb', line 122 def dup other = super other.data = data.map(&:dup) other end |