Method: SDM::Resources#get

Defined in:
lib/svc.rb

#get(id, deadline: nil) ⇒ Object

Get reads one Resource by ID.



823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/svc.rb', line 823

def get(
  id,
  deadline: nil
)
  req = V1::ResourceGetRequest.new()

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.get(req, metadata: @parent.("Resources.Get", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = ResourceGetResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end