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.
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(host, insecure, 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(host, insecure, parent) ⇒ Nodes
Returns a new instance of Nodes.
590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/svc.rb', line 590 def initialize(host, insecure, parent) begin if insecure @stub = V1::Nodes::Stub.new(host, :this_channel_is_insecure) else cred = GRPC::Core::ChannelCredentials.new() @stub = V1::Nodes::Stub.new(host, cred) end 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.
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/svc.rb', line 605 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)) tries + +@parent.jitterSleep(tries) 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.
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 |
# File 'lib/svc.rb', line 696 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)) tries + +@parent.jitterSleep(tries) 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.
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
# File 'lib/svc.rb', line 636 def get( id, deadline: nil ) req = V1::NodeGetRequest.new() 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)) tries + +@parent.jitterSleep(tries) 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.
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/svc.rb', line 725 def list( filter, *args, deadline: nil ) req = V1::NodeListRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..limit = page_size_option 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)) tries + +@parent.jitterSleep(tries) 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.
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/svc.rb', line 666 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)) tries + +@parent.jitterSleep(tries) 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 |