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.
6102 6103 6104 6105 6106 6107 6108 6109 |
# File 'lib/svc.rb', line 6102 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
6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 |
# File 'lib/svc.rb', line 6185 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
6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 |
# File 'lib/svc.rb', line 6245 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
6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 |
# File 'lib/svc.rb', line 6313 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
6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 |
# File 'lib/svc.rb', line 6151 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
6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 |
# File 'lib/svc.rb', line 6341 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
6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 |
# File 'lib/svc.rb', line 6112 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
6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 |
# File 'lib/svc.rb', line 6274 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
6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 |
# File 'lib/svc.rb', line 6370 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
6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 |
# File 'lib/svc.rb', line 6215 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 |