Class: SDM::AccountGrants
- Inherits:
-
Object
- Object
- SDM::AccountGrants
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
AccountGrants assign a resource directly to an account, giving the account the permission to connect to that resource.
See AccountGrant.
Instance Method Summary collapse
-
#create(account_grant, deadline: nil) ⇒ Object
Create registers a new AccountGrant.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a AccountGrant by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one AccountGrant by ID.
-
#initialize(channel, parent) ⇒ AccountGrants
constructor
A new instance of AccountGrants.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountGrants matching a given set of criteria.
Constructor Details
#initialize(channel, parent) ⇒ AccountGrants
463 464 465 466 467 468 469 470 |
# File 'lib/svc.rb', line 463 def initialize(channel, parent) begin @stub = V1::AccountGrants::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(account_grant, deadline: nil) ⇒ Object
Create registers a new AccountGrant.
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/svc.rb', line 473 def create( account_grant, deadline: nil ) req = V1::AccountGrantCreateRequest.new() req.account_grant = Plumbing::convert_account_grant_to_plumbing(account_grant) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("AccountGrants.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 = AccountGrantCreateResponse.new() resp.account_grant = Plumbing::convert_account_grant_to_porcelain(plumbing_response.account_grant) resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a AccountGrant by ID.
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/svc.rb', line 537 def delete( id, deadline: nil ) req = V1::AccountGrantDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("AccountGrants.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 = AccountGrantDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one AccountGrant by ID.
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
# File 'lib/svc.rb', line 503 def get( id, deadline: nil ) req = V1::AccountGrantGetRequest.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.("AccountGrants.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 = AccountGrantGetResponse.new() resp.account_grant = Plumbing::convert_account_grant_to_porcelain(plumbing_response.account_grant) resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountGrants matching a given set of criteria.
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'lib/svc.rb', line 566 def list( filter, *args, deadline: nil ) req = V1::AccountGrantListRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..limit = page_size_option 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.("AccountGrants.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.account_grants.each do |plumbing_item| g.yield Plumbing::convert_account_grant_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |