class Fog::DNS::AzureRM::RecordSet
This class is giving implementation of create/save and delete/destroy for RecordSet
.
Public Class Methods
parse(recordset)
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 17 def self.parse(recordset) hash = {} hash['id'] = recordset.id hash['name'] = recordset.name hash['resource_group'] = get_resource_group_from_id(recordset.id) hash['zone_name'] = get_record_set_from_id(recordset.id) hash['type'] = recordset.type type = get_type_from_recordset_type(recordset.type) hash['records'] = [] if type == 'A' record_entries = recordset.arecords record_entries.each do |record| hash['records'] << record.ipv4address end end if type == 'CNAME' record_entries = recordset.cname_record hash['records'] << record_entries end hash['a_records'] = recordset.arecords if type == 'A' hash['cname_record'] = recordset.cname_record if type == 'CNAME' hash['ttl'] = recordset.ttl hash end
Public Instance Methods
add_a_type_record(record)
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 63 def add_a_type_record(record) records << record record_set = service.create_or_update_record_set(record_set_params, get_record_type(type)) merge_attributes(Fog::DNS::AzureRM::RecordSet.parse(record_set)) end
destroy()
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 48 def destroy service.delete_record_set(resource_group, name, zone_name, get_record_type(type)) end
get_records(resource_group, name, zone_name, record_type)
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 52 def get_records(resource_group, name, zone_name, record_type) service.get_records_from_record_set(resource_group, name, zone_name, record_type) end
remove_a_type_record(record)
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 69 def remove_a_type_record(record) records.delete(record) record_set = service.create_or_update_record_set(record_set_params, get_record_type(type)) merge_attributes(Fog::DNS::AzureRM::RecordSet.parse(record_set)) end
save()
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 42 def save requires :name, :resource_group, :zone_name, :records, :type, :ttl record_set = service.create_or_update_record_set(record_set_params, type) merge_attributes(Fog::DNS::AzureRM::RecordSet.parse(record_set)) end
update_ttl(ttl)
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 56 def update_ttl(ttl) params = record_set_params params[:ttl] = ttl record_set = service.create_or_update_record_set(params, get_record_type(type)) merge_attributes(Fog::DNS::AzureRM::RecordSet.parse(record_set)) end
Private Instance Methods
record_set_params()
click to toggle source
# File lib/fog/azurerm/models/dns/record_set.rb, line 77 def record_set_params { name: name, resource_group: resource_group, zone_name: zone_name, records: records, ttl: ttl, cname_record: cname_record, a_records: a_records } end