Class: SDM::PeeringGroupPeers
- Inherits:
-
Object
- Object
- SDM::PeeringGroupPeers
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
PeeringGroupPeers provides the building blocks necessary to link two peering groups.
See PeeringGroupPeer.
Instance Method Summary collapse
-
#create(peering_group_peer, deadline: nil) ⇒ Object
Create links two peering groups.
-
#delete(id, deadline: nil) ⇒ Object
Delete unlinks two peering groups.
-
#get(id, deadline: nil) ⇒ Object
Get reads the information of one peering group link.
-
#initialize(channel, parent) ⇒ PeeringGroupPeers
constructor
A new instance of PeeringGroupPeers.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of peering group links.
Constructor Details
#initialize(channel, parent) ⇒ PeeringGroupPeers
Returns a new instance of PeeringGroupPeers.
3127 3128 3129 3130 3131 3132 3133 3134 |
# File 'lib/svc.rb', line 3127 def initialize(channel, parent) begin @stub = V1::PeeringGroupPeers::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_peer, deadline: nil) ⇒ Object
Create links two peering groups.
3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 |
# File 'lib/svc.rb', line 3137 def create( peering_group_peer, deadline: nil ) req = V1::PeeringGroupPeerCreateRequest.new() req.peering_group_peer = Plumbing::convert_peering_group_peer_to_plumbing(peering_group_peer) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("PeeringGroupPeers.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 = PeeringGroupPeerCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group_peer = Plumbing::convert_peering_group_peer_to_porcelain(plumbing_response.peering_group_peer) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete unlinks two peering groups.
3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 |
# File 'lib/svc.rb', line 3167 def delete( id, deadline: nil ) req = V1::PeeringGroupPeerDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("PeeringGroupPeers.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 = PeeringGroupPeerDeleteResponse.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 link.
3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 |
# File 'lib/svc.rb', line 3196 def get( id, deadline: nil ) req = V1::PeeringGroupPeerGetRequest.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.("PeeringGroupPeers.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 = PeeringGroupPeerGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group_peer = Plumbing::convert_peering_group_peer_to_porcelain(plumbing_response.peering_group_peer) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of peering group links.
3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 |
# File 'lib/svc.rb', line 3230 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupPeerListRequest.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.("PeeringGroupPeers.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_peers.each do |plumbing_item| g.yield Plumbing::convert_peering_group_peer_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |