Method: Fog::Compute::Google::Operations#get

Defined in:
lib/fog/compute/google/models/operations.rb

#get(identity, zone = nil, region = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/compute/google/models/operations.rb', line 41

def get(identity, zone = nil, region = nil)
  if !zone.nil?
    operation = service.get_zone_operation(zone, identity).to_h
    return new(operation)
  elsif !region.nil?
    operation = service.get_region_operation(region, identity).to_h
    return new(operation)
  elsif identity
    operation = service.get_global_operation(identity).to_h
    return new(operation)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end