Class: Cadenya::Resources::ToolSetSecrets
- Inherits:
-
Object
- Object
- Cadenya::Resources::ToolSetSecrets
- Defined in:
- lib/cadenya/resources/tool_set_secrets.rb
Instance Method Summary collapse
-
#create(tool_set_id, metadata:, spec:, workspace_id: nil, request_options: nil) ⇒ Object
Create a new tool set secret.
-
#delete(tool_set_id, id, workspace_id: nil, request_options: nil) ⇒ Object
Delete a tool set secret.
-
#initialize(core) ⇒ ToolSetSecrets
constructor
A new instance of ToolSetSecrets.
-
#list(tool_set_id, workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, sort_order: nil, include_info: nil, request_options: nil) ⇒ Object
List tool set secrets.
-
#retrieve(tool_set_id, id, workspace_id: nil, request_options: nil) ⇒ Object
Get a tool set secret by ID.
-
#update(tool_set_id, id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, request_options: nil) ⇒ Object
Update a tool set secret.
Constructor Details
#initialize(core) ⇒ ToolSetSecrets
Returns a new instance of ToolSetSecrets.
8 9 10 |
# File 'lib/cadenya/resources/tool_set_secrets.rb', line 8 def initialize(core) @core = core end |
Instance Method Details
#create(tool_set_id, metadata:, spec:, workspace_id: nil, request_options: nil) ⇒ Object
Create a new tool set secret
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cadenya/resources/tool_set_secrets.rb', line 33 def create(tool_set_id, metadata:, spec:, workspace_id: nil, request_options: nil) workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id) _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/tool_sets/#{Util.path_param('toolSetId', tool_set_id)}/secrets" _body = { "metadata" => .nil? ? nil : (->(_v) { Types.encode_CreateResourceMetadata(_v) }).call(), "spec" => spec.nil? ? nil : (->(_v) { Types.encode_ToolSetSecretSpec(_v) }).call(spec), }.reject { |_k, v| v.nil? } _data = @core.request(:post, _path, body: _body, request_options: ) Types::ToolSetSecret.from_json(_data) end |
#delete(tool_set_id, id, workspace_id: nil, request_options: nil) ⇒ Object
Delete a tool set secret
53 54 55 56 57 58 |
# File 'lib/cadenya/resources/tool_set_secrets.rb', line 53 def delete(tool_set_id, id, workspace_id: nil, request_options: nil) workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id) _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/tool_sets/#{Util.path_param('toolSetId', tool_set_id)}/secrets/#{Util.path_param('id', id)}" @core.request(:delete, _path, expects_body: false, request_options: ) nil end |
#list(tool_set_id, workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, sort_order: nil, include_info: nil, request_options: nil) ⇒ Object
List tool set secrets
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cadenya/resources/tool_set_secrets.rb', line 13 def list(tool_set_id, workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, sort_order: nil, include_info: nil, request_options: nil) workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id) _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/tool_sets/#{Util.path_param('toolSetId', tool_set_id)}/secrets" _query = { "limit" => limit, "cursor" => cursor, "prefix" => prefix, "query" => query, "sortOrder" => sort_order, "includeInfo" => include_info, } _data = @core.request(:get, _path, query: _query, request_options: ) || {} _items = (_data["items"] || []).map { |item| Types::ToolSetSecret.from_json(item) } _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s Page.new(_items, _next_cursor) do |_c| list(tool_set_id, workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, sort_order: sort_order, include_info: include_info, request_options: ) end end |
#retrieve(tool_set_id, id, workspace_id: nil, request_options: nil) ⇒ Object
Get a tool set secret by ID
45 46 47 48 49 50 |
# File 'lib/cadenya/resources/tool_set_secrets.rb', line 45 def retrieve(tool_set_id, id, workspace_id: nil, request_options: nil) workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id) _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/tool_sets/#{Util.path_param('toolSetId', tool_set_id)}/secrets/#{Util.path_param('id', id)}" _data = @core.request(:get, _path, request_options: ) Types::ToolSetSecret.from_json(_data) end |
#update(tool_set_id, id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, request_options: nil) ⇒ Object
Update a tool set secret
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/cadenya/resources/tool_set_secrets.rb', line 61 def update(tool_set_id, id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, request_options: nil) workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id) _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/tool_sets/#{Util.path_param('toolSetId', tool_set_id)}/secrets/#{Util.path_param('id', id)}" _body = { "metadata" => .nil? ? nil : (->(_v) { Types.encode_UpdateResourceMetadata(_v) }).call(), "spec" => spec.nil? ? nil : (->(_v) { Types.encode_ToolSetSecretSpec(_v) }).call(spec), "updateMask" => update_mask, }.reject { |_k, v| v.nil? } _data = @core.request(:patch, _path, body: _body, request_options: ) Types::ToolSetSecret.from_json(_data) end |