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
Returns a new instance of PeeringGroupNodes.
3036 3037 3038 3039 3040 3041 3042 3043 |
# File 'lib/svc.rb', line 3036 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
3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 |
# File 'lib/svc.rb', line 3046 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.
3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 |
# File 'lib/svc.rb', line 3076 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.
3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 |
# File 'lib/svc.rb', line 3105 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.
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 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 |
# File 'lib/svc.rb', line 3139 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupNodeListRequest.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.("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 |