Class: SDM::SecretEngines
- Inherits:
-
Object
- Object
- SDM::SecretEngines
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
Instance Method Summary collapse
-
#create(secret_engine, deadline: nil) ⇒ Object
Create creates a secret engine.
-
#delete(id, deadline: nil) ⇒ Object
Delete deletes a secret engine.
-
#generate_keys(secret_engine_id, deadline: nil) ⇒ Object
GenerateKeys generates a private key, stores it in a secret store and stores a public key in a secret engine.
-
#get(id, deadline: nil) ⇒ Object
Get returns a secret engine details.
-
#healthcheck(secret_engine_id, deadline: nil) ⇒ Object
Healthcheck triggers a healthcheck for all nodes serving a secret engine.
-
#initialize(channel, parent) ⇒ SecretEngines
constructor
A new instance of SecretEngines.
-
#list(filter, *args, deadline: nil) ⇒ Object
List returns a list of Secret Engines.
-
#list_secret_stores(filter, *args, deadline: nil) ⇒ Object
ListSecretStores returns a list of Secret Stores that can be used as a backing store for Secret Engine.
-
#rotate(id, password_policy, deadline: nil) ⇒ Object
Rotate rotates secret engine's credentials.
-
#update(secret_engine, deadline: nil) ⇒ Object
Update updates a secret engine.
Constructor Details
#initialize(channel, parent) ⇒ SecretEngines
Returns a new instance of SecretEngines.
6877 6878 6879 6880 6881 6882 6883 6884 |
# File 'lib/svc.rb', line 6877 def initialize(channel, parent) begin @stub = V1::SecretEngines::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(secret_engine, deadline: nil) ⇒ Object
Create creates a secret engine
6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 |
# File 'lib/svc.rb', line 6960 def create( secret_engine, deadline: nil ) req = V1::SecretEngineCreateRequest.new() req.secret_engine = Plumbing::convert_secret_engine_to_plumbing(secret_engine) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("SecretEngines.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 = SecretEngineCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.secret_engine = Plumbing::convert_secret_engine_to_porcelain(plumbing_response.secret_engine) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete deletes a secret engine
7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 |
# File 'lib/svc.rb', line 7020 def delete( id, deadline: nil ) req = V1::SecretEngineDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("SecretEngines.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 = SecretEngineDeleteResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#generate_keys(secret_engine_id, deadline: nil) ⇒ Object
GenerateKeys generates a private key, stores it in a secret store and stores a public key in a secret engine
7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 |
# File 'lib/svc.rb', line 7088 def generate_keys( secret_engine_id, deadline: nil ) req = V1::GenerateKeysRequest.new() req.secret_engine_id = (secret_engine_id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.generate_keys(req, metadata: @parent.("SecretEngines.GenerateKeys", 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 = GenerateKeysResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get returns a secret engine details
6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 |
# File 'lib/svc.rb', line 6926 def get( id, deadline: nil ) req = V1::SecretEngineGetRequest.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.("SecretEngines.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 = SecretEngineGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.secret_engine = Plumbing::convert_secret_engine_to_porcelain(plumbing_response.secret_engine) resp end |
#healthcheck(secret_engine_id, deadline: nil) ⇒ Object
Healthcheck triggers a healthcheck for all nodes serving a secret engine
7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 |
# File 'lib/svc.rb', line 7116 def healthcheck( secret_engine_id, deadline: nil ) req = V1::HealthcheckRequest.new() req.secret_engine_id = (secret_engine_id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.healthcheck(req, metadata: @parent.("SecretEngines.Healthcheck", 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 = HealthcheckResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.status = Plumbing::convert_repeated_healthcheck_status_to_porcelain(plumbing_response.status) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List returns a list of Secret Engines
6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 |
# File 'lib/svc.rb', line 6887 def list( filter, *args, deadline: nil ) req = V1::SecretEngineListRequest.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.("SecretEngines.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.secret_engines.each do |plumbing_item| g.yield Plumbing::convert_secret_engine_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#list_secret_stores(filter, *args, deadline: nil) ⇒ Object
ListSecretStores returns a list of Secret Stores that can be used as a backing store for Secret Engine
7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 |
# File 'lib/svc.rb', line 7049 def list_secret_stores( filter, *args, deadline: nil ) req = V1::SecretStoreListRequest.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_secret_stores(req, metadata: @parent.("SecretEngines.ListSecretStores", 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.secret_stores.each do |plumbing_item| g.yield Plumbing::convert_secret_store_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#rotate(id, password_policy, deadline: nil) ⇒ Object
Rotate rotates secret engine's credentials
7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 |
# File 'lib/svc.rb', line 7145 def rotate( id, password_policy, deadline: nil ) req = V1::SecretEngineRotateRequest.new() req.id = (id) req.password_policy = Plumbing::convert_secret_engine_password_policy_to_plumbing(password_policy) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.rotate(req, metadata: @parent.("SecretEngines.Rotate", 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 = SecretEngineRotateResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#update(secret_engine, deadline: nil) ⇒ Object
Update updates a secret engine
6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 |
# File 'lib/svc.rb', line 6990 def update( secret_engine, deadline: nil ) req = V1::SecretEngineUpdateRequest.new() req.secret_engine = Plumbing::convert_secret_engine_to_plumbing(secret_engine) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("SecretEngines.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 = SecretEngineUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.secret_engine = Plumbing::convert_secret_engine_to_porcelain(plumbing_response.secret_engine) resp end |