Sha256: e00db983c8d3bff478671bd8d8b834b4db0fee88f00728969e6936e56a86387f

Contents?: true

Size: 1.6 KB

Versions: 14

Compression:

Stored size: 1.6 KB

Contents

module Fog
  module DNS
    class Google
      ##
      # Enumerates Resource Record Sets that have been created but not yet deleted.
      #
      # @see https://developers.google.com/cloud-dns/api/v1beta1/resourceRecordSets/list
      class Real
        def list_resource_record_sets(zone_name_or_id, options = {})
          api_method = @dns.resource_record_sets.list
          parameters = {
            'project' => @project,
            'managedZone' => zone_name_or_id,
          }

          [:name, :type].reject{ |o| options[o].nil? }.each do |key|
            parameters[key] = options[key]
          end

          request(api_method, parameters)
        end
      end

      class Mock
        def list_resource_record_sets(zone_name_or_id, options = {})
          if self.data[:managed_zones].has_key?(zone_name_or_id)
            zone = self.data[:managed_zones][zone_name_or_id]
          else
            zone = self.data[:managed_zones].values.find { |zone| zone['name'] = zone_name_or_id }
          end

          unless zone
            raise Fog::Errors::NotFound, "The 'parameters.managedZone' resource named '#{zone_name_or_id}' does not exist."
          end

          rrsets = self.data[:resource_record_sets][zone['id']]
          if options.has_key?(:name) && options.has_key?(:type)
            rrsets.delete_if { |rrset| rrset['name'] != options[:name] || rrset['type'] != options[:type] }
          end

          body = {
            'kind' => 'dns#resourceRecordSetsListResponse',
            'rrsets' => rrsets,
          }
          build_excon_response(body)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
fog-google-0.0.9 lib/fog/google/requests/dns/list_resource_record_sets.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-google-0.0.7/lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-google-0.0.7 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-google-0.0.6 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-google-0.0.5 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-google-0.0.4 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-google-0.0.3 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-google-0.0.2 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-1.29.0 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-1.28.0 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-1.27.0 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-1.26.0 lib/fog/google/requests/dns/list_resource_record_sets.rb
fog-1.25.0 lib/fog/google/requests/dns/list_resource_record_sets.rb
nsidc-fog-1.24.1 lib/fog/google/requests/dns/list_resource_record_sets.rb