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.
2713 2714 2715 2716 2717 2718 2719 2720 |
# File 'lib/svc.rb', line 2713 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.
2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 |
# File 'lib/svc.rb', line 2723 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.
2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 |
# File 'lib/svc.rb', line 2818 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.
2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 |
# File 'lib/svc.rb', line 2754 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)) 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.
2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 |
# File 'lib/svc.rb', line 2847 def list( filter, *args, deadline: nil ) req = V1::NodeListRequest.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.("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.
2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 |
# File 'lib/svc.rb', line 2788 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 |