Sha256: 89d46617c4cf745af5be7a684fa438c9d000887a5e55d96b38ad69e47ec0f8a9

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

module Fog
  module DNS
    class AzureRM
      # Real class for DNS Request
      class Real
        def get_records_from_record_set(resource_group, name, zone_name, record_type)
          msg = "Getting all records from RecordSet #{name} of type '#{record_type}' in zone #{zone_name}"
          Fog::Logger.debug msg
          begin
            record_set = @dns_client.record_sets.get(resource_group, zone_name, name, record_type)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end

          case record_type
          when 'A'
            record_set.arecords
          when 'CNAME'
            record_set.cname_record
          end
        end
      end

      # Mock class for DNS Request
      class Mock
        def get_records_from_record_set(*)
          %w(1.2.3.4 1.2.3.5 1.2.3.6)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/requests/dns/get_records_from_record_set.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/dns/get_records_from_record_set.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/requests/dns/get_records_from_record_set.rb