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.
8277 8278 8279 8280 8281 8282 8283 8284 |
# File 'lib/svc.rb', line 8277 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
8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 |
# File 'lib/svc.rb', line 8367 def create( secret_engine, deadline: nil ) req = V1::SecretEngineCreateRequest.new() req.secret_engine = Plumbing::convert_secret_engine_to_plumbing(secret_engine) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.Create", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.Create", self, req, plumbing_response) 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
8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 |
# File 'lib/svc.rb', line 8437 def delete( id, deadline: nil ) req = V1::SecretEngineDeleteRequest.new() req.id = (id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.Delete", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.Delete", self, req, plumbing_response) 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
8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 |
# File 'lib/svc.rb', line 8510 def generate_keys( secret_engine_id, deadline: nil ) req = V1::GenerateKeysRequest.new() req.secret_engine_id = (secret_engine_id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.GenerateKeys", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.GenerateKeys", self, req, plumbing_response) resp = GenerateKeysResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get returns a secret engine details
8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 |
# File 'lib/svc.rb', line 8328 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) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.Get", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.Get", self, req, plumbing_response) 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
8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 |
# File 'lib/svc.rb', line 8543 def healthcheck( secret_engine_id, deadline: nil ) req = V1::HealthcheckRequest.new() req.secret_engine_id = (secret_engine_id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.Healthcheck", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.Healthcheck", self, req, plumbing_response) 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
8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 |
# File 'lib/svc.rb', line 8287 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 } # Wrap enumerator to cache secret engine public keys resp = EnumeratorInterceptor.wrap_secret_engine_list(resp, @parent.instance_variable_get(:@encryption_interceptor)) 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
8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 |
# File 'lib/svc.rb', line 8471 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
8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 |
# File 'lib/svc.rb', line 8577 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) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.Rotate", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.Rotate", self, req, plumbing_response) resp = SecretEngineRotateResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#update(secret_engine, deadline: nil) ⇒ Object
Update updates a secret engine
8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 |
# File 'lib/svc.rb', line 8402 def update( secret_engine, deadline: nil ) req = V1::SecretEngineUpdateRequest.new() req.secret_engine = Plumbing::convert_secret_engine_to_plumbing(secret_engine) # Execute before interceptor hooks req = @parent.interceptor.execute_before("SecretEngines.Update", self, req) 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 # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("SecretEngines.Update", self, req, plumbing_response) 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 |