Class: Gcloud::Dns::Record
- Inherits:
-
Object
- Object
- Gcloud::Dns::Record
- Defined in:
- lib/gcloud/dns/record.rb,
lib/gcloud/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.
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/gcloud/dns/record.rb', line 94 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."].
75 76 77 |
# File 'lib/gcloud/dns/record.rb', line 75 def data @data end |
#name ⇒ String
The owner of the record. For example: example.com.
.
48 49 50 |
# File 'lib/gcloud/dns/record.rb', line 48 def name @name end |
#ttl ⇒ Integer
The number of seconds that the record can be cached by resolvers.
64 65 66 |
# File 'lib/gcloud/dns/record.rb', line 64 def ttl @ttl end |
#type ⇒ String
The identifier of a supported record type
. For example: A
, AAAA
, CNAME
, MX
, or TXT
.
57 58 59 |
# File 'lib/gcloud/dns/record.rb', line 57 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.
119 120 121 122 123 |
# File 'lib/gcloud/dns/record.rb', line 119 def dup other = super other.data = data.map(&:dup) other end |