Sha256: ace18490896ea2a3753a8e818afc4b41afae58242c9997f48b8918360d3fed98

Contents?: true

Size: 1.3 KB

Versions: 14

Compression:

Stored size: 1.3 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def list_subnetworks(region_name)
          region_name = region_name.split("/")[-1] if region_name.start_with? "http"
          subnetworks = data[:subnetworks].values.select { |d| d["region"].split("/")[-1] == region_name }

          build_excon_response("kind" => "compute#subnetworkList",
                               "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/#{region_name}/subnetworks",
                               "id" => "projects/#{@project}/regions/#{region_name}/subnetworks",
                               "items" => subnetworks)
        end
      end

      class Real
        def list_subnetworks(region_name, options = {})
          region_name = region_name.split("/")[-1] if region_name.start_with? "http"

          api_method = @compute.subnetworks.list
          parameters = {
            "project" => @project,
            "region"  => region_name
          }

          parameters["filter"] = options[:filter] if options[:filter]
          parameters["maxResults"] = options[:max_results] if options[:max_results]
          parameters["pageToken"] = options[:page_token] if options[:page_token]

          request(api_method, parameters)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.5.5 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.5.4 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.5.3 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.5.2 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.5.1 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.5.0 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.4.2 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.4.1 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.4.0 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.3.2 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.3.1 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.3.0 lib/fog/compute/google/requests/list_subnetworks.rb
fog-google-0.2.0 lib/fog/compute/google/requests/list_subnetworks.rb