Class: Ultradns::Api::Rrset
- Inherits:
-
ClientAccessor
- Object
- ClientAccessor
- Ultradns::Api::Rrset
- Defined in:
- lib/ultradns/api/rrset.rb
Instance Attribute Summary collapse
-
#owner_name ⇒ Object
readonly
Returns the value of attribute owner_name.
-
#rtype ⇒ Object
readonly
Returns the value of attribute rtype.
Instance Method Summary collapse
-
#create(ttl, rdata) ⇒ Object
Creates a new RRSet in the specified zone.
-
#delete ⇒ Object
Delete an rrset.
-
#initialize(zone, rtype, owner_name) ⇒ Rrset
constructor
A new instance of Rrset.
-
#list ⇒ Object
List all RRSets for this rtype and owner_name.
-
#profile(options) ⇒ Object
Set the profile for the matching rrsets.
-
#replace ⇒ Object
Updates (by replacing) an existing RRSet for this rtype and owner_name in this zone.
-
#update(ttl, rdata = nil) ⇒ Object
(Partially) Updates an existing RRSet for this rtype and owner_name in this zone.
Constructor Details
#initialize(zone, rtype, owner_name) ⇒ Rrset
Returns a new instance of Rrset.
13 14 15 16 17 18 |
# File 'lib/ultradns/api/rrset.rb', line 13 def initialize(zone, rtype, owner_name) super(zone) @zone_name = zone.zone_name @rtype = rtype @owner_name = owner_name end |
Instance Attribute Details
#owner_name ⇒ Object (readonly)
Returns the value of attribute owner_name.
11 12 13 |
# File 'lib/ultradns/api/rrset.rb', line 11 def owner_name @owner_name end |
#rtype ⇒ Object (readonly)
Returns the value of attribute rtype.
11 12 13 |
# File 'lib/ultradns/api/rrset.rb', line 11 def rtype @rtype end |
Instance Method Details
#create(ttl, rdata) ⇒ Object
Creates a new RRSet in the specified zone.
Required Parameters
-
zone_name
- The zone that contains the RRSet.The trailing dot is optional. -
rtype
- The type of the RRSet.This can be numeric (1) orif a well-known name is defined for the type (A), you can use it instead.
-
owner_name
- The owner name for the RRSet.If no trailing dot is supplied, the owner_name is assumed to be relative (foo). If a trailing dot is supplied, the owner name is assumed to be absolute (foo.zonename.com.)
-
ttl
- The updated TTL value for the RRSet. -
rdata
- The updated BIND data for the RRSet as a string.If there is a single resource record in the RRSet, you can pass in the single string or an array with a single element. If there are multiple resource records in this RRSet, pass in a list of strings.
Examples
c.zone('zone.invalid.').rrset('A', 'foo').create(300, '1.2.3.4')
39 40 41 42 43 |
# File 'lib/ultradns/api/rrset.rb', line 39 def create(ttl, rdata) rrset = {:ttl => ttl, :rdata => rdata} rrset[:rdata] = [rdata] unless rdata.kind_of? Array client.with_auth_retry {|c| c.post rrset_path, ({body: rrset.to_json}) } end |
#delete ⇒ Object
Delete an rrset
Required Parameters
-
zone_name
- The zone containing the RRSet to be deleted. The trailing dot is optional. -
rtype
- The type of the RRSet.This can be numeric (1) or if a well-known nameis defined for the type (A), you can use it instead.
-
owner_name
- The owner name for the RRSet.If no trailing dot is supplied, the owner_name is assumed to be relative (foo). If a trailing dot is supplied, the owner name is assumed to be absolute (foo.zonename.com.)
Examples
c.delete_rrset(first_zone_name, 'A', 'foo')
89 90 91 |
# File 'lib/ultradns/api/rrset.rb', line 89 def delete client.with_auth_retry {|c| c.delete rrset_path, } end |
#list ⇒ Object
List all RRSets for this rtype and owner_name
47 48 49 |
# File 'lib/ultradns/api/rrset.rb', line 47 def list client.with_auth_retry {|c| c.get rrset_path, } end |
#profile(options) ⇒ Object
Set the profile for the matching rrsets
100 101 102 |
# File 'lib/ultradns/api/rrset.rb', line 100 def profile() client.with_auth_retry {|c| c.patch rrset_path, ({body: {profile: }.to_json}) } end |
#replace ⇒ Object
Updates (by replacing) an existing RRSet for this rtype and owner_name in this zone
72 73 |
# File 'lib/ultradns/api/rrset.rb', line 72 def replace() end |
#update(ttl, rdata = nil) ⇒ Object
(Partially) Updates an existing RRSet for this rtype and owner_name in this zone
Required Parameters
-
ttl
- The updated TTL value for the RRSet. -
rdata
- The updated BIND data for the RRSet as a string.If there is a single resource record in the RRSet, you can pass in the single string or an array with a single element. If there are multiple resource records in this RRSet, pass in a list of strings. #
Examples
c.update('zone.invalid.', "A", "foo", 100, ["10.20.30.40"])
63 64 65 66 67 68 69 |
# File 'lib/ultradns/api/rrset.rb', line 63 def update(ttl, rdata = nil) rrset = {} rrset[:ttl] = ttl if ttl != nil rrset[:rdata] = (rdata.kind_of?(Array) ? rdata : [rdata]) if rdata != nil client.with_auth_retry {|c| c.patch rrset_path, ({body: rrset.to_json}) } end |