Class: Zavudev::Resources::Functions::Secrets
- Inherits:
-
Object
- Object
- Zavudev::Resources::Functions::Secrets
- Defined in:
- lib/zavudev/resources/functions/secrets.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Secrets
constructor
private
A new instance of Secrets.
-
#list(function_id, request_options: {}) ⇒ Zavudev::Models::Functions::SecretListResponse
Lists every secret key set on the function.
-
#set(key, function_id:, value:, request_options: {}) ⇒ Object
Create or update a secret on a function.
-
#unset(key, function_id:, request_options: {}) ⇒ nil
Remove a secret from a function.
Constructor Details
#initialize(client:) ⇒ Secrets
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Secrets.
92 93 94 |
# File 'lib/zavudev/resources/functions/secrets.rb', line 92 def initialize(client:) @client = client end |
Instance Method Details
#list(function_id, request_options: {}) ⇒ Zavudev::Models::Functions::SecretListResponse
Lists every secret key set on the function. Plaintext is NEVER returned — only the last 4 characters of each value, for visual confirmation.
19 20 21 22 23 24 25 26 |
# File 'lib/zavudev/resources/functions/secrets.rb', line 19 def list(function_id, params = {}) @client.request( method: :get, path: ["v1/functions/%1$s/secrets", function_id], model: Zavudev::Models::Functions::SecretListResponse, options: params[:request_options] ) end |
#set(key, function_id:, value:, request_options: {}) ⇒ Object
Create or update a secret on a function. Marks the function out-of-sync; the next ‘POST /deploy` re-publishes the Lambda with the new env. Keys must match `[A-Z_]*` (uppercase env-var style) and cannot start with reserved prefixes (AWS*, LAMBDA*, etc).
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/zavudev/resources/functions/secrets.rb', line 46 def set(key, params) parsed, = Zavudev::Functions::SecretSetParams.dump_request(params) function_id = parsed.delete(:function_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["v1/functions/%1$s/secrets/%2$s", function_id, key], body: parsed, model: Zavudev::Internal::Type::Unknown, options: ) end |
#unset(key, function_id:, request_options: {}) ⇒ nil
Remove a secret from a function. Doesn’t take effect on the running Lambda until the next deploy.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/zavudev/resources/functions/secrets.rb', line 75 def unset(key, params) parsed, = Zavudev::Functions::SecretUnsetParams.dump_request(params) function_id = parsed.delete(:function_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v1/functions/%1$s/secrets/%2$s", function_id, key], model: NilClass, options: ) end |