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.
5160 5161 5162 5163 5164 5165 5166 5167 |
# File 'lib/svc.rb', line 5160 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
5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 |
# File 'lib/svc.rb', line 5170 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)) tries + +@parent.jitterSleep(tries) 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
5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 |
# File 'lib/svc.rb', line 5233 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)) tries + +@parent.jitterSleep(tries) 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.
5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 |
# File 'lib/svc.rb', line 5199 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)) tries + +@parent.jitterSleep(tries) 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.
5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 |
# File 'lib/svc.rb', line 5261 def list( filter, *args, deadline: nil ) req = V1::WorkflowRolesListRequest.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.("WorkflowRoles.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.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 |