Class: SDM::Workflows
Overview
Workflows are the collection of rules that define the resources to which access can be requested, the users that can request that access, and the mechanism for approving those requests which can either be automatic approval or a set of users authorized to approve the requests.
See Workflow.
Instance Method Summary collapse
-
#create(workflow, deadline: nil) ⇒ Object
Create creates a new workflow and requires a name for the workflow.
-
#delete(id, deadline: nil) ⇒ Object
Delete deletes an existing workflow.
-
#get(id, deadline: nil) ⇒ Object
Get reads one workflow by ID.
-
#initialize(channel, parent) ⇒ Workflows
constructor
A new instance of Workflows.
-
#list(filter, *args, deadline: nil) ⇒ Object
Lists existing workflows.
-
#update(workflow, deadline: nil) ⇒ Object
Update updates an existing workflow.
Constructor Details
#initialize(channel, parent) ⇒ Workflows
Returns a new instance of Workflows.
4653 4654 4655 4656 4657 4658 4659 4660 |
# File 'lib/svc.rb', line 4653 def initialize(channel, parent) begin @stub = V1::Workflows::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, deadline: nil) ⇒ Object
Create creates a new workflow and requires a name for the workflow.
4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 |
# File 'lib/svc.rb', line 4663 def create( workflow, deadline: nil ) req = V1::WorkflowCreateRequest.new() req.workflow = Plumbing::convert_workflow_to_plumbing(workflow) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Workflows.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 = WorkflowCreateResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow = Plumbing::convert_workflow_to_porcelain(plumbing_response.workflow) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete deletes an existing workflow.
4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 |
# File 'lib/svc.rb', line 4726 def delete( id, deadline: nil ) req = V1::WorkflowDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("Workflows.Delete", 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 = WorkflowDeleteResponse.new() resp.id = (plumbing_response.id) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one workflow by ID.
4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 |
# File 'lib/svc.rb', line 4692 def get( id, deadline: nil ) req = V1::WorkflowGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("Workflows.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 = WorkflowGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow = Plumbing::convert_workflow_to_porcelain(plumbing_response.workflow) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
Lists existing workflows.
4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 |
# File 'lib/svc.rb', line 4784 def list( filter, *args, deadline: nil ) req = V1::WorkflowListRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 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.("Workflows.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.workflows.each do |plumbing_item| g.yield Plumbing::convert_workflow_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(workflow, deadline: nil) ⇒ Object
Update updates an existing workflow.
4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 |
# File 'lib/svc.rb', line 4755 def update( workflow, deadline: nil ) req = V1::WorkflowUpdateRequest.new() req.workflow = Plumbing::convert_workflow_to_plumbing(workflow) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("Workflows.Update", 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 = WorkflowUpdateResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow = Plumbing::convert_workflow_to_porcelain(plumbing_response.workflow) resp end |