Class: Cadenya::Resources::GlobalAPIKey
- Inherits:
-
Object
- Object
- Cadenya::Resources::GlobalAPIKey
- Defined in:
- lib/cadenya/resources/global_api_key.rb,
sig/cadenya/resources/global_api_key.rbs
Overview
Manage the account's system-provisioned global API key. The global key is the only key that spans every workspace; it is created by the system and cannot be deleted, so the surface is retrieve, rotate, and the disable/enable kill switch.
Instance Method Summary collapse
-
#disable(request_options: {}) ⇒ Cadenya::Models::APIKey
Disables the global API key.
-
#enable(request_options: {}) ⇒ Cadenya::Models::APIKey
Re-enables the disabled global API key so its token authenticates again.
-
#initialize(client:) ⇒ GlobalAPIKey
constructor
private
A new instance of GlobalAPIKey.
-
#retrieve(request_options: {}) ⇒ Cadenya::Models::APIKey
Retrieves the account's global API key.
-
#rotate(request_options: {}) ⇒ Cadenya::Models::APIKey
Rotates the global API key and returns a new token.
Constructor Details
#initialize(client:) ⇒ GlobalAPIKey
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 GlobalAPIKey.
88 89 90 |
# File 'lib/cadenya/resources/global_api_key.rb', line 88 def initialize(client:) @client = client end |
Instance Method Details
#disable(request_options: {}) ⇒ Cadenya::Models::APIKey
Disables the global API key. While disabled, presenting its token fails authentication on every endpoint; the key is retained. Idempotent.
38 39 40 41 42 43 44 45 |
# File 'lib/cadenya/resources/global_api_key.rb', line 38 def disable(params = {}) @client.request( method: :post, path: "v1/account/global_api_key:disable", model: Cadenya::APIKey, options: params[:request_options] ) end |
#enable(request_options: {}) ⇒ Cadenya::Models::APIKey
Re-enables the disabled global API key so its token authenticates again. Idempotent.
57 58 59 60 61 62 63 64 |
# File 'lib/cadenya/resources/global_api_key.rb', line 57 def enable(params = {}) @client.request( method: :post, path: "v1/account/global_api_key:enable", model: Cadenya::APIKey, options: params[:request_options] ) end |
#retrieve(request_options: {}) ⇒ Cadenya::Models::APIKey
Retrieves the account's global API key. The token is included only when the caller's scopes dominate the key's.
19 20 21 22 23 24 25 26 |
# File 'lib/cadenya/resources/global_api_key.rb', line 19 def retrieve(params = {}) @client.request( method: :get, path: "v1/account/global_api_key", model: Cadenya::APIKey, options: params[:request_options] ) end |
#rotate(request_options: {}) ⇒ Cadenya::Models::APIKey
Rotates the global API key and returns a new token. All previous tokens are invalidated.
76 77 78 79 80 81 82 83 |
# File 'lib/cadenya/resources/global_api_key.rb', line 76 def rotate(params = {}) @client.request( method: :post, path: "v1/account/global_api_key:rotate", model: Cadenya::APIKey, options: params[:request_options] ) end |