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.
7121 7122 7123 7124 7125 7126 7127 7128 |
# File 'lib/svc.rb', line 7121 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.
7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 |
# File 'lib/svc.rb', line 7131 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.
7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 |
# File 'lib/svc.rb', line 7194 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.
7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 |
# File 'lib/svc.rb', line 7160 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.
7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 |
# File 'lib/svc.rb', line 7252 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.
7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 |
# File 'lib/svc.rb', line 7223 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 |