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.
3410 3411 3412 3413 3414 3415 3416 3417 |
# File 'lib/svc.rb', line 3410 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.
3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 |
# File 'lib/svc.rb', line 3420 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.
3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 |
# File 'lib/svc.rb', line 3514 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.
3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 |
# File 'lib/svc.rb', line 3450 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.
3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 |
# File 'lib/svc.rb', line 3543 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.
3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 |
# File 'lib/svc.rb', line 3484 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 |