Class: SDM::RemoteIdentities
- Inherits:
-
Object
- Object
- SDM::RemoteIdentities
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
RemoteIdentities assign a resource directly to an account, giving the account the permission to connect to that resource.
See RemoteIdentity.
Instance Method Summary collapse
-
#create(remote_identity, deadline: nil) ⇒ Object
Create registers a new RemoteIdentity.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a RemoteIdentity by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one RemoteIdentity by ID.
-
#initialize(channel, parent) ⇒ RemoteIdentities
constructor
A new instance of RemoteIdentities.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of RemoteIdentities matching a given set of criteria.
-
#update(remote_identity, deadline: nil) ⇒ Object
Update replaces all the fields of a RemoteIdentity by ID.
Constructor Details
#initialize(channel, parent) ⇒ RemoteIdentities
Returns a new instance of RemoteIdentities.
5497 5498 5499 5500 5501 5502 5503 5504 |
# File 'lib/svc.rb', line 5497 def initialize(channel, parent) begin @stub = V1::RemoteIdentities::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(remote_identity, deadline: nil) ⇒ Object
Create registers a new RemoteIdentity.
5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 |
# File 'lib/svc.rb', line 5507 def create( remote_identity, deadline: nil ) req = V1::RemoteIdentityCreateRequest.new() req.remote_identity = Plumbing::convert_remote_identity_to_plumbing(remote_identity) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("RemoteIdentities.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RemoteIdentityCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.remote_identity = Plumbing::convert_remote_identity_to_porcelain(plumbing_response.remote_identity) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a RemoteIdentity by ID.
5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 |
# File 'lib/svc.rb', line 5601 def delete( id, deadline: nil ) req = V1::RemoteIdentityDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("RemoteIdentities.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RemoteIdentityDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one RemoteIdentity by ID.
5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 |
# File 'lib/svc.rb', line 5537 def get( id, deadline: nil ) req = V1::RemoteIdentityGetRequest.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.("RemoteIdentities.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RemoteIdentityGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.remote_identity = Plumbing::convert_remote_identity_to_porcelain(plumbing_response.remote_identity) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of RemoteIdentities matching a given set of criteria.
5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 |
# File 'lib/svc.rb', line 5630 def list( filter, *args, deadline: nil ) req = V1::RemoteIdentityListRequest.new() req. = V1::ListRequestMetadata.new() if not @parent.page_limit.nil? 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.("RemoteIdentities.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.remote_identities.each do |plumbing_item| g.yield Plumbing::convert_remote_identity_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(remote_identity, deadline: nil) ⇒ Object
Update replaces all the fields of a RemoteIdentity by ID.
5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 |
# File 'lib/svc.rb', line 5571 def update( remote_identity, deadline: nil ) req = V1::RemoteIdentityUpdateRequest.new() req.remote_identity = Plumbing::convert_remote_identity_to_plumbing(remote_identity) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("RemoteIdentities.Update", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RemoteIdentityUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.remote_identity = Plumbing::convert_remote_identity_to_porcelain(plumbing_response.remote_identity) resp end |