Class: Cadenya::Resources::APIKeys::Access
- Inherits:
-
Object
- Object
- Cadenya::Resources::APIKeys::Access
- Defined in:
- lib/cadenya/resources/api_keys/access.rb,
sig/cadenya/resources/api_keys/access.rbs
Overview
Issue, rotate, and revoke API keys for the account, and grant or revoke each key's access to individual workspaces.
Instance Method Summary collapse
-
#add(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::APIKey
Grants this API key access to the specified workspace.
-
#initialize(client:) ⇒ Access
constructor
private
A new instance of Access.
-
#list(id, cursor: nil, labels: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Workspace>
Some parameter documentations has been truncated, see Models::APIKeys::AccessListParams for more details.
-
#remove(workspace_id, id:, request_options: {}) ⇒ nil
Revokes this API key's access to the specified workspace.
Constructor Details
#initialize(client:) ⇒ Access
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 Access.
99 100 101 |
# File 'lib/cadenya/resources/api_keys/access.rb', line 99 def initialize(client:) @client = client end |
Instance Method Details
#add(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::APIKey
Grants this API key access to the specified workspace. Idempotent — adding an already-associated workspace is a no-op. Returns the updated API key with refreshed workspace preview and total.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cadenya/resources/api_keys/access.rb', line 57 def add(id, params = {}) parsed, = Cadenya::APIKeys::AccessAddParams.dump_request(params) @client.request( method: :post, path: ["v1/account/api_keys/%1$s/workspaces", id], body: parsed, model: Cadenya::APIKey, options: ) end |
#list(id, cursor: nil, labels: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Workspace>
Some parameter documentations has been truncated, see Models::APIKeys::AccessListParams for more details.
Lists the workspaces this API key has access to. Cursor-paginated.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cadenya/resources/api_keys/access.rb', line 29 def list(id, params = {}) parsed, = Cadenya::APIKeys::AccessListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v1/account/api_keys/%1$s/workspaces", id], query: query, page: Cadenya::Internal::CursorPagination, model: Cadenya::Workspace, options: ) end |
#remove(workspace_id, id:, request_options: {}) ⇒ nil
Revokes this API key's access to the specified workspace. Idempotent. A key may have zero workspaces and remains valid.
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cadenya/resources/api_keys/access.rb', line 82 def remove(workspace_id, params) parsed, = Cadenya::APIKeys::AccessRemoveParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v1/account/api_keys/%1$s/workspaces/%2$s", id, workspace_id], model: NilClass, options: ) end |