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.
3332 3333 3334 3335 3336 3337 3338 3339 |
# File 'lib/svc.rb', line 3332 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
3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 |
# File 'lib/svc.rb', line 3342 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
3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 |
# File 'lib/svc.rb', line 3372 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.
3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 |
# File 'lib/svc.rb', line 3401 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.
3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 |
# File 'lib/svc.rb', line 3435 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 |