cadenya 0.46.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/cadenya/client.rb +10 -2
  5. data/lib/cadenya/models/account_info.rb +5 -4
  6. data/lib/cadenya/models/api_key.rb +33 -4
  7. data/lib/cadenya/models/api_key_create_params.rb +8 -12
  8. data/lib/cadenya/models/api_key_delete_params.rb +7 -1
  9. data/lib/cadenya/models/api_key_disable_params.rb +26 -0
  10. data/lib/cadenya/models/api_key_enable_params.rb +26 -0
  11. data/lib/cadenya/models/api_key_info.rb +1 -21
  12. data/lib/cadenya/models/api_key_list_params.rb +8 -1
  13. data/lib/cadenya/models/api_key_retrieve_params.rb +7 -1
  14. data/lib/cadenya/models/api_key_rotate_params.rb +7 -1
  15. data/lib/cadenya/models/api_key_spec.rb +2 -2
  16. data/lib/cadenya/models/api_key_update_params.rb +8 -1
  17. data/lib/cadenya/models/global_api_key_disable_params.rb +14 -0
  18. data/lib/cadenya/models/global_api_key_enable_params.rb +14 -0
  19. data/lib/cadenya/models/global_api_key_retrieve_params.rb +14 -0
  20. data/lib/cadenya/models/global_api_key_rotate_params.rb +14 -0
  21. data/lib/cadenya/models.rb +12 -2
  22. data/lib/cadenya/resources/api_keys.rb +116 -38
  23. data/lib/cadenya/resources/global_api_key.rb +93 -0
  24. data/lib/cadenya/version.rb +1 -1
  25. data/lib/cadenya.rb +7 -4
  26. data/rbi/cadenya/client.rbi +9 -2
  27. data/rbi/cadenya/models/account_info.rbi +8 -6
  28. data/rbi/cadenya/models/api_key.rbi +37 -3
  29. data/rbi/cadenya/models/api_key_create_params.rbi +6 -13
  30. data/rbi/cadenya/models/api_key_delete_params.rbi +10 -2
  31. data/rbi/cadenya/models/api_key_disable_params.rbi +43 -0
  32. data/rbi/cadenya/models/api_key_enable_params.rbi +43 -0
  33. data/rbi/cadenya/models/api_key_info.rbi +3 -39
  34. data/rbi/cadenya/models/api_key_list_params.rbi +6 -0
  35. data/rbi/cadenya/models/api_key_retrieve_params.rbi +10 -2
  36. data/rbi/cadenya/models/api_key_rotate_params.rbi +10 -2
  37. data/rbi/cadenya/models/api_key_spec.rbi +2 -2
  38. data/rbi/cadenya/models/api_key_update_params.rbi +6 -0
  39. data/rbi/cadenya/models/global_api_key_disable_params.rbi +27 -0
  40. data/rbi/cadenya/models/global_api_key_enable_params.rbi +27 -0
  41. data/rbi/cadenya/models/global_api_key_retrieve_params.rbi +27 -0
  42. data/rbi/cadenya/models/global_api_key_rotate_params.rbi +27 -0
  43. data/rbi/cadenya/models.rbi +12 -2
  44. data/rbi/cadenya/resources/api_keys.rbi +64 -20
  45. data/rbi/cadenya/resources/global_api_key.rbi +55 -0
  46. data/sig/cadenya/client.rbs +2 -0
  47. data/sig/cadenya/models/api_key.rbs +17 -0
  48. data/sig/cadenya/models/api_key_create_params.rbs +6 -8
  49. data/sig/cadenya/models/api_key_delete_params.rbs +10 -2
  50. data/sig/cadenya/models/api_key_disable_params.rbs +28 -0
  51. data/sig/cadenya/models/api_key_enable_params.rbs +28 -0
  52. data/sig/cadenya/models/api_key_info.rbs +3 -26
  53. data/sig/cadenya/models/api_key_list_params.rbs +5 -0
  54. data/sig/cadenya/models/api_key_retrieve_params.rbs +10 -2
  55. data/sig/cadenya/models/api_key_rotate_params.rbs +10 -2
  56. data/sig/cadenya/models/api_key_update_params.rbs +5 -0
  57. data/sig/cadenya/models/global_api_key_disable_params.rbs +15 -0
  58. data/sig/cadenya/models/global_api_key_enable_params.rbs +15 -0
  59. data/sig/cadenya/models/global_api_key_retrieve_params.rbs +15 -0
  60. data/sig/cadenya/models/global_api_key_rotate_params.rbs +15 -0
  61. data/sig/cadenya/models.rbs +12 -2
  62. data/sig/cadenya/resources/api_keys.rbs +22 -4
  63. data/sig/cadenya/resources/global_api_key.rbs +15 -0
  64. metadata +23 -14
  65. data/lib/cadenya/models/api_keys/access_add_params.rb +0 -31
  66. data/lib/cadenya/models/api_keys/access_list_params.rb +0 -52
  67. data/lib/cadenya/models/api_keys/access_remove_params.rb +0 -28
  68. data/lib/cadenya/resources/api_keys/access.rb +0 -105
  69. data/rbi/cadenya/models/api_keys/access_add_params.rbi +0 -54
  70. data/rbi/cadenya/models/api_keys/access_list_params.rbi +0 -83
  71. data/rbi/cadenya/models/api_keys/access_remove_params.rbi +0 -48
  72. data/rbi/cadenya/resources/api_keys/access.rbi +0 -78
  73. data/sig/cadenya/models/api_keys/access_add_params.rbs +0 -32
  74. data/sig/cadenya/models/api_keys/access_list_params.rbs +0 -44
  75. data/sig/cadenya/models/api_keys/access_remove_params.rbs +0 -30
  76. data/sig/cadenya/resources/api_keys/access.rbs +0 -29
@@ -2,38 +2,33 @@
2
2
 
3
3
  module Cadenya
4
4
  module Resources
5
- # Issue, rotate, and revoke API keys for the account, and grant or revoke each
6
- # key's access to individual workspaces.
5
+ # Issue, rotate, disable, and revoke a workspace's API keys. Every key belongs to
6
+ # exactly one workspace; the system-managed global account key is managed via
7
+ # GlobalAPIKeyService instead.
7
8
  class APIKeys
8
- # Issue, rotate, and revoke API keys for the account, and grant or revoke each
9
- # key's access to individual workspaces.
10
- # @return [Cadenya::Resources::APIKeys::Access]
11
- attr_reader :access
12
-
13
9
  # Some parameter documentations has been truncated, see
14
10
  # {Cadenya::Models::APIKeyCreateParams} for more details.
15
11
  #
16
- # Creates a new API key on the account. Optionally grants the key access to one or
17
- # more workspaces via initial_workspace_ids.
12
+ # Creates a new API key in the workspace.
13
+ #
14
+ # @overload create(workspace_id, metadata:, spec:, request_options: {})
18
15
  #
19
- # @overload create(metadata:, spec:, initial_workspace_ids: nil, request_options: {})
16
+ # @param workspace_id [String] The workspace this API key belongs to (path).
20
17
  #
21
18
  # @param metadata [Cadenya::Models::APIKeyCreateParams::Metadata] CreateAccountResourceMetadata contains the user-provided fields for creating
22
19
  #
23
20
  # @param spec [Cadenya::Models::APIKeySpec] Configuration for an API key.
24
21
  #
25
- # @param initial_workspace_ids [Array<String>] Workspaces this API key will have access to on creation. Optional —
26
- #
27
22
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
28
23
  #
29
24
  # @return [Cadenya::Models::APIKey]
30
25
  #
31
26
  # @see Cadenya::Models::APIKeyCreateParams
32
- def create(params)
27
+ def create(workspace_id, params)
33
28
  parsed, options = Cadenya::APIKeyCreateParams.dump_request(params)
34
29
  @client.request(
35
30
  method: :post,
36
- path: "v1/account/api_keys",
31
+ path: ["v1/workspaces/%1$s/api_keys", workspace_id],
37
32
  body: parsed,
38
33
  model: Cadenya::APIKey,
39
34
  options: options
@@ -42,21 +37,28 @@ module Cadenya
42
37
 
43
38
  # Retrieves an API key by ID.
44
39
  #
45
- # @overload retrieve(id, request_options: {})
40
+ # @overload retrieve(id, workspace_id:, request_options: {})
46
41
  #
47
42
  # @param id [String] The API key to retrieve.
48
43
  #
44
+ # @param workspace_id [String] The workspace the API key belongs to (path).
45
+ #
49
46
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
50
47
  #
51
48
  # @return [Cadenya::Models::APIKey]
52
49
  #
53
50
  # @see Cadenya::Models::APIKeyRetrieveParams
54
- def retrieve(id, params = {})
51
+ def retrieve(id, params)
52
+ parsed, options = Cadenya::APIKeyRetrieveParams.dump_request(params)
53
+ workspace_id =
54
+ parsed.delete(:workspace_id) do
55
+ raise ArgumentError.new("missing required path argument #{_1}")
56
+ end
55
57
  @client.request(
56
58
  method: :get,
57
- path: ["v1/account/api_keys/%1$s", id],
59
+ path: ["v1/workspaces/%1$s/api_keys/%2$s", workspace_id, id],
58
60
  model: Cadenya::APIKey,
59
- options: params[:request_options]
61
+ options: options
60
62
  )
61
63
  end
62
64
 
@@ -65,26 +67,32 @@ module Cadenya
65
67
  #
66
68
  # Updates an API key.
67
69
  #
68
- # @overload update(id, metadata: nil, spec: nil, update_mask: nil, request_options: {})
70
+ # @overload update(id, workspace_id:, metadata: nil, spec: nil, update_mask: nil, request_options: {})
69
71
  #
70
- # @param id [String] The API key to update.
72
+ # @param id [String] Path param: The API key to update.
71
73
  #
72
- # @param metadata [Cadenya::Models::APIKeyUpdateParams::Metadata] UpdateAccountResourceMetadata contains the user-provided fields for updating
74
+ # @param workspace_id [String] Path param: The workspace the API key belongs to (path).
73
75
  #
74
- # @param spec [Cadenya::Models::APIKeySpec] Configuration for an API key.
76
+ # @param metadata [Cadenya::Models::APIKeyUpdateParams::Metadata] Body param: UpdateAccountResourceMetadata contains the user-provided fields for
75
77
  #
76
- # @param update_mask [String] Fields to update.
78
+ # @param spec [Cadenya::Models::APIKeySpec] Body param: Configuration for an API key.
79
+ #
80
+ # @param update_mask [String] Body param: Fields to update.
77
81
  #
78
82
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
79
83
  #
80
84
  # @return [Cadenya::Models::APIKey]
81
85
  #
82
86
  # @see Cadenya::Models::APIKeyUpdateParams
83
- def update(id, params = {})
87
+ def update(id, params)
84
88
  parsed, options = Cadenya::APIKeyUpdateParams.dump_request(params)
89
+ workspace_id =
90
+ parsed.delete(:workspace_id) do
91
+ raise ArgumentError.new("missing required path argument #{_1}")
92
+ end
85
93
  @client.request(
86
94
  method: :patch,
87
- path: ["v1/account/api_keys/%1$s", id],
95
+ path: ["v1/workspaces/%1$s/api_keys/%2$s", workspace_id, id],
88
96
  body: parsed,
89
97
  model: Cadenya::APIKey,
90
98
  options: options
@@ -94,9 +102,11 @@ module Cadenya
94
102
  # Some parameter documentations has been truncated, see
95
103
  # {Cadenya::Models::APIKeyListParams} for more details.
96
104
  #
97
- # Lists all API keys on the account.
105
+ # Lists the workspace's API keys.
106
+ #
107
+ # @overload list(workspace_id, cursor: nil, include_info: nil, labels: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, request_options: {})
98
108
  #
99
- # @overload list(cursor: nil, include_info: nil, labels: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, request_options: {})
109
+ # @param workspace_id [String] The workspace whose API keys will be listed (path).
100
110
  #
101
111
  # @param cursor [String] Pagination cursor from previous response.
102
112
  #
@@ -117,12 +127,12 @@ module Cadenya
117
127
  # @return [Cadenya::Internal::CursorPagination<Cadenya::Models::APIKey>]
118
128
  #
119
129
  # @see Cadenya::Models::APIKeyListParams
120
- def list(params = {})
130
+ def list(workspace_id, params = {})
121
131
  parsed, options = Cadenya::APIKeyListParams.dump_request(params)
122
132
  query = Cadenya::Internal::Util.encode_query_params(parsed)
123
133
  @client.request(
124
134
  method: :get,
125
- path: "v1/account/api_keys",
135
+ path: ["v1/workspaces/%1$s/api_keys", workspace_id],
126
136
  query: query.transform_keys(include_info: "includeInfo", sort_order: "sortOrder"),
127
137
  page: Cadenya::Internal::CursorPagination,
128
138
  model: Cadenya::APIKey,
@@ -132,21 +142,83 @@ module Cadenya
132
142
 
133
143
  # Deletes an API key.
134
144
  #
135
- # @overload delete(id, request_options: {})
145
+ # @overload delete(id, workspace_id:, request_options: {})
136
146
  #
137
147
  # @param id [String] The API key to delete.
138
148
  #
149
+ # @param workspace_id [String] The workspace the API key belongs to (path).
150
+ #
139
151
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
140
152
  #
141
153
  # @return [nil]
142
154
  #
143
155
  # @see Cadenya::Models::APIKeyDeleteParams
144
- def delete(id, params = {})
156
+ def delete(id, params)
157
+ parsed, options = Cadenya::APIKeyDeleteParams.dump_request(params)
158
+ workspace_id =
159
+ parsed.delete(:workspace_id) do
160
+ raise ArgumentError.new("missing required path argument #{_1}")
161
+ end
145
162
  @client.request(
146
163
  method: :delete,
147
- path: ["v1/account/api_keys/%1$s", id],
164
+ path: ["v1/workspaces/%1$s/api_keys/%2$s", workspace_id, id],
148
165
  model: NilClass,
149
- options: params[:request_options]
166
+ options: options
167
+ )
168
+ end
169
+
170
+ # Disables an API key. While disabled, presenting the key's token fails
171
+ # authentication on every endpoint; the key is retained. Idempotent.
172
+ #
173
+ # @overload disable(id, workspace_id:, request_options: {})
174
+ #
175
+ # @param id [String] The API key to disable.
176
+ #
177
+ # @param workspace_id [String] The workspace the API key belongs to (path).
178
+ #
179
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
180
+ #
181
+ # @return [Cadenya::Models::APIKey]
182
+ #
183
+ # @see Cadenya::Models::APIKeyDisableParams
184
+ def disable(id, params)
185
+ parsed, options = Cadenya::APIKeyDisableParams.dump_request(params)
186
+ workspace_id =
187
+ parsed.delete(:workspace_id) do
188
+ raise ArgumentError.new("missing required path argument #{_1}")
189
+ end
190
+ @client.request(
191
+ method: :post,
192
+ path: ["v1/workspaces/%1$s/api_keys/%2$s:disable", workspace_id, id],
193
+ model: Cadenya::APIKey,
194
+ options: options
195
+ )
196
+ end
197
+
198
+ # Re-enables a disabled API key so its token authenticates again. Idempotent.
199
+ #
200
+ # @overload enable(id, workspace_id:, request_options: {})
201
+ #
202
+ # @param id [String] The API key to enable.
203
+ #
204
+ # @param workspace_id [String] The workspace the API key belongs to (path).
205
+ #
206
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
207
+ #
208
+ # @return [Cadenya::Models::APIKey]
209
+ #
210
+ # @see Cadenya::Models::APIKeyEnableParams
211
+ def enable(id, params)
212
+ parsed, options = Cadenya::APIKeyEnableParams.dump_request(params)
213
+ workspace_id =
214
+ parsed.delete(:workspace_id) do
215
+ raise ArgumentError.new("missing required path argument #{_1}")
216
+ end
217
+ @client.request(
218
+ method: :post,
219
+ path: ["v1/workspaces/%1$s/api_keys/%2$s:enable", workspace_id, id],
220
+ model: Cadenya::APIKey,
221
+ options: options
150
222
  )
151
223
  end
152
224
 
@@ -156,21 +228,28 @@ module Cadenya
156
228
  # Rotates an API key and returns a new token. All previous tokens for this key are
157
229
  # invalidated.
158
230
  #
159
- # @overload rotate(id, request_options: {})
231
+ # @overload rotate(id, workspace_id:, request_options: {})
160
232
  #
161
233
  # @param id [String] The API key to rotate. A new token is issued and any existing token is
162
234
  #
235
+ # @param workspace_id [String] The workspace the API key belongs to (path).
236
+ #
163
237
  # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
164
238
  #
165
239
  # @return [Cadenya::Models::APIKey]
166
240
  #
167
241
  # @see Cadenya::Models::APIKeyRotateParams
168
- def rotate(id, params = {})
242
+ def rotate(id, params)
243
+ parsed, options = Cadenya::APIKeyRotateParams.dump_request(params)
244
+ workspace_id =
245
+ parsed.delete(:workspace_id) do
246
+ raise ArgumentError.new("missing required path argument #{_1}")
247
+ end
169
248
  @client.request(
170
249
  method: :post,
171
- path: ["v1/account/api_keys/%1$s:rotate", id],
250
+ path: ["v1/workspaces/%1$s/api_keys/%2$s:rotate", workspace_id, id],
172
251
  model: Cadenya::APIKey,
173
- options: params[:request_options]
252
+ options: options
174
253
  )
175
254
  end
176
255
 
@@ -179,7 +258,6 @@ module Cadenya
179
258
  # @param client [Cadenya::Client]
180
259
  def initialize(client:)
181
260
  @client = client
182
- @access = Cadenya::Resources::APIKeys::Access.new(client: client)
183
261
  end
184
262
  end
185
263
  end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Resources
5
+ # Manage the account's system-provisioned global API key. The global key is the
6
+ # only key that spans every workspace; it is created by the system and cannot be
7
+ # deleted, so the surface is retrieve, rotate, and the disable/enable kill switch.
8
+ class GlobalAPIKey
9
+ # Retrieves the account's global API key. The token is included only when the
10
+ # caller's scopes dominate the key's.
11
+ #
12
+ # @overload retrieve(request_options: {})
13
+ #
14
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
15
+ #
16
+ # @return [Cadenya::Models::APIKey]
17
+ #
18
+ # @see Cadenya::Models::GlobalAPIKeyRetrieveParams
19
+ def retrieve(params = {})
20
+ @client.request(
21
+ method: :get,
22
+ path: "v1/account/global_api_key",
23
+ model: Cadenya::APIKey,
24
+ options: params[:request_options]
25
+ )
26
+ end
27
+
28
+ # Disables the global API key. While disabled, presenting its token fails
29
+ # authentication on every endpoint; the key is retained. Idempotent.
30
+ #
31
+ # @overload disable(request_options: {})
32
+ #
33
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
34
+ #
35
+ # @return [Cadenya::Models::APIKey]
36
+ #
37
+ # @see Cadenya::Models::GlobalAPIKeyDisableParams
38
+ def disable(params = {})
39
+ @client.request(
40
+ method: :post,
41
+ path: "v1/account/global_api_key:disable",
42
+ model: Cadenya::APIKey,
43
+ options: params[:request_options]
44
+ )
45
+ end
46
+
47
+ # Re-enables the disabled global API key so its token authenticates again.
48
+ # Idempotent.
49
+ #
50
+ # @overload enable(request_options: {})
51
+ #
52
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
53
+ #
54
+ # @return [Cadenya::Models::APIKey]
55
+ #
56
+ # @see Cadenya::Models::GlobalAPIKeyEnableParams
57
+ def enable(params = {})
58
+ @client.request(
59
+ method: :post,
60
+ path: "v1/account/global_api_key:enable",
61
+ model: Cadenya::APIKey,
62
+ options: params[:request_options]
63
+ )
64
+ end
65
+
66
+ # Rotates the global API key and returns a new token. All previous tokens are
67
+ # invalidated.
68
+ #
69
+ # @overload rotate(request_options: {})
70
+ #
71
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
72
+ #
73
+ # @return [Cadenya::Models::APIKey]
74
+ #
75
+ # @see Cadenya::Models::GlobalAPIKeyRotateParams
76
+ def rotate(params = {})
77
+ @client.request(
78
+ method: :post,
79
+ path: "v1/account/global_api_key:rotate",
80
+ model: Cadenya::APIKey,
81
+ options: params[:request_options]
82
+ )
83
+ end
84
+
85
+ # @api private
86
+ #
87
+ # @param client [Cadenya::Client]
88
+ def initialize(client:)
89
+ @client = client
90
+ end
91
+ end
92
+ end
93
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.46.0"
4
+ VERSION = "0.47.0"
5
5
  end
data/lib/cadenya.rb CHANGED
@@ -125,13 +125,12 @@ require_relative "cadenya/models/ai_provider_key_update_params"
125
125
  require_relative "cadenya/models/api_key"
126
126
  require_relative "cadenya/models/api_key_create_params"
127
127
  require_relative "cadenya/models/api_key_delete_params"
128
+ require_relative "cadenya/models/api_key_disable_params"
129
+ require_relative "cadenya/models/api_key_enable_params"
128
130
  require_relative "cadenya/models/api_key_info"
129
131
  require_relative "cadenya/models/api_key_list_params"
130
132
  require_relative "cadenya/models/api_key_retrieve_params"
131
133
  require_relative "cadenya/models/api_key_rotate_params"
132
- require_relative "cadenya/models/api_keys/access_add_params"
133
- require_relative "cadenya/models/api_keys/access_list_params"
134
- require_relative "cadenya/models/api_keys/access_remove_params"
135
134
  require_relative "cadenya/models/api_key_spec"
136
135
  require_relative "cadenya/models/api_key_update_params"
137
136
  require_relative "cadenya/models/approval_requirement_filter"
@@ -144,6 +143,10 @@ require_relative "cadenya/models/context_lengths"
144
143
  require_relative "cadenya/models/context_window_compacted"
145
144
  require_relative "cadenya/models/create_operation_metadata"
146
145
  require_relative "cadenya/models/create_resource_metadata"
146
+ require_relative "cadenya/models/global_api_key_disable_params"
147
+ require_relative "cadenya/models/global_api_key_enable_params"
148
+ require_relative "cadenya/models/global_api_key_retrieve_params"
149
+ require_relative "cadenya/models/global_api_key_rotate_params"
147
150
  require_relative "cadenya/models/memory_layer"
148
151
  require_relative "cadenya/models/memory_layer_create_params"
149
152
  require_relative "cadenya/models/memory_layer_delete_params"
@@ -335,7 +338,7 @@ require_relative "cadenya/resources/agents/variations"
335
338
  require_relative "cadenya/resources/agents/webhook_deliveries"
336
339
  require_relative "cadenya/resources/ai_provider_keys"
337
340
  require_relative "cadenya/resources/api_keys"
338
- require_relative "cadenya/resources/api_keys/access"
341
+ require_relative "cadenya/resources/global_api_key"
339
342
  require_relative "cadenya/resources/memory_layers"
340
343
  require_relative "cadenya/resources/memory_layers/entries"
341
344
  require_relative "cadenya/resources/models"
@@ -66,11 +66,18 @@ module Cadenya
66
66
  sig { returns(Cadenya::Resources::ToolSets) }
67
67
  attr_reader :tool_sets
68
68
 
69
- # Issue, rotate, and revoke API keys for the account, and grant or revoke each
70
- # key's access to individual workspaces.
69
+ # Issue, rotate, disable, and revoke a workspace's API keys. Every key belongs to
70
+ # exactly one workspace; the system-managed global account key is managed via
71
+ # GlobalAPIKeyService instead.
71
72
  sig { returns(Cadenya::Resources::APIKeys) }
72
73
  attr_reader :api_keys
73
74
 
75
+ # Manage the account's system-provisioned global API key. The global key is the
76
+ # only key that spans every workspace; it is created by the system and cannot be
77
+ # deleted, so the surface is retrieve, rotate, and the disable/enable kill switch.
78
+ sig { returns(Cadenya::Resources::GlobalAPIKey) }
79
+ attr_reader :global_api_key
80
+
74
81
  sig { returns(Cadenya::Resources::WorkspaceSecrets) }
75
82
  attr_reader :workspace_secrets
76
83
 
@@ -17,9 +17,10 @@ module Cadenya
17
17
  sig { params(challenge_token: String).void }
18
18
  attr_writer :challenge_token
19
19
 
20
- # An API key for the account. Use workspace-association RPCs to grant the key
21
- # access to specific workspaces; a key with zero workspaces is valid but cannot
22
- # access workspace-scoped resources.
20
+ # An API key. Every key belongs to exactly one workspace and is managed via the
21
+ # workspace-scoped API key routes. The only exception is the system-managed global
22
+ # account key, which spans all workspaces and is managed via the account
23
+ # global_api_key routes.
23
24
  sig { returns(T.nilable(Cadenya::APIKey)) }
24
25
  attr_reader :global_api_key
25
26
 
@@ -50,9 +51,10 @@ module Cadenya
50
51
  # requiring real auth on tools/call. Rotate with RotateChallengeToken; update any
51
52
  # servers validating the token before rotating.
52
53
  challenge_token: nil,
53
- # An API key for the account. Use workspace-association RPCs to grant the key
54
- # access to specific workspaces; a key with zero workspaces is valid but cannot
55
- # access workspace-scoped resources.
54
+ # An API key. Every key belongs to exactly one workspace and is managed via the
55
+ # workspace-scoped API key routes. The only exception is the system-managed global
56
+ # account key, which spans all workspaces and is managed via the account
57
+ # global_api_key routes.
56
58
  global_api_key: nil,
57
59
  # The generated secret that will sign all webhooks that are sent to your
58
60
  # configured Webhook URL. Formatted as "wh_asdf1234" per the
@@ -27,13 +27,21 @@ module Cadenya
27
27
  sig { params(info: Cadenya::APIKeyInfo::OrHash).void }
28
28
  attr_writer :info
29
29
 
30
- # An API key for the account. Use workspace-association RPCs to grant the key
31
- # access to specific workspaces; a key with zero workspaces is valid but cannot
32
- # access workspace-scoped resources.
30
+ # The current lifecycle state of the API key. Output only. Keys are created
31
+ # STATE_ENABLED; use the :disable and :enable actions to transition between
32
+ # states.
33
+ sig { returns(Cadenya::APIKey::State::TaggedSymbol) }
34
+ attr_accessor :state
35
+
36
+ # An API key. Every key belongs to exactly one workspace and is managed via the
37
+ # workspace-scoped API key routes. The only exception is the system-managed global
38
+ # account key, which spans all workspaces and is managed via the account
39
+ # global_api_key routes.
33
40
  sig do
34
41
  params(
35
42
  metadata: Cadenya::AccountResourceMetadata::OrHash,
36
43
  spec: Cadenya::APIKeySpec::OrHash,
44
+ state: Cadenya::APIKey::State::OrSymbol,
37
45
  info: Cadenya::APIKeyInfo::OrHash
38
46
  ).returns(T.attached_class)
39
47
  end
@@ -43,6 +51,10 @@ module Cadenya
43
51
  metadata:,
44
52
  # Configuration for an API key.
45
53
  spec:,
54
+ # The current lifecycle state of the API key. Output only. Keys are created
55
+ # STATE_ENABLED; use the :disable and :enable actions to transition between
56
+ # states.
57
+ state:,
46
58
  info: nil
47
59
  )
48
60
  end
@@ -52,12 +64,34 @@ module Cadenya
52
64
  {
53
65
  metadata: Cadenya::AccountResourceMetadata,
54
66
  spec: Cadenya::APIKeySpec,
67
+ state: Cadenya::APIKey::State::TaggedSymbol,
55
68
  info: Cadenya::APIKeyInfo
56
69
  }
57
70
  )
58
71
  end
59
72
  def to_hash
60
73
  end
74
+
75
+ # The current lifecycle state of the API key. Output only. Keys are created
76
+ # STATE_ENABLED; use the :disable and :enable actions to transition between
77
+ # states.
78
+ module State
79
+ extend Cadenya::Internal::Type::Enum
80
+
81
+ TaggedSymbol = T.type_alias { T.all(Symbol, Cadenya::APIKey::State) }
82
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
83
+
84
+ STATE_UNSPECIFIED =
85
+ T.let(:STATE_UNSPECIFIED, Cadenya::APIKey::State::TaggedSymbol)
86
+ STATE_ENABLED =
87
+ T.let(:STATE_ENABLED, Cadenya::APIKey::State::TaggedSymbol)
88
+ STATE_DISABLED =
89
+ T.let(:STATE_DISABLED, Cadenya::APIKey::State::TaggedSymbol)
90
+
91
+ sig { override.returns(T::Array[Cadenya::APIKey::State::TaggedSymbol]) }
92
+ def self.values
93
+ end
94
+ end
61
95
  end
62
96
  end
63
97
  end
@@ -11,6 +11,9 @@ module Cadenya
11
11
  T.any(Cadenya::APIKeyCreateParams, Cadenya::Internal::AnyHash)
12
12
  end
13
13
 
14
+ sig { returns(String) }
15
+ attr_accessor :workspace_id
16
+
14
17
  # CreateAccountResourceMetadata contains the user-provided fields for creating an
15
18
  # account-scoped resource. Read-only fields (id, account_id, profile_id) are
16
19
  # excluded since they are set by the server.
@@ -29,32 +32,22 @@ module Cadenya
29
32
  sig { params(spec: Cadenya::APIKeySpec::OrHash).void }
30
33
  attr_writer :spec
31
34
 
32
- # Workspaces this API key will have access to on creation. Optional — a key can be
33
- # created with no workspace access and granted later via AddAPIKeyWorkspace.
34
- sig { returns(T.nilable(T::Array[String])) }
35
- attr_reader :initial_workspace_ids
36
-
37
- sig { params(initial_workspace_ids: T::Array[String]).void }
38
- attr_writer :initial_workspace_ids
39
-
40
35
  sig do
41
36
  params(
37
+ workspace_id: String,
42
38
  metadata: Cadenya::APIKeyCreateParams::Metadata::OrHash,
43
39
  spec: Cadenya::APIKeySpec::OrHash,
44
- initial_workspace_ids: T::Array[String],
45
40
  request_options: Cadenya::RequestOptions::OrHash
46
41
  ).returns(T.attached_class)
47
42
  end
48
43
  def self.new(
44
+ workspace_id:,
49
45
  # CreateAccountResourceMetadata contains the user-provided fields for creating an
50
46
  # account-scoped resource. Read-only fields (id, account_id, profile_id) are
51
47
  # excluded since they are set by the server.
52
48
  metadata:,
53
49
  # Configuration for an API key.
54
50
  spec:,
55
- # Workspaces this API key will have access to on creation. Optional — a key can be
56
- # created with no workspace access and granted later via AddAPIKeyWorkspace.
57
- initial_workspace_ids: nil,
58
51
  request_options: {}
59
52
  )
60
53
  end
@@ -62,9 +55,9 @@ module Cadenya
62
55
  sig do
63
56
  override.returns(
64
57
  {
58
+ workspace_id: String,
65
59
  metadata: Cadenya::APIKeyCreateParams::Metadata,
66
60
  spec: Cadenya::APIKeySpec,
67
- initial_workspace_ids: T::Array[String],
68
61
  request_options: Cadenya::RequestOptions
69
62
  }
70
63
  )
@@ -11,21 +11,29 @@ module Cadenya
11
11
  T.any(Cadenya::APIKeyDeleteParams, Cadenya::Internal::AnyHash)
12
12
  end
13
13
 
14
+ sig { returns(String) }
15
+ attr_accessor :workspace_id
16
+
14
17
  sig { returns(String) }
15
18
  attr_accessor :id
16
19
 
17
20
  sig do
18
21
  params(
22
+ workspace_id: String,
19
23
  id: String,
20
24
  request_options: Cadenya::RequestOptions::OrHash
21
25
  ).returns(T.attached_class)
22
26
  end
23
- def self.new(id:, request_options: {})
27
+ def self.new(workspace_id:, id:, request_options: {})
24
28
  end
25
29
 
26
30
  sig do
27
31
  override.returns(
28
- { id: String, request_options: Cadenya::RequestOptions }
32
+ {
33
+ workspace_id: String,
34
+ id: String,
35
+ request_options: Cadenya::RequestOptions
36
+ }
29
37
  )
30
38
  end
31
39
  def to_hash
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class APIKeyDisableParams < Cadenya::Internal::Type::BaseModel
6
+ extend Cadenya::Internal::Type::RequestParameters::Converter
7
+ include Cadenya::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Cadenya::APIKeyDisableParams, Cadenya::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :workspace_id
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :id
19
+
20
+ sig do
21
+ params(
22
+ workspace_id: String,
23
+ id: String,
24
+ request_options: Cadenya::RequestOptions::OrHash
25
+ ).returns(T.attached_class)
26
+ end
27
+ def self.new(workspace_id:, id:, request_options: {})
28
+ end
29
+
30
+ sig do
31
+ override.returns(
32
+ {
33
+ workspace_id: String,
34
+ id: String,
35
+ request_options: Cadenya::RequestOptions
36
+ }
37
+ )
38
+ end
39
+ def to_hash
40
+ end
41
+ end
42
+ end
43
+ end