Class: SDM::WorkflowRoles
- Inherits:
-
Object
- Object
- SDM::WorkflowRoles
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
WorkflowRole links a role to a workflow. The linked roles indicate which roles a user must be a part of to request access to a resource via the workflow.
See WorkflowRole.
Instance Method Summary collapse
-
#create(workflow_role, deadline: nil) ⇒ Object
Create creates a new workflow role.
-
#delete(id, deadline: nil) ⇒ Object
Delete deletes a workflow role.
-
#get(id, deadline: nil) ⇒ Object
Get reads one workflow role by ID.
-
#initialize(channel, parent) ⇒ WorkflowRoles
constructor
A new instance of WorkflowRoles.
-
#list(filter, *args, deadline: nil) ⇒ Object
Lists existing workflow roles.
Constructor Details
#initialize(channel, parent) ⇒ WorkflowRoles
Returns a new instance of WorkflowRoles.
8393 8394 8395 8396 8397 8398 8399 8400 |
# File 'lib/svc.rb', line 8393 def initialize(channel, parent) begin @stub = V1::WorkflowRoles::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(workflow_role, deadline: nil) ⇒ Object
Create creates a new workflow role
8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 |
# File 'lib/svc.rb', line 8403 def create( workflow_role, deadline: nil ) req = V1::WorkflowRolesCreateRequest.new() req.workflow_role = Plumbing::convert_workflow_role_to_plumbing(workflow_role) # Execute before interceptor hooks req = @parent.interceptor.execute_before("WorkflowRoles.Create", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("WorkflowRoles.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("WorkflowRoles.Create", self, req, plumbing_response) resp = WorkflowRolesCreateResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow_role = Plumbing::convert_workflow_role_to_porcelain(plumbing_response.workflow_role) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete deletes a workflow role
8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 |
# File 'lib/svc.rb', line 8476 def delete( id, deadline: nil ) req = V1::WorkflowRolesDeleteRequest.new() req.id = (id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("WorkflowRoles.Delete", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("WorkflowRoles.Delete", 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("WorkflowRoles.Delete", self, req, plumbing_response) resp = WorkflowRolesDeleteResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one workflow role by ID.
8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 |
# File 'lib/svc.rb', line 8437 def get( id, deadline: nil ) req = V1::WorkflowRoleGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("WorkflowRoles.Get", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("WorkflowRoles.Get", 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("WorkflowRoles.Get", self, req, plumbing_response) resp = WorkflowRoleGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow_role = Plumbing::convert_workflow_role_to_porcelain(plumbing_response.workflow_role) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
Lists existing workflow roles.
8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 |
# File 'lib/svc.rb', line 8509 def list( filter, *args, deadline: nil ) req = V1::WorkflowRolesListRequest.new() req. = V1::ListRequestMetadata.new() if not @parent.page_limit.nil? req..limit = @parent.page_limit end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.list(req, metadata: @parent.("WorkflowRoles.List", 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 tries = 0 plumbing_response.workflow_role.each do |plumbing_item| g.yield Plumbing::convert_workflow_role_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |