cadenya 1.7.0 → 1.8.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/api.md +51 -28
- data/lib/cadenya/client.rb +3 -2
- data/lib/cadenya/resources/api_keys.rb +43 -50
- data/lib/cadenya/resources/memory_layers.rb +7 -3
- data/lib/cadenya/resources/trusted_endpoints.rb +64 -0
- data/lib/cadenya/types.rb +518 -56
- data/lib/cadenya.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46343a16c9b5115f974c1adece9ea3a9c73545c874d8e49bc722f729555aca6e
|
|
4
|
+
data.tar.gz: 3410780a17133cdc51db580b522d1dfc65f31f05b4c433da87fd5b2568b3ba27
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad7711a70eb3536b373ce2b600ba4b67fb5d6c2f84e529d107e3591dffaa3a52ad34fd589a83b3fa3d6296bcca60760ce58ad20726b6212afb0dbd0df73c9cab
|
|
7
|
+
data.tar.gz: f67228827825272d48f09744da5168e551c5cf561abe7a4c1fc716c2c5e3df258b38ac27580b12ba8394afba08b39744cf4a4865140078ac2fdbd151ece18377
|
data/README.md
CHANGED
data/api.md
CHANGED
|
@@ -22,65 +22,60 @@ client.accounts.rotate_webhook_signing_key() # => Cadenya::Types::RotateWebhookE
|
|
|
22
22
|
|
|
23
23
|
## client.api_keys
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```ruby
|
|
28
|
-
client.api_keys.retrieve_global() # => Cadenya::Types::APIKey
|
|
29
|
-
```
|
|
30
|
-
Disable the global API key
|
|
25
|
+
List API keys
|
|
31
26
|
|
|
32
27
|
```ruby
|
|
33
|
-
client.api_keys.
|
|
28
|
+
client.api_keys.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::APIKey
|
|
34
29
|
```
|
|
35
|
-
|
|
30
|
+
Create a new API key
|
|
36
31
|
|
|
37
32
|
```ruby
|
|
38
|
-
client.api_keys.
|
|
33
|
+
client.api_keys.create(metadata:, spec:) # => Cadenya::Types::APIKey
|
|
39
34
|
```
|
|
40
|
-
|
|
35
|
+
Get an API key by ID
|
|
41
36
|
|
|
42
37
|
```ruby
|
|
43
|
-
client.api_keys.
|
|
38
|
+
client.api_keys.retrieve(id) # => Cadenya::Types::APIKey
|
|
44
39
|
```
|
|
45
|
-
|
|
40
|
+
Delete an API key
|
|
46
41
|
|
|
47
42
|
```ruby
|
|
48
|
-
client.api_keys.
|
|
43
|
+
client.api_keys.delete(id) # => nil
|
|
49
44
|
```
|
|
50
|
-
|
|
45
|
+
Update an API key
|
|
51
46
|
|
|
52
47
|
```ruby
|
|
53
|
-
client.api_keys.
|
|
48
|
+
client.api_keys.update(id, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::APIKey
|
|
54
49
|
```
|
|
55
|
-
|
|
50
|
+
Assign a workspace to an API key
|
|
56
51
|
|
|
57
52
|
```ruby
|
|
58
|
-
client.api_keys.
|
|
53
|
+
client.api_keys.add_workspace(id, workspace_id:) # => Cadenya::Types::APIKey
|
|
59
54
|
```
|
|
60
|
-
|
|
55
|
+
Disable an API key
|
|
61
56
|
|
|
62
57
|
```ruby
|
|
63
|
-
client.api_keys.
|
|
58
|
+
client.api_keys.disable(id) # => Cadenya::Types::APIKey
|
|
64
59
|
```
|
|
65
|
-
|
|
60
|
+
Enable an API key
|
|
66
61
|
|
|
67
62
|
```ruby
|
|
68
|
-
client.api_keys.
|
|
63
|
+
client.api_keys.enable(id) # => Cadenya::Types::APIKey
|
|
69
64
|
```
|
|
70
|
-
|
|
65
|
+
Remove a workspace from an API key
|
|
71
66
|
|
|
72
67
|
```ruby
|
|
73
|
-
client.api_keys.
|
|
68
|
+
client.api_keys.remove_workspace(id, workspace_id:) # => Cadenya::Types::APIKey
|
|
74
69
|
```
|
|
75
|
-
|
|
70
|
+
Reveal an API key's token
|
|
76
71
|
|
|
77
72
|
```ruby
|
|
78
|
-
client.api_keys.
|
|
73
|
+
client.api_keys.reveal(id) # => Cadenya::Types::APIKey
|
|
79
74
|
```
|
|
80
75
|
Rotate an API key
|
|
81
76
|
|
|
82
77
|
```ruby
|
|
83
|
-
client.api_keys.rotate(id
|
|
78
|
+
client.api_keys.rotate(id) # => Cadenya::Types::APIKey
|
|
84
79
|
```
|
|
85
80
|
|
|
86
81
|
## client.workspace_admin
|
|
@@ -131,6 +126,34 @@ Remove a member from a workspace
|
|
|
131
126
|
client.workspace_admin.remove_member(profile_id, workspace_id: nil) # => nil
|
|
132
127
|
```
|
|
133
128
|
|
|
129
|
+
## client.trusted_endpoints
|
|
130
|
+
|
|
131
|
+
List trusted endpoints
|
|
132
|
+
|
|
133
|
+
```ruby
|
|
134
|
+
client.trusted_endpoints.list(limit: nil, cursor: nil, labels: nil) # => Cadenya::Page of Cadenya::Types::TrustedEndpoint
|
|
135
|
+
```
|
|
136
|
+
Create a trusted endpoint
|
|
137
|
+
|
|
138
|
+
```ruby
|
|
139
|
+
client.trusted_endpoints.create(metadata:, spec:) # => Cadenya::Types::TrustedEndpoint
|
|
140
|
+
```
|
|
141
|
+
Get a trusted endpoint by ID
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
client.trusted_endpoints.retrieve(id) # => Cadenya::Types::TrustedEndpoint
|
|
145
|
+
```
|
|
146
|
+
Delete a trusted endpoint
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
client.trusted_endpoints.delete(id) # => nil
|
|
150
|
+
```
|
|
151
|
+
Verify a URL against the trusted endpoints
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
client.trusted_endpoints.verify(url:) # => Cadenya::Types::VerifyTrustedEndpointResponse
|
|
155
|
+
```
|
|
156
|
+
|
|
134
157
|
## client.profiles
|
|
135
158
|
|
|
136
159
|
Retrieves the profile for the credentials accessing the API
|
|
@@ -420,12 +443,12 @@ client.models.swap_on_variations(workspace_id: nil, model_swaps: nil) # => nil
|
|
|
420
443
|
List memory layers
|
|
421
444
|
|
|
422
445
|
```ruby
|
|
423
|
-
client.memory_layers.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::MemoryLayer
|
|
446
|
+
client.memory_layers.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, tenant_id: nil, subject_id: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::MemoryLayer
|
|
424
447
|
```
|
|
425
448
|
Create a new memory layer
|
|
426
449
|
|
|
427
450
|
```ruby
|
|
428
|
-
client.memory_layers.create(metadata:, spec:, workspace_id: nil) # => Cadenya::Types::MemoryLayer
|
|
451
|
+
client.memory_layers.create(metadata:, spec:, workspace_id: nil, tenant: nil, subject: nil) # => Cadenya::Types::MemoryLayer
|
|
429
452
|
```
|
|
430
453
|
Get a memory layer by ID
|
|
431
454
|
|
data/lib/cadenya/client.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Cadenya
|
|
|
8
8
|
# The Cadenya API client. Resource groups are readers; unset options are
|
|
9
9
|
# read from the environment.
|
|
10
10
|
class Client
|
|
11
|
-
attr_reader :accounts, :api_keys, :workspace_admin, :profiles, :workspaces, :agent_pools, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
|
|
11
|
+
attr_reader :accounts, :api_keys, :workspace_admin, :trusted_endpoints, :profiles, :workspaces, :agent_pools, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
|
|
12
12
|
|
|
13
13
|
def initialize(api_key: nil, base_url: nil, webhook_secret: nil, max_retries: 0, connection: nil, stream_transport: nil, workspace_id: nil)
|
|
14
14
|
if !api_key.nil? && api_key.to_s.strip.empty?
|
|
@@ -37,13 +37,14 @@ module Cadenya
|
|
|
37
37
|
auth_header: ["Authorization", "Bearer #{api_key}"],
|
|
38
38
|
max_retries: max_retries,
|
|
39
39
|
defaults: defaults,
|
|
40
|
-
user_agent: "cadenya-ruby/1.
|
|
40
|
+
user_agent: "cadenya-ruby/1.7.0 (api 1.0)",
|
|
41
41
|
connection: connection,
|
|
42
42
|
stream_transport: stream_transport
|
|
43
43
|
)
|
|
44
44
|
@accounts = Resources::Accounts.new(core)
|
|
45
45
|
@api_keys = Resources::ApiKeys.new(core)
|
|
46
46
|
@workspace_admin = Resources::WorkspaceAdmin.new(core)
|
|
47
|
+
@trusted_endpoints = Resources::TrustedEndpoints.new(core)
|
|
47
48
|
@profiles = Resources::Profiles.new(core)
|
|
48
49
|
@workspaces = Resources::Workspaces.new(core)
|
|
49
50
|
@agent_pools = Resources::AgentPools.new(core)
|
|
@@ -9,39 +9,12 @@ module Cadenya
|
|
|
9
9
|
@core = core
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
# Get the global API key
|
|
13
|
-
def retrieve_global(request_options: nil)
|
|
14
|
-
_path = "/v1/account/global_api_key"
|
|
15
|
-
_data = @core.request(:get, _path, request_options: request_options)
|
|
16
|
-
Types::APIKey.from_json(_data)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Disable the global API key
|
|
20
|
-
def disable_global(request_options: nil)
|
|
21
|
-
_path = "/v1/account/global_api_key:disable"
|
|
22
|
-
_data = @core.request(:post, _path, request_options: request_options)
|
|
23
|
-
Types::APIKey.from_json(_data)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Enable the global API key
|
|
27
|
-
def enable_global(request_options: nil)
|
|
28
|
-
_path = "/v1/account/global_api_key:enable"
|
|
29
|
-
_data = @core.request(:post, _path, request_options: request_options)
|
|
30
|
-
Types::APIKey.from_json(_data)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Rotate the global API key
|
|
34
|
-
def rotate_global(request_options: nil)
|
|
35
|
-
_path = "/v1/account/global_api_key:rotate"
|
|
36
|
-
_data = @core.request(:post, _path, request_options: request_options)
|
|
37
|
-
Types::APIKey.from_json(_data)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
12
|
# List API keys
|
|
41
13
|
def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
|
|
42
14
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
43
|
-
_path = "/v1/
|
|
15
|
+
_path = "/v1/account/api_keys"
|
|
44
16
|
_query = {
|
|
17
|
+
"workspaceId" => workspace_id,
|
|
45
18
|
"limit" => limit,
|
|
46
19
|
"cursor" => cursor,
|
|
47
20
|
"prefix" => prefix,
|
|
@@ -59,9 +32,8 @@ module Cadenya
|
|
|
59
32
|
end
|
|
60
33
|
|
|
61
34
|
# Create a new API key
|
|
62
|
-
def create(metadata:, spec:,
|
|
63
|
-
|
|
64
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys"
|
|
35
|
+
def create(metadata:, spec:, request_options: nil)
|
|
36
|
+
_path = "/v1/account/api_keys"
|
|
65
37
|
_body = {
|
|
66
38
|
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAccountResourceMetadata(_v) }).call(metadata),
|
|
67
39
|
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_APIKeySpec(_v) }).call(spec),
|
|
@@ -71,25 +43,22 @@ module Cadenya
|
|
|
71
43
|
end
|
|
72
44
|
|
|
73
45
|
# Get an API key by ID
|
|
74
|
-
def retrieve(id,
|
|
75
|
-
|
|
76
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
|
|
46
|
+
def retrieve(id, request_options: nil)
|
|
47
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
|
|
77
48
|
_data = @core.request(:get, _path, request_options: request_options)
|
|
78
49
|
Types::APIKey.from_json(_data)
|
|
79
50
|
end
|
|
80
51
|
|
|
81
52
|
# Delete an API key
|
|
82
|
-
def delete(id,
|
|
83
|
-
|
|
84
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
|
|
53
|
+
def delete(id, request_options: nil)
|
|
54
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
|
|
85
55
|
@core.request(:delete, _path, expects_body: false, request_options: request_options)
|
|
86
56
|
nil
|
|
87
57
|
end
|
|
88
58
|
|
|
89
59
|
# Update an API key
|
|
90
|
-
def update(id,
|
|
91
|
-
|
|
92
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
|
|
60
|
+
def update(id, metadata: nil, spec: nil, update_mask: nil, request_options: nil)
|
|
61
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
|
|
93
62
|
_body = {
|
|
94
63
|
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_UpdateAccountResourceMetadata(_v) }).call(metadata),
|
|
95
64
|
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_APIKeySpec(_v) }).call(spec),
|
|
@@ -99,26 +68,50 @@ module Cadenya
|
|
|
99
68
|
Types::APIKey.from_json(_data)
|
|
100
69
|
end
|
|
101
70
|
|
|
71
|
+
# Assign a workspace to an API key
|
|
72
|
+
def add_workspace(id, workspace_id:, request_options: nil)
|
|
73
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:addWorkspace"
|
|
74
|
+
_body = {
|
|
75
|
+
"workspaceId" => workspace_id,
|
|
76
|
+
}.reject { |_k, v| v.nil? }
|
|
77
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
78
|
+
Types::APIKey.from_json(_data)
|
|
79
|
+
end
|
|
80
|
+
|
|
102
81
|
# Disable an API key
|
|
103
|
-
def disable(id,
|
|
104
|
-
|
|
105
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:disable"
|
|
82
|
+
def disable(id, request_options: nil)
|
|
83
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:disable"
|
|
106
84
|
_data = @core.request(:post, _path, request_options: request_options)
|
|
107
85
|
Types::APIKey.from_json(_data)
|
|
108
86
|
end
|
|
109
87
|
|
|
110
88
|
# Enable an API key
|
|
111
|
-
def enable(id,
|
|
112
|
-
|
|
113
|
-
|
|
89
|
+
def enable(id, request_options: nil)
|
|
90
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:enable"
|
|
91
|
+
_data = @core.request(:post, _path, request_options: request_options)
|
|
92
|
+
Types::APIKey.from_json(_data)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Remove a workspace from an API key
|
|
96
|
+
def remove_workspace(id, workspace_id:, request_options: nil)
|
|
97
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:removeWorkspace"
|
|
98
|
+
_body = {
|
|
99
|
+
"workspaceId" => workspace_id,
|
|
100
|
+
}.reject { |_k, v| v.nil? }
|
|
101
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
102
|
+
Types::APIKey.from_json(_data)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Reveal an API key's token
|
|
106
|
+
def reveal(id, request_options: nil)
|
|
107
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:reveal"
|
|
114
108
|
_data = @core.request(:post, _path, request_options: request_options)
|
|
115
109
|
Types::APIKey.from_json(_data)
|
|
116
110
|
end
|
|
117
111
|
|
|
118
112
|
# Rotate an API key
|
|
119
|
-
def rotate(id,
|
|
120
|
-
|
|
121
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:rotate"
|
|
113
|
+
def rotate(id, request_options: nil)
|
|
114
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:rotate"
|
|
122
115
|
_data = @core.request(:post, _path, request_options: request_options)
|
|
123
116
|
Types::APIKey.from_json(_data)
|
|
124
117
|
end
|
|
@@ -13,7 +13,7 @@ module Cadenya
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# List memory layers
|
|
16
|
-
def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
|
|
16
|
+
def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, tenant_id: nil, subject_id: nil, sort_order: nil, include_info: nil, request_options: nil)
|
|
17
17
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
18
18
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/memory_layers"
|
|
19
19
|
_query = {
|
|
@@ -25,6 +25,8 @@ module Cadenya
|
|
|
25
25
|
"agentId" => agent_id,
|
|
26
26
|
"episodicKeyPrefix" => episodic_key_prefix,
|
|
27
27
|
"labels" => labels,
|
|
28
|
+
"tenantId" => tenant_id,
|
|
29
|
+
"subjectId" => subject_id,
|
|
28
30
|
"sortOrder" => sort_order,
|
|
29
31
|
"includeInfo" => include_info,
|
|
30
32
|
}
|
|
@@ -32,17 +34,19 @@ module Cadenya
|
|
|
32
34
|
_items = (_data["items"] || []).map { |item| Types::MemoryLayer.from_json(item) }
|
|
33
35
|
_next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
|
|
34
36
|
Page.new(_items, _next_cursor) do |_c|
|
|
35
|
-
list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, type: type, agent_id: agent_id, episodic_key_prefix: episodic_key_prefix, labels: labels, sort_order: sort_order, include_info: include_info, request_options: request_options)
|
|
37
|
+
list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, type: type, agent_id: agent_id, episodic_key_prefix: episodic_key_prefix, labels: labels, tenant_id: tenant_id, subject_id: subject_id, sort_order: sort_order, include_info: include_info, request_options: request_options)
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
# Create a new memory layer
|
|
40
|
-
def create(metadata:, spec:, workspace_id: nil, request_options: nil)
|
|
42
|
+
def create(metadata:, spec:, workspace_id: nil, tenant: nil, subject: nil, request_options: nil)
|
|
41
43
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
42
44
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/memory_layers"
|
|
43
45
|
_body = {
|
|
44
46
|
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateResourceMetadata(_v) }).call(metadata),
|
|
45
47
|
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_MemoryLayerSpec(_v) }).call(spec),
|
|
48
|
+
"tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
|
|
49
|
+
"subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
|
|
46
50
|
}.reject { |_k, v| v.nil? }
|
|
47
51
|
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
48
52
|
Types::MemoryLayer.from_json(_data)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by redwood. DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
module Cadenya
|
|
6
|
+
module Resources
|
|
7
|
+
class TrustedEndpoints
|
|
8
|
+
def initialize(core)
|
|
9
|
+
@core = core
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# List trusted endpoints
|
|
13
|
+
def list(limit: nil, cursor: nil, labels: nil, request_options: nil)
|
|
14
|
+
_path = "/v1/account/trusted_endpoints"
|
|
15
|
+
_query = {
|
|
16
|
+
"limit" => limit,
|
|
17
|
+
"cursor" => cursor,
|
|
18
|
+
"labels" => labels,
|
|
19
|
+
}
|
|
20
|
+
_data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
|
|
21
|
+
_items = (_data["items"] || []).map { |item| Types::TrustedEndpoint.from_json(item) }
|
|
22
|
+
_next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
|
|
23
|
+
Page.new(_items, _next_cursor) do |_c|
|
|
24
|
+
list(limit: limit, cursor: _c, labels: labels, request_options: request_options)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Create a trusted endpoint
|
|
29
|
+
def create(metadata:, spec:, request_options: nil)
|
|
30
|
+
_path = "/v1/account/trusted_endpoints"
|
|
31
|
+
_body = {
|
|
32
|
+
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAccountResourceMetadata(_v) }).call(metadata),
|
|
33
|
+
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_TrustedEndpointSpec(_v) }).call(spec),
|
|
34
|
+
}.reject { |_k, v| v.nil? }
|
|
35
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
36
|
+
Types::TrustedEndpoint.from_json(_data)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Get a trusted endpoint by ID
|
|
40
|
+
def retrieve(id, request_options: nil)
|
|
41
|
+
_path = "/v1/account/trusted_endpoints/#{Util.path_param('id', id)}"
|
|
42
|
+
_data = @core.request(:get, _path, request_options: request_options)
|
|
43
|
+
Types::TrustedEndpoint.from_json(_data)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Delete a trusted endpoint
|
|
47
|
+
def delete(id, request_options: nil)
|
|
48
|
+
_path = "/v1/account/trusted_endpoints/#{Util.path_param('id', id)}"
|
|
49
|
+
@core.request(:delete, _path, expects_body: false, request_options: request_options)
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Verify a URL against the trusted endpoints
|
|
54
|
+
def verify(url:, request_options: nil)
|
|
55
|
+
_path = "/v1/account/trusted_endpoints:verify"
|
|
56
|
+
_body = {
|
|
57
|
+
"url" => url,
|
|
58
|
+
}.reject { |_k, v| v.nil? }
|
|
59
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
60
|
+
Types::VerifyTrustedEndpointResponse.from_json(_data)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|