Class/Module Index [+]

Quicksearch

Fog::Compute::Google::Shared

Attributes

api_version[R]
project[R]

Public Instance Methods

build_excon_response(body, status=200) click to toggle source
# File lib/fog/google/compute.rb, line 165
def build_excon_response(body, status=200)
  response = Excon::Response.new
  response.body = body
  if response.body and response.body["error"]
    response.status = response.body["error"]["code"]
    if response.body["error"]["errors"]
      msg = response.body["error"]["errors"].map{|error| error["message"]}.join(", ")
    else
      msg = "Error [#{response.body["error"]["code"]}]: #{response.body["error"]["message"] || "GCE didn't return an error message"}"
    end
    case response.status
    when 404
      raise Fog::Errors::NotFound.new(msg)
    else
      raise Fog::Errors::Error.new(msg)
    end
  else
    response.status = status
  end
  response
end
find_zone(zone_name) click to toggle source
# File lib/fog/google/requests/compute/delete_server.rb, line 5
def find_zone(zone_name)
  if zone_name.nil?
    list_zones.body['items'].each do |zone|
      if get_server(server_name, zone['name']).status == 200
        return zone['name']
      end
    end
  else
    if zone_name.is_a? Excon::Response
      return zone_name.body["name"]
    end
  end
  return zone_name
end
shared_initialize(options = {}) click to toggle source
# File lib/fog/google/compute.rb, line 157
def shared_initialize(options = {})
  @project = options[:google_project]
  @api_version = 'v1'
  base_url = 'https://www.googleapis.com/compute/'
  @api_url = base_url + api_version + '/projects/'
  @default_network = 'default'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.