Class: Cadenya::Resources::APIKeys
- Inherits:
-
Object
- Object
- Cadenya::Resources::APIKeys
- Defined in:
- lib/cadenya/resources/api_keys.rb,
lib/cadenya/resources/api_keys/access.rb
Overview
Issue, rotate, and revoke API keys for the account, and grant or revoke each key’s access to individual workspaces.
Defined Under Namespace
Classes: Access
Instance Attribute Summary collapse
-
#access ⇒ Cadenya::Resources::APIKeys::Access
readonly
Issue, rotate, and revoke API keys for the account, and grant or revoke each key’s access to individual workspaces.
Instance Method Summary collapse
-
#create(metadata:, spec:, initial_workspace_ids: nil, request_options: {}) ⇒ Cadenya::Models::APIKey
Some parameter documentations has been truncated, see Models::APIKeyCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Deletes an API key.
-
#initialize(client:) ⇒ APIKeys
constructor
private
A new instance of APIKeys.
-
#list(cursor: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::APIKey>
Some parameter documentations has been truncated, see Models::APIKeyListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ Cadenya::Models::APIKey
Retrieves an API key by ID.
-
#rotate(id, request_options: {}) ⇒ Cadenya::Models::APIKey
Some parameter documentations has been truncated, see Models::APIKeyRotateParams for more details.
-
#update(id, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::APIKey
Some parameter documentations has been truncated, see Models::APIKeyUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ APIKeys
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 APIKeys.
178 179 180 181 |
# File 'lib/cadenya/resources/api_keys.rb', line 178 def initialize(client:) @client = client @access = Cadenya::Resources::APIKeys::Access.new(client: client) end |
Instance Attribute Details
#access ⇒ Cadenya::Resources::APIKeys::Access (readonly)
Issue, rotate, and revoke API keys for the account, and grant or revoke each key’s access to individual workspaces.
11 12 13 |
# File 'lib/cadenya/resources/api_keys.rb', line 11 def access @access end |
Instance Method Details
#create(metadata:, spec:, initial_workspace_ids: nil, request_options: {}) ⇒ Cadenya::Models::APIKey
Some parameter documentations has been truncated, see Models::APIKeyCreateParams for more details.
Creates a new API key on the account. Optionally grants the key access to one or more workspaces via initial_workspace_ids.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cadenya/resources/api_keys.rb', line 32 def create(params) parsed, = Cadenya::APIKeyCreateParams.dump_request(params) @client.request( method: :post, path: "v1/account/api_keys", body: parsed, model: Cadenya::APIKey, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Deletes an API key.
142 143 144 145 146 147 148 149 |
# File 'lib/cadenya/resources/api_keys.rb', line 142 def delete(id, params = {}) @client.request( method: :delete, path: ["v1/account/api_keys/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(cursor: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::APIKey>
Some parameter documentations has been truncated, see Models::APIKeyListParams for more details.
Lists all API keys on the account.
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/cadenya/resources/api_keys.rb', line 118 def list(params = {}) parsed, = Cadenya::APIKeyListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/account/api_keys", query: query.transform_keys(include_info: "includeInfo", sort_order: "sortOrder"), page: Cadenya::Internal::CursorPagination, model: Cadenya::APIKey, options: ) end |
#retrieve(id, request_options: {}) ⇒ Cadenya::Models::APIKey
Retrieves an API key by ID.
54 55 56 57 58 59 60 61 |
# File 'lib/cadenya/resources/api_keys.rb', line 54 def retrieve(id, params = {}) @client.request( method: :get, path: ["v1/account/api_keys/%1$s", id], model: Cadenya::APIKey, options: params[:request_options] ) end |
#rotate(id, request_options: {}) ⇒ Cadenya::Models::APIKey
Some parameter documentations has been truncated, see Models::APIKeyRotateParams for more details.
Rotates an API key and returns a new token. All previous tokens for this key are invalidated.
166 167 168 169 170 171 172 173 |
# File 'lib/cadenya/resources/api_keys.rb', line 166 def rotate(id, params = {}) @client.request( method: :post, path: ["v1/account/api_keys/%1$s:rotate", id], model: Cadenya::APIKey, options: params[:request_options] ) end |
#update(id, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::APIKey
Some parameter documentations has been truncated, see Models::APIKeyUpdateParams for more details.
Updates an API key.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/cadenya/resources/api_keys.rb', line 83 def update(id, params = {}) parsed, = Cadenya::APIKeyUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/account/api_keys/%1$s", id], body: parsed, model: Cadenya::APIKey, options: ) end |