Method: SDM::WorkflowApprovers#create

Defined in:
lib/svc.rb

#create(workflow_approver, deadline: nil) ⇒ Object

Create creates a new workflow approver



8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
# File 'lib/svc.rb', line 8114

def create(
  workflow_approver,
  deadline: nil
)
  req = V1::WorkflowApproversCreateRequest.new()

  req.workflow_approver = Plumbing::convert_workflow_approver_to_plumbing(workflow_approver)
  # Execute before interceptor hooks
  req = @parent.interceptor.execute_before("WorkflowApprovers.Create", self, req)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.create(req, metadata: @parent.("WorkflowApprovers.Create", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception, deadline))
        tries + +sleep(@parent.exponentialBackoff(tries, deadline))
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  # Execute after interceptor hooks
  plumbing_response = @parent.interceptor.execute_after("WorkflowApprovers.Create", self, req, plumbing_response)

  resp = WorkflowApproversCreateResponse.new()
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.workflow_approver = Plumbing::convert_workflow_approver_to_porcelain(plumbing_response.workflow_approver)
  resp
end