cadenya 0.46.0 → 0.48.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 +16 -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
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class APIKeyEnableParams < 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::APIKeyEnableParams, 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
@@ -15,54 +15,18 @@ module Cadenya
15
15
  sig { params(created_by: Cadenya::Profile::OrHash).void }
16
16
  attr_writer :created_by
17
17
 
18
- # Up to a small number of workspaces this key has access to, intended for display
19
- # ("Workspace 1, Workspace 2, and 4 more"). Use ListAPIKeyWorkspaces for the full
20
- # paginated list.
21
- sig { returns(T.nilable(T::Array[Cadenya::BareMetadata])) }
22
- attr_reader :workspaces_preview
23
-
24
- sig do
25
- params(workspaces_preview: T::Array[Cadenya::BareMetadata::OrHash]).void
26
- end
27
- attr_writer :workspaces_preview
28
-
29
- # Total number of workspaces this key has access to.
30
- sig { returns(T.nilable(Integer)) }
31
- attr_reader :workspaces_total
32
-
33
- sig { params(workspaces_total: Integer).void }
34
- attr_writer :workspaces_total
35
-
36
18
  sig do
37
- params(
38
- created_by: Cadenya::Profile::OrHash,
39
- workspaces_preview: T::Array[Cadenya::BareMetadata::OrHash],
40
- workspaces_total: Integer
41
- ).returns(T.attached_class)
19
+ params(created_by: Cadenya::Profile::OrHash).returns(T.attached_class)
42
20
  end
43
21
  def self.new(
44
22
  # A profile identifies a user or non-human principal (such as an API key) at the
45
23
  # account level. Profiles are account-scoped and can be granted access to multiple
46
24
  # workspaces.
47
- created_by: nil,
48
- # Up to a small number of workspaces this key has access to, intended for display
49
- # ("Workspace 1, Workspace 2, and 4 more"). Use ListAPIKeyWorkspaces for the full
50
- # paginated list.
51
- workspaces_preview: nil,
52
- # Total number of workspaces this key has access to.
53
- workspaces_total: nil
25
+ created_by: nil
54
26
  )
55
27
  end
56
28
 
57
- sig do
58
- override.returns(
59
- {
60
- created_by: Cadenya::Profile,
61
- workspaces_preview: T::Array[Cadenya::BareMetadata],
62
- workspaces_total: Integer
63
- }
64
- )
65
- end
29
+ sig { override.returns({ created_by: Cadenya::Profile }) }
66
30
  def to_hash
67
31
  end
68
32
  end
@@ -11,6 +11,9 @@ module Cadenya
11
11
  T.any(Cadenya::APIKeyListParams, Cadenya::Internal::AnyHash)
12
12
  end
13
13
 
14
+ sig { returns(String) }
15
+ attr_accessor :workspace_id
16
+
14
17
  # Pagination cursor from previous response.
15
18
  sig { returns(T.nilable(String)) }
16
19
  attr_reader :cursor
@@ -65,6 +68,7 @@ module Cadenya
65
68
 
66
69
  sig do
67
70
  params(
71
+ workspace_id: String,
68
72
  cursor: String,
69
73
  include_info: T::Boolean,
70
74
  labels: String,
@@ -76,6 +80,7 @@ module Cadenya
76
80
  ).returns(T.attached_class)
77
81
  end
78
82
  def self.new(
83
+ workspace_id:,
79
84
  # Pagination cursor from previous response.
80
85
  cursor: nil,
81
86
  # When true, included info fields are populated. Requests with this flag count
@@ -100,6 +105,7 @@ module Cadenya
100
105
  sig do
101
106
  override.returns(
102
107
  {
108
+ workspace_id: String,
103
109
  cursor: String,
104
110
  include_info: T::Boolean,
105
111
  labels: String,
@@ -11,21 +11,29 @@ module Cadenya
11
11
  T.any(Cadenya::APIKeyRetrieveParams, 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
@@ -11,21 +11,29 @@ module Cadenya
11
11
  T.any(Cadenya::APIKeyRotateParams, 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
@@ -37,7 +37,7 @@ module Cadenya
37
37
  sig { params(token: String).void }
38
38
  attr_writer :token
39
39
 
40
- # True when this key is managed by the system (e.g. the auto-provisioned global
40
+ # True when this key is managed by the system (i.e. the auto-provisioned global
41
41
  # account key). System keys cannot be deleted but can be rotated.
42
42
  sig { returns(T.nilable(T::Boolean)) }
43
43
  attr_reader :system_
@@ -71,7 +71,7 @@ module Cadenya
71
71
  # Scopes are deny-by-default: a key with an empty list can call only scope-free
72
72
  # endpoints. Full access is always an explicit "\*" grant.
73
73
  permissions: nil,
74
- # True when this key is managed by the system (e.g. the auto-provisioned global
74
+ # True when this key is managed by the system (i.e. the auto-provisioned global
75
75
  # account key). System keys cannot be deleted but can be rotated.
76
76
  system_: nil
77
77
  )
@@ -11,6 +11,9 @@ module Cadenya
11
11
  T.any(Cadenya::APIKeyUpdateParams, 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
 
@@ -41,6 +44,7 @@ module Cadenya
41
44
 
42
45
  sig do
43
46
  params(
47
+ workspace_id: String,
44
48
  id: String,
45
49
  metadata: Cadenya::APIKeyUpdateParams::Metadata::OrHash,
46
50
  spec: Cadenya::APIKeySpec::OrHash,
@@ -49,6 +53,7 @@ module Cadenya
49
53
  ).returns(T.attached_class)
50
54
  end
51
55
  def self.new(
56
+ workspace_id:,
52
57
  id:,
53
58
  # UpdateAccountResourceMetadata contains the user-provided fields for updating an
54
59
  # account-scoped resource. Read-only fields (id, account_id, profile_id) are
@@ -65,6 +70,7 @@ module Cadenya
65
70
  sig do
66
71
  override.returns(
67
72
  {
73
+ workspace_id: String,
68
74
  id: String,
69
75
  metadata: Cadenya::APIKeyUpdateParams::Metadata,
70
76
  spec: Cadenya::APIKeySpec,
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class GlobalAPIKeyDisableParams < 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::GlobalAPIKeyDisableParams, Cadenya::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: Cadenya::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class GlobalAPIKeyEnableParams < 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::GlobalAPIKeyEnableParams, Cadenya::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: Cadenya::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class GlobalAPIKeyRetrieveParams < 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::GlobalAPIKeyRetrieveParams, Cadenya::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: Cadenya::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Cadenya
4
+ module Models
5
+ class GlobalAPIKeyRotateParams < 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::GlobalAPIKeyRotateParams, Cadenya::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: Cadenya::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -63,6 +63,10 @@ module Cadenya
63
63
 
64
64
  APIKeyDeleteParams = Cadenya::Models::APIKeyDeleteParams
65
65
 
66
+ APIKeyDisableParams = Cadenya::Models::APIKeyDisableParams
67
+
68
+ APIKeyEnableParams = Cadenya::Models::APIKeyEnableParams
69
+
66
70
  APIKeyInfo = Cadenya::Models::APIKeyInfo
67
71
 
68
72
  APIKeyListParams = Cadenya::Models::APIKeyListParams
@@ -71,8 +75,6 @@ module Cadenya
71
75
 
72
76
  APIKeyRotateParams = Cadenya::Models::APIKeyRotateParams
73
77
 
74
- APIKeys = Cadenya::Models::APIKeys
75
-
76
78
  APIKeySpec = Cadenya::Models::APIKeySpec
77
79
 
78
80
  APIKeyUpdateParams = Cadenya::Models::APIKeyUpdateParams
@@ -97,6 +99,14 @@ module Cadenya
97
99
 
98
100
  CreateResourceMetadata = Cadenya::Models::CreateResourceMetadata
99
101
 
102
+ GlobalAPIKeyDisableParams = Cadenya::Models::GlobalAPIKeyDisableParams
103
+
104
+ GlobalAPIKeyEnableParams = Cadenya::Models::GlobalAPIKeyEnableParams
105
+
106
+ GlobalAPIKeyRetrieveParams = Cadenya::Models::GlobalAPIKeyRetrieveParams
107
+
108
+ GlobalAPIKeyRotateParams = Cadenya::Models::GlobalAPIKeyRotateParams
109
+
100
110
  MemoryLayer = Cadenya::Models::MemoryLayer
101
111
 
102
112
  MemoryLayerCreateParams = Cadenya::Models::MemoryLayerCreateParams
@@ -2,34 +2,28 @@
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
- sig { returns(Cadenya::Resources::APIKeys::Access) }
11
- attr_reader :access
12
-
13
- # Creates a new API key on the account. Optionally grants the key access to one or
14
- # more workspaces via initial_workspace_ids.
9
+ # Creates a new API key in the workspace.
15
10
  sig do
16
11
  params(
12
+ workspace_id: String,
17
13
  metadata: Cadenya::APIKeyCreateParams::Metadata::OrHash,
18
14
  spec: Cadenya::APIKeySpec::OrHash,
19
- initial_workspace_ids: T::Array[String],
20
15
  request_options: Cadenya::RequestOptions::OrHash
21
16
  ).returns(Cadenya::APIKey)
22
17
  end
23
18
  def create(
19
+ # The workspace this API key belongs to (path).
20
+ workspace_id,
24
21
  # CreateAccountResourceMetadata contains the user-provided fields for creating an
25
22
  # account-scoped resource. Read-only fields (id, account_id, profile_id) are
26
23
  # excluded since they are set by the server.
27
24
  metadata:,
28
25
  # Configuration for an API key.
29
26
  spec:,
30
- # Workspaces this API key will have access to on creation. Optional — a key can be
31
- # created with no workspace access and granted later via AddAPIKeyWorkspace.
32
- initial_workspace_ids: nil,
33
27
  request_options: {}
34
28
  )
35
29
  end
@@ -38,12 +32,15 @@ module Cadenya
38
32
  sig do
39
33
  params(
40
34
  id: String,
35
+ workspace_id: String,
41
36
  request_options: Cadenya::RequestOptions::OrHash
42
37
  ).returns(Cadenya::APIKey)
43
38
  end
44
39
  def retrieve(
45
40
  # The API key to retrieve.
46
41
  id,
42
+ # The workspace the API key belongs to (path).
43
+ workspace_id:,
47
44
  request_options: {}
48
45
  )
49
46
  end
@@ -52,6 +49,7 @@ module Cadenya
52
49
  sig do
53
50
  params(
54
51
  id: String,
52
+ workspace_id: String,
55
53
  metadata: Cadenya::APIKeyUpdateParams::Metadata::OrHash,
56
54
  spec: Cadenya::APIKeySpec::OrHash,
57
55
  update_mask: String,
@@ -59,23 +57,26 @@ module Cadenya
59
57
  ).returns(Cadenya::APIKey)
60
58
  end
61
59
  def update(
62
- # The API key to update.
60
+ # Path param: The API key to update.
63
61
  id,
64
- # UpdateAccountResourceMetadata contains the user-provided fields for updating an
65
- # account-scoped resource. Read-only fields (id, account_id, profile_id) are
66
- # excluded since they are set by the server.
62
+ # Path param: The workspace the API key belongs to (path).
63
+ workspace_id:,
64
+ # Body param: UpdateAccountResourceMetadata contains the user-provided fields for
65
+ # updating an account-scoped resource. Read-only fields (id, account_id,
66
+ # profile_id) are excluded since they are set by the server.
67
67
  metadata: nil,
68
- # Configuration for an API key.
68
+ # Body param: Configuration for an API key.
69
69
  spec: nil,
70
- # Fields to update.
70
+ # Body param: Fields to update.
71
71
  update_mask: nil,
72
72
  request_options: {}
73
73
  )
74
74
  end
75
75
 
76
- # Lists all API keys on the account.
76
+ # Lists the workspace's API keys.
77
77
  sig do
78
78
  params(
79
+ workspace_id: String,
79
80
  cursor: String,
80
81
  include_info: T::Boolean,
81
82
  labels: String,
@@ -87,6 +88,8 @@ module Cadenya
87
88
  ).returns(Cadenya::Internal::CursorPagination[Cadenya::APIKey])
88
89
  end
89
90
  def list(
91
+ # The workspace whose API keys will be listed (path).
92
+ workspace_id,
90
93
  # Pagination cursor from previous response.
91
94
  cursor: nil,
92
95
  # When true, included info fields are populated. Requests with this flag count
@@ -112,12 +115,50 @@ module Cadenya
112
115
  sig do
113
116
  params(
114
117
  id: String,
118
+ workspace_id: String,
115
119
  request_options: Cadenya::RequestOptions::OrHash
116
120
  ).void
117
121
  end
118
122
  def delete(
119
123
  # The API key to delete.
120
124
  id,
125
+ # The workspace the API key belongs to (path).
126
+ workspace_id:,
127
+ request_options: {}
128
+ )
129
+ end
130
+
131
+ # Disables an API key. While disabled, presenting the key's token fails
132
+ # authentication on every endpoint; the key is retained. Idempotent.
133
+ sig do
134
+ params(
135
+ id: String,
136
+ workspace_id: String,
137
+ request_options: Cadenya::RequestOptions::OrHash
138
+ ).returns(Cadenya::APIKey)
139
+ end
140
+ def disable(
141
+ # The API key to disable.
142
+ id,
143
+ # The workspace the API key belongs to (path).
144
+ workspace_id:,
145
+ request_options: {}
146
+ )
147
+ end
148
+
149
+ # Re-enables a disabled API key so its token authenticates again. Idempotent.
150
+ sig do
151
+ params(
152
+ id: String,
153
+ workspace_id: String,
154
+ request_options: Cadenya::RequestOptions::OrHash
155
+ ).returns(Cadenya::APIKey)
156
+ end
157
+ def enable(
158
+ # The API key to enable.
159
+ id,
160
+ # The workspace the API key belongs to (path).
161
+ workspace_id:,
121
162
  request_options: {}
122
163
  )
123
164
  end
@@ -127,6 +168,7 @@ module Cadenya
127
168
  sig do
128
169
  params(
129
170
  id: String,
171
+ workspace_id: String,
130
172
  request_options: Cadenya::RequestOptions::OrHash
131
173
  ).returns(Cadenya::APIKey)
132
174
  end
@@ -134,6 +176,8 @@ module Cadenya
134
176
  # The API key to rotate. A new token is issued and any existing token is
135
177
  # invalidated.
136
178
  id,
179
+ # The workspace the API key belongs to (path).
180
+ workspace_id:,
137
181
  request_options: {}
138
182
  )
139
183
  end
@@ -0,0 +1,55 @@
1
+ # typed: strong
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
+ sig do
12
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
13
+ Cadenya::APIKey
14
+ )
15
+ end
16
+ def retrieve(request_options: {})
17
+ end
18
+
19
+ # Disables the global API key. While disabled, presenting its token fails
20
+ # authentication on every endpoint; the key is retained. Idempotent.
21
+ sig do
22
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
23
+ Cadenya::APIKey
24
+ )
25
+ end
26
+ def disable(request_options: {})
27
+ end
28
+
29
+ # Re-enables the disabled global API key so its token authenticates again.
30
+ # Idempotent.
31
+ sig do
32
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
33
+ Cadenya::APIKey
34
+ )
35
+ end
36
+ def enable(request_options: {})
37
+ end
38
+
39
+ # Rotates the global API key and returns a new token. All previous tokens are
40
+ # invalidated.
41
+ sig do
42
+ params(request_options: Cadenya::RequestOptions::OrHash).returns(
43
+ Cadenya::APIKey
44
+ )
45
+ end
46
+ def rotate(request_options: {})
47
+ end
48
+
49
+ # @api private
50
+ sig { params(client: Cadenya::Client).returns(T.attached_class) }
51
+ def self.new(client:)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -34,6 +34,8 @@ module Cadenya
34
34
 
35
35
  attr_reader api_keys: Cadenya::Resources::APIKeys
36
36
 
37
+ attr_reader global_api_key: Cadenya::Resources::GlobalAPIKey
38
+
37
39
  attr_reader workspace_secrets: Cadenya::Resources::WorkspaceSecrets
38
40
 
39
41
  attr_reader workspaces: Cadenya::Resources::Workspaces
@@ -4,6 +4,7 @@ module Cadenya
4
4
  {
5
5
  metadata: Cadenya::AccountResourceMetadata,
6
6
  spec: Cadenya::APIKeySpec,
7
+ state: Cadenya::Models::APIKey::state,
7
8
  info: Cadenya::APIKeyInfo
8
9
  }
9
10
 
@@ -16,17 +17,33 @@ module Cadenya
16
17
 
17
18
  def info=: (Cadenya::APIKeyInfo) -> Cadenya::APIKeyInfo
18
19
 
20
+ attr_accessor state: Cadenya::Models::APIKey::state
21
+
19
22
  def initialize: (
20
23
  metadata: Cadenya::AccountResourceMetadata,
21
24
  spec: Cadenya::APIKeySpec,
25
+ state: Cadenya::Models::APIKey::state,
22
26
  ?info: Cadenya::APIKeyInfo
23
27
  ) -> void
24
28
 
25
29
  def to_hash: -> {
26
30
  metadata: Cadenya::AccountResourceMetadata,
27
31
  spec: Cadenya::APIKeySpec,
32
+ state: Cadenya::Models::APIKey::state,
28
33
  info: Cadenya::APIKeyInfo
29
34
  }
35
+
36
+ type state = :STATE_UNSPECIFIED | :STATE_ENABLED | :STATE_DISABLED
37
+
38
+ module State
39
+ extend Cadenya::Internal::Type::Enum
40
+
41
+ STATE_UNSPECIFIED: :STATE_UNSPECIFIED
42
+ STATE_ENABLED: :STATE_ENABLED
43
+ STATE_DISABLED: :STATE_DISABLED
44
+
45
+ def self?.values: -> ::Array[Cadenya::Models::APIKey::state]
46
+ end
30
47
  end
31
48
  end
32
49
  end