Class: Fog::DNS::AzureRM::RecordSet
- Inherits:
-
Model
- Object
- Model
- Fog::DNS::AzureRM::RecordSet
- Defined in:
- lib/fog/azurerm/models/dns/record_set.rb
Overview
This class is giving implementation of create/save and delete/destroy for RecordSet.
Class Method Summary collapse
Instance Method Summary collapse
- #add_a_type_record(record) ⇒ Object
- #destroy ⇒ Object
- #get_records(resource_group, name, zone_name, record_type) ⇒ Object
- #remove_a_type_record(record) ⇒ Object
- #save ⇒ Object
- #update_ttl(ttl) ⇒ Object
Class Method Details
.parse(recordset) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# 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 |
Instance Method Details
#add_a_type_record(record) ⇒ Object
63 64 65 66 67 |
# 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 ⇒ Object
48 49 50 |
# 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) ⇒ Object
52 53 54 |
# 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) ⇒ Object
69 70 71 72 73 |
# 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 ⇒ Object
42 43 44 45 46 |
# 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) ⇒ Object
56 57 58 59 60 61 |
# 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 |