Class: Retab::Secrets
- Inherits:
-
Object
- Object
- Retab::Secrets
- Defined in:
- lib/retab/secrets.rb
Instance Method Summary collapse
-
#create_secret(name:, value:, request_options: {}) ⇒ Retab::SecretResponse
Create Secret.
-
#delete_secret(name:, request_options: {}) ⇒ void
Delete Secret.
-
#get_secret(name:, request_options: {}) ⇒ Retab::SecretResponse
Get Secret.
-
#initialize(client) ⇒ Secrets
constructor
A new instance of Secrets.
-
#list_secret_value(name:, request_options: {}) ⇒ Retab::SecretValueResponse
Get Secret Value.
-
#list_secrets(request_options: {}) ⇒ Retab::SecretListResponse
List Secrets.
-
#update_secret(name:, value:, request_options: {}) ⇒ Retab::SecretResponse
Set Secret.
Constructor Details
#initialize(client) ⇒ Secrets
Returns a new instance of Secrets.
9 10 11 |
# File 'lib/retab/secrets.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create_secret(name:, value:, request_options: {}) ⇒ Retab::SecretResponse
Create Secret
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/retab/secrets.rb', line 37 def create_secret( name:, value:, request_options: {} ) body = { "name" => name, "value" => value } response = @client.request( method: :post, path: "/v1/secrets", auth: true, body: body, request_options: ) result = Retab::SecretResponse.new(response.body) result.last_response = Retab::Types::ApiResponse.new( http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"] ) result end |
#delete_secret(name:, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Secret
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/retab/secrets.rb', line 118 def delete_secret( name:, request_options: {} ) @client.request( method: :delete, path: "/v1/secrets/#{Retab::Util.encode_path(name)}", auth: true, request_options: ) nil end |
#get_secret(name:, request_options: {}) ⇒ Retab::SecretResponse
Get Secret
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/retab/secrets.rb', line 66 def get_secret( name:, request_options: {} ) response = @client.request( method: :get, path: "/v1/secrets/#{Retab::Util.encode_path(name)}", auth: true, request_options: ) result = Retab::SecretResponse.new(response.body) result.last_response = Retab::Types::ApiResponse.new( http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"] ) result end |
#list_secret_value(name:, request_options: {}) ⇒ Retab::SecretValueResponse
Get Secret Value
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/retab/secrets.rb', line 135 def list_secret_value( name:, request_options: {} ) response = @client.request( method: :get, path: "/v1/secrets/#{Retab::Util.encode_path(name)}/value", auth: true, request_options: ) result = Retab::SecretValueResponse.new(response.body) result.last_response = Retab::Types::ApiResponse.new( http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"] ) result end |
#list_secrets(request_options: {}) ⇒ Retab::SecretListResponse
List Secrets
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/retab/secrets.rb', line 16 def list_secrets(request_options: {}) response = @client.request( method: :get, path: "/v1/secrets", auth: true, request_options: ) result = Retab::SecretListResponse.new(response.body) result.last_response = Retab::Types::ApiResponse.new( http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"] ) result end |
#update_secret(name:, value:, request_options: {}) ⇒ Retab::SecretResponse
Set Secret
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/retab/secrets.rb', line 90 def update_secret( name:, value:, request_options: {} ) body = { "value" => value } response = @client.request( method: :put, path: "/v1/secrets/#{Retab::Util.encode_path(name)}", auth: true, body: body, request_options: ) result = Retab::SecretResponse.new(response.body) result.last_response = Retab::Types::ApiResponse.new( http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"] ) result end |