Class: SDM::PeeringGroups
- Inherits:
-
Object
- Object
- SDM::PeeringGroups
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
PeeringGroups provides the building blocks necessary to obtain explicit network topology and routing.
See PeeringGroup.
Instance Method Summary collapse
-
#create(peering_group, deadline: nil) ⇒ Object
Create registers a new PeeringGroup.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a PeeringGroup by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one PeeringGroup by ID.
-
#initialize(channel, parent) ⇒ PeeringGroups
constructor
A new instance of PeeringGroups.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Peering Groups.
Constructor Details
#initialize(channel, parent) ⇒ PeeringGroups
Returns a new instance of PeeringGroups.
4842 4843 4844 4845 4846 4847 4848 4849 |
# File 'lib/svc.rb', line 4842 def initialize(channel, parent) begin @stub = V1::PeeringGroups::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, deadline: nil) ⇒ Object
Create registers a new PeeringGroup.
4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 |
# File 'lib/svc.rb', line 4852 def create( peering_group, deadline: nil ) req = V1::PeeringGroupCreateRequest.new() req.peering_group = Plumbing::convert_peering_group_to_plumbing(peering_group) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("PeeringGroups.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 = PeeringGroupCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a PeeringGroup by ID.
4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 |
# File 'lib/svc.rb', line 4882 def delete( id, deadline: nil ) req = V1::PeeringGroupDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("PeeringGroups.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 = PeeringGroupDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one PeeringGroup by ID. It will load all its dependencies.
4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 |
# File 'lib/svc.rb', line 4911 def get( id, deadline: nil ) req = V1::PeeringGroupGetRequest.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.("PeeringGroups.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 = PeeringGroupGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Peering Groups.
4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 |
# File 'lib/svc.rb', line 4945 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupListRequest.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.("PeeringGroups.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_groups.each do |plumbing_item| g.yield Plumbing::convert_peering_group_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |