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(bundle_key: nil, 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.
184 185 186 187 |
# File 'lib/cadenya/resources/api_keys.rb', line 184 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.
148 149 150 151 152 153 154 155 |
# File 'lib/cadenya/resources/api_keys.rb', line 148 def delete(id, params = {}) @client.request( method: :delete, path: ["v1/account/api_keys/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(bundle_key: nil, 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.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/cadenya/resources/api_keys.rb', line 120 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( bundle_key: "bundleKey", 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.
172 173 174 175 176 177 178 179 |
# File 'lib/cadenya/resources/api_keys.rb', line 172 def rotate(id, params = {}) @client.request( method: :put, 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 |