Class: SDM::PeeringGroupResources
- Inherits:
-
Object
- Object
- SDM::PeeringGroupResources
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
PeeringGroupResources provides the building blocks necessary to obtain attach a resource to a peering group.
See PeeringGroupResource.
Instance Method Summary collapse
-
#create(peering_group_resource, deadline: nil) ⇒ Object
Create attaches a Resource to a PeeringGroup.
-
#delete(id, deadline: nil) ⇒ Object
Delete detaches a Resource to a PeeringGroup.
-
#get(id, deadline: nil) ⇒ Object
Get reads the information of one peering group to resource attachment.
-
#initialize(channel, parent) ⇒ PeeringGroupResources
constructor
A new instance of PeeringGroupResources.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of peering group resource attachments.
Constructor Details
#initialize(channel, parent) ⇒ PeeringGroupResources
Returns a new instance of PeeringGroupResources.
4694 4695 4696 4697 4698 4699 4700 4701 |
# File 'lib/svc.rb', line 4694 def initialize(channel, parent) begin @stub = V1::PeeringGroupResources::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(peering_group_resource, deadline: nil) ⇒ Object
Create attaches a Resource to a PeeringGroup
4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 |
# File 'lib/svc.rb', line 4704 def create( peering_group_resource, deadline: nil ) req = V1::PeeringGroupResourceCreateRequest.new() req.peering_group_resource = Plumbing::convert_peering_group_resource_to_plumbing(peering_group_resource) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("PeeringGroupResources.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 = PeeringGroupResourceCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group_resource = Plumbing::convert_peering_group_resource_to_porcelain(plumbing_response.peering_group_resource) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete detaches a Resource to a PeeringGroup
4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 |
# File 'lib/svc.rb', line 4734 def delete( id, deadline: nil ) req = V1::PeeringGroupResourceDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("PeeringGroupResources.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 = PeeringGroupResourceDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads the information of one peering group to resource attachment.
4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 |
# File 'lib/svc.rb', line 4763 def get( id, deadline: nil ) req = V1::PeeringGroupResourceGetRequest.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.("PeeringGroupResources.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 = PeeringGroupResourceGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group_resource = Plumbing::convert_peering_group_resource_to_porcelain(plumbing_response.peering_group_resource) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of peering group resource attachments.
4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 |
# File 'lib/svc.rb', line 4797 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupResourceListRequest.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.("PeeringGroupResources.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.peering_group_resources.each do |plumbing_item| g.yield Plumbing::convert_peering_group_resource_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |