Class: SDM::PeeringGroupNodes
- Inherits:
-
Object
- Object
- SDM::PeeringGroupNodes
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group.
See PeeringGroupNode.
Instance Method Summary collapse
-
#create(peering_group_node, deadline: nil) ⇒ Object
Create attaches a Node to a PeeringGroup.
-
#delete(id, deadline: nil) ⇒ Object
Delete detaches a Node to a PeeringGroup.
-
#get(id, deadline: nil) ⇒ Object
Get reads the information of one peering group to node attachment.
-
#initialize(channel, parent) ⇒ PeeringGroupNodes
constructor
A new instance of PeeringGroupNodes.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of peering group node attachments.
Constructor Details
#initialize(channel, parent) ⇒ PeeringGroupNodes
1686 1687 1688 1689 1690 1691 1692 1693 |
# File 'lib/svc.rb', line 1686 def initialize(channel, parent) begin @stub = V1::PeeringGroupNodes::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_node, deadline: nil) ⇒ Object
Create attaches a Node to a PeeringGroup
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 |
# File 'lib/svc.rb', line 1696 def create( peering_group_node, deadline: nil ) req = V1::PeeringGroupNodeCreateRequest.new() req.peering_group_node = Plumbing::convert_peering_group_node_to_plumbing(peering_group_node) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("PeeringGroupNodes.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 = PeeringGroupNodeCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group_node = Plumbing::convert_peering_group_node_to_porcelain(plumbing_response.peering_group_node) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete detaches a Node to a PeeringGroup.
1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 |
# File 'lib/svc.rb', line 1726 def delete( id, deadline: nil ) req = V1::PeeringGroupNodeDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("PeeringGroupNodes.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 = PeeringGroupNodeDeleteResponse.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 node attachment.
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 |
# File 'lib/svc.rb', line 1755 def get( id, deadline: nil ) req = V1::PeeringGroupNodeGetRequest.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.("PeeringGroupNodes.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 = PeeringGroupNodeGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group_node = Plumbing::convert_peering_group_node_to_porcelain(plumbing_response.peering_group_node) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of peering group node attachments.
1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 |
# File 'lib/svc.rb', line 1789 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupNodeListRequest.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.("PeeringGroupNodes.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.peering_group_nodes.each do |plumbing_item| g.yield Plumbing::convert_peering_group_node_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |