Class: SDM::PeeringGroups
- Inherits:
-
Object
- Object
- SDM::PeeringGroups
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
PeeringGroups provides the building blocks necessary to obtain explicit network topology and routing.
See PeeringGroup.
Instance Method Summary collapse
-
#create(peering_group, deadline: nil) ⇒ Object
Create registers a new PeeringGroup.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a PeeringGroup by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one PeeringGroup by ID.
-
#initialize(channel, parent) ⇒ PeeringGroups
constructor
A new instance of PeeringGroups.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Peering Groups.
Constructor Details
#initialize(channel, parent) ⇒ PeeringGroups
Returns a new instance of PeeringGroups.
4074 4075 4076 4077 4078 4079 4080 4081 |
# File 'lib/svc.rb', line 4074 def initialize(channel, parent) begin @stub = V1::PeeringGroups::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, deadline: nil) ⇒ Object
Create registers a new PeeringGroup.
4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 |
# File 'lib/svc.rb', line 4084 def create( peering_group, deadline: nil ) req = V1::PeeringGroupCreateRequest.new() req.peering_group = Plumbing::convert_peering_group_to_plumbing(peering_group) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("PeeringGroups.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = PeeringGroupCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a PeeringGroup by ID.
4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 |
# File 'lib/svc.rb', line 4114 def delete( id, deadline: nil ) req = V1::PeeringGroupDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("PeeringGroups.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = PeeringGroupDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one PeeringGroup by ID. It will load all its dependencies.
4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 |
# File 'lib/svc.rb', line 4143 def get( id, deadline: nil ) req = V1::PeeringGroupGetRequest.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.("PeeringGroups.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = PeeringGroupGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Peering Groups.
4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 |
# File 'lib/svc.rb', line 4177 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupListRequest.new() req. = V1::ListRequestMetadata.new() if not @parent.page_limit.nil? 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.("PeeringGroups.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.peering_groups.each do |plumbing_item| g.yield Plumbing::convert_peering_group_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |