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.
1997 1998 1999 2000 2001 2002 2003 2004 |
# File 'lib/svc.rb', line 1997 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
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 |
# File 'lib/svc.rb', line 2007 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)) tries + +@parent.jitterSleep(tries) 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
2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 |
# File 'lib/svc.rb', line 2037 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)) tries + +@parent.jitterSleep(tries) 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.
2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 |
# File 'lib/svc.rb', line 2066 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)) tries + +@parent.jitterSleep(tries) 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.
2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 |
# File 'lib/svc.rb', line 2100 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupResourceListRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 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)) tries + +@parent.jitterSleep(tries) 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 |