Class: SDM::Roles
Overview
A Role has a list of access rules which determine which Resources the members of the Role have access to. An Account can be a member of multiple Roles via AccountAttachments.
See Role.
Instance Method Summary collapse
-
#create(role, deadline: nil) ⇒ Object
Create registers a new Role.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a Role by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one Role by ID.
-
#initialize(channel, parent) ⇒ Roles
constructor
A new instance of Roles.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Roles matching a given set of criteria.
-
#update(role, deadline: nil) ⇒ Object
Update replaces all the fields of a Role by ID.
Constructor Details
#initialize(channel, parent) ⇒ Roles
Returns a new instance of Roles.
5206 5207 5208 5209 5210 5211 5212 5213 |
# File 'lib/svc.rb', line 5206 def initialize(channel, parent) begin @stub = V1::Roles::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(role, deadline: nil) ⇒ Object
Create registers a new Role.
5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 |
# File 'lib/svc.rb', line 5216 def create( role, deadline: nil ) req = V1::RoleCreateRequest.new() req.role = Plumbing::convert_role_to_plumbing(role) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Roles.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 = RoleCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a Role by ID.
5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 |
# File 'lib/svc.rb', line 5310 def delete( id, deadline: nil ) req = V1::RoleDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("Roles.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 = RoleDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one Role by ID.
5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 |
# File 'lib/svc.rb', line 5246 def get( id, deadline: nil ) req = V1::RoleGetRequest.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.("Roles.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 = RoleGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Roles matching a given set of criteria.
5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 |
# File 'lib/svc.rb', line 5339 def list( filter, *args, deadline: nil ) req = V1::RoleListRequest.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.("Roles.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.roles.each do |plumbing_item| g.yield Plumbing::convert_role_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(role, deadline: nil) ⇒ Object
Update replaces all the fields of a Role by ID.
5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 |
# File 'lib/svc.rb', line 5280 def update( role, deadline: nil ) req = V1::RoleUpdateRequest.new() req.role = Plumbing::convert_role_to_plumbing(role) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("Roles.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 = RoleUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role) resp end |