Class: SDM::Resources
Overview
Resources are databases, servers, clusters, websites, or clouds that strongDM delegates access to.
See: AKS AKSBasicAuth AKSServiceAccount AKSServiceAccountUserImpersonation AKSUserImpersonation AmazonEKS AmazonEKSUserImpersonation AmazonES AmazonMQAMQP091 Athena AuroraMysql AuroraPostgres AWS Azure AzureCertificate AzurePostgres BigQuery Cassandra Citus Clustrix Cockroach DB2I DB2LUW DocumentDBHost DocumentDBReplicaSet Druid DynamoDB Elastic ElasticacheRedis GCP GoogleGKE GoogleGKEUserImpersonation Greenplum HTTPAuth HTTPBasicAuth HTTPNoAuth Kubernetes KubernetesBasicAuth KubernetesServiceAccount KubernetesServiceAccountUserImpersonation KubernetesUserImpersonation Maria Memcached Memsql MongoHost MongoLegacyHost MongoLegacyReplicaset MongoReplicaSet MongoShardedCluster MTLSPostgres Mysql Neptune NeptuneIAM Oracle Postgres Presto RabbitMQAMQP091 RawTCP RDP Redis Redshift SingleStore Snowflake SQLServer SSH SSHCert SSHCustomerKey Sybase SybaseIQ Teradata
Instance Method Summary collapse
-
#create(resource, deadline: nil) ⇒ Object
Create registers a new Resource.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a Resource by ID.
-
#enumerate_tags(filter, *args, deadline: nil) ⇒ Object
EnumerateTags gets a list of the filter matching tags.
-
#get(id, deadline: nil) ⇒ Object
Get reads one Resource by ID.
-
#initialize(host, insecure, parent) ⇒ Resources
constructor
A new instance of Resources.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Resources matching a given set of criteria.
-
#update(resource, deadline: nil) ⇒ Object
Update replaces all the fields of a Resource by ID.
Constructor Details
#initialize(host, insecure, parent) ⇒ Resources
Returns a new instance of Resources.
839 840 841 842 843 844 845 846 847 848 849 850 851 |
# File 'lib/svc.rb', line 839 def initialize(host, insecure, parent) begin if insecure @stub = V1::Resources::Stub.new(host, :this_channel_is_insecure) else cred = GRPC::Core::ChannelCredentials.new() @stub = V1::Resources::Stub.new(host, cred) end rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(resource, deadline: nil) ⇒ Object
Create registers a new Resource.
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 |
# File 'lib/svc.rb', line 891 def create( resource, deadline: nil ) req = V1::ResourceCreateRequest.new() req.resource = Plumbing::convert_resource_to_plumbing(resource) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Resources.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 = ResourceCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a Resource by ID.
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
# File 'lib/svc.rb', line 981 def delete( id, deadline: nil ) req = V1::ResourceDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("Resources.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 = ResourceDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#enumerate_tags(filter, *args, deadline: nil) ⇒ Object
EnumerateTags gets a list of the filter matching tags.
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
# File 'lib/svc.rb', line 854 def ( filter, *args, deadline: nil ) req = V1::EnumerateTagsRequest.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.(req, metadata: @parent.("Resources.EnumerateTags", 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.matches.each do |plumbing_item| g.yield Plumbing::convert_tag_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one Resource by ID.
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 |
# File 'lib/svc.rb', line 921 def get( id, deadline: nil ) req = V1::ResourceGetRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("Resources.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 = ResourceGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Resources matching a given set of criteria.
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/svc.rb', line 1010 def list( filter, *args, deadline: nil ) req = V1::ResourceListRequest.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.("Resources.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.resources.each do |plumbing_item| g.yield Plumbing::convert_resource_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(resource, deadline: nil) ⇒ Object
Update replaces all the fields of a Resource by ID.
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 |
# File 'lib/svc.rb', line 951 def update( resource, deadline: nil ) req = V1::ResourceUpdateRequest.new() req.resource = Plumbing::convert_resource_to_plumbing(resource) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("Resources.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 = ResourceUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp end |