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.
5459 5460 5461 5462 5463 5464 5465 5466 |
# File 'lib/svc.rb', line 5459 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.
5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 |
# File 'lib/svc.rb', line 5469 def create( peering_group, deadline: nil ) req = V1::PeeringGroupCreateRequest.new() req.peering_group = Plumbing::convert_peering_group_to_plumbing(peering_group) # Execute before interceptor hooks req = @parent.interceptor.execute_before("PeeringGroups.Create", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("PeeringGroups.Create", self, req, plumbing_response) 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.
5504 5505 5506 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 5535 |
# File 'lib/svc.rb', line 5504 def delete( id, deadline: nil ) req = V1::PeeringGroupDeleteRequest.new() req.id = (id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("PeeringGroups.Delete", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("PeeringGroups.Delete", self, req, plumbing_response) 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.
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 5569 5570 5571 5572 5573 5574 |
# File 'lib/svc.rb', line 5538 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) # Execute before interceptor hooks req = @parent.interceptor.execute_before("PeeringGroups.Get", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("PeeringGroups.Get", self, req, plumbing_response) 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.
5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 |
# File 'lib/svc.rb', line 5577 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 |