Method: SDM::Resources#create
- Defined in:
- lib/svc.rb
#create(resource, deadline: nil) ⇒ Object
Create registers a new Resource.
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 |
# File 'lib/svc.rb', line 793 def create( resource, deadline: nil ) req = V1::ResourceCreateRequest.new() req.resource = Plumbing::convert_resource_to_plumbing(resource) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Resources.Create", 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 = ResourceCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |