Class: NgrokAPI::Services::VaultsClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::VaultsClient
- Defined in:
- lib/ngrokapi/services/vaults_client.rb
Overview
Vaults is an api service for securely storing and managing sensitive data such as secrets, credentials, and tokens.
Constant Summary collapse
- PATH =
The API path for the requests
'/vaults'- LIST_PROPERTY =
The List Property from the resulting API for list calls
'vaults'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(name: "", metadata: "", description: "") ⇒ NgrokAPI::Models::Vault
Create a new Vault.
-
#create!(name: "", metadata: "", description: "") ⇒ NgrokAPI::Models::Vault
Create a new Vault Throws an exception if API error.
-
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete a Vault.
-
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete a Vault Throws an exception if API error.
-
#get(id: "") ⇒ NgrokAPI::Models::Vault
Get a Vault by ID.
-
#get!(id: "") ⇒ NgrokAPI::Models::Vault
Get a Vault by ID Throws an exception if API error.
-
#initialize(client:) ⇒ VaultsClient
constructor
A new instance of VaultsClient.
-
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all Vaults owned by account.
-
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all Vaults owned by account Throws an exception if API error.
-
#update(id: "", name: nil, metadata: nil, description: nil) ⇒ NgrokAPI::Models::Vault
Update an existing Vault by ID.
-
#update!(id: "", name: nil, metadata: nil, description: nil) ⇒ NgrokAPI::Models::Vault
Update an existing Vault by ID Throws an exception if API error.
Constructor Details
#initialize(client:) ⇒ VaultsClient
Returns a new instance of VaultsClient.
20 21 22 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 20 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
18 19 20 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 18 def client @client end |
Instance Method Details
#create(name: "", metadata: "", description: "") ⇒ NgrokAPI::Models::Vault
Create a new Vault
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 33 def create(name: "", metadata: "", description: "") path = '/vaults' replacements = { } data = {} data[:name] = name if name data[:metadata] = if data[:description] = description if description result = @client.post(path % replacements, data: data) NgrokAPI::Models::Vault.new(client: self, attrs: result) end |
#create!(name: "", metadata: "", description: "") ⇒ NgrokAPI::Models::Vault
Create a new Vault Throws an exception if API error.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 55 def create!(name: "", metadata: "", description: "") path = '/vaults' replacements = { } data = {} data[:name] = name if name data[:metadata] = if data[:description] = description if description result = @client.post(path % replacements, data: data, danger: true) NgrokAPI::Models::Vault.new(client: self, attrs: result) end |
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete a Vault
121 122 123 124 125 126 127 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 121 def delete(id: "") path = '/vaults/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete a Vault Throws an exception if API error.
137 138 139 140 141 142 143 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 137 def delete!(id: "") path = '/vaults/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::Vault
Get a Vault by ID
152 153 154 155 156 157 158 159 160 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 152 def get(id: "") path = '/vaults/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::Vault.new(client: self, attrs: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::Vault
Get a Vault by ID Throws an exception if API error.
170 171 172 173 174 175 176 177 178 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 170 def get!(id: "") path = '/vaults/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::Vault.new(client: self, attrs: result) end |
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all Vaults owned by account
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 189 def list(before_id: nil, limit: nil, url: nil) result = @client.list( before_id: before_id, limit: limit, url: url, path: PATH ) NgrokAPI::Models::Listable.new( client: self, attrs: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::Vault ) end |
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all Vaults owned by account Throws an exception if API error.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 215 def list!(before_id: nil, limit: nil, url: nil) result = @client.list( before_id: before_id, limit: limit, danger: true, url: url, path: PATH ) NgrokAPI::Models::Listable.new( client: self, attrs: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::Vault, danger: true ) end |
#update(id: "", name: nil, metadata: nil, description: nil) ⇒ NgrokAPI::Models::Vault
Update an existing Vault by ID
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 77 def update(id: "", name: nil, metadata: nil, description: nil) path = '/vaults/%{id}' replacements = { id: id, } data = {} data[:name] = name if name data[:metadata] = if data[:description] = description if description result = @client.patch(path % replacements, data: data) NgrokAPI::Models::Vault.new(client: self, attrs: result) end |
#update!(id: "", name: nil, metadata: nil, description: nil) ⇒ NgrokAPI::Models::Vault
Update an existing Vault by ID Throws an exception if API error.
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ngrokapi/services/vaults_client.rb', line 101 def update!(id: "", name: nil, metadata: nil, description: nil) path = '/vaults/%{id}' replacements = { id: id, } data = {} data[:name] = name if name data[:metadata] = if data[:description] = description if description result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::Vault.new(client: self, attrs: result) end |