Sha256: 8cecddf5e1bc3b7f43ff29663523263eb71eb9fa8e562dc60f42d767bf7c949b

Contents?: true

Size: 1.17 KB

Versions: 14

Compression:

Stored size: 1.17 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def get_target_pool(name, region_name)
          region = get_region(region_name)
          target_pool = data[:target_pools][name] || {
            "error" => {
              "errors" => [{
                "domain" => "global",
                "reason" => "notFound",
                "message" => "The resource 'projects/#{project}/regions/#{region_name}/targetPools/#{name}' was not found"
              }],
              "code" => 404,
              "message" => "The resource 'projects/#{project}/regions/#{region_name}/targetPools/#{name}' was not found"
            }
          }
          build_excon_response(target_pool)
        end
      end

      class Real
        def get_target_pool(target_pool_name, region_name)
          if region_name.start_with? "http"
            region_name = region_name.split("/")[-1]
          end

          api_method = @compute.target_pools.get
          parameters = {
            "project" => @project,
            "targetPool" => target_pool_name,
            "region" => region_name
          }

          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/get_target_pool.rb
fog-google-0.5.5 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.5.4 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.5.3 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.5.2 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.5.1 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.5.0 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.4.2 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.4.1 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.4.0 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.3.2 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.3.1 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.3.0 lib/fog/compute/google/requests/get_target_pool.rb
fog-google-0.2.0 lib/fog/compute/google/requests/get_target_pool.rb