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.
7656 7657 7658 7659 7660 7661 7662 7663 |
# File 'lib/svc.rb', line 7656 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
7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 |
# File 'lib/svc.rb', line 7746 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
7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 |
# File 'lib/svc.rb', line 7816 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
7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 |
# File 'lib/svc.rb', line 7889 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
7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 |
# File 'lib/svc.rb', line 7707 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
7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 |
# File 'lib/svc.rb', line 7922 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
7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 |
# File 'lib/svc.rb', line 7666 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
7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 |
# File 'lib/svc.rb', line 7850 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
7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 |
# File 'lib/svc.rb', line 7956 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
7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 |
# File 'lib/svc.rb', line 7781 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 |