Class: Cadenya::Resources::GlobalAPIKey

Inherits:
Object
  • Object
show all
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

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.

Parameters:



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.

Parameters:

Returns:

See Also:



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.

Parameters:

Returns:

See Also:



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.

Parameters:

Returns:

See Also:



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.

Parameters:

Returns:

See Also:



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