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.
7813 7814 7815 7816 7817 7818 7819 7820 |
# File 'lib/svc.rb', line 7813 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
7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 |
# File 'lib/svc.rb', line 7823 def create( workflow_role, deadline: nil ) req = V1::WorkflowRolesCreateRequest.new() req.workflow_role = Plumbing::convert_workflow_role_to_plumbing(workflow_role) 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 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
7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 |
# File 'lib/svc.rb', line 7886 def delete( id, deadline: nil ) req = V1::WorkflowRolesDeleteRequest.new() req.id = (id) 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 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.
7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 |
# File 'lib/svc.rb', line 7852 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) 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 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.
7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 |
# File 'lib/svc.rb', line 7914 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 |