Class: SDM::Nodes
Overview
Nodes make up the strongDM network, and allow your users to connect securely to your resources. There are two types of nodes:
- Gateways are the entry points into network. They listen for connection from the strongDM client, and provide access to databases and servers.
- Relays are used to extend the strongDM network into segmented subnets. They provide access to databases and servers but do not listen for incoming connections.
See: Gateway ProxyCluster Relay
Instance Method Summary collapse
-
#create(node, deadline: nil) ⇒ Object
Create registers a new Node.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a Node by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one Node by ID.
-
#initialize(channel, parent) ⇒ Nodes
constructor
A new instance of Nodes.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Nodes matching a given set of criteria.
-
#update(node, deadline: nil) ⇒ Object
Update replaces all the fields of a Node by ID.
Constructor Details
#initialize(channel, parent) ⇒ Nodes
Returns a new instance of Nodes.
3307 3308 3309 3310 3311 3312 3313 3314 |
# File 'lib/svc.rb', line 3307 def initialize(channel, parent) begin @stub = V1::Nodes::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(node, deadline: nil) ⇒ Object
Create registers a new Node.
3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 |
# File 'lib/svc.rb', line 3317 def create( node, deadline: nil ) req = V1::NodeCreateRequest.new() req.node = Plumbing::convert_node_to_plumbing(node) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Nodes.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 = NodeCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.token = (plumbing_response.token) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a Node by ID.
3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 |
# File 'lib/svc.rb', line 3412 def delete( id, deadline: nil ) req = V1::NodeDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("Nodes.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 = NodeDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one Node by ID.
3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 |
# File 'lib/svc.rb', line 3348 def get( id, deadline: nil ) req = V1::NodeGetRequest.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.("Nodes.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 = NodeGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Nodes matching a given set of criteria.
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 3472 3473 3474 3475 3476 3477 |
# File 'lib/svc.rb', line 3441 def list( filter, *args, deadline: nil ) req = V1::NodeListRequest.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.("Nodes.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.nodes.each do |plumbing_item| g.yield Plumbing::convert_node_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(node, deadline: nil) ⇒ Object
Update replaces all the fields of a Node by ID.
3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 |
# File 'lib/svc.rb', line 3382 def update( node, deadline: nil ) req = V1::NodeUpdateRequest.new() req.node = Plumbing::convert_node_to_plumbing(node) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("Nodes.Update", 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 = NodeUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |