diff --git a/.claude/context/api-server-development.md b/.claude/context/api-server-development.md index 1689036b1..e2b9c944a 100644 --- a/.claude/context/api-server-development.md +++ b/.claude/context/api-server-development.md @@ -195,6 +195,7 @@ Migration rules: - `AMBIENT_ENV=integration_testing` spins up ephemeral Postgres via testcontainers-go - Requires podman socket: `systemctl --user start podman.socket` - `DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock` +- **Always set `TESTCONTAINERS_RYUK_DISABLED=true`** — ryuk tries to connect to `/var/run/docker.sock` which is unavailable; without this flag tests abort before running - Mock DAOs (`mock_dao.go`) for unit tests without DB - Presenter nil safety: nil-guard each nullable field independently — `UpdatedAt` and `CreatedAt` can be nil independently; treating them as a pair causes panics @@ -208,6 +209,7 @@ cd components/ambient-api-server make generate # Regenerate OpenAPI Go client from openapi/*.yaml make binary # Compile the ambient-api-server binary make test # Integration tests — spins up testcontainer PostgreSQL + # Full invocation: DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock TESTCONTAINERS_RYUK_DISABLED=true AMBIENT_ENV=integration_testing go test -p 1 -v ./... make test-integration # Run only ./test/integration/... package make proto # Regenerate gRPC stubs from proto/ make proto-lint # Lint proto definitions diff --git a/components/ambient-api-server/cmd/ambient-api-server/main.go b/components/ambient-api-server/cmd/ambient-api-server/main.go index 4fb5d2470..2e5f8cec4 100644 --- a/components/ambient-api-server/cmd/ambient-api-server/main.go +++ b/components/ambient-api-server/cmd/ambient-api-server/main.go @@ -15,6 +15,7 @@ import ( // Backend-compatible plugins only _ "github.com/ambient-code/platform/components/ambient-api-server/plugins/agents" + _ "github.com/ambient-code/platform/components/ambient-api-server/plugins/credentials" _ "github.com/ambient-code/platform/components/ambient-api-server/plugins/inbox" _ "github.com/ambient-code/platform/components/ambient-api-server/plugins/projectSettings" _ "github.com/ambient-code/platform/components/ambient-api-server/plugins/projects" diff --git a/components/ambient-api-server/openapi/openapi.credentials.yaml b/components/ambient-api-server/openapi/openapi.credentials.yaml new file mode 100644 index 000000000..a98b1220d --- /dev/null +++ b/components/ambient-api-server/openapi/openapi.credentials.yaml @@ -0,0 +1,437 @@ +paths: + # NEW ENDPOINT START + /api/ambient/v1/credentials: + # NEW ENDPOINT END + get: + summary: Returns a list of credentials + security: + - Bearer: [] + responses: + '200': + description: A JSON array of credential objects + content: + application/json: + schema: + $ref: '#/components/schemas/CredentialList' + '401': + description: Auth token is invalid + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '403': + description: Unauthorized to perform operation + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '500': + description: Unexpected error occurred + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/search' + - $ref: '#/components/parameters/orderBy' + - $ref: '#/components/parameters/fields' + - name: provider + in: query + required: false + description: Filter credentials by provider + schema: + type: string + enum: [github, gitlab, jira, google] + post: + summary: Create a new credential + security: + - Bearer: [] + requestBody: + description: Credential data + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Credential' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/Credential' + '400': + description: Validation errors occurred + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '401': + description: Auth token is invalid + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '403': + description: Unauthorized to perform operation + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '409': + description: Credential already exists + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '500': + description: An unexpected error occurred creating the credential + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + # NEW ENDPOINT START + /api/ambient/v1/credentials/{id}: + # NEW ENDPOINT END + get: + summary: Get an credential by id + security: + - Bearer: [] + responses: + '200': + description: Credential found by id + content: + application/json: + schema: + $ref: '#/components/schemas/Credential' + '401': + description: Auth token is invalid + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '403': + description: Unauthorized to perform operation + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '404': + description: No credential with specified id exists + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '500': + description: Unexpected error occurred + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + patch: + summary: Update an credential + security: + - Bearer: [] + requestBody: + description: Updated credential data + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CredentialPatchRequest' + responses: + '200': + description: Credential updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/Credential' + '400': + description: Validation errors occurred + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '401': + description: Auth token is invalid + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '403': + description: Unauthorized to perform operation + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '404': + description: No credential with specified id exists + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '409': + description: Credential already exists + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '500': + description: Unexpected error updating credential + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + delete: + summary: Delete a credential + security: + - Bearer: [] + responses: + '204': + description: Credential deleted successfully + '401': + description: Auth token is invalid + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '403': + description: Unauthorized to perform operation + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '404': + description: No credential with specified id exists + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '500': + description: Unexpected error deleting credential + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + parameters: + - $ref: '#/components/parameters/id' + # NEW ENDPOINT START + /api/ambient/v1/credentials/{id}/token: + # NEW ENDPOINT END + get: + summary: Get a decrypted token for a credential + description: Returns the decrypted token value for the given credential. Requires token-reader role. + security: + - Bearer: [] + responses: + '200': + description: Credential token retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CredentialTokenResponse' + '401': + description: Auth token is invalid + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '403': + description: Unauthorized to perform operation + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '404': + description: No credential with specified id exists + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + '500': + description: Unexpected error retrieving token + content: + application/json: + schema: + $ref: 'openapi.yaml#/components/schemas/Error' + parameters: + - $ref: '#/components/parameters/id' +components: + schemas: + # NEW SCHEMA START + Credential: + # NEW SCHEMA END + allOf: + - $ref: 'openapi.yaml#/components/schemas/ObjectReference' + - type: object + required: + - name + - provider + properties: + name: + type: string + description: + type: string + provider: + type: string + enum: [github, gitlab, jira, google] + token: + type: string + writeOnly: true + description: Credential token value; write-only, never returned in GET/LIST responses + url: + type: string + email: + type: string + labels: + type: string + annotations: + type: string + # NEW SCHEMA START + CredentialList: + # NEW SCHEMA END + allOf: + - $ref: 'openapi.yaml#/components/schemas/List' + - type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/Credential' + # NEW SCHEMA START + CredentialPatchRequest: + # NEW SCHEMA END + type: object + properties: + name: + type: string + description: + type: string + provider: + type: string + enum: [github, gitlab, jira, google] + token: + type: string + writeOnly: true + description: Credential token value; write-only, never returned in GET/LIST responses + url: + type: string + email: + type: string + labels: + type: string + annotations: + type: string + # NEW SCHEMA START + CredentialTokenResponse: + # NEW SCHEMA END + type: object + required: + - credential_id + - provider + - token + properties: + credential_id: + type: string + description: ID of the credential + provider: + type: string + enum: [github, gitlab, jira, google] + description: Provider type for this credential + token: + type: string + description: Decrypted token value + parameters: + id: + name: id + in: path + description: The id of record + required: true + schema: + type: string + page: + name: page + in: query + description: Page number of record list when record list exceeds specified page size + schema: + type: integer + default: 1 + minimum: 1 + required: false + size: + name: size + in: query + description: Maximum number of records to return + schema: + type: integer + default: 100 + minimum: 0 + required: false + search: + name: search + in: query + required: false + description: |- + Specifies the search criteria. The syntax of this parameter is + similar to the syntax of the _where_ clause of an SQL statement, + using the names of the json attributes / column names of the account. + For example, in order to retrieve all the accounts with a username + starting with `my`: + + ```sql + username like 'my%' + ``` + + The search criteria can also be applied on related resource. + For example, in order to retrieve all the subscriptions labeled by `foo=bar`, + + ```sql + subscription_labels.key = 'foo' and subscription_labels.value = 'bar' + ``` + + If the parameter isn't provided, or if the value is empty, then + all the accounts that the user has permission to see will be + returned. + schema: + type: string + orderBy: + name: orderBy + in: query + required: false + description: |- + Specifies the order by criteria. The syntax of this parameter is + similar to the syntax of the _order by_ clause of an SQL statement, + but using the names of the json attributes / column of the account. + For example, in order to retrieve all accounts ordered by username: + + ```sql + username asc + ``` + + Or in order to retrieve all accounts ordered by username _and_ first name: + + ```sql + username asc, firstName asc + ``` + + If the parameter isn't provided, or if the value is empty, then + no explicit ordering will be applied. + schema: + type: string + fields: + name: fields + in: query + required: false + description: |- + Supplies a comma-separated list of fields to be returned. + Fields of sub-structures and of arrays use . notation. + .* means all field of a structure + Example: For each Subscription to get id, href, plan(id and kind) and labels (all fields) + + ``` + curl "/api/ambient/v1/sessions?fields=id,href,name,project_id" + ``` + schema: + type: string diff --git a/components/ambient-api-server/openapi/openapi.yaml b/components/ambient-api-server/openapi/openapi.yaml index 4fbd6ef39..eaf1ad1fe 100644 --- a/components/ambient-api-server/openapi/openapi.yaml +++ b/components/ambient-api-server/openapi/openapi.yaml @@ -50,20 +50,26 @@ paths: $ref: 'openapi.sessionMessages.yaml#/paths/~1api~1ambient~1v1~1sessions~1{id}~1messages' /api/ambient/v1/projects/{id}/agents: $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents' - /api/ambient/v1/projects/{id}/agents/{pa_id}: - $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{pa_id}' - /api/ambient/v1/projects/{id}/agents/{pa_id}/start: - $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{pa_id}~1start' - /api/ambient/v1/projects/{id}/agents/{pa_id}/ignition: - $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{pa_id}~1ignition' - /api/ambient/v1/projects/{id}/agents/{pa_id}/sessions: - $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{pa_id}~1sessions' + /api/ambient/v1/projects/{id}/agents/{agent_id}: + $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{agent_id}' + /api/ambient/v1/projects/{id}/agents/{agent_id}/start: + $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{agent_id}~1start' + /api/ambient/v1/projects/{id}/agents/{agent_id}/ignition: + $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{agent_id}~1ignition' + /api/ambient/v1/projects/{id}/agents/{agent_id}/sessions: + $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{agent_id}~1sessions' /api/ambient/v1/projects/{id}/home: $ref: 'openapi.agents.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1home' - /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox: - $ref: 'openapi.inbox.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{pa_id}~1inbox' - /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox/{msg_id}: - $ref: 'openapi.inbox.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{pa_id}~1inbox~1{msg_id}' + /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox: + $ref: 'openapi.inbox.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{agent_id}~1inbox' + /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id}: + $ref: 'openapi.inbox.yaml#/paths/~1api~1ambient~1v1~1projects~1{id}~1agents~1{agent_id}~1inbox~1{msg_id}' + /api/ambient/v1/credentials: + $ref: 'openapi.credentials.yaml#/paths/~1api~1ambient~1v1~1credentials' + /api/ambient/v1/credentials/{id}: + $ref: 'openapi.credentials.yaml#/paths/~1api~1ambient~1v1~1credentials~1{id}' + /api/ambient/v1/credentials/{id}/token: + $ref: 'openapi.credentials.yaml#/paths/~1api~1ambient~1v1~1credentials~1{id}~1token' # AUTO-ADD NEW PATHS components: securitySchemes: @@ -209,6 +215,14 @@ components: $ref: 'openapi.inbox.yaml#/components/schemas/InboxMessageList' InboxMessagePatchRequest: $ref: 'openapi.inbox.yaml#/components/schemas/InboxMessagePatchRequest' + Credential: + $ref: 'openapi.credentials.yaml#/components/schemas/Credential' + CredentialList: + $ref: 'openapi.credentials.yaml#/components/schemas/CredentialList' + CredentialPatchRequest: + $ref: 'openapi.credentials.yaml#/components/schemas/CredentialPatchRequest' + CredentialTokenResponse: + $ref: 'openapi.credentials.yaml#/components/schemas/CredentialTokenResponse' # AUTO-ADD NEW SCHEMAS parameters: id: diff --git a/components/ambient-api-server/pkg/api/openapi/.openapi-generator/FILES b/components/ambient-api-server/pkg/api/openapi/.openapi-generator/FILES index 307597788..144bee9da 100644 --- a/components/ambient-api-server/pkg/api/openapi/.openapi-generator/FILES +++ b/components/ambient-api-server/pkg/api/openapi/.openapi-generator/FILES @@ -6,20 +6,22 @@ api/openapi.yaml api_default.go client.go configuration.go +docs/Agent.md +docs/AgentList.md +docs/AgentPatchRequest.md +docs/AgentSessionList.md +docs/Credential.md +docs/CredentialList.md +docs/CredentialPatchRequest.md +docs/CredentialTokenResponse.md docs/DefaultAPI.md docs/Error.md -docs/IgniteRequest.md -docs/IgniteResponse.md docs/InboxMessage.md docs/InboxMessageList.md docs/InboxMessagePatchRequest.md docs/List.md docs/ObjectReference.md docs/Project.md -docs/ProjectAgent.md -docs/ProjectAgentList.md -docs/ProjectAgentPatchRequest.md -docs/ProjectAgentSessionList.md docs/ProjectHome.md docs/ProjectHomeAgent.md docs/ProjectList.md @@ -39,25 +41,29 @@ docs/SessionMessage.md docs/SessionMessagePushRequest.md docs/SessionPatchRequest.md docs/SessionStatusPatchRequest.md +docs/StartRequest.md +docs/StartResponse.md docs/User.md docs/UserList.md docs/UserPatchRequest.md git_push.sh go.mod go.sum +model_agent.go +model_agent_list.go +model_agent_patch_request.go +model_agent_session_list.go +model_credential.go +model_credential_list.go +model_credential_patch_request.go +model_credential_token_response.go model_error.go -model_ignite_request.go -model_ignite_response.go model_inbox_message.go model_inbox_message_list.go model_inbox_message_patch_request.go model_list.go model_object_reference.go model_project.go -model_project_agent.go -model_project_agent_list.go -model_project_agent_patch_request.go -model_project_agent_session_list.go model_project_home.go model_project_home_agent.go model_project_list.go @@ -77,6 +83,8 @@ model_session_message.go model_session_message_push_request.go model_session_patch_request.go model_session_status_patch_request.go +model_start_request.go +model_start_response.go model_user.go model_user_list.go model_user_patch_request.go diff --git a/components/ambient-api-server/pkg/api/openapi/README.md b/components/ambient-api-server/pkg/api/openapi/README.md index 66546bd11..0cbfb2752 100644 --- a/components/ambient-api-server/pkg/api/openapi/README.md +++ b/components/ambient-api-server/pkg/api/openapi/README.md @@ -78,23 +78,29 @@ All URIs are relative to *http://localhost:8000* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultAPI* | [**ApiAmbientV1CredentialsGet**](docs/DefaultAPI.md#apiambientv1credentialsget) | **Get** /api/ambient/v1/credentials | Returns a list of credentials +*DefaultAPI* | [**ApiAmbientV1CredentialsIdDelete**](docs/DefaultAPI.md#apiambientv1credentialsiddelete) | **Delete** /api/ambient/v1/credentials/{id} | Delete a credential +*DefaultAPI* | [**ApiAmbientV1CredentialsIdGet**](docs/DefaultAPI.md#apiambientv1credentialsidget) | **Get** /api/ambient/v1/credentials/{id} | Get an credential by id +*DefaultAPI* | [**ApiAmbientV1CredentialsIdPatch**](docs/DefaultAPI.md#apiambientv1credentialsidpatch) | **Patch** /api/ambient/v1/credentials/{id} | Update an credential +*DefaultAPI* | [**ApiAmbientV1CredentialsIdTokenGet**](docs/DefaultAPI.md#apiambientv1credentialsidtokenget) | **Get** /api/ambient/v1/credentials/{id}/token | Get a decrypted token for a credential +*DefaultAPI* | [**ApiAmbientV1CredentialsPost**](docs/DefaultAPI.md#apiambientv1credentialspost) | **Post** /api/ambient/v1/credentials | Create a new credential *DefaultAPI* | [**ApiAmbientV1ProjectSettingsGet**](docs/DefaultAPI.md#apiambientv1projectsettingsget) | **Get** /api/ambient/v1/project_settings | Returns a list of project settings *DefaultAPI* | [**ApiAmbientV1ProjectSettingsIdDelete**](docs/DefaultAPI.md#apiambientv1projectsettingsiddelete) | **Delete** /api/ambient/v1/project_settings/{id} | Delete a project settings by id *DefaultAPI* | [**ApiAmbientV1ProjectSettingsIdGet**](docs/DefaultAPI.md#apiambientv1projectsettingsidget) | **Get** /api/ambient/v1/project_settings/{id} | Get a project settings by id *DefaultAPI* | [**ApiAmbientV1ProjectSettingsIdPatch**](docs/DefaultAPI.md#apiambientv1projectsettingsidpatch) | **Patch** /api/ambient/v1/project_settings/{id} | Update a project settings *DefaultAPI* | [**ApiAmbientV1ProjectSettingsPost**](docs/DefaultAPI.md#apiambientv1projectsettingspost) | **Post** /api/ambient/v1/project_settings | Create a new project settings *DefaultAPI* | [**ApiAmbientV1ProjectsGet**](docs/DefaultAPI.md#apiambientv1projectsget) | **Get** /api/ambient/v1/projects | Returns a list of projects +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdDelete**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentiddelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{agent_id} | Delete an agent from a project +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdGet**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidget) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id} | Get an agent by id +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidignitionget) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id}/ignition | Preview start context (dry run — no session created) +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidinboxget) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox | Read inbox messages for an agent (unread first) +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidinboxmsgiddelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id} | Delete an inbox message +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidinboxmsgidpatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id} | Mark an inbox message as read +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidinboxpost) | **Post** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox | Send a message to an agent's inbox +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdPatch**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidpatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{agent_id} | Update an agent (name, prompt, labels, annotations) +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidsessionsget) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id}/sessions | Get session run history for an agent +*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsAgentIdStartPost**](docs/DefaultAPI.md#apiambientv1projectsidagentsagentidstartpost) | **Post** /api/ambient/v1/projects/{id}/agents/{agent_id}/start | Start an agent — creates a Session (idempotent) *DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsGet**](docs/DefaultAPI.md#apiambientv1projectsidagentsget) | **Get** /api/ambient/v1/projects/{id}/agents | Returns a list of agents in a project -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdDelete**](docs/DefaultAPI.md#apiambientv1projectsidagentspaiddelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{pa_id} | Delete an agent from a project -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdGet**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidget) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id} | Get an agent by id -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidignitepost) | **Post** /api/ambient/v1/projects/{id}/agents/{pa_id}/ignite | Ignite an agent — creates a Session (idempotent) -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidignitionget) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id}/ignition | Preview ignition context (dry run — no session created) -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdInboxGet**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidinboxget) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox | Read inbox messages for an agent (unread first) -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidinboxmsgiddelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox/{msg_id} | Delete an inbox message -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidinboxmsgidpatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox/{msg_id} | Mark an inbox message as read -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdInboxPost**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidinboxpost) | **Post** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox | Send a message to an agent's inbox -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdPatch**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidpatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{pa_id} | Update an agent (name, prompt, labels, annotations) -*DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet**](docs/DefaultAPI.md#apiambientv1projectsidagentspaidsessionsget) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id}/sessions | Get session run history for an agent *DefaultAPI* | [**ApiAmbientV1ProjectsIdAgentsPost**](docs/DefaultAPI.md#apiambientv1projectsidagentspost) | **Post** /api/ambient/v1/projects/{id}/agents | Create an agent in a project *DefaultAPI* | [**ApiAmbientV1ProjectsIdDelete**](docs/DefaultAPI.md#apiambientv1projectsiddelete) | **Delete** /api/ambient/v1/projects/{id} | Delete a project by id *DefaultAPI* | [**ApiAmbientV1ProjectsIdGet**](docs/DefaultAPI.md#apiambientv1projectsidget) | **Get** /api/ambient/v1/projects/{id} | Get a project by id @@ -127,19 +133,21 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [Agent](docs/Agent.md) + - [AgentList](docs/AgentList.md) + - [AgentPatchRequest](docs/AgentPatchRequest.md) + - [AgentSessionList](docs/AgentSessionList.md) + - [Credential](docs/Credential.md) + - [CredentialList](docs/CredentialList.md) + - [CredentialPatchRequest](docs/CredentialPatchRequest.md) + - [CredentialTokenResponse](docs/CredentialTokenResponse.md) - [Error](docs/Error.md) - - [IgniteRequest](docs/IgniteRequest.md) - - [IgniteResponse](docs/IgniteResponse.md) - [InboxMessage](docs/InboxMessage.md) - [InboxMessageList](docs/InboxMessageList.md) - [InboxMessagePatchRequest](docs/InboxMessagePatchRequest.md) - [List](docs/List.md) - [ObjectReference](docs/ObjectReference.md) - [Project](docs/Project.md) - - [ProjectAgent](docs/ProjectAgent.md) - - [ProjectAgentList](docs/ProjectAgentList.md) - - [ProjectAgentPatchRequest](docs/ProjectAgentPatchRequest.md) - - [ProjectAgentSessionList](docs/ProjectAgentSessionList.md) - [ProjectHome](docs/ProjectHome.md) - [ProjectHomeAgent](docs/ProjectHomeAgent.md) - [ProjectList](docs/ProjectList.md) @@ -159,6 +167,8 @@ Class | Method | HTTP request | Description - [SessionMessagePushRequest](docs/SessionMessagePushRequest.md) - [SessionPatchRequest](docs/SessionPatchRequest.md) - [SessionStatusPatchRequest](docs/SessionStatusPatchRequest.md) + - [StartRequest](docs/StartRequest.md) + - [StartResponse](docs/StartResponse.md) - [User](docs/User.md) - [UserList](docs/UserList.md) - [UserPatchRequest](docs/UserPatchRequest.md) diff --git a/components/ambient-api-server/pkg/api/openapi/api/openapi.yaml b/components/ambient-api-server/pkg/api/openapi/api/openapi.yaml index 0fcdf5029..642dc75e6 100644 --- a/components/ambient-api-server/pkg/api/openapi/api/openapi.yaml +++ b/components/ambient-api-server/pkg/api/openapi/api/openapi.yaml @@ -1888,7 +1888,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgentList" + $ref: "#/components/schemas/AgentList" description: A JSON array of agent objects "401": content: @@ -1931,7 +1931,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgent" + $ref: "#/components/schemas/Agent" description: Agent data required: true responses: @@ -1939,7 +1939,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgent" + $ref: "#/components/schemas/Agent" description: Created "400": content: @@ -1980,7 +1980,7 @@ paths: security: - Bearer: [] summary: Create an agent in a project - /api/ambient/v1/projects/{id}/agents/{pa_id}: + /api/ambient/v1/projects/{id}/agents/{agent_id}: delete: parameters: - description: The id of record @@ -1993,7 +1993,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2039,7 +2039,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2048,7 +2048,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgent" + $ref: "#/components/schemas/Agent" description: Agent found by id "401": content: @@ -2089,7 +2089,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2097,7 +2097,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgentPatchRequest" + $ref: "#/components/schemas/AgentPatchRequest" description: Updated agent data required: true responses: @@ -2105,7 +2105,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgent" + $ref: "#/components/schemas/Agent" description: Agent updated successfully "400": content: @@ -2140,10 +2140,10 @@ paths: security: - Bearer: [] summary: "Update an agent (name, prompt, labels, annotations)" - /api/ambient/v1/projects/{id}/agents/{pa_id}/ignite: + /api/ambient/v1/projects/{id}/agents/{agent_id}/start: post: description: | - Creates a new Session for this Agent and drains the inbox into the ignition context. + Creates a new Session for this Agent and drains the inbox into the start context. If an active session already exists, it is returned as-is. Unread Inbox messages are marked read and injected as context before the first turn. parameters: @@ -2157,7 +2157,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2165,22 +2165,22 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/IgniteRequest" - description: Optional ignition parameters + $ref: "#/components/schemas/StartRequest" + description: Optional start parameters required: false responses: "200": content: application/json: schema: - $ref: "#/components/schemas/IgniteResponse" + $ref: "#/components/schemas/StartResponse" description: Session already active — returned as-is "201": content: application/json: schema: - $ref: "#/components/schemas/IgniteResponse" - description: New session created and ignited + $ref: "#/components/schemas/StartResponse" + description: New session created and started "401": content: application/json: @@ -2207,8 +2207,8 @@ paths: description: Unexpected error occurred security: - Bearer: [] - summary: Ignite an agent — creates a Session (idempotent) - /api/ambient/v1/projects/{id}/agents/{pa_id}/ignition: + summary: Start an agent — creates a Session (idempotent) + /api/ambient/v1/projects/{id}/agents/{agent_id}/ignition: get: parameters: - description: The id of record @@ -2221,7 +2221,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2230,8 +2230,8 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/IgniteResponse" - description: Ignition context preview + $ref: "#/components/schemas/StartResponse" + description: Start context preview "401": content: application/json: @@ -2258,8 +2258,8 @@ paths: description: Unexpected error occurred security: - Bearer: [] - summary: Preview ignition context (dry run — no session created) - /api/ambient/v1/projects/{id}/agents/{pa_id}/sessions: + summary: Preview start context (dry run — no session created) + /api/ambient/v1/projects/{id}/agents/{agent_id}/sessions: get: parameters: - description: The id of record @@ -2272,7 +2272,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2302,7 +2302,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ProjectAgentSessionList" + $ref: "#/components/schemas/AgentSessionList" description: Session run history "401": content: @@ -2376,7 +2376,7 @@ paths: security: - Bearer: [] summary: Project home — latest status for every Agent in this project - /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox: + /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox: get: parameters: - description: The id of record @@ -2389,7 +2389,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2460,7 +2460,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2511,7 +2511,7 @@ paths: security: - Bearer: [] summary: Send a message to an agent's inbox - /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox/{msg_id}: + /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id}: delete: parameters: - description: The id of record @@ -2524,7 +2524,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2576,7 +2576,7 @@ paths: style: simple - description: The id of the agent in: path - name: pa_id + name: agent_id required: true schema: type: string @@ -2627,6 +2627,336 @@ paths: security: - Bearer: [] summary: Mark an inbox message as read + /api/ambient/v1/credentials: + get: + parameters: + - description: Page number of record list when record list exceeds specified + page size + explode: true + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + style: form + - description: Maximum number of records to return + explode: true + in: query + name: size + required: false + schema: + default: 100 + minimum: 0 + type: integer + style: form + - description: Specifies the search criteria + explode: true + in: query + name: search + required: false + schema: + type: string + style: form + - description: Specifies the order by criteria + explode: true + in: query + name: orderBy + required: false + schema: + type: string + style: form + - description: Supplies a comma-separated list of fields to be returned + explode: true + in: query + name: fields + required: false + schema: + type: string + style: form + - description: Filter credentials by provider + in: query + name: provider + required: false + schema: + enum: + - github + - gitlab + - jira + - google + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CredentialList" + description: A JSON array of credential objects + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Auth token is invalid + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized to perform operation + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unexpected error occurred + security: + - Bearer: [] + summary: Returns a list of credentials + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Credential" + description: Credential data + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/Credential" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Validation errors occurred + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Auth token is invalid + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized to perform operation + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Credential already exists + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: An unexpected error occurred creating the credential + security: + - Bearer: [] + summary: Create a new credential + /api/ambient/v1/credentials/{id}: + delete: + parameters: + - description: The id of record + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "204": + description: Credential deleted successfully + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Auth token is invalid + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized to perform operation + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: No credential with specified id exists + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unexpected error deleting credential + security: + - Bearer: [] + summary: Delete a credential + get: + parameters: + - description: The id of record + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Credential" + description: Credential found by id + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Auth token is invalid + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized to perform operation + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: No credential with specified id exists + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unexpected error occurred + security: + - Bearer: [] + summary: Get an credential by id + patch: + parameters: + - description: The id of record + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CredentialPatchRequest" + description: Updated credential data + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Credential" + description: Credential updated successfully + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Validation errors occurred + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Auth token is invalid + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized to perform operation + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: No credential with specified id exists + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Credential already exists + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unexpected error updating credential + security: + - Bearer: [] + summary: Update an credential + /api/ambient/v1/credentials/{id}/token: + get: + description: Returns the decrypted token value for the given credential. Requires + token-reader role. + parameters: + - description: The id of record + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CredentialTokenResponse" + description: Credential token retrieved successfully + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Auth token is invalid + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized to perform operation + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: No credential with specified id exists + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unexpected error retrieving token + security: + - Bearer: [] + summary: Get a decrypted token for a credential components: parameters: id: @@ -3490,7 +3820,7 @@ components: description: Message body type: string type: object - ProjectAgent: + Agent: allOf: - $ref: "#/components/schemas/ObjectReference" - properties: @@ -3534,13 +3864,13 @@ components: href: href prompt: prompt labels: labels - ProjectAgentList: + AgentList: allOf: - $ref: "#/components/schemas/List" - properties: items: items: - $ref: "#/components/schemas/ProjectAgent" + $ref: "#/components/schemas/Agent" type: array type: object example: @@ -3571,7 +3901,7 @@ components: href: href prompt: prompt labels: labels - ProjectAgentPatchRequest: + AgentPatchRequest: example: name: name annotations: annotations @@ -3588,7 +3918,94 @@ components: annotations: type: string type: object - IgniteRequest: + AgentSessionList: + allOf: + - $ref: "#/components/schemas/List" + - properties: + items: + items: + $ref: "#/components/schemas/Session" + type: array + type: object + example: + total: 1 + size: 6 + kind: kind + page: 0 + items: + - workflow_id: workflow_id + completion_time: 2000-01-23T04:56:07.000+00:00 + agent_id: agent_id + created_at: 2000-01-23T04:56:07.000+00:00 + annotations: annotations + reconciled_workflow: reconciled_workflow + timeout: 5 + environment_variables: environment_variables + kube_cr_uid: kube_cr_uid + triggered_by_user_id: triggered_by_user_id + sdk_restart_count: 7 + updated_at: 2000-01-23T04:56:07.000+00:00 + project_id: project_id + parent_session_id: parent_session_id + id: id + href: href + phase: phase + repo_url: repo_url + llm_model: llm_model + resource_overrides: resource_overrides + kind: kind + llm_temperature: 5.637376656633329 + assigned_user_id: assigned_user_id + created_by_user_id: created_by_user_id + llm_max_tokens: 2 + labels: labels + reconciled_repos: reconciled_repos + start_time: 2000-01-23T04:56:07.000+00:00 + sdk_session_id: sdk_session_id + bot_account_name: bot_account_name + repos: repos + name: name + kube_cr_name: kube_cr_name + conditions: conditions + kube_namespace: kube_namespace + prompt: prompt + - workflow_id: workflow_id + completion_time: 2000-01-23T04:56:07.000+00:00 + agent_id: agent_id + created_at: 2000-01-23T04:56:07.000+00:00 + annotations: annotations + reconciled_workflow: reconciled_workflow + timeout: 5 + environment_variables: environment_variables + kube_cr_uid: kube_cr_uid + triggered_by_user_id: triggered_by_user_id + sdk_restart_count: 7 + updated_at: 2000-01-23T04:56:07.000+00:00 + project_id: project_id + parent_session_id: parent_session_id + id: id + href: href + phase: phase + repo_url: repo_url + llm_model: llm_model + resource_overrides: resource_overrides + kind: kind + llm_temperature: 5.637376656633329 + assigned_user_id: assigned_user_id + created_by_user_id: created_by_user_id + llm_max_tokens: 2 + labels: labels + reconciled_repos: reconciled_repos + start_time: 2000-01-23T04:56:07.000+00:00 + sdk_session_id: sdk_session_id + bot_account_name: bot_account_name + repos: repos + name: name + kube_cr_name: kube_cr_name + conditions: conditions + kube_namespace: kube_namespace + prompt: prompt + StartRequest: example: prompt: prompt properties: @@ -3596,7 +4013,7 @@ components: description: Task scope for this specific run (Session.prompt) type: string type: object - IgniteResponse: + StartResponse: example: session: workflow_id: workflow_id @@ -3640,7 +4057,7 @@ components: session: $ref: "#/components/schemas/Session" ignition_prompt: - description: Assembled ignition prompt — Agent.prompt + Inbox + Session.prompt + description: Assembled start prompt — Agent.prompt + Inbox + Session.prompt + peer roster type: string type: object @@ -3761,13 +4178,59 @@ components: read: type: boolean type: object - ProjectAgentSessionList: + Credential: + allOf: + - $ref: "#/components/schemas/ObjectReference" + - properties: + name: + type: string + description: + type: string + provider: + enum: + - github + - gitlab + - jira + - google + type: string + token: + description: "Credential token value; write-only, never returned in GET/LIST\ + \ responses" + type: string + writeOnly: true + url: + type: string + email: + type: string + labels: + type: string + annotations: + type: string + required: + - name + - provider + type: object + example: + kind: kind + created_at: 2000-01-23T04:56:07.000+00:00 + description: description + annotations: annotations + url: url + token: token + labels: labels + updated_at: 2000-01-23T04:56:07.000+00:00 + provider: github + name: name + id: id + href: href + email: email + CredentialList: allOf: - $ref: "#/components/schemas/List" - properties: items: items: - $ref: "#/components/schemas/Session" + $ref: "#/components/schemas/Credential" type: array type: object example: @@ -3776,78 +4239,93 @@ components: kind: kind page: 0 items: - - workflow_id: workflow_id - completion_time: 2000-01-23T04:56:07.000+00:00 - agent_id: agent_id + - kind: kind created_at: 2000-01-23T04:56:07.000+00:00 + description: description annotations: annotations - reconciled_workflow: reconciled_workflow - timeout: 5 - environment_variables: environment_variables - kube_cr_uid: kube_cr_uid - triggered_by_user_id: triggered_by_user_id - sdk_restart_count: 7 + url: url + token: token + labels: labels updated_at: 2000-01-23T04:56:07.000+00:00 - project_id: project_id - parent_session_id: parent_session_id + provider: github + name: name id: id href: href - phase: phase - repo_url: repo_url - llm_model: llm_model - resource_overrides: resource_overrides - kind: kind - llm_temperature: 5.637376656633329 - assigned_user_id: assigned_user_id - created_by_user_id: created_by_user_id - llm_max_tokens: 2 - labels: labels - reconciled_repos: reconciled_repos - start_time: 2000-01-23T04:56:07.000+00:00 - sdk_session_id: sdk_session_id - bot_account_name: bot_account_name - repos: repos - name: name - kube_cr_name: kube_cr_name - conditions: conditions - kube_namespace: kube_namespace - prompt: prompt - - workflow_id: workflow_id - completion_time: 2000-01-23T04:56:07.000+00:00 - agent_id: agent_id + email: email + - kind: kind created_at: 2000-01-23T04:56:07.000+00:00 + description: description annotations: annotations - reconciled_workflow: reconciled_workflow - timeout: 5 - environment_variables: environment_variables - kube_cr_uid: kube_cr_uid - triggered_by_user_id: triggered_by_user_id - sdk_restart_count: 7 + url: url + token: token + labels: labels updated_at: 2000-01-23T04:56:07.000+00:00 - project_id: project_id - parent_session_id: parent_session_id + provider: github + name: name id: id href: href - phase: phase - repo_url: repo_url - llm_model: llm_model - resource_overrides: resource_overrides - kind: kind - llm_temperature: 5.637376656633329 - assigned_user_id: assigned_user_id - created_by_user_id: created_by_user_id - llm_max_tokens: 2 - labels: labels - reconciled_repos: reconciled_repos - start_time: 2000-01-23T04:56:07.000+00:00 - sdk_session_id: sdk_session_id - bot_account_name: bot_account_name - repos: repos - name: name - kube_cr_name: kube_cr_name - conditions: conditions - kube_namespace: kube_namespace - prompt: prompt + email: email + CredentialPatchRequest: + example: + provider: github + name: name + description: description + annotations: annotations + url: url + email: email + token: token + labels: labels + properties: + name: + type: string + description: + type: string + provider: + enum: + - github + - gitlab + - jira + - google + type: string + token: + description: "Credential token value; write-only, never returned in GET/LIST\ + \ responses" + type: string + writeOnly: true + url: + type: string + email: + type: string + labels: + type: string + annotations: + type: string + type: object + CredentialTokenResponse: + example: + provider: github + credential_id: credential_id + token: token + properties: + credential_id: + description: ID of the credential + type: string + provider: + description: Provider type for this credential + enum: + - github + - gitlab + - jira + - google + type: string + token: + description: Decrypted token value + type: string + required: + - credential_id + - provider + - token + type: object securitySchemes: Bearer: bearerFormat: JWT diff --git a/components/ambient-api-server/pkg/api/openapi/api_default.go b/components/ambient-api-server/pkg/api/openapi/api_default.go index e579656a5..a5a1a0092 100644 --- a/components/ambient-api-server/pkg/api/openapi/api_default.go +++ b/components/ambient-api-server/pkg/api/openapi/api_default.go @@ -23,7 +23,7 @@ import ( // DefaultAPIService DefaultAPI service type DefaultAPIService service -type ApiApiAmbientV1ProjectSettingsGetRequest struct { +type ApiApiAmbientV1CredentialsGetRequest struct { ctx context.Context ApiService *DefaultAPIService page *int32 @@ -31,50 +31,57 @@ type ApiApiAmbientV1ProjectSettingsGetRequest struct { search *string orderBy *string fields *string + provider *string } // Page number of record list when record list exceeds specified page size -func (r ApiApiAmbientV1ProjectSettingsGetRequest) Page(page int32) ApiApiAmbientV1ProjectSettingsGetRequest { +func (r ApiApiAmbientV1CredentialsGetRequest) Page(page int32) ApiApiAmbientV1CredentialsGetRequest { r.page = &page return r } // Maximum number of records to return -func (r ApiApiAmbientV1ProjectSettingsGetRequest) Size(size int32) ApiApiAmbientV1ProjectSettingsGetRequest { +func (r ApiApiAmbientV1CredentialsGetRequest) Size(size int32) ApiApiAmbientV1CredentialsGetRequest { r.size = &size return r } // Specifies the search criteria -func (r ApiApiAmbientV1ProjectSettingsGetRequest) Search(search string) ApiApiAmbientV1ProjectSettingsGetRequest { +func (r ApiApiAmbientV1CredentialsGetRequest) Search(search string) ApiApiAmbientV1CredentialsGetRequest { r.search = &search return r } // Specifies the order by criteria -func (r ApiApiAmbientV1ProjectSettingsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1ProjectSettingsGetRequest { +func (r ApiApiAmbientV1CredentialsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1CredentialsGetRequest { r.orderBy = &orderBy return r } // Supplies a comma-separated list of fields to be returned -func (r ApiApiAmbientV1ProjectSettingsGetRequest) Fields(fields string) ApiApiAmbientV1ProjectSettingsGetRequest { +func (r ApiApiAmbientV1CredentialsGetRequest) Fields(fields string) ApiApiAmbientV1CredentialsGetRequest { r.fields = &fields return r } -func (r ApiApiAmbientV1ProjectSettingsGetRequest) Execute() (*ProjectSettingsList, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectSettingsGetExecute(r) +// Filter credentials by provider +func (r ApiApiAmbientV1CredentialsGetRequest) Provider(provider string) ApiApiAmbientV1CredentialsGetRequest { + r.provider = &provider + return r +} + +func (r ApiApiAmbientV1CredentialsGetRequest) Execute() (*CredentialList, *http.Response, error) { + return r.ApiService.ApiAmbientV1CredentialsGetExecute(r) } /* -ApiAmbientV1ProjectSettingsGet Returns a list of project settings +ApiAmbientV1CredentialsGet Returns a list of credentials @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiApiAmbientV1ProjectSettingsGetRequest + @return ApiApiAmbientV1CredentialsGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGet(ctx context.Context) ApiApiAmbientV1ProjectSettingsGetRequest { - return ApiApiAmbientV1ProjectSettingsGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1CredentialsGet(ctx context.Context) ApiApiAmbientV1CredentialsGetRequest { + return ApiApiAmbientV1CredentialsGetRequest{ ApiService: a, ctx: ctx, } @@ -82,21 +89,21 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGet(ctx context.Context) // Execute executes the request // -// @return ProjectSettingsList -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGetExecute(r ApiApiAmbientV1ProjectSettingsGetRequest) (*ProjectSettingsList, *http.Response, error) { +// @return CredentialList +func (a *DefaultAPIService) ApiAmbientV1CredentialsGetExecute(r ApiApiAmbientV1CredentialsGetRequest) (*CredentialList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectSettingsList + localVarReturnValue *CredentialList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1CredentialsGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/project_settings" + localVarPath := localBasePath + "/api/ambient/v1/credentials" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -123,6 +130,9 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGetExecute(r ApiApiAmbien if r.fields != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "form", "") } + if r.provider != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "provider", r.provider, "", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -209,25 +219,25 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGetExecute(r ApiApiAmbien return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectSettingsIdDeleteRequest struct { +type ApiApiAmbientV1CredentialsIdDeleteRequest struct { ctx context.Context ApiService *DefaultAPIService id string } -func (r ApiApiAmbientV1ProjectSettingsIdDeleteRequest) Execute() (*http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectSettingsIdDeleteExecute(r) +func (r ApiApiAmbientV1CredentialsIdDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.ApiAmbientV1CredentialsIdDeleteExecute(r) } /* -ApiAmbientV1ProjectSettingsIdDelete Delete a project settings by id +ApiAmbientV1CredentialsIdDelete Delete a credential @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record - @return ApiApiAmbientV1ProjectSettingsIdDeleteRequest + @return ApiApiAmbientV1CredentialsIdDeleteRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdDelete(ctx context.Context, id string) ApiApiAmbientV1ProjectSettingsIdDeleteRequest { - return ApiApiAmbientV1ProjectSettingsIdDeleteRequest{ +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdDelete(ctx context.Context, id string) ApiApiAmbientV1CredentialsIdDeleteRequest { + return ApiApiAmbientV1CredentialsIdDeleteRequest{ ApiService: a, ctx: ctx, id: id, @@ -235,19 +245,19 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdDelete(ctx context.Cont } // Execute executes the request -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdDeleteExecute(r ApiApiAmbientV1ProjectSettingsIdDeleteRequest) (*http.Response, error) { +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdDeleteExecute(r ApiApiAmbientV1CredentialsIdDeleteRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsIdDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1CredentialsIdDelete") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/project_settings/{id}" + localVarPath := localBasePath + "/api/ambient/v1/credentials/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) @@ -342,25 +352,25 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdDeleteExecute(r ApiApiA return localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectSettingsIdGetRequest struct { +type ApiApiAmbientV1CredentialsIdGetRequest struct { ctx context.Context ApiService *DefaultAPIService id string } -func (r ApiApiAmbientV1ProjectSettingsIdGetRequest) Execute() (*ProjectSettings, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectSettingsIdGetExecute(r) +func (r ApiApiAmbientV1CredentialsIdGetRequest) Execute() (*Credential, *http.Response, error) { + return r.ApiService.ApiAmbientV1CredentialsIdGetExecute(r) } /* -ApiAmbientV1ProjectSettingsIdGet Get a project settings by id +ApiAmbientV1CredentialsIdGet Get an credential by id @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record - @return ApiApiAmbientV1ProjectSettingsIdGetRequest + @return ApiApiAmbientV1CredentialsIdGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdGet(ctx context.Context, id string) ApiApiAmbientV1ProjectSettingsIdGetRequest { - return ApiApiAmbientV1ProjectSettingsIdGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdGet(ctx context.Context, id string) ApiApiAmbientV1CredentialsIdGetRequest { + return ApiApiAmbientV1CredentialsIdGetRequest{ ApiService: a, ctx: ctx, id: id, @@ -369,21 +379,21 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdGet(ctx context.Context // Execute executes the request // -// @return ProjectSettings -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdGetExecute(r ApiApiAmbientV1ProjectSettingsIdGetRequest) (*ProjectSettings, *http.Response, error) { +// @return Credential +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdGetExecute(r ApiApiAmbientV1CredentialsIdGetRequest) (*Credential, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectSettings + localVarReturnValue *Credential ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsIdGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1CredentialsIdGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/project_settings/{id}" + localVarPath := localBasePath + "/api/ambient/v1/credentials/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) @@ -487,32 +497,32 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdGetExecute(r ApiApiAmbi return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectSettingsIdPatchRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string - projectSettingsPatchRequest *ProjectSettingsPatchRequest +type ApiApiAmbientV1CredentialsIdPatchRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + credentialPatchRequest *CredentialPatchRequest } -// Updated project settings data -func (r ApiApiAmbientV1ProjectSettingsIdPatchRequest) ProjectSettingsPatchRequest(projectSettingsPatchRequest ProjectSettingsPatchRequest) ApiApiAmbientV1ProjectSettingsIdPatchRequest { - r.projectSettingsPatchRequest = &projectSettingsPatchRequest +// Updated credential data +func (r ApiApiAmbientV1CredentialsIdPatchRequest) CredentialPatchRequest(credentialPatchRequest CredentialPatchRequest) ApiApiAmbientV1CredentialsIdPatchRequest { + r.credentialPatchRequest = &credentialPatchRequest return r } -func (r ApiApiAmbientV1ProjectSettingsIdPatchRequest) Execute() (*ProjectSettings, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectSettingsIdPatchExecute(r) +func (r ApiApiAmbientV1CredentialsIdPatchRequest) Execute() (*Credential, *http.Response, error) { + return r.ApiService.ApiAmbientV1CredentialsIdPatchExecute(r) } /* -ApiAmbientV1ProjectSettingsIdPatch Update a project settings +ApiAmbientV1CredentialsIdPatch Update an credential @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record - @return ApiApiAmbientV1ProjectSettingsIdPatchRequest + @return ApiApiAmbientV1CredentialsIdPatchRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatch(ctx context.Context, id string) ApiApiAmbientV1ProjectSettingsIdPatchRequest { - return ApiApiAmbientV1ProjectSettingsIdPatchRequest{ +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdPatch(ctx context.Context, id string) ApiApiAmbientV1CredentialsIdPatchRequest { + return ApiApiAmbientV1CredentialsIdPatchRequest{ ApiService: a, ctx: ctx, id: id, @@ -521,28 +531,28 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatch(ctx context.Conte // Execute executes the request // -// @return ProjectSettings -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatchExecute(r ApiApiAmbientV1ProjectSettingsIdPatchRequest) (*ProjectSettings, *http.Response, error) { +// @return Credential +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdPatchExecute(r ApiApiAmbientV1CredentialsIdPatchRequest) (*Credential, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectSettings + localVarReturnValue *Credential ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsIdPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1CredentialsIdPatch") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/project_settings/{id}" + localVarPath := localBasePath + "/api/ambient/v1/credentials/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.projectSettingsPatchRequest == nil { - return localVarReturnValue, nil, reportError("projectSettingsPatchRequest is required and must be specified") + if r.credentialPatchRequest == nil { + return localVarReturnValue, nil, reportError("credentialPatchRequest is required and must be specified") } // to determine the Content-Type header @@ -563,7 +573,7 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatchExecute(r ApiApiAm localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.projectSettingsPatchRequest + localVarPostBody = r.credentialPatchRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -666,62 +676,58 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatchExecute(r ApiApiAm return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectSettingsPostRequest struct { - ctx context.Context - ApiService *DefaultAPIService - projectSettings *ProjectSettings -} - -// Project settings data -func (r ApiApiAmbientV1ProjectSettingsPostRequest) ProjectSettings(projectSettings ProjectSettings) ApiApiAmbientV1ProjectSettingsPostRequest { - r.projectSettings = &projectSettings - return r +type ApiApiAmbientV1CredentialsIdTokenGetRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string } -func (r ApiApiAmbientV1ProjectSettingsPostRequest) Execute() (*ProjectSettings, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectSettingsPostExecute(r) +func (r ApiApiAmbientV1CredentialsIdTokenGetRequest) Execute() (*CredentialTokenResponse, *http.Response, error) { + return r.ApiService.ApiAmbientV1CredentialsIdTokenGetExecute(r) } /* -ApiAmbientV1ProjectSettingsPost Create a new project settings +ApiAmbientV1CredentialsIdTokenGet Get a decrypted token for a credential + +Returns the decrypted token value for the given credential. Requires token-reader role. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiApiAmbientV1ProjectSettingsPostRequest + @param id The id of record + @return ApiApiAmbientV1CredentialsIdTokenGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPost(ctx context.Context) ApiApiAmbientV1ProjectSettingsPostRequest { - return ApiApiAmbientV1ProjectSettingsPostRequest{ +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdTokenGet(ctx context.Context, id string) ApiApiAmbientV1CredentialsIdTokenGetRequest { + return ApiApiAmbientV1CredentialsIdTokenGetRequest{ ApiService: a, ctx: ctx, + id: id, } } // Execute executes the request // -// @return ProjectSettings -func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPostExecute(r ApiApiAmbientV1ProjectSettingsPostRequest) (*ProjectSettings, *http.Response, error) { +// @return CredentialTokenResponse +func (a *DefaultAPIService) ApiAmbientV1CredentialsIdTokenGetExecute(r ApiApiAmbientV1CredentialsIdTokenGetRequest) (*CredentialTokenResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectSettings + localVarReturnValue *CredentialTokenResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1CredentialsIdTokenGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/project_settings" + localVarPath := localBasePath + "/api/ambient/v1/credentials/{id}/token" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.projectSettings == nil { - return localVarReturnValue, nil, reportError("projectSettings is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -737,8 +743,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPostExecute(r ApiApiAmbie if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.projectSettings req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -761,17 +765,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPostExecute(r ApiApiAmbie body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -794,7 +787,7 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPostExecute(r ApiApiAmbie newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 409 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -830,58 +823,30 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPostExecute(r ApiApiAmbie return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsGetRequest struct { +type ApiApiAmbientV1CredentialsPostRequest struct { ctx context.Context ApiService *DefaultAPIService - page *int32 - size *int32 - search *string - orderBy *string - fields *string -} - -// Page number of record list when record list exceeds specified page size -func (r ApiApiAmbientV1ProjectsGetRequest) Page(page int32) ApiApiAmbientV1ProjectsGetRequest { - r.page = &page - return r -} - -// Maximum number of records to return -func (r ApiApiAmbientV1ProjectsGetRequest) Size(size int32) ApiApiAmbientV1ProjectsGetRequest { - r.size = &size - return r -} - -// Specifies the search criteria -func (r ApiApiAmbientV1ProjectsGetRequest) Search(search string) ApiApiAmbientV1ProjectsGetRequest { - r.search = &search - return r -} - -// Specifies the order by criteria -func (r ApiApiAmbientV1ProjectsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1ProjectsGetRequest { - r.orderBy = &orderBy - return r + credential *Credential } -// Supplies a comma-separated list of fields to be returned -func (r ApiApiAmbientV1ProjectsGetRequest) Fields(fields string) ApiApiAmbientV1ProjectsGetRequest { - r.fields = &fields +// Credential data +func (r ApiApiAmbientV1CredentialsPostRequest) Credential(credential Credential) ApiApiAmbientV1CredentialsPostRequest { + r.credential = &credential return r } -func (r ApiApiAmbientV1ProjectsGetRequest) Execute() (*ProjectList, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsGetExecute(r) +func (r ApiApiAmbientV1CredentialsPostRequest) Execute() (*Credential, *http.Response, error) { + return r.ApiService.ApiAmbientV1CredentialsPostExecute(r) } /* -ApiAmbientV1ProjectsGet Returns a list of projects +ApiAmbientV1CredentialsPost Create a new credential @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiApiAmbientV1ProjectsGetRequest + @return ApiApiAmbientV1CredentialsPostRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsGet(ctx context.Context) ApiApiAmbientV1ProjectsGetRequest { - return ApiApiAmbientV1ProjectsGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1CredentialsPost(ctx context.Context) ApiApiAmbientV1CredentialsPostRequest { + return ApiApiAmbientV1CredentialsPostRequest{ ApiService: a, ctx: ctx, } @@ -889,49 +854,31 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsGet(ctx context.Context) ApiApiA // Execute executes the request // -// @return ProjectList -func (a *DefaultAPIService) ApiAmbientV1ProjectsGetExecute(r ApiApiAmbientV1ProjectsGetRequest) (*ProjectList, *http.Response, error) { +// @return Credential +func (a *DefaultAPIService) ApiAmbientV1CredentialsPostExecute(r ApiApiAmbientV1CredentialsPostRequest) (*Credential, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectList + localVarReturnValue *Credential ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1CredentialsPost") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects" + localVarPath := localBasePath + "/api/ambient/v1/credentials" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - - if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") - } else { - var defaultValue int32 = 1 - r.page = &defaultValue - } - if r.size != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") - } else { - var defaultValue int32 = 100 - r.size = &defaultValue - } - if r.search != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "form", "") - } - if r.orderBy != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "form", "") - } - if r.fields != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "form", "") + if r.credential == nil { + return localVarReturnValue, nil, reportError("credential is required and must be specified") } + // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -947,6 +894,8 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsGetExecute(r ApiApiAmbientV1Proj if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.credential req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -969,6 +918,17 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsGetExecute(r ApiApiAmbientV1Proj body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -991,6 +951,17 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsGetExecute(r ApiApiAmbientV1Proj newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1016,10 +987,9 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsGetExecute(r ApiApiAmbientV1Proj return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsGetRequest struct { +type ApiApiAmbientV1ProjectSettingsGetRequest struct { ctx context.Context ApiService *DefaultAPIService - id string page *int32 size *int32 search *string @@ -1028,72 +998,69 @@ type ApiApiAmbientV1ProjectsIdAgentsGetRequest struct { } // Page number of record list when record list exceeds specified page size -func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Page(page int32) ApiApiAmbientV1ProjectsIdAgentsGetRequest { +func (r ApiApiAmbientV1ProjectSettingsGetRequest) Page(page int32) ApiApiAmbientV1ProjectSettingsGetRequest { r.page = &page return r } // Maximum number of records to return -func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Size(size int32) ApiApiAmbientV1ProjectsIdAgentsGetRequest { +func (r ApiApiAmbientV1ProjectSettingsGetRequest) Size(size int32) ApiApiAmbientV1ProjectSettingsGetRequest { r.size = &size return r } // Specifies the search criteria -func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Search(search string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { +func (r ApiApiAmbientV1ProjectSettingsGetRequest) Search(search string) ApiApiAmbientV1ProjectSettingsGetRequest { r.search = &search return r } // Specifies the order by criteria -func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { +func (r ApiApiAmbientV1ProjectSettingsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1ProjectSettingsGetRequest { r.orderBy = &orderBy return r } // Supplies a comma-separated list of fields to be returned -func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Fields(fields string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { +func (r ApiApiAmbientV1ProjectSettingsGetRequest) Fields(fields string) ApiApiAmbientV1ProjectSettingsGetRequest { r.fields = &fields return r } -func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Execute() (*AgentList, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsGetExecute(r) +func (r ApiApiAmbientV1ProjectSettingsGetRequest) Execute() (*ProjectSettingsList, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectSettingsGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsGet Returns a list of agents in a project +ApiAmbientV1ProjectSettingsGet Returns a list of project settings @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The id of record - @return ApiApiAmbientV1ProjectsIdAgentsGetRequest + @return ApiApiAmbientV1ProjectSettingsGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsGet(ctx context.Context, id string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { - return ApiApiAmbientV1ProjectsIdAgentsGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGet(ctx context.Context) ApiApiAmbientV1ProjectSettingsGetRequest { + return ApiApiAmbientV1ProjectSettingsGetRequest{ ApiService: a, ctx: ctx, - id: id, } } // Execute executes the request // -// @return AgentList -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsGetExecute(r ApiApiAmbientV1ProjectsIdAgentsGetRequest) (*AgentList, *http.Response, error) { +// @return ProjectSettingsList +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsGetExecute(r ApiApiAmbientV1ProjectSettingsGetRequest) (*ProjectSettingsList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AgentList + localVarReturnValue *ProjectSettingsList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath := localBasePath + "/api/ambient/v1/project_settings" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1181,18 +1148,7 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsGetExecute(r ApiApiAmbie newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { + if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1217,50 +1173,46 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsGetExecute(r ApiApiAmbie return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest struct { +type ApiApiAmbientV1ProjectSettingsIdDeleteRequest struct { ctx context.Context ApiService *DefaultAPIService id string - agentId string } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest) Execute() (*http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdDeleteExecute(r) +func (r ApiApiAmbientV1ProjectSettingsIdDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectSettingsIdDeleteExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdDelete Delete an agent from a project +ApiAmbientV1ProjectSettingsIdDelete Delete a project settings by id @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record - @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest + @return ApiApiAmbientV1ProjectSettingsIdDeleteRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdDelete(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdDelete(ctx context.Context, id string) ApiApiAmbientV1ProjectSettingsIdDeleteRequest { + return ApiApiAmbientV1ProjectSettingsIdDeleteRequest{ ApiService: a, ctx: ctx, id: id, - agentId: agentId, } } // Execute executes the request -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdDeleteExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest) (*http.Response, error) { +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdDeleteExecute(r ApiApiAmbientV1ProjectSettingsIdDeleteRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsIdDelete") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}" + localVarPath := localBasePath + "/api/ambient/v1/project_settings/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1354,53 +1306,49 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdDeleteExecute(r A return localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest struct { +type ApiApiAmbientV1ProjectSettingsIdGetRequest struct { ctx context.Context ApiService *DefaultAPIService id string - agentId string } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest) Execute() (*Agent, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdGetExecute(r) +func (r ApiApiAmbientV1ProjectSettingsIdGetRequest) Execute() (*ProjectSettings, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectSettingsIdGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdGet Get an agent by id +ApiAmbientV1ProjectSettingsIdGet Get a project settings by id @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record - @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest + @return ApiApiAmbientV1ProjectSettingsIdGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdGet(ctx context.Context, id string) ApiApiAmbientV1ProjectSettingsIdGetRequest { + return ApiApiAmbientV1ProjectSettingsIdGetRequest{ ApiService: a, ctx: ctx, id: id, - agentId: agentId, } } // Execute executes the request // -// @return Agent -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest) (*Agent, *http.Response, error) { +// @return ProjectSettings +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdGetExecute(r ApiApiAmbientV1ProjectSettingsIdGetRequest) (*ProjectSettings, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Agent + localVarReturnValue *ProjectSettings ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsIdGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}" + localVarPath := localBasePath + "/api/ambient/v1/project_settings/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1503,68 +1451,63 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdGetExecute(r ApiA return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string - agentId string - startRequest *StartRequest +type ApiApiAmbientV1ProjectSettingsIdPatchRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + projectSettingsPatchRequest *ProjectSettingsPatchRequest } -// Optional start parameters -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest) StartRequest(startRequest StartRequest) ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest { - r.startRequest = &startRequest +// Updated project settings data +func (r ApiApiAmbientV1ProjectSettingsIdPatchRequest) ProjectSettingsPatchRequest(projectSettingsPatchRequest ProjectSettingsPatchRequest) ApiApiAmbientV1ProjectSettingsIdPatchRequest { + r.projectSettingsPatchRequest = &projectSettingsPatchRequest return r } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest) Execute() (*StartResponse, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute(r) +func (r ApiApiAmbientV1ProjectSettingsIdPatchRequest) Execute() (*ProjectSettings, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectSettingsIdPatchExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdStartPost Start an agent — creates a Session (idempotent) - -Creates a new Session for this Agent and drains the inbox into the start context. -If an active session already exists, it is returned as-is. -Unread Inbox messages are marked read and injected as context before the first turn. +ApiAmbientV1ProjectSettingsIdPatch Update a project settings @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record - @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest + @return ApiApiAmbientV1ProjectSettingsIdPatchRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPost(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatch(ctx context.Context, id string) ApiApiAmbientV1ProjectSettingsIdPatchRequest { + return ApiApiAmbientV1ProjectSettingsIdPatchRequest{ ApiService: a, ctx: ctx, id: id, - agentId: agentId, } } // Execute executes the request // -// @return StartResponse -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest) (*StartResponse, *http.Response, error) { +// @return ProjectSettings +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsIdPatchExecute(r ApiApiAmbientV1ProjectSettingsIdPatchRequest) (*ProjectSettings, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *StartResponse + localVarReturnValue *ProjectSettings ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdStartPost") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsIdPatch") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/start" + localVarPath := localBasePath + "/api/ambient/v1/project_settings/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.projectSettingsPatchRequest == nil { + return localVarReturnValue, nil, reportError("projectSettingsPatchRequest is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -1584,7 +1527,7 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.startRequest + localVarPostBody = r.projectSettingsPatchRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1607,6 +1550,17 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute( body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1640,6 +1594,17 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute( newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1665,60 +1630,62 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute( return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string - agentId string +type ApiApiAmbientV1ProjectSettingsPostRequest struct { + ctx context.Context + ApiService *DefaultAPIService + projectSettings *ProjectSettings } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest) Execute() (*StartResponse, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecute(r) +// Project settings data +func (r ApiApiAmbientV1ProjectSettingsPostRequest) ProjectSettings(projectSettings ProjectSettings) ApiApiAmbientV1ProjectSettingsPostRequest { + r.projectSettings = &projectSettings + return r +} + +func (r ApiApiAmbientV1ProjectSettingsPostRequest) Execute() (*ProjectSettings, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectSettingsPostExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet Preview start context (dry run — no session created) +ApiAmbientV1ProjectSettingsPost Create a new project settings @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The id of record - @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest + @return ApiApiAmbientV1ProjectSettingsPostRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPost(ctx context.Context) ApiApiAmbientV1ProjectSettingsPostRequest { + return ApiApiAmbientV1ProjectSettingsPostRequest{ ApiService: a, ctx: ctx, - id: id, - agentId: agentId, } } // Execute executes the request // -// @return StartResponse -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest) (*StartResponse, *http.Response, error) { +// @return ProjectSettings +func (a *DefaultAPIService) ApiAmbientV1ProjectSettingsPostExecute(r ApiApiAmbientV1ProjectSettingsPostRequest) (*ProjectSettings, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *StartResponse + localVarReturnValue *ProjectSettings ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectSettingsPost") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/ignition" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + localVarPath := localBasePath + "/api/ambient/v1/project_settings" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.projectSettings == nil { + return localVarReturnValue, nil, reportError("projectSettings is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1734,6 +1701,8 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecut if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.projectSettings req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1756,6 +1725,17 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecut body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1778,7 +1758,7 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecut newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1814,67 +1794,80 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecut return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest struct { +type ApiApiAmbientV1ProjectsGetRequest struct { ctx context.Context ApiService *DefaultAPIService - id string - agentId string page *int32 size *int32 + search *string + orderBy *string + fields *string } // Page number of record list when record list exceeds specified page size -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) Page(page int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest { +func (r ApiApiAmbientV1ProjectsGetRequest) Page(page int32) ApiApiAmbientV1ProjectsGetRequest { r.page = &page return r } // Maximum number of records to return -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) Size(size int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest { +func (r ApiApiAmbientV1ProjectsGetRequest) Size(size int32) ApiApiAmbientV1ProjectsGetRequest { r.size = &size return r } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) Execute() (*InboxMessageList, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r) +// Specifies the search criteria +func (r ApiApiAmbientV1ProjectsGetRequest) Search(search string) ApiApiAmbientV1ProjectsGetRequest { + r.search = &search + return r +} + +// Specifies the order by criteria +func (r ApiApiAmbientV1ProjectsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1ProjectsGetRequest { + r.orderBy = &orderBy + return r +} + +// Supplies a comma-separated list of fields to be returned +func (r ApiApiAmbientV1ProjectsGetRequest) Fields(fields string) ApiApiAmbientV1ProjectsGetRequest { + r.fields = &fields + return r +} + +func (r ApiApiAmbientV1ProjectsGetRequest) Execute() (*ProjectList, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet Read inbox messages for an agent (unread first) +ApiAmbientV1ProjectsGet Returns a list of projects @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The id of record - @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest + @return ApiApiAmbientV1ProjectsGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectsGet(ctx context.Context) ApiApiAmbientV1ProjectsGetRequest { + return ApiApiAmbientV1ProjectsGetRequest{ ApiService: a, ctx: ctx, - id: id, - agentId: agentId, } } // Execute executes the request // -// @return InboxMessageList -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) (*InboxMessageList, *http.Response, error) { +// @return ProjectList +func (a *DefaultAPIService) ApiAmbientV1ProjectsGetExecute(r ApiApiAmbientV1ProjectsGetRequest) (*ProjectList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InboxMessageList + localVarReturnValue *ProjectList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + localVarPath := localBasePath + "/api/ambient/v1/projects" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1892,10 +1885,19 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r var defaultValue int32 = 100 r.size = &defaultValue } - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "form", "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "form", "") + } + if r.fields != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType @@ -1953,17 +1955,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1989,54 +1980,50 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest struct { +type ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest struct { ctx context.Context ApiService *DefaultAPIService id string agentId string - msgId string } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest) Execute() (*http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteExecute(r) +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdDeleteExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete Delete an inbox message +ApiAmbientV1ProjectsIdAgentsAgentIdDelete Delete an agent from a project @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record @param agentId The id of the agent - @param msgId The id of the inbox message - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete(ctx context.Context, id string, agentId string, msgId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdDelete(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest{ ApiService: a, ctx: ctx, id: id, agentId: agentId, - msgId: msgId, } } // Execute executes the request -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest) (*http.Response, error) { +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdDeleteExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdDelete") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id}" + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"msg_id"+"}", url.PathEscape(parameterValueToString(r.msgId, "msgId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2130,74 +2117,60 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteE return localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string - agentId string - msgId string - inboxMessagePatchRequest *InboxMessagePatchRequest -} - -// Inbox message patch -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest) InboxMessagePatchRequest(inboxMessagePatchRequest InboxMessagePatchRequest) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest { - r.inboxMessagePatchRequest = &inboxMessagePatchRequest - return r +type ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest) Execute() (*InboxMessage, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchExecute(r) +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest) Execute() (*Agent, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch Mark an inbox message as read +ApiAmbientV1ProjectsIdAgentsAgentIdGet Get an agent by id @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record @param agentId The id of the agent - @param msgId The id of the inbox message - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch(ctx context.Context, id string, agentId string, msgId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest{ ApiService: a, ctx: ctx, id: id, agentId: agentId, - msgId: msgId, } } // Execute executes the request // -// @return InboxMessage -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest) (*InboxMessage, *http.Response, error) { +// @return Agent +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest) (*Agent, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InboxMessage + localVarReturnValue *Agent ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id}" + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"msg_id"+"}", url.PathEscape(parameterValueToString(r.msgId, "msgId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.inboxMessagePatchRequest == nil { - return localVarReturnValue, nil, reportError("inboxMessagePatchRequest is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2213,8 +2186,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchEx if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.inboxMessagePatchRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2295,34 +2266,27 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchEx return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string - agentId string - inboxMessage *InboxMessage -} - -// Inbox message to send -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest) InboxMessage(inboxMessage InboxMessage) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest { - r.inboxMessage = &inboxMessage - return r +type ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest) Execute() (*InboxMessage, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute(r) +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest) Execute() (*StartResponse, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost Send a message to an agent's inbox +ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet Preview start context (dry run — no session created) @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest{ ApiService: a, ctx: ctx, id: id, @@ -2332,33 +2296,30 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost(ctx con // Execute executes the request // -// @return InboxMessage -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest) (*InboxMessage, *http.Response, error) { +// @return StartResponse +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest) (*StartResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InboxMessage + localVarReturnValue *StartResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox" + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/ignition" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.inboxMessage == nil { - return localVarReturnValue, nil, reportError("inboxMessage is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2374,8 +2335,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute( if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.inboxMessage req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2398,17 +2357,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute( body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2467,34 +2415,41 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute( return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string - agentId string - agentPatchRequest *AgentPatchRequest +type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string + page *int32 + size *int32 } -// Updated agent data -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest) AgentPatchRequest(agentPatchRequest AgentPatchRequest) ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest { - r.agentPatchRequest = &agentPatchRequest +// Page number of record list when record list exceeds specified page size +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) Page(page int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest { + r.page = &page return r } -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest) Execute() (*Agent, *http.Response, error) { - return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r) +// Maximum number of records to return +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) Size(size int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest { + r.size = &size + return r +} + +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) Execute() (*InboxMessageList, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdPatch Update an agent (name, prompt, labels, annotations) +ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet Read inbox messages for an agent (unread first) @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatch(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest{ ApiService: a, ctx: ctx, id: id, @@ -2504,33 +2459,42 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatch(ctx context // Execute executes the request // -// @return Agent -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest) (*Agent, *http.Response, error) { +// @return InboxMessageList +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest) (*InboxMessageList, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Agent + localVarReturnValue *InboxMessageList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}" + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.agentPatchRequest == nil { - return localVarReturnValue, nil, reportError("agentPatchRequest is required and must be specified") - } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 100 + r.size = &defaultValue + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2546,8 +2510,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r Ap if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.agentPatchRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2570,17 +2532,6 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r Ap body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2639,41 +2590,863 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r Ap return localVarReturnValue, localVarHTTPResponse, nil } -type ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest struct { +type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest struct { ctx context.Context ApiService *DefaultAPIService id string agentId string - page *int32 - size *int32 + msgId string } -// Page number of record list when record list exceeds specified page size -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) Page(page int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest { - r.page = &page - return r +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteExecute(r) } -// Maximum number of records to return -func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) Size(size int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest { - r.size = &size - return r -} +/* +ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete Delete an inbox message + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of record + @param agentId The id of the agent + @param msgId The id of the inbox message + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest +*/ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete(ctx context.Context, id string, agentId string, msgId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest{ + ApiService: a, + ctx: ctx, + id: id, + agentId: agentId, + msgId: msgId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"msg_id"+"}", url.PathEscape(parameterValueToString(r.msgId, "msgId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string + msgId string + inboxMessagePatchRequest *InboxMessagePatchRequest +} + +// Inbox message patch +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest) InboxMessagePatchRequest(inboxMessagePatchRequest InboxMessagePatchRequest) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest { + r.inboxMessagePatchRequest = &inboxMessagePatchRequest + return r +} + +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest) Execute() (*InboxMessage, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchExecute(r) +} + +/* +ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch Mark an inbox message as read + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of record + @param agentId The id of the agent + @param msgId The id of the inbox message + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest +*/ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch(ctx context.Context, id string, agentId string, msgId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest{ + ApiService: a, + ctx: ctx, + id: id, + agentId: agentId, + msgId: msgId, + } +} + +// Execute executes the request +// +// @return InboxMessage +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest) (*InboxMessage, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InboxMessage + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"msg_id"+"}", url.PathEscape(parameterValueToString(r.msgId, "msgId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inboxMessagePatchRequest == nil { + return localVarReturnValue, nil, reportError("inboxMessagePatchRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inboxMessagePatchRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string + inboxMessage *InboxMessage +} + +// Inbox message to send +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest) InboxMessage(inboxMessage InboxMessage) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest { + r.inboxMessage = &inboxMessage + return r +} + +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest) Execute() (*InboxMessage, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute(r) +} + +/* +ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost Send a message to an agent's inbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of record + @param agentId The id of the agent + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest +*/ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest{ + ApiService: a, + ctx: ctx, + id: id, + agentId: agentId, + } +} + +// Execute executes the request +// +// @return InboxMessage +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdInboxPostExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest) (*InboxMessage, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InboxMessage + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/inbox" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inboxMessage == nil { + return localVarReturnValue, nil, reportError("inboxMessage is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inboxMessage + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string + agentPatchRequest *AgentPatchRequest +} + +// Updated agent data +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest) AgentPatchRequest(agentPatchRequest AgentPatchRequest) ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest { + r.agentPatchRequest = &agentPatchRequest + return r +} + +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest) Execute() (*Agent, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r) +} + +/* +ApiAmbientV1ProjectsIdAgentsAgentIdPatch Update an agent (name, prompt, labels, annotations) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of record + @param agentId The id of the agent + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest +*/ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatch(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest{ + ApiService: a, + ctx: ctx, + id: id, + agentId: agentId, + } +} + +// Execute executes the request +// +// @return Agent +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdPatchExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest) (*Agent, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Agent + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdPatch") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.agentPatchRequest == nil { + return localVarReturnValue, nil, reportError("agentPatchRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.agentPatchRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string + page *int32 + size *int32 +} + +// Page number of record list when record list exceeds specified page size +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) Page(page int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest { + r.page = &page + return r +} + +// Maximum number of records to return +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) Size(size int32) ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest { + r.size = &size + return r +} func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) Execute() (*AgentSessionList, *http.Response, error) { return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetExecute(r) } /* -ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet Get session run history for an agent +ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet Get session run history for an agent + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of record + @param agentId The id of the agent + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest +*/ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest{ + ApiService: a, + ctx: ctx, + id: id, + agentId: agentId, + } +} + +// Execute executes the request +// +// @return AgentSessionList +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) (*AgentSessionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AgentSessionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/sessions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 100 + r.size = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + agentId string + startRequest *StartRequest +} + +// Optional start parameters +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest) StartRequest(startRequest StartRequest) ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest { + r.startRequest = &startRequest + return r +} + +func (r ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest) Execute() (*StartResponse, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute(r) +} + +/* +ApiAmbientV1ProjectsIdAgentsAgentIdStartPost Start an agent — creates a Session (idempotent) + +Creates a new Session for this Agent and drains the inbox into the start context. +If an active session already exists, it is returned as-is. +Unread Inbox messages are marked read and injected as context before the first turn. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id The id of record @param agentId The id of the agent - @return ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest + @return ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest */ -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest { - return ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest{ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPost(ctx context.Context, id string, agentId string) ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest { + return ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest{ ApiService: a, ctx: ctx, id: id, @@ -2683,21 +3456,21 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet(ctx c // Execute executes the request // -// @return AgentSessionList -func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest) (*AgentSessionList, *http.Response, error) { +// @return StartResponse +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdStartPostExecute(r ApiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest) (*StartResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AgentSessionList + localVarReturnValue *StartResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsAgentIdStartPost") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/sessions" + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents/{agent_id}/start" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) localVarPath = strings.Replace(localVarPath, "{"+"agent_id"+"}", url.PathEscape(parameterValueToString(r.agentId, "agentId")), -1) @@ -2705,6 +3478,188 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetExecut localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.startRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiApiAmbientV1ProjectsIdAgentsGetRequest struct { + ctx context.Context + ApiService *DefaultAPIService + id string + page *int32 + size *int32 + search *string + orderBy *string + fields *string +} + +// Page number of record list when record list exceeds specified page size +func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Page(page int32) ApiApiAmbientV1ProjectsIdAgentsGetRequest { + r.page = &page + return r +} + +// Maximum number of records to return +func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Size(size int32) ApiApiAmbientV1ProjectsIdAgentsGetRequest { + r.size = &size + return r +} + +// Specifies the search criteria +func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Search(search string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { + r.search = &search + return r +} + +// Specifies the order by criteria +func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) OrderBy(orderBy string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { + r.orderBy = &orderBy + return r +} + +// Supplies a comma-separated list of fields to be returned +func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Fields(fields string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { + r.fields = &fields + return r +} + +func (r ApiApiAmbientV1ProjectsIdAgentsGetRequest) Execute() (*AgentList, *http.Response, error) { + return r.ApiService.ApiAmbientV1ProjectsIdAgentsGetExecute(r) +} + +/* +ApiAmbientV1ProjectsIdAgentsGet Returns a list of agents in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id The id of record + @return ApiApiAmbientV1ProjectsIdAgentsGetRequest +*/ +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsGet(ctx context.Context, id string) ApiApiAmbientV1ProjectsIdAgentsGetRequest { + return ApiApiAmbientV1ProjectsIdAgentsGetRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return AgentList +func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsGetExecute(r ApiApiAmbientV1ProjectsIdAgentsGetRequest) (*AgentList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AgentList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ApiAmbientV1ProjectsIdAgentsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/ambient/v1/projects/{id}/agents" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.page != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } else { @@ -2717,6 +3672,15 @@ func (a *DefaultAPIService) ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetExecut var defaultValue int32 = 100 r.size = &defaultValue } + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "form", "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "form", "") + } + if r.fields != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgent.md b/components/ambient-api-server/pkg/api/openapi/docs/Agent.md similarity index 70% rename from components/ambient-api-server/pkg/api/openapi/docs/ProjectAgent.md rename to components/ambient-api-server/pkg/api/openapi/docs/Agent.md index 0c2792e53..3f53a91d9 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgent.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/Agent.md @@ -1,4 +1,4 @@ -# ProjectAgent +# Agent ## Properties @@ -18,285 +18,285 @@ Name | Type | Description | Notes ## Methods -### NewProjectAgent +### NewAgent -`func NewProjectAgent(projectId string, name string, ) *ProjectAgent` +`func NewAgent(projectId string, name string, ) *Agent` -NewProjectAgent instantiates a new ProjectAgent object +NewAgent instantiates a new Agent object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewProjectAgentWithDefaults +### NewAgentWithDefaults -`func NewProjectAgentWithDefaults() *ProjectAgent` +`func NewAgentWithDefaults() *Agent` -NewProjectAgentWithDefaults instantiates a new ProjectAgent object +NewAgentWithDefaults instantiates a new Agent object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetId -`func (o *ProjectAgent) GetId() string` +`func (o *Agent) GetId() string` GetId returns the Id field if non-nil, zero value otherwise. ### GetIdOk -`func (o *ProjectAgent) GetIdOk() (*string, bool)` +`func (o *Agent) GetIdOk() (*string, bool)` GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetId -`func (o *ProjectAgent) SetId(v string)` +`func (o *Agent) SetId(v string)` SetId sets Id field to given value. ### HasId -`func (o *ProjectAgent) HasId() bool` +`func (o *Agent) HasId() bool` HasId returns a boolean if a field has been set. ### GetKind -`func (o *ProjectAgent) GetKind() string` +`func (o *Agent) GetKind() string` GetKind returns the Kind field if non-nil, zero value otherwise. ### GetKindOk -`func (o *ProjectAgent) GetKindOk() (*string, bool)` +`func (o *Agent) GetKindOk() (*string, bool)` GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetKind -`func (o *ProjectAgent) SetKind(v string)` +`func (o *Agent) SetKind(v string)` SetKind sets Kind field to given value. ### HasKind -`func (o *ProjectAgent) HasKind() bool` +`func (o *Agent) HasKind() bool` HasKind returns a boolean if a field has been set. ### GetHref -`func (o *ProjectAgent) GetHref() string` +`func (o *Agent) GetHref() string` GetHref returns the Href field if non-nil, zero value otherwise. ### GetHrefOk -`func (o *ProjectAgent) GetHrefOk() (*string, bool)` +`func (o *Agent) GetHrefOk() (*string, bool)` GetHrefOk returns a tuple with the Href field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetHref -`func (o *ProjectAgent) SetHref(v string)` +`func (o *Agent) SetHref(v string)` SetHref sets Href field to given value. ### HasHref -`func (o *ProjectAgent) HasHref() bool` +`func (o *Agent) HasHref() bool` HasHref returns a boolean if a field has been set. ### GetCreatedAt -`func (o *ProjectAgent) GetCreatedAt() time.Time` +`func (o *Agent) GetCreatedAt() time.Time` GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. ### GetCreatedAtOk -`func (o *ProjectAgent) GetCreatedAtOk() (*time.Time, bool)` +`func (o *Agent) GetCreatedAtOk() (*time.Time, bool)` GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetCreatedAt -`func (o *ProjectAgent) SetCreatedAt(v time.Time)` +`func (o *Agent) SetCreatedAt(v time.Time)` SetCreatedAt sets CreatedAt field to given value. ### HasCreatedAt -`func (o *ProjectAgent) HasCreatedAt() bool` +`func (o *Agent) HasCreatedAt() bool` HasCreatedAt returns a boolean if a field has been set. ### GetUpdatedAt -`func (o *ProjectAgent) GetUpdatedAt() time.Time` +`func (o *Agent) GetUpdatedAt() time.Time` GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. ### GetUpdatedAtOk -`func (o *ProjectAgent) GetUpdatedAtOk() (*time.Time, bool)` +`func (o *Agent) GetUpdatedAtOk() (*time.Time, bool)` GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetUpdatedAt -`func (o *ProjectAgent) SetUpdatedAt(v time.Time)` +`func (o *Agent) SetUpdatedAt(v time.Time)` SetUpdatedAt sets UpdatedAt field to given value. ### HasUpdatedAt -`func (o *ProjectAgent) HasUpdatedAt() bool` +`func (o *Agent) HasUpdatedAt() bool` HasUpdatedAt returns a boolean if a field has been set. ### GetProjectId -`func (o *ProjectAgent) GetProjectId() string` +`func (o *Agent) GetProjectId() string` GetProjectId returns the ProjectId field if non-nil, zero value otherwise. ### GetProjectIdOk -`func (o *ProjectAgent) GetProjectIdOk() (*string, bool)` +`func (o *Agent) GetProjectIdOk() (*string, bool)` GetProjectIdOk returns a tuple with the ProjectId field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetProjectId -`func (o *ProjectAgent) SetProjectId(v string)` +`func (o *Agent) SetProjectId(v string)` SetProjectId sets ProjectId field to given value. ### GetName -`func (o *ProjectAgent) GetName() string` +`func (o *Agent) GetName() string` GetName returns the Name field if non-nil, zero value otherwise. ### GetNameOk -`func (o *ProjectAgent) GetNameOk() (*string, bool)` +`func (o *Agent) GetNameOk() (*string, bool)` GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetName -`func (o *ProjectAgent) SetName(v string)` +`func (o *Agent) SetName(v string)` SetName sets Name field to given value. ### GetPrompt -`func (o *ProjectAgent) GetPrompt() string` +`func (o *Agent) GetPrompt() string` GetPrompt returns the Prompt field if non-nil, zero value otherwise. ### GetPromptOk -`func (o *ProjectAgent) GetPromptOk() (*string, bool)` +`func (o *Agent) GetPromptOk() (*string, bool)` GetPromptOk returns a tuple with the Prompt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPrompt -`func (o *ProjectAgent) SetPrompt(v string)` +`func (o *Agent) SetPrompt(v string)` SetPrompt sets Prompt field to given value. ### HasPrompt -`func (o *ProjectAgent) HasPrompt() bool` +`func (o *Agent) HasPrompt() bool` HasPrompt returns a boolean if a field has been set. ### GetCurrentSessionId -`func (o *ProjectAgent) GetCurrentSessionId() string` +`func (o *Agent) GetCurrentSessionId() string` GetCurrentSessionId returns the CurrentSessionId field if non-nil, zero value otherwise. ### GetCurrentSessionIdOk -`func (o *ProjectAgent) GetCurrentSessionIdOk() (*string, bool)` +`func (o *Agent) GetCurrentSessionIdOk() (*string, bool)` GetCurrentSessionIdOk returns a tuple with the CurrentSessionId field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetCurrentSessionId -`func (o *ProjectAgent) SetCurrentSessionId(v string)` +`func (o *Agent) SetCurrentSessionId(v string)` SetCurrentSessionId sets CurrentSessionId field to given value. ### HasCurrentSessionId -`func (o *ProjectAgent) HasCurrentSessionId() bool` +`func (o *Agent) HasCurrentSessionId() bool` HasCurrentSessionId returns a boolean if a field has been set. ### GetLabels -`func (o *ProjectAgent) GetLabels() string` +`func (o *Agent) GetLabels() string` GetLabels returns the Labels field if non-nil, zero value otherwise. ### GetLabelsOk -`func (o *ProjectAgent) GetLabelsOk() (*string, bool)` +`func (o *Agent) GetLabelsOk() (*string, bool)` GetLabelsOk returns a tuple with the Labels field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetLabels -`func (o *ProjectAgent) SetLabels(v string)` +`func (o *Agent) SetLabels(v string)` SetLabels sets Labels field to given value. ### HasLabels -`func (o *ProjectAgent) HasLabels() bool` +`func (o *Agent) HasLabels() bool` HasLabels returns a boolean if a field has been set. ### GetAnnotations -`func (o *ProjectAgent) GetAnnotations() string` +`func (o *Agent) GetAnnotations() string` GetAnnotations returns the Annotations field if non-nil, zero value otherwise. ### GetAnnotationsOk -`func (o *ProjectAgent) GetAnnotationsOk() (*string, bool)` +`func (o *Agent) GetAnnotationsOk() (*string, bool)` GetAnnotationsOk returns a tuple with the Annotations field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetAnnotations -`func (o *ProjectAgent) SetAnnotations(v string)` +`func (o *Agent) SetAnnotations(v string)` SetAnnotations sets Annotations field to given value. ### HasAnnotations -`func (o *ProjectAgent) HasAnnotations() bool` +`func (o *Agent) HasAnnotations() bool` HasAnnotations returns a boolean if a field has been set. diff --git a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentSessionList.md b/components/ambient-api-server/pkg/api/openapi/docs/AgentList.md similarity index 61% rename from components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentSessionList.md rename to components/ambient-api-server/pkg/api/openapi/docs/AgentList.md index 20f26fdb7..482ec884e 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentSessionList.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/AgentList.md @@ -1,4 +1,4 @@ -# ProjectAgentSessionList +# AgentList ## Properties @@ -8,123 +8,123 @@ Name | Type | Description | Notes **Page** | **int32** | | **Size** | **int32** | | **Total** | **int32** | | -**Items** | [**[]Session**](Session.md) | | +**Items** | [**[]Agent**](Agent.md) | | ## Methods -### NewProjectAgentSessionList +### NewAgentList -`func NewProjectAgentSessionList(kind string, page int32, size int32, total int32, items []Session, ) *ProjectAgentSessionList` +`func NewAgentList(kind string, page int32, size int32, total int32, items []Agent, ) *AgentList` -NewProjectAgentSessionList instantiates a new ProjectAgentSessionList object +NewAgentList instantiates a new AgentList object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewProjectAgentSessionListWithDefaults +### NewAgentListWithDefaults -`func NewProjectAgentSessionListWithDefaults() *ProjectAgentSessionList` +`func NewAgentListWithDefaults() *AgentList` -NewProjectAgentSessionListWithDefaults instantiates a new ProjectAgentSessionList object +NewAgentListWithDefaults instantiates a new AgentList object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetKind -`func (o *ProjectAgentSessionList) GetKind() string` +`func (o *AgentList) GetKind() string` GetKind returns the Kind field if non-nil, zero value otherwise. ### GetKindOk -`func (o *ProjectAgentSessionList) GetKindOk() (*string, bool)` +`func (o *AgentList) GetKindOk() (*string, bool)` GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetKind -`func (o *ProjectAgentSessionList) SetKind(v string)` +`func (o *AgentList) SetKind(v string)` SetKind sets Kind field to given value. ### GetPage -`func (o *ProjectAgentSessionList) GetPage() int32` +`func (o *AgentList) GetPage() int32` GetPage returns the Page field if non-nil, zero value otherwise. ### GetPageOk -`func (o *ProjectAgentSessionList) GetPageOk() (*int32, bool)` +`func (o *AgentList) GetPageOk() (*int32, bool)` GetPageOk returns a tuple with the Page field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPage -`func (o *ProjectAgentSessionList) SetPage(v int32)` +`func (o *AgentList) SetPage(v int32)` SetPage sets Page field to given value. ### GetSize -`func (o *ProjectAgentSessionList) GetSize() int32` +`func (o *AgentList) GetSize() int32` GetSize returns the Size field if non-nil, zero value otherwise. ### GetSizeOk -`func (o *ProjectAgentSessionList) GetSizeOk() (*int32, bool)` +`func (o *AgentList) GetSizeOk() (*int32, bool)` GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSize -`func (o *ProjectAgentSessionList) SetSize(v int32)` +`func (o *AgentList) SetSize(v int32)` SetSize sets Size field to given value. ### GetTotal -`func (o *ProjectAgentSessionList) GetTotal() int32` +`func (o *AgentList) GetTotal() int32` GetTotal returns the Total field if non-nil, zero value otherwise. ### GetTotalOk -`func (o *ProjectAgentSessionList) GetTotalOk() (*int32, bool)` +`func (o *AgentList) GetTotalOk() (*int32, bool)` GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTotal -`func (o *ProjectAgentSessionList) SetTotal(v int32)` +`func (o *AgentList) SetTotal(v int32)` SetTotal sets Total field to given value. ### GetItems -`func (o *ProjectAgentSessionList) GetItems() []Session` +`func (o *AgentList) GetItems() []Agent` GetItems returns the Items field if non-nil, zero value otherwise. ### GetItemsOk -`func (o *ProjectAgentSessionList) GetItemsOk() (*[]Session, bool)` +`func (o *AgentList) GetItemsOk() (*[]Agent, bool)` GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetItems -`func (o *ProjectAgentSessionList) SetItems(v []Session)` +`func (o *AgentList) SetItems(v []Agent)` SetItems sets Items field to given value. diff --git a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentPatchRequest.md b/components/ambient-api-server/pkg/api/openapi/docs/AgentPatchRequest.md similarity index 64% rename from components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentPatchRequest.md rename to components/ambient-api-server/pkg/api/openapi/docs/AgentPatchRequest.md index a8ed47b77..ec9075386 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentPatchRequest.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/AgentPatchRequest.md @@ -1,4 +1,4 @@ -# ProjectAgentPatchRequest +# AgentPatchRequest ## Properties @@ -11,120 +11,120 @@ Name | Type | Description | Notes ## Methods -### NewProjectAgentPatchRequest +### NewAgentPatchRequest -`func NewProjectAgentPatchRequest() *ProjectAgentPatchRequest` +`func NewAgentPatchRequest() *AgentPatchRequest` -NewProjectAgentPatchRequest instantiates a new ProjectAgentPatchRequest object +NewAgentPatchRequest instantiates a new AgentPatchRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewProjectAgentPatchRequestWithDefaults +### NewAgentPatchRequestWithDefaults -`func NewProjectAgentPatchRequestWithDefaults() *ProjectAgentPatchRequest` +`func NewAgentPatchRequestWithDefaults() *AgentPatchRequest` -NewProjectAgentPatchRequestWithDefaults instantiates a new ProjectAgentPatchRequest object +NewAgentPatchRequestWithDefaults instantiates a new AgentPatchRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetName -`func (o *ProjectAgentPatchRequest) GetName() string` +`func (o *AgentPatchRequest) GetName() string` GetName returns the Name field if non-nil, zero value otherwise. ### GetNameOk -`func (o *ProjectAgentPatchRequest) GetNameOk() (*string, bool)` +`func (o *AgentPatchRequest) GetNameOk() (*string, bool)` GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetName -`func (o *ProjectAgentPatchRequest) SetName(v string)` +`func (o *AgentPatchRequest) SetName(v string)` SetName sets Name field to given value. ### HasName -`func (o *ProjectAgentPatchRequest) HasName() bool` +`func (o *AgentPatchRequest) HasName() bool` HasName returns a boolean if a field has been set. ### GetPrompt -`func (o *ProjectAgentPatchRequest) GetPrompt() string` +`func (o *AgentPatchRequest) GetPrompt() string` GetPrompt returns the Prompt field if non-nil, zero value otherwise. ### GetPromptOk -`func (o *ProjectAgentPatchRequest) GetPromptOk() (*string, bool)` +`func (o *AgentPatchRequest) GetPromptOk() (*string, bool)` GetPromptOk returns a tuple with the Prompt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPrompt -`func (o *ProjectAgentPatchRequest) SetPrompt(v string)` +`func (o *AgentPatchRequest) SetPrompt(v string)` SetPrompt sets Prompt field to given value. ### HasPrompt -`func (o *ProjectAgentPatchRequest) HasPrompt() bool` +`func (o *AgentPatchRequest) HasPrompt() bool` HasPrompt returns a boolean if a field has been set. ### GetLabels -`func (o *ProjectAgentPatchRequest) GetLabels() string` +`func (o *AgentPatchRequest) GetLabels() string` GetLabels returns the Labels field if non-nil, zero value otherwise. ### GetLabelsOk -`func (o *ProjectAgentPatchRequest) GetLabelsOk() (*string, bool)` +`func (o *AgentPatchRequest) GetLabelsOk() (*string, bool)` GetLabelsOk returns a tuple with the Labels field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetLabels -`func (o *ProjectAgentPatchRequest) SetLabels(v string)` +`func (o *AgentPatchRequest) SetLabels(v string)` SetLabels sets Labels field to given value. ### HasLabels -`func (o *ProjectAgentPatchRequest) HasLabels() bool` +`func (o *AgentPatchRequest) HasLabels() bool` HasLabels returns a boolean if a field has been set. ### GetAnnotations -`func (o *ProjectAgentPatchRequest) GetAnnotations() string` +`func (o *AgentPatchRequest) GetAnnotations() string` GetAnnotations returns the Annotations field if non-nil, zero value otherwise. ### GetAnnotationsOk -`func (o *ProjectAgentPatchRequest) GetAnnotationsOk() (*string, bool)` +`func (o *AgentPatchRequest) GetAnnotationsOk() (*string, bool)` GetAnnotationsOk returns a tuple with the Annotations field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetAnnotations -`func (o *ProjectAgentPatchRequest) SetAnnotations(v string)` +`func (o *AgentPatchRequest) SetAnnotations(v string)` SetAnnotations sets Annotations field to given value. ### HasAnnotations -`func (o *ProjectAgentPatchRequest) HasAnnotations() bool` +`func (o *AgentPatchRequest) HasAnnotations() bool` HasAnnotations returns a boolean if a field has been set. diff --git a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentList.md b/components/ambient-api-server/pkg/api/openapi/docs/AgentSessionList.md similarity index 64% rename from components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentList.md rename to components/ambient-api-server/pkg/api/openapi/docs/AgentSessionList.md index 28b2a0c8a..61e32e0e6 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/ProjectAgentList.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/AgentSessionList.md @@ -1,4 +1,4 @@ -# ProjectAgentList +# AgentSessionList ## Properties @@ -8,123 +8,123 @@ Name | Type | Description | Notes **Page** | **int32** | | **Size** | **int32** | | **Total** | **int32** | | -**Items** | [**[]ProjectAgent**](ProjectAgent.md) | | +**Items** | [**[]Session**](Session.md) | | ## Methods -### NewProjectAgentList +### NewAgentSessionList -`func NewProjectAgentList(kind string, page int32, size int32, total int32, items []ProjectAgent, ) *ProjectAgentList` +`func NewAgentSessionList(kind string, page int32, size int32, total int32, items []Session, ) *AgentSessionList` -NewProjectAgentList instantiates a new ProjectAgentList object +NewAgentSessionList instantiates a new AgentSessionList object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewProjectAgentListWithDefaults +### NewAgentSessionListWithDefaults -`func NewProjectAgentListWithDefaults() *ProjectAgentList` +`func NewAgentSessionListWithDefaults() *AgentSessionList` -NewProjectAgentListWithDefaults instantiates a new ProjectAgentList object +NewAgentSessionListWithDefaults instantiates a new AgentSessionList object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetKind -`func (o *ProjectAgentList) GetKind() string` +`func (o *AgentSessionList) GetKind() string` GetKind returns the Kind field if non-nil, zero value otherwise. ### GetKindOk -`func (o *ProjectAgentList) GetKindOk() (*string, bool)` +`func (o *AgentSessionList) GetKindOk() (*string, bool)` GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetKind -`func (o *ProjectAgentList) SetKind(v string)` +`func (o *AgentSessionList) SetKind(v string)` SetKind sets Kind field to given value. ### GetPage -`func (o *ProjectAgentList) GetPage() int32` +`func (o *AgentSessionList) GetPage() int32` GetPage returns the Page field if non-nil, zero value otherwise. ### GetPageOk -`func (o *ProjectAgentList) GetPageOk() (*int32, bool)` +`func (o *AgentSessionList) GetPageOk() (*int32, bool)` GetPageOk returns a tuple with the Page field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPage -`func (o *ProjectAgentList) SetPage(v int32)` +`func (o *AgentSessionList) SetPage(v int32)` SetPage sets Page field to given value. ### GetSize -`func (o *ProjectAgentList) GetSize() int32` +`func (o *AgentSessionList) GetSize() int32` GetSize returns the Size field if non-nil, zero value otherwise. ### GetSizeOk -`func (o *ProjectAgentList) GetSizeOk() (*int32, bool)` +`func (o *AgentSessionList) GetSizeOk() (*int32, bool)` GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSize -`func (o *ProjectAgentList) SetSize(v int32)` +`func (o *AgentSessionList) SetSize(v int32)` SetSize sets Size field to given value. ### GetTotal -`func (o *ProjectAgentList) GetTotal() int32` +`func (o *AgentSessionList) GetTotal() int32` GetTotal returns the Total field if non-nil, zero value otherwise. ### GetTotalOk -`func (o *ProjectAgentList) GetTotalOk() (*int32, bool)` +`func (o *AgentSessionList) GetTotalOk() (*int32, bool)` GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTotal -`func (o *ProjectAgentList) SetTotal(v int32)` +`func (o *AgentSessionList) SetTotal(v int32)` SetTotal sets Total field to given value. ### GetItems -`func (o *ProjectAgentList) GetItems() []ProjectAgent` +`func (o *AgentSessionList) GetItems() []Session` GetItems returns the Items field if non-nil, zero value otherwise. ### GetItemsOk -`func (o *ProjectAgentList) GetItemsOk() (*[]ProjectAgent, bool)` +`func (o *AgentSessionList) GetItemsOk() (*[]Session, bool)` GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetItems -`func (o *ProjectAgentList) SetItems(v []ProjectAgent)` +`func (o *AgentSessionList) SetItems(v []Session)` SetItems sets Items field to given value. diff --git a/components/ambient-api-server/pkg/api/openapi/docs/Credential.md b/components/ambient-api-server/pkg/api/openapi/docs/Credential.md new file mode 100644 index 000000000..fa1fe27e5 --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/docs/Credential.md @@ -0,0 +1,358 @@ +# Credential + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Kind** | Pointer to **string** | | [optional] +**Href** | Pointer to **string** | | [optional] +**CreatedAt** | Pointer to **time.Time** | | [optional] +**UpdatedAt** | Pointer to **time.Time** | | [optional] +**Name** | **string** | | +**Description** | Pointer to **string** | | [optional] +**Provider** | **string** | | +**Token** | Pointer to **string** | Credential token value; write-only, never returned in GET/LIST responses | [optional] +**Url** | Pointer to **string** | | [optional] +**Email** | Pointer to **string** | | [optional] +**Labels** | Pointer to **string** | | [optional] +**Annotations** | Pointer to **string** | | [optional] + +## Methods + +### NewCredential + +`func NewCredential(name string, provider string, ) *Credential` + +NewCredential instantiates a new Credential object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCredentialWithDefaults + +`func NewCredentialWithDefaults() *Credential` + +NewCredentialWithDefaults instantiates a new Credential object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Credential) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Credential) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Credential) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Credential) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetKind + +`func (o *Credential) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *Credential) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *Credential) SetKind(v string)` + +SetKind sets Kind field to given value. + +### HasKind + +`func (o *Credential) HasKind() bool` + +HasKind returns a boolean if a field has been set. + +### GetHref + +`func (o *Credential) GetHref() string` + +GetHref returns the Href field if non-nil, zero value otherwise. + +### GetHrefOk + +`func (o *Credential) GetHrefOk() (*string, bool)` + +GetHrefOk returns a tuple with the Href field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHref + +`func (o *Credential) SetHref(v string)` + +SetHref sets Href field to given value. + +### HasHref + +`func (o *Credential) HasHref() bool` + +HasHref returns a boolean if a field has been set. + +### GetCreatedAt + +`func (o *Credential) GetCreatedAt() time.Time` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *Credential) GetCreatedAtOk() (*time.Time, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *Credential) SetCreatedAt(v time.Time)` + +SetCreatedAt sets CreatedAt field to given value. + +### HasCreatedAt + +`func (o *Credential) HasCreatedAt() bool` + +HasCreatedAt returns a boolean if a field has been set. + +### GetUpdatedAt + +`func (o *Credential) GetUpdatedAt() time.Time` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *Credential) GetUpdatedAtOk() (*time.Time, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *Credential) SetUpdatedAt(v time.Time)` + +SetUpdatedAt sets UpdatedAt field to given value. + +### HasUpdatedAt + +`func (o *Credential) HasUpdatedAt() bool` + +HasUpdatedAt returns a boolean if a field has been set. + +### GetName + +`func (o *Credential) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Credential) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Credential) SetName(v string)` + +SetName sets Name field to given value. + + +### GetDescription + +`func (o *Credential) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *Credential) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *Credential) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *Credential) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetProvider + +`func (o *Credential) GetProvider() string` + +GetProvider returns the Provider field if non-nil, zero value otherwise. + +### GetProviderOk + +`func (o *Credential) GetProviderOk() (*string, bool)` + +GetProviderOk returns a tuple with the Provider field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProvider + +`func (o *Credential) SetProvider(v string)` + +SetProvider sets Provider field to given value. + + +### GetToken + +`func (o *Credential) GetToken() string` + +GetToken returns the Token field if non-nil, zero value otherwise. + +### GetTokenOk + +`func (o *Credential) GetTokenOk() (*string, bool)` + +GetTokenOk returns a tuple with the Token field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetToken + +`func (o *Credential) SetToken(v string)` + +SetToken sets Token field to given value. + +### HasToken + +`func (o *Credential) HasToken() bool` + +HasToken returns a boolean if a field has been set. + +### GetUrl + +`func (o *Credential) GetUrl() string` + +GetUrl returns the Url field if non-nil, zero value otherwise. + +### GetUrlOk + +`func (o *Credential) GetUrlOk() (*string, bool)` + +GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUrl + +`func (o *Credential) SetUrl(v string)` + +SetUrl sets Url field to given value. + +### HasUrl + +`func (o *Credential) HasUrl() bool` + +HasUrl returns a boolean if a field has been set. + +### GetEmail + +`func (o *Credential) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *Credential) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *Credential) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *Credential) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetLabels + +`func (o *Credential) GetLabels() string` + +GetLabels returns the Labels field if non-nil, zero value otherwise. + +### GetLabelsOk + +`func (o *Credential) GetLabelsOk() (*string, bool)` + +GetLabelsOk returns a tuple with the Labels field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLabels + +`func (o *Credential) SetLabels(v string)` + +SetLabels sets Labels field to given value. + +### HasLabels + +`func (o *Credential) HasLabels() bool` + +HasLabels returns a boolean if a field has been set. + +### GetAnnotations + +`func (o *Credential) GetAnnotations() string` + +GetAnnotations returns the Annotations field if non-nil, zero value otherwise. + +### GetAnnotationsOk + +`func (o *Credential) GetAnnotationsOk() (*string, bool)` + +GetAnnotationsOk returns a tuple with the Annotations field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAnnotations + +`func (o *Credential) SetAnnotations(v string)` + +SetAnnotations sets Annotations field to given value. + +### HasAnnotations + +`func (o *Credential) HasAnnotations() bool` + +HasAnnotations returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/components/ambient-api-server/pkg/api/openapi/docs/CredentialList.md b/components/ambient-api-server/pkg/api/openapi/docs/CredentialList.md new file mode 100644 index 000000000..ead48d971 --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/docs/CredentialList.md @@ -0,0 +1,135 @@ +# CredentialList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | **string** | | +**Page** | **int32** | | +**Size** | **int32** | | +**Total** | **int32** | | +**Items** | [**[]Credential**](Credential.md) | | + +## Methods + +### NewCredentialList + +`func NewCredentialList(kind string, page int32, size int32, total int32, items []Credential, ) *CredentialList` + +NewCredentialList instantiates a new CredentialList object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCredentialListWithDefaults + +`func NewCredentialListWithDefaults() *CredentialList` + +NewCredentialListWithDefaults instantiates a new CredentialList object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetKind + +`func (o *CredentialList) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *CredentialList) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *CredentialList) SetKind(v string)` + +SetKind sets Kind field to given value. + + +### GetPage + +`func (o *CredentialList) GetPage() int32` + +GetPage returns the Page field if non-nil, zero value otherwise. + +### GetPageOk + +`func (o *CredentialList) GetPageOk() (*int32, bool)` + +GetPageOk returns a tuple with the Page field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPage + +`func (o *CredentialList) SetPage(v int32)` + +SetPage sets Page field to given value. + + +### GetSize + +`func (o *CredentialList) GetSize() int32` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *CredentialList) GetSizeOk() (*int32, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *CredentialList) SetSize(v int32)` + +SetSize sets Size field to given value. + + +### GetTotal + +`func (o *CredentialList) GetTotal() int32` + +GetTotal returns the Total field if non-nil, zero value otherwise. + +### GetTotalOk + +`func (o *CredentialList) GetTotalOk() (*int32, bool)` + +GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotal + +`func (o *CredentialList) SetTotal(v int32)` + +SetTotal sets Total field to given value. + + +### GetItems + +`func (o *CredentialList) GetItems() []Credential` + +GetItems returns the Items field if non-nil, zero value otherwise. + +### GetItemsOk + +`func (o *CredentialList) GetItemsOk() (*[]Credential, bool)` + +GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetItems + +`func (o *CredentialList) SetItems(v []Credential)` + +SetItems sets Items field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/components/ambient-api-server/pkg/api/openapi/docs/CredentialPatchRequest.md b/components/ambient-api-server/pkg/api/openapi/docs/CredentialPatchRequest.md new file mode 100644 index 000000000..b06cdbfac --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/docs/CredentialPatchRequest.md @@ -0,0 +1,238 @@ +# CredentialPatchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] +**Description** | Pointer to **string** | | [optional] +**Provider** | Pointer to **string** | | [optional] +**Token** | Pointer to **string** | Credential token value; write-only, never returned in GET/LIST responses | [optional] +**Url** | Pointer to **string** | | [optional] +**Email** | Pointer to **string** | | [optional] +**Labels** | Pointer to **string** | | [optional] +**Annotations** | Pointer to **string** | | [optional] + +## Methods + +### NewCredentialPatchRequest + +`func NewCredentialPatchRequest() *CredentialPatchRequest` + +NewCredentialPatchRequest instantiates a new CredentialPatchRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCredentialPatchRequestWithDefaults + +`func NewCredentialPatchRequestWithDefaults() *CredentialPatchRequest` + +NewCredentialPatchRequestWithDefaults instantiates a new CredentialPatchRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *CredentialPatchRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *CredentialPatchRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *CredentialPatchRequest) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *CredentialPatchRequest) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetDescription + +`func (o *CredentialPatchRequest) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *CredentialPatchRequest) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *CredentialPatchRequest) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *CredentialPatchRequest) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetProvider + +`func (o *CredentialPatchRequest) GetProvider() string` + +GetProvider returns the Provider field if non-nil, zero value otherwise. + +### GetProviderOk + +`func (o *CredentialPatchRequest) GetProviderOk() (*string, bool)` + +GetProviderOk returns a tuple with the Provider field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProvider + +`func (o *CredentialPatchRequest) SetProvider(v string)` + +SetProvider sets Provider field to given value. + +### HasProvider + +`func (o *CredentialPatchRequest) HasProvider() bool` + +HasProvider returns a boolean if a field has been set. + +### GetToken + +`func (o *CredentialPatchRequest) GetToken() string` + +GetToken returns the Token field if non-nil, zero value otherwise. + +### GetTokenOk + +`func (o *CredentialPatchRequest) GetTokenOk() (*string, bool)` + +GetTokenOk returns a tuple with the Token field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetToken + +`func (o *CredentialPatchRequest) SetToken(v string)` + +SetToken sets Token field to given value. + +### HasToken + +`func (o *CredentialPatchRequest) HasToken() bool` + +HasToken returns a boolean if a field has been set. + +### GetUrl + +`func (o *CredentialPatchRequest) GetUrl() string` + +GetUrl returns the Url field if non-nil, zero value otherwise. + +### GetUrlOk + +`func (o *CredentialPatchRequest) GetUrlOk() (*string, bool)` + +GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUrl + +`func (o *CredentialPatchRequest) SetUrl(v string)` + +SetUrl sets Url field to given value. + +### HasUrl + +`func (o *CredentialPatchRequest) HasUrl() bool` + +HasUrl returns a boolean if a field has been set. + +### GetEmail + +`func (o *CredentialPatchRequest) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *CredentialPatchRequest) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *CredentialPatchRequest) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *CredentialPatchRequest) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetLabels + +`func (o *CredentialPatchRequest) GetLabels() string` + +GetLabels returns the Labels field if non-nil, zero value otherwise. + +### GetLabelsOk + +`func (o *CredentialPatchRequest) GetLabelsOk() (*string, bool)` + +GetLabelsOk returns a tuple with the Labels field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLabels + +`func (o *CredentialPatchRequest) SetLabels(v string)` + +SetLabels sets Labels field to given value. + +### HasLabels + +`func (o *CredentialPatchRequest) HasLabels() bool` + +HasLabels returns a boolean if a field has been set. + +### GetAnnotations + +`func (o *CredentialPatchRequest) GetAnnotations() string` + +GetAnnotations returns the Annotations field if non-nil, zero value otherwise. + +### GetAnnotationsOk + +`func (o *CredentialPatchRequest) GetAnnotationsOk() (*string, bool)` + +GetAnnotationsOk returns a tuple with the Annotations field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAnnotations + +`func (o *CredentialPatchRequest) SetAnnotations(v string)` + +SetAnnotations sets Annotations field to given value. + +### HasAnnotations + +`func (o *CredentialPatchRequest) HasAnnotations() bool` + +HasAnnotations returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/components/ambient-api-server/pkg/api/openapi/docs/CredentialTokenResponse.md b/components/ambient-api-server/pkg/api/openapi/docs/CredentialTokenResponse.md new file mode 100644 index 000000000..ba3fff738 --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/docs/CredentialTokenResponse.md @@ -0,0 +1,93 @@ +# CredentialTokenResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**CredentialId** | **string** | ID of the credential | +**Provider** | **string** | Provider type for this credential | +**Token** | **string** | Decrypted token value | + +## Methods + +### NewCredentialTokenResponse + +`func NewCredentialTokenResponse(credentialId string, provider string, token string, ) *CredentialTokenResponse` + +NewCredentialTokenResponse instantiates a new CredentialTokenResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCredentialTokenResponseWithDefaults + +`func NewCredentialTokenResponseWithDefaults() *CredentialTokenResponse` + +NewCredentialTokenResponseWithDefaults instantiates a new CredentialTokenResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCredentialId + +`func (o *CredentialTokenResponse) GetCredentialId() string` + +GetCredentialId returns the CredentialId field if non-nil, zero value otherwise. + +### GetCredentialIdOk + +`func (o *CredentialTokenResponse) GetCredentialIdOk() (*string, bool)` + +GetCredentialIdOk returns a tuple with the CredentialId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCredentialId + +`func (o *CredentialTokenResponse) SetCredentialId(v string)` + +SetCredentialId sets CredentialId field to given value. + + +### GetProvider + +`func (o *CredentialTokenResponse) GetProvider() string` + +GetProvider returns the Provider field if non-nil, zero value otherwise. + +### GetProviderOk + +`func (o *CredentialTokenResponse) GetProviderOk() (*string, bool)` + +GetProviderOk returns a tuple with the Provider field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProvider + +`func (o *CredentialTokenResponse) SetProvider(v string)` + +SetProvider sets Provider field to given value. + + +### GetToken + +`func (o *CredentialTokenResponse) GetToken() string` + +GetToken returns the Token field if non-nil, zero value otherwise. + +### GetTokenOk + +`func (o *CredentialTokenResponse) GetTokenOk() (*string, bool)` + +GetTokenOk returns a tuple with the Token field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetToken + +`func (o *CredentialTokenResponse) SetToken(v string)` + +SetToken sets Token field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/components/ambient-api-server/pkg/api/openapi/docs/DefaultAPI.md b/components/ambient-api-server/pkg/api/openapi/docs/DefaultAPI.md index 219208631..fb7a61ef6 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/DefaultAPI.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/DefaultAPI.md @@ -4,23 +4,29 @@ All URIs are relative to *http://localhost:8000* Method | HTTP request | Description ------------- | ------------- | ------------- +[**ApiAmbientV1CredentialsGet**](DefaultAPI.md#ApiAmbientV1CredentialsGet) | **Get** /api/ambient/v1/credentials | Returns a list of credentials +[**ApiAmbientV1CredentialsIdDelete**](DefaultAPI.md#ApiAmbientV1CredentialsIdDelete) | **Delete** /api/ambient/v1/credentials/{id} | Delete a credential +[**ApiAmbientV1CredentialsIdGet**](DefaultAPI.md#ApiAmbientV1CredentialsIdGet) | **Get** /api/ambient/v1/credentials/{id} | Get an credential by id +[**ApiAmbientV1CredentialsIdPatch**](DefaultAPI.md#ApiAmbientV1CredentialsIdPatch) | **Patch** /api/ambient/v1/credentials/{id} | Update an credential +[**ApiAmbientV1CredentialsIdTokenGet**](DefaultAPI.md#ApiAmbientV1CredentialsIdTokenGet) | **Get** /api/ambient/v1/credentials/{id}/token | Get a decrypted token for a credential +[**ApiAmbientV1CredentialsPost**](DefaultAPI.md#ApiAmbientV1CredentialsPost) | **Post** /api/ambient/v1/credentials | Create a new credential [**ApiAmbientV1ProjectSettingsGet**](DefaultAPI.md#ApiAmbientV1ProjectSettingsGet) | **Get** /api/ambient/v1/project_settings | Returns a list of project settings [**ApiAmbientV1ProjectSettingsIdDelete**](DefaultAPI.md#ApiAmbientV1ProjectSettingsIdDelete) | **Delete** /api/ambient/v1/project_settings/{id} | Delete a project settings by id [**ApiAmbientV1ProjectSettingsIdGet**](DefaultAPI.md#ApiAmbientV1ProjectSettingsIdGet) | **Get** /api/ambient/v1/project_settings/{id} | Get a project settings by id [**ApiAmbientV1ProjectSettingsIdPatch**](DefaultAPI.md#ApiAmbientV1ProjectSettingsIdPatch) | **Patch** /api/ambient/v1/project_settings/{id} | Update a project settings [**ApiAmbientV1ProjectSettingsPost**](DefaultAPI.md#ApiAmbientV1ProjectSettingsPost) | **Post** /api/ambient/v1/project_settings | Create a new project settings [**ApiAmbientV1ProjectsGet**](DefaultAPI.md#ApiAmbientV1ProjectsGet) | **Get** /api/ambient/v1/projects | Returns a list of projects +[**ApiAmbientV1ProjectsIdAgentsAgentIdDelete**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdDelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{agent_id} | Delete an agent from a project +[**ApiAmbientV1ProjectsIdAgentsAgentIdGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdGet) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id} | Get an agent by id +[**ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id}/ignition | Preview start context (dry run — no session created) +[**ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox | Read inbox messages for an agent (unread first) +[**ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id} | Delete an inbox message +[**ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox/{msg_id} | Mark an inbox message as read +[**ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost) | **Post** /api/ambient/v1/projects/{id}/agents/{agent_id}/inbox | Send a message to an agent's inbox +[**ApiAmbientV1ProjectsIdAgentsAgentIdPatch**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdPatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{agent_id} | Update an agent (name, prompt, labels, annotations) +[**ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet) | **Get** /api/ambient/v1/projects/{id}/agents/{agent_id}/sessions | Get session run history for an agent +[**ApiAmbientV1ProjectsIdAgentsAgentIdStartPost**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsAgentIdStartPost) | **Post** /api/ambient/v1/projects/{id}/agents/{agent_id}/start | Start an agent — creates a Session (idempotent) [**ApiAmbientV1ProjectsIdAgentsGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsGet) | **Get** /api/ambient/v1/projects/{id}/agents | Returns a list of agents in a project -[**ApiAmbientV1ProjectsIdAgentsPaIdDelete**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdDelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{pa_id} | Delete an agent from a project -[**ApiAmbientV1ProjectsIdAgentsPaIdGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdGet) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id} | Get an agent by id -[**ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost) | **Post** /api/ambient/v1/projects/{id}/agents/{pa_id}/ignite | Ignite an agent — creates a Session (idempotent) -[**ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id}/ignition | Preview ignition context (dry run — no session created) -[**ApiAmbientV1ProjectsIdAgentsPaIdInboxGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdInboxGet) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox | Read inbox messages for an agent (unread first) -[**ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete) | **Delete** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox/{msg_id} | Delete an inbox message -[**ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox/{msg_id} | Mark an inbox message as read -[**ApiAmbientV1ProjectsIdAgentsPaIdInboxPost**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdInboxPost) | **Post** /api/ambient/v1/projects/{id}/agents/{pa_id}/inbox | Send a message to an agent's inbox -[**ApiAmbientV1ProjectsIdAgentsPaIdPatch**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdPatch) | **Patch** /api/ambient/v1/projects/{id}/agents/{pa_id} | Update an agent (name, prompt, labels, annotations) -[**ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet) | **Get** /api/ambient/v1/projects/{id}/agents/{pa_id}/sessions | Get session run history for an agent [**ApiAmbientV1ProjectsIdAgentsPost**](DefaultAPI.md#ApiAmbientV1ProjectsIdAgentsPost) | **Post** /api/ambient/v1/projects/{id}/agents | Create an agent in a project [**ApiAmbientV1ProjectsIdDelete**](DefaultAPI.md#ApiAmbientV1ProjectsIdDelete) | **Delete** /api/ambient/v1/projects/{id} | Delete a project by id [**ApiAmbientV1ProjectsIdGet**](DefaultAPI.md#ApiAmbientV1ProjectsIdGet) | **Get** /api/ambient/v1/projects/{id} | Get a project by id @@ -52,6 +58,418 @@ Method | HTTP request | Description +## ApiAmbientV1CredentialsGet + +> CredentialList ApiAmbientV1CredentialsGet(ctx).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Provider(provider).Execute() + +Returns a list of credentials + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + page := int32(56) // int32 | Page number of record list when record list exceeds specified page size (optional) (default to 1) + size := int32(56) // int32 | Maximum number of records to return (optional) (default to 100) + search := "search_example" // string | Specifies the search criteria (optional) + orderBy := "orderBy_example" // string | Specifies the order by criteria (optional) + fields := "fields_example" // string | Supplies a comma-separated list of fields to be returned (optional) + provider := "provider_example" // string | Filter credentials by provider (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1CredentialsGet(context.Background()).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Provider(provider).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1CredentialsGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ApiAmbientV1CredentialsGet`: CredentialList + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1CredentialsGet`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiApiAmbientV1CredentialsGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **page** | **int32** | Page number of record list when record list exceeds specified page size | [default to 1] + **size** | **int32** | Maximum number of records to return | [default to 100] + **search** | **string** | Specifies the search criteria | + **orderBy** | **string** | Specifies the order by criteria | + **fields** | **string** | Supplies a comma-separated list of fields to be returned | + **provider** | **string** | Filter credentials by provider | + +### Return type + +[**CredentialList**](CredentialList.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ApiAmbientV1CredentialsIdDelete + +> ApiAmbientV1CredentialsIdDelete(ctx, id).Execute() + +Delete a credential + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + id := "id_example" // string | The id of record + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DefaultAPI.ApiAmbientV1CredentialsIdDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1CredentialsIdDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The id of record | + +### Other Parameters + +Other parameters are passed through a pointer to a apiApiAmbientV1CredentialsIdDeleteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ApiAmbientV1CredentialsIdGet + +> Credential ApiAmbientV1CredentialsIdGet(ctx, id).Execute() + +Get an credential by id + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + id := "id_example" // string | The id of record + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1CredentialsIdGet(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1CredentialsIdGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ApiAmbientV1CredentialsIdGet`: Credential + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1CredentialsIdGet`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The id of record | + +### Other Parameters + +Other parameters are passed through a pointer to a apiApiAmbientV1CredentialsIdGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Credential**](Credential.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ApiAmbientV1CredentialsIdPatch + +> Credential ApiAmbientV1CredentialsIdPatch(ctx, id).CredentialPatchRequest(credentialPatchRequest).Execute() + +Update an credential + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + id := "id_example" // string | The id of record + credentialPatchRequest := *openapiclient.NewCredentialPatchRequest() // CredentialPatchRequest | Updated credential data + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1CredentialsIdPatch(context.Background(), id).CredentialPatchRequest(credentialPatchRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1CredentialsIdPatch``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ApiAmbientV1CredentialsIdPatch`: Credential + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1CredentialsIdPatch`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The id of record | + +### Other Parameters + +Other parameters are passed through a pointer to a apiApiAmbientV1CredentialsIdPatchRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **credentialPatchRequest** | [**CredentialPatchRequest**](CredentialPatchRequest.md) | Updated credential data | + +### Return type + +[**Credential**](Credential.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ApiAmbientV1CredentialsIdTokenGet + +> CredentialTokenResponse ApiAmbientV1CredentialsIdTokenGet(ctx, id).Execute() + +Get a decrypted token for a credential + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + id := "id_example" // string | The id of record + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1CredentialsIdTokenGet(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1CredentialsIdTokenGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ApiAmbientV1CredentialsIdTokenGet`: CredentialTokenResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1CredentialsIdTokenGet`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | The id of record | + +### Other Parameters + +Other parameters are passed through a pointer to a apiApiAmbientV1CredentialsIdTokenGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**CredentialTokenResponse**](CredentialTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ApiAmbientV1CredentialsPost + +> Credential ApiAmbientV1CredentialsPost(ctx).Credential(credential).Execute() + +Create a new credential + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + credential := *openapiclient.NewCredential("Name_example", "Provider_example") // Credential | Credential data + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1CredentialsPost(context.Background()).Credential(credential).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1CredentialsPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ApiAmbientV1CredentialsPost`: Credential + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1CredentialsPost`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiApiAmbientV1CredentialsPostRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **credential** | [**Credential**](Credential.md) | Credential data | + +### Return type + +[**Credential**](Credential.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## ApiAmbientV1ProjectSettingsGet > ProjectSettingsList ApiAmbientV1ProjectSettingsGet(ctx).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Execute() @@ -464,11 +882,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsGet +## ApiAmbientV1ProjectsIdAgentsAgentIdDelete -> ProjectAgentList ApiAmbientV1ProjectsIdAgentsGet(ctx, id).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Execute() +> ApiAmbientV1ProjectsIdAgentsAgentIdDelete(ctx, id, agentId).Execute() -Returns a list of agents in a project +Delete an agent from a project ### Example @@ -484,21 +902,15 @@ import ( func main() { id := "id_example" // string | The id of record - page := int32(56) // int32 | Page number of record list when record list exceeds specified page size (optional) (default to 1) - size := int32(56) // int32 | Maximum number of records to return (optional) (default to 100) - search := "search_example" // string | Specifies the search criteria (optional) - orderBy := "orderBy_example" // string | Specifies the order by criteria (optional) - fields := "fields_example" // string | Supplies a comma-separated list of fields to be returned (optional) + agentId := "agentId_example" // string | The id of the agent configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsGet(context.Background(), id).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Execute() + r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdDelete(context.Background(), id, agentId).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdDelete``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsGet`: ProjectAgentList - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsGet`: %v\n", resp) } ``` @@ -509,24 +921,21 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsGetRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdDeleteRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **page** | **int32** | Page number of record list when record list exceeds specified page size | [default to 1] - **size** | **int32** | Maximum number of records to return | [default to 100] - **search** | **string** | Specifies the search criteria | - **orderBy** | **string** | Specifies the order by criteria | - **fields** | **string** | Supplies a comma-separated list of fields to be returned | + ### Return type -[**ProjectAgentList**](ProjectAgentList.md) + (empty response body) ### Authorization @@ -542,11 +951,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdDelete +## ApiAmbientV1ProjectsIdAgentsAgentIdGet -> ApiAmbientV1ProjectsIdAgentsPaIdDelete(ctx, id, paId).Execute() +> Agent ApiAmbientV1ProjectsIdAgentsAgentIdGet(ctx, id, agentId).Execute() -Delete an agent from a project +Get an agent by id ### Example @@ -562,15 +971,17 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent + agentId := "agentId_example" // string | The id of the agent configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdDelete(context.Background(), id, paId).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdGet(context.Background(), id, agentId).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdGet`: Agent + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdGet`: %v\n", resp) } ``` @@ -581,11 +992,11 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdDeleteRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdGetRequest struct via the builder pattern Name | Type | Description | Notes @@ -595,7 +1006,7 @@ Name | Type | Description | Notes ### Return type - (empty response body) +[**Agent**](Agent.md) ### Authorization @@ -611,11 +1022,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdGet +## ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet -> ProjectAgent ApiAmbientV1ProjectsIdAgentsPaIdGet(ctx, id, paId).Execute() +> StartResponse ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet(ctx, id, agentId).Execute() -Get an agent by id +Preview start context (dry run — no session created) ### Example @@ -631,17 +1042,17 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent + agentId := "agentId_example" // string | The id of the agent configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdGet(context.Background(), id, paId).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet(context.Background(), id, agentId).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdGet`: ProjectAgent - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdGet`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet`: StartResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGet`: %v\n", resp) } ``` @@ -652,11 +1063,11 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdGetRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdIgnitionGetRequest struct via the builder pattern Name | Type | Description | Notes @@ -666,7 +1077,7 @@ Name | Type | Description | Notes ### Return type -[**ProjectAgent**](ProjectAgent.md) +[**StartResponse**](StartResponse.md) ### Authorization @@ -682,13 +1093,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost - -> IgniteResponse ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost(ctx, id, paId).IgniteRequest(igniteRequest).Execute() - -Ignite an agent — creates a Session (idempotent) +## ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet +> InboxMessageList ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet(ctx, id, agentId).Page(page).Size(size).Execute() +Read inbox messages for an agent (unread first) ### Example @@ -704,18 +1113,19 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent - igniteRequest := *openapiclient.NewIgniteRequest() // IgniteRequest | Optional ignition parameters (optional) + agentId := "agentId_example" // string | The id of the agent + page := int32(56) // int32 | Page number of record list when record list exceeds specified page size (optional) (default to 1) + size := int32(56) // int32 | Maximum number of records to return (optional) (default to 100) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost(context.Background(), id, paId).IgniteRequest(igniteRequest).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet(context.Background(), id, agentId).Page(page).Size(size).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost`: IgniteResponse - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdIgnitePost`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet`: InboxMessageList + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxGet`: %v\n", resp) } ``` @@ -726,22 +1136,23 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdIgnitePostRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdInboxGetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **igniteRequest** | [**IgniteRequest**](IgniteRequest.md) | Optional ignition parameters | + **page** | **int32** | Page number of record list when record list exceeds specified page size | [default to 1] + **size** | **int32** | Maximum number of records to return | [default to 100] ### Return type -[**IgniteResponse**](IgniteResponse.md) +[**InboxMessageList**](InboxMessageList.md) ### Authorization @@ -749,7 +1160,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -757,11 +1168,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet +## ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete -> IgniteResponse ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet(ctx, id, paId).Execute() +> ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete(ctx, id, agentId, msgId).Execute() -Preview ignition context (dry run — no session created) +Delete an inbox message ### Example @@ -777,17 +1188,16 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent + agentId := "agentId_example" // string | The id of the agent + msgId := "msgId_example" // string | The id of the inbox message configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet(context.Background(), id, paId).Execute() + r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete(context.Background(), id, agentId, msgId).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDelete``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet`: IgniteResponse - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdIgnitionGet`: %v\n", resp) } ``` @@ -798,11 +1208,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | +**msgId** | **string** | The id of the inbox message | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdIgnitionGetRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdDeleteRequest struct via the builder pattern Name | Type | Description | Notes @@ -810,9 +1221,10 @@ Name | Type | Description | Notes + ### Return type -[**IgniteResponse**](IgniteResponse.md) + (empty response body) ### Authorization @@ -828,11 +1240,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdInboxGet +## ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch -> InboxMessageList ApiAmbientV1ProjectsIdAgentsPaIdInboxGet(ctx, id, paId).Page(page).Size(size).Execute() +> InboxMessage ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch(ctx, id, agentId, msgId).InboxMessagePatchRequest(inboxMessagePatchRequest).Execute() -Read inbox messages for an agent (unread first) +Mark an inbox message as read ### Example @@ -848,19 +1260,19 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent - page := int32(56) // int32 | Page number of record list when record list exceeds specified page size (optional) (default to 1) - size := int32(56) // int32 | Maximum number of records to return (optional) (default to 100) + agentId := "agentId_example" // string | The id of the agent + msgId := "msgId_example" // string | The id of the inbox message + inboxMessagePatchRequest := *openapiclient.NewInboxMessagePatchRequest() // InboxMessagePatchRequest | Inbox message patch configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxGet(context.Background(), id, paId).Page(page).Size(size).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch(context.Background(), id, agentId, msgId).InboxMessagePatchRequest(inboxMessagePatchRequest).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdInboxGet`: InboxMessageList - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxGet`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch`: InboxMessage + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatch`: %v\n", resp) } ``` @@ -871,23 +1283,24 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | +**msgId** | **string** | The id of the inbox message | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdInboxGetRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdInboxMsgIdPatchRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **page** | **int32** | Page number of record list when record list exceeds specified page size | [default to 1] - **size** | **int32** | Maximum number of records to return | [default to 100] + + **inboxMessagePatchRequest** | [**InboxMessagePatchRequest**](InboxMessagePatchRequest.md) | Inbox message patch | ### Return type -[**InboxMessageList**](InboxMessageList.md) +[**InboxMessage**](InboxMessage.md) ### Authorization @@ -895,7 +1308,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -903,11 +1316,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete +## ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost -> ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete(ctx, id, paId, msgId).Execute() +> InboxMessage ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost(ctx, id, agentId).InboxMessage(inboxMessage).Execute() -Delete an inbox message +Send a message to an agent's inbox ### Example @@ -923,16 +1336,18 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent - msgId := "msgId_example" // string | The id of the inbox message + agentId := "agentId_example" // string | The id of the agent + inboxMessage := *openapiclient.NewInboxMessage("AgentId_example", "Body_example") // InboxMessage | Inbox message to send configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete(context.Background(), id, paId, msgId).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost(context.Background(), id, agentId).InboxMessage(inboxMessage).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost`: InboxMessage + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdInboxPost`: %v\n", resp) } ``` @@ -943,23 +1358,22 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | -**msgId** | **string** | The id of the inbox message | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdDeleteRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdInboxPostRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - + **inboxMessage** | [**InboxMessage**](InboxMessage.md) | Inbox message to send | ### Return type - (empty response body) +[**InboxMessage**](InboxMessage.md) ### Authorization @@ -967,7 +1381,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -975,11 +1389,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch +## ApiAmbientV1ProjectsIdAgentsAgentIdPatch -> InboxMessage ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch(ctx, id, paId, msgId).InboxMessagePatchRequest(inboxMessagePatchRequest).Execute() +> Agent ApiAmbientV1ProjectsIdAgentsAgentIdPatch(ctx, id, agentId).AgentPatchRequest(agentPatchRequest).Execute() -Mark an inbox message as read +Update an agent (name, prompt, labels, annotations) ### Example @@ -995,19 +1409,18 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent - msgId := "msgId_example" // string | The id of the inbox message - inboxMessagePatchRequest := *openapiclient.NewInboxMessagePatchRequest() // InboxMessagePatchRequest | Inbox message patch + agentId := "agentId_example" // string | The id of the agent + agentPatchRequest := *openapiclient.NewAgentPatchRequest() // AgentPatchRequest | Updated agent data configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch(context.Background(), id, paId, msgId).InboxMessagePatchRequest(inboxMessagePatchRequest).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdPatch(context.Background(), id, agentId).AgentPatchRequest(agentPatchRequest).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdPatch``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch`: InboxMessage - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatch`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdPatch`: Agent + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdPatch`: %v\n", resp) } ``` @@ -1018,24 +1431,22 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | -**msgId** | **string** | The id of the inbox message | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdInboxMsgIdPatchRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdPatchRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - **inboxMessagePatchRequest** | [**InboxMessagePatchRequest**](InboxMessagePatchRequest.md) | Inbox message patch | + **agentPatchRequest** | [**AgentPatchRequest**](AgentPatchRequest.md) | Updated agent data | ### Return type -[**InboxMessage**](InboxMessage.md) +[**Agent**](Agent.md) ### Authorization @@ -1051,11 +1462,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdInboxPost +## ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet -> InboxMessage ApiAmbientV1ProjectsIdAgentsPaIdInboxPost(ctx, id, paId).InboxMessage(inboxMessage).Execute() +> AgentSessionList ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet(ctx, id, agentId).Page(page).Size(size).Execute() -Send a message to an agent's inbox +Get session run history for an agent ### Example @@ -1071,18 +1482,19 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent - inboxMessage := *openapiclient.NewInboxMessage("AgentId_example", "Body_example") // InboxMessage | Inbox message to send + agentId := "agentId_example" // string | The id of the agent + page := int32(56) // int32 | Page number of record list when record list exceeds specified page size (optional) (default to 1) + size := int32(56) // int32 | Maximum number of records to return (optional) (default to 100) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxPost(context.Background(), id, paId).InboxMessage(inboxMessage).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet(context.Background(), id, agentId).Page(page).Size(size).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdInboxPost`: InboxMessage - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdInboxPost`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet`: AgentSessionList + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdSessionsGet`: %v\n", resp) } ``` @@ -1093,22 +1505,23 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdInboxPostRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdSessionsGetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **inboxMessage** | [**InboxMessage**](InboxMessage.md) | Inbox message to send | + **page** | **int32** | Page number of record list when record list exceeds specified page size | [default to 1] + **size** | **int32** | Maximum number of records to return | [default to 100] ### Return type -[**InboxMessage**](InboxMessage.md) +[**AgentSessionList**](AgentSessionList.md) ### Authorization @@ -1116,7 +1529,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -1124,11 +1537,13 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdPatch +## ApiAmbientV1ProjectsIdAgentsAgentIdStartPost + +> StartResponse ApiAmbientV1ProjectsIdAgentsAgentIdStartPost(ctx, id, agentId).StartRequest(startRequest).Execute() + +Start an agent — creates a Session (idempotent) -> ProjectAgent ApiAmbientV1ProjectsIdAgentsPaIdPatch(ctx, id, paId).ProjectAgentPatchRequest(projectAgentPatchRequest).Execute() -Update an agent (name, prompt, labels, annotations) ### Example @@ -1144,18 +1559,18 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent - projectAgentPatchRequest := *openapiclient.NewProjectAgentPatchRequest() // ProjectAgentPatchRequest | Updated agent data + agentId := "agentId_example" // string | The id of the agent + startRequest := *openapiclient.NewStartRequest() // StartRequest | Optional start parameters (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdPatch(context.Background(), id, paId).ProjectAgentPatchRequest(projectAgentPatchRequest).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdStartPost(context.Background(), id, agentId).StartRequest(startRequest).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdPatch``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdStartPost``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdPatch`: ProjectAgent - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdPatch`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsAgentIdStartPost`: StartResponse + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsAgentIdStartPost`: %v\n", resp) } ``` @@ -1166,22 +1581,22 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | +**agentId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdPatchRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsAgentIdStartPostRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **projectAgentPatchRequest** | [**ProjectAgentPatchRequest**](ProjectAgentPatchRequest.md) | Updated agent data | + **startRequest** | [**StartRequest**](StartRequest.md) | Optional start parameters | ### Return type -[**ProjectAgent**](ProjectAgent.md) +[**StartResponse**](StartResponse.md) ### Authorization @@ -1197,11 +1612,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet +## ApiAmbientV1ProjectsIdAgentsGet -> ProjectAgentSessionList ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet(ctx, id, paId).Page(page).Size(size).Execute() +> AgentList ApiAmbientV1ProjectsIdAgentsGet(ctx, id).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Execute() -Get session run history for an agent +Returns a list of agents in a project ### Example @@ -1217,19 +1632,21 @@ import ( func main() { id := "id_example" // string | The id of record - paId := "paId_example" // string | The id of the agent page := int32(56) // int32 | Page number of record list when record list exceeds specified page size (optional) (default to 1) size := int32(56) // int32 | Maximum number of records to return (optional) (default to 100) + search := "search_example" // string | Specifies the search criteria (optional) + orderBy := "orderBy_example" // string | Specifies the order by criteria (optional) + fields := "fields_example" // string | Supplies a comma-separated list of fields to be returned (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet(context.Background(), id, paId).Page(page).Size(size).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsGet(context.Background(), id).Page(page).Size(size).Search(search).OrderBy(orderBy).Fields(fields).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet`: ProjectAgentSessionList - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPaIdSessionsGet`: %v\n", resp) + // response from `ApiAmbientV1ProjectsIdAgentsGet`: AgentList + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsGet`: %v\n", resp) } ``` @@ -1240,23 +1657,24 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **id** | **string** | The id of record | -**paId** | **string** | The id of the agent | ### Other Parameters -Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsPaIdSessionsGetRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgentsGetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **page** | **int32** | Page number of record list when record list exceeds specified page size | [default to 1] **size** | **int32** | Maximum number of records to return | [default to 100] + **search** | **string** | Specifies the search criteria | + **orderBy** | **string** | Specifies the order by criteria | + **fields** | **string** | Supplies a comma-separated list of fields to be returned | ### Return type -[**ProjectAgentSessionList**](ProjectAgentSessionList.md) +[**AgentList**](AgentList.md) ### Authorization @@ -1274,7 +1692,7 @@ Name | Type | Description | Notes ## ApiAmbientV1ProjectsIdAgentsPost -> ProjectAgent ApiAmbientV1ProjectsIdAgentsPost(ctx, id).ProjectAgent(projectAgent).Execute() +> Agent ApiAmbientV1ProjectsIdAgentsPost(ctx, id).Agent(agent).Execute() Create an agent in a project @@ -1292,16 +1710,16 @@ import ( func main() { id := "id_example" // string | The id of record - projectAgent := *openapiclient.NewProjectAgent("ProjectId_example", "Name_example") // ProjectAgent | Agent data + agent := *openapiclient.NewAgent("ProjectId_example", "Name_example") // Agent | Agent data configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPost(context.Background(), id).ProjectAgent(projectAgent).Execute() + resp, r, err := apiClient.DefaultAPI.ApiAmbientV1ProjectsIdAgentsPost(context.Background(), id).Agent(agent).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPost``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ApiAmbientV1ProjectsIdAgentsPost`: ProjectAgent + // response from `ApiAmbientV1ProjectsIdAgentsPost`: Agent fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ApiAmbientV1ProjectsIdAgentsPost`: %v\n", resp) } ``` @@ -1322,11 +1740,11 @@ Other parameters are passed through a pointer to a apiApiAmbientV1ProjectsIdAgen Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **projectAgent** | [**ProjectAgent**](ProjectAgent.md) | Agent data | + **agent** | [**Agent**](Agent.md) | Agent data | ### Return type -[**ProjectAgent**](ProjectAgent.md) +[**Agent**](Agent.md) ### Authorization diff --git a/components/ambient-api-server/pkg/api/openapi/docs/IgniteRequest.md b/components/ambient-api-server/pkg/api/openapi/docs/StartRequest.md similarity index 70% rename from components/ambient-api-server/pkg/api/openapi/docs/IgniteRequest.md rename to components/ambient-api-server/pkg/api/openapi/docs/StartRequest.md index bc4269524..a24db2c04 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/IgniteRequest.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/StartRequest.md @@ -1,4 +1,4 @@ -# IgniteRequest +# StartRequest ## Properties @@ -8,45 +8,45 @@ Name | Type | Description | Notes ## Methods -### NewIgniteRequest +### NewStartRequest -`func NewIgniteRequest() *IgniteRequest` +`func NewStartRequest() *StartRequest` -NewIgniteRequest instantiates a new IgniteRequest object +NewStartRequest instantiates a new StartRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewIgniteRequestWithDefaults +### NewStartRequestWithDefaults -`func NewIgniteRequestWithDefaults() *IgniteRequest` +`func NewStartRequestWithDefaults() *StartRequest` -NewIgniteRequestWithDefaults instantiates a new IgniteRequest object +NewStartRequestWithDefaults instantiates a new StartRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetPrompt -`func (o *IgniteRequest) GetPrompt() string` +`func (o *StartRequest) GetPrompt() string` GetPrompt returns the Prompt field if non-nil, zero value otherwise. ### GetPromptOk -`func (o *IgniteRequest) GetPromptOk() (*string, bool)` +`func (o *StartRequest) GetPromptOk() (*string, bool)` GetPromptOk returns a tuple with the Prompt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPrompt -`func (o *IgniteRequest) SetPrompt(v string)` +`func (o *StartRequest) SetPrompt(v string)` SetPrompt sets Prompt field to given value. ### HasPrompt -`func (o *IgniteRequest) HasPrompt() bool` +`func (o *StartRequest) HasPrompt() bool` HasPrompt returns a boolean if a field has been set. diff --git a/components/ambient-api-server/pkg/api/openapi/docs/IgniteResponse.md b/components/ambient-api-server/pkg/api/openapi/docs/StartResponse.md similarity index 64% rename from components/ambient-api-server/pkg/api/openapi/docs/IgniteResponse.md rename to components/ambient-api-server/pkg/api/openapi/docs/StartResponse.md index a2f9a8e02..502ce112a 100644 --- a/components/ambient-api-server/pkg/api/openapi/docs/IgniteResponse.md +++ b/components/ambient-api-server/pkg/api/openapi/docs/StartResponse.md @@ -1,78 +1,78 @@ -# IgniteResponse +# StartResponse ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Session** | Pointer to [**Session**](Session.md) | | [optional] -**IgnitionPrompt** | Pointer to **string** | Assembled ignition prompt — Agent.prompt + Inbox + Session.prompt + peer roster | [optional] +**IgnitionPrompt** | Pointer to **string** | Assembled start prompt — Agent.prompt + Inbox + Session.prompt + peer roster | [optional] ## Methods -### NewIgniteResponse +### NewStartResponse -`func NewIgniteResponse() *IgniteResponse` +`func NewStartResponse() *StartResponse` -NewIgniteResponse instantiates a new IgniteResponse object +NewStartResponse instantiates a new StartResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewIgniteResponseWithDefaults +### NewStartResponseWithDefaults -`func NewIgniteResponseWithDefaults() *IgniteResponse` +`func NewStartResponseWithDefaults() *StartResponse` -NewIgniteResponseWithDefaults instantiates a new IgniteResponse object +NewStartResponseWithDefaults instantiates a new StartResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetSession -`func (o *IgniteResponse) GetSession() Session` +`func (o *StartResponse) GetSession() Session` GetSession returns the Session field if non-nil, zero value otherwise. ### GetSessionOk -`func (o *IgniteResponse) GetSessionOk() (*Session, bool)` +`func (o *StartResponse) GetSessionOk() (*Session, bool)` GetSessionOk returns a tuple with the Session field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSession -`func (o *IgniteResponse) SetSession(v Session)` +`func (o *StartResponse) SetSession(v Session)` SetSession sets Session field to given value. ### HasSession -`func (o *IgniteResponse) HasSession() bool` +`func (o *StartResponse) HasSession() bool` HasSession returns a boolean if a field has been set. ### GetIgnitionPrompt -`func (o *IgniteResponse) GetIgnitionPrompt() string` +`func (o *StartResponse) GetIgnitionPrompt() string` GetIgnitionPrompt returns the IgnitionPrompt field if non-nil, zero value otherwise. ### GetIgnitionPromptOk -`func (o *IgniteResponse) GetIgnitionPromptOk() (*string, bool)` +`func (o *StartResponse) GetIgnitionPromptOk() (*string, bool)` GetIgnitionPromptOk returns a tuple with the IgnitionPrompt field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetIgnitionPrompt -`func (o *IgniteResponse) SetIgnitionPrompt(v string)` +`func (o *StartResponse) SetIgnitionPrompt(v string)` SetIgnitionPrompt sets IgnitionPrompt field to given value. ### HasIgnitionPrompt -`func (o *IgniteResponse) HasIgnitionPrompt() bool` +`func (o *StartResponse) HasIgnitionPrompt() bool` HasIgnitionPrompt returns a boolean if a field has been set. diff --git a/components/ambient-api-server/pkg/api/openapi/model_agent_list.go b/components/ambient-api-server/pkg/api/openapi/model_agent_list.go index 0d2aa5043..c9601e9f4 100644 --- a/components/ambient-api-server/pkg/api/openapi/model_agent_list.go +++ b/components/ambient-api-server/pkg/api/openapi/model_agent_list.go @@ -22,10 +22,10 @@ var _ MappedNullable = &AgentList{} // AgentList struct for AgentList type AgentList struct { - Kind string `json:"kind"` - Page int32 `json:"page"` - Size int32 `json:"size"` - Total int32 `json:"total"` + Kind string `json:"kind"` + Page int32 `json:"page"` + Size int32 `json:"size"` + Total int32 `json:"total"` Items []Agent `json:"items"` } diff --git a/components/ambient-api-server/pkg/api/openapi/model_credential.go b/components/ambient-api-server/pkg/api/openapi/model_credential.go new file mode 100644 index 000000000..02ae9caeb --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/model_credential.go @@ -0,0 +1,583 @@ +/* +Ambient API Server + +Ambient API Server + +API version: 1.0.0 +Contact: ambient-code@redhat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the Credential type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Credential{} + +// Credential struct for Credential +type Credential struct { + Id *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Href *string `json:"href,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Name string `json:"name"` + Description *string `json:"description,omitempty"` + Provider string `json:"provider"` + // Credential token value; write-only, never returned in GET/LIST responses + Token *string `json:"token,omitempty"` + Url *string `json:"url,omitempty"` + Email *string `json:"email,omitempty"` + Labels *string `json:"labels,omitempty"` + Annotations *string `json:"annotations,omitempty"` +} + +type _Credential Credential + +// NewCredential instantiates a new Credential object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCredential(name string, provider string) *Credential { + this := Credential{} + this.Name = name + this.Provider = provider + return &this +} + +// NewCredentialWithDefaults instantiates a new Credential object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCredentialWithDefaults() *Credential { + this := Credential{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Credential) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Credential) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Credential) SetId(v string) { + o.Id = &v +} + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *Credential) GetKind() string { + if o == nil || IsNil(o.Kind) { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetKindOk() (*string, bool) { + if o == nil || IsNil(o.Kind) { + return nil, false + } + return o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *Credential) HasKind() bool { + if o != nil && !IsNil(o.Kind) { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *Credential) SetKind(v string) { + o.Kind = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Credential) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Credential) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Credential) SetHref(v string) { + o.Href = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Credential) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Credential) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Credential) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Credential) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Credential) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Credential) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetName returns the Name field value +func (o *Credential) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Credential) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Credential) SetName(v string) { + o.Name = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Credential) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Credential) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Credential) SetDescription(v string) { + o.Description = &v +} + +// GetProvider returns the Provider field value +func (o *Credential) GetProvider() string { + if o == nil { + var ret string + return ret + } + + return o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value +// and a boolean to check if the value has been set. +func (o *Credential) GetProviderOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Provider, true +} + +// SetProvider sets field value +func (o *Credential) SetProvider(v string) { + o.Provider = v +} + +// GetToken returns the Token field value if set, zero value otherwise. +func (o *Credential) GetToken() string { + if o == nil || IsNil(o.Token) { + var ret string + return ret + } + return *o.Token +} + +// GetTokenOk returns a tuple with the Token field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetTokenOk() (*string, bool) { + if o == nil || IsNil(o.Token) { + return nil, false + } + return o.Token, true +} + +// HasToken returns a boolean if a field has been set. +func (o *Credential) HasToken() bool { + if o != nil && !IsNil(o.Token) { + return true + } + + return false +} + +// SetToken gets a reference to the given string and assigns it to the Token field. +func (o *Credential) SetToken(v string) { + o.Token = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *Credential) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetUrlOk() (*string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *Credential) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *Credential) SetUrl(v string) { + o.Url = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *Credential) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *Credential) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *Credential) SetEmail(v string) { + o.Email = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Credential) GetLabels() string { + if o == nil || IsNil(o.Labels) { + var ret string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetLabelsOk() (*string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Credential) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given string and assigns it to the Labels field. +func (o *Credential) SetLabels(v string) { + o.Labels = &v +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *Credential) GetAnnotations() string { + if o == nil || IsNil(o.Annotations) { + var ret string + return ret + } + return *o.Annotations +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credential) GetAnnotationsOk() (*string, bool) { + if o == nil || IsNil(o.Annotations) { + return nil, false + } + return o.Annotations, true +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *Credential) HasAnnotations() bool { + if o != nil && !IsNil(o.Annotations) { + return true + } + + return false +} + +// SetAnnotations gets a reference to the given string and assigns it to the Annotations field. +func (o *Credential) SetAnnotations(v string) { + o.Annotations = &v +} + +func (o Credential) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Credential) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Kind) { + toSerialize["kind"] = o.Kind + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + toSerialize["name"] = o.Name + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["provider"] = o.Provider + if !IsNil(o.Token) { + toSerialize["token"] = o.Token + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Annotations) { + toSerialize["annotations"] = o.Annotations + } + return toSerialize, nil +} + +func (o *Credential) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "provider", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCredential := _Credential{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCredential) + + if err != nil { + return err + } + + *o = Credential(varCredential) + + return err +} + +type NullableCredential struct { + value *Credential + isSet bool +} + +func (v NullableCredential) Get() *Credential { + return v.value +} + +func (v *NullableCredential) Set(val *Credential) { + v.value = val + v.isSet = true +} + +func (v NullableCredential) IsSet() bool { + return v.isSet +} + +func (v *NullableCredential) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredential(val *Credential) *NullableCredential { + return &NullableCredential{value: val, isSet: true} +} + +func (v NullableCredential) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredential) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/components/ambient-api-server/pkg/api/openapi/model_credential_list.go b/components/ambient-api-server/pkg/api/openapi/model_credential_list.go new file mode 100644 index 000000000..022fc0efc --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/model_credential_list.go @@ -0,0 +1,269 @@ +/* +Ambient API Server + +Ambient API Server + +API version: 1.0.0 +Contact: ambient-code@redhat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CredentialList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CredentialList{} + +// CredentialList struct for CredentialList +type CredentialList struct { + Kind string `json:"kind"` + Page int32 `json:"page"` + Size int32 `json:"size"` + Total int32 `json:"total"` + Items []Credential `json:"items"` +} + +type _CredentialList CredentialList + +// NewCredentialList instantiates a new CredentialList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCredentialList(kind string, page int32, size int32, total int32, items []Credential) *CredentialList { + this := CredentialList{} + this.Kind = kind + this.Page = page + this.Size = size + this.Total = total + this.Items = items + return &this +} + +// NewCredentialListWithDefaults instantiates a new CredentialList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCredentialListWithDefaults() *CredentialList { + this := CredentialList{} + return &this +} + +// GetKind returns the Kind field value +func (o *CredentialList) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *CredentialList) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *CredentialList) SetKind(v string) { + o.Kind = v +} + +// GetPage returns the Page field value +func (o *CredentialList) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *CredentialList) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value +func (o *CredentialList) SetPage(v int32) { + o.Page = v +} + +// GetSize returns the Size field value +func (o *CredentialList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *CredentialList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *CredentialList) SetSize(v int32) { + o.Size = v +} + +// GetTotal returns the Total field value +func (o *CredentialList) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *CredentialList) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *CredentialList) SetTotal(v int32) { + o.Total = v +} + +// GetItems returns the Items field value +func (o *CredentialList) GetItems() []Credential { + if o == nil { + var ret []Credential + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *CredentialList) GetItemsOk() ([]Credential, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *CredentialList) SetItems(v []Credential) { + o.Items = v +} + +func (o CredentialList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CredentialList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kind"] = o.Kind + toSerialize["page"] = o.Page + toSerialize["size"] = o.Size + toSerialize["total"] = o.Total + toSerialize["items"] = o.Items + return toSerialize, nil +} + +func (o *CredentialList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "kind", + "page", + "size", + "total", + "items", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCredentialList := _CredentialList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCredentialList) + + if err != nil { + return err + } + + *o = CredentialList(varCredentialList) + + return err +} + +type NullableCredentialList struct { + value *CredentialList + isSet bool +} + +func (v NullableCredentialList) Get() *CredentialList { + return v.value +} + +func (v *NullableCredentialList) Set(val *CredentialList) { + v.value = val + v.isSet = true +} + +func (v NullableCredentialList) IsSet() bool { + return v.isSet +} + +func (v *NullableCredentialList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredentialList(val *CredentialList) *NullableCredentialList { + return &NullableCredentialList{value: val, isSet: true} +} + +func (v NullableCredentialList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredentialList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/components/ambient-api-server/pkg/api/openapi/model_credential_patch_request.go b/components/ambient-api-server/pkg/api/openapi/model_credential_patch_request.go new file mode 100644 index 000000000..ffc8258e5 --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/model_credential_patch_request.go @@ -0,0 +1,378 @@ +/* +Ambient API Server + +Ambient API Server + +API version: 1.0.0 +Contact: ambient-code@redhat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the CredentialPatchRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CredentialPatchRequest{} + +// CredentialPatchRequest struct for CredentialPatchRequest +type CredentialPatchRequest struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Provider *string `json:"provider,omitempty"` + // Credential token value; write-only, never returned in GET/LIST responses + Token *string `json:"token,omitempty"` + Url *string `json:"url,omitempty"` + Email *string `json:"email,omitempty"` + Labels *string `json:"labels,omitempty"` + Annotations *string `json:"annotations,omitempty"` +} + +// NewCredentialPatchRequest instantiates a new CredentialPatchRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCredentialPatchRequest() *CredentialPatchRequest { + this := CredentialPatchRequest{} + return &this +} + +// NewCredentialPatchRequestWithDefaults instantiates a new CredentialPatchRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCredentialPatchRequestWithDefaults() *CredentialPatchRequest { + this := CredentialPatchRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CredentialPatchRequest) SetName(v string) { + o.Name = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CredentialPatchRequest) SetDescription(v string) { + o.Description = &v +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetProvider() string { + if o == nil || IsNil(o.Provider) { + var ret string + return ret + } + return *o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetProviderOk() (*string, bool) { + if o == nil || IsNil(o.Provider) { + return nil, false + } + return o.Provider, true +} + +// HasProvider returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasProvider() bool { + if o != nil && !IsNil(o.Provider) { + return true + } + + return false +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *CredentialPatchRequest) SetProvider(v string) { + o.Provider = &v +} + +// GetToken returns the Token field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetToken() string { + if o == nil || IsNil(o.Token) { + var ret string + return ret + } + return *o.Token +} + +// GetTokenOk returns a tuple with the Token field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetTokenOk() (*string, bool) { + if o == nil || IsNil(o.Token) { + return nil, false + } + return o.Token, true +} + +// HasToken returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasToken() bool { + if o != nil && !IsNil(o.Token) { + return true + } + + return false +} + +// SetToken gets a reference to the given string and assigns it to the Token field. +func (o *CredentialPatchRequest) SetToken(v string) { + o.Token = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetUrlOk() (*string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *CredentialPatchRequest) SetUrl(v string) { + o.Url = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *CredentialPatchRequest) SetEmail(v string) { + o.Email = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetLabels() string { + if o == nil || IsNil(o.Labels) { + var ret string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetLabelsOk() (*string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given string and assigns it to the Labels field. +func (o *CredentialPatchRequest) SetLabels(v string) { + o.Labels = &v +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *CredentialPatchRequest) GetAnnotations() string { + if o == nil || IsNil(o.Annotations) { + var ret string + return ret + } + return *o.Annotations +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialPatchRequest) GetAnnotationsOk() (*string, bool) { + if o == nil || IsNil(o.Annotations) { + return nil, false + } + return o.Annotations, true +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *CredentialPatchRequest) HasAnnotations() bool { + if o != nil && !IsNil(o.Annotations) { + return true + } + + return false +} + +// SetAnnotations gets a reference to the given string and assigns it to the Annotations field. +func (o *CredentialPatchRequest) SetAnnotations(v string) { + o.Annotations = &v +} + +func (o CredentialPatchRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CredentialPatchRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Provider) { + toSerialize["provider"] = o.Provider + } + if !IsNil(o.Token) { + toSerialize["token"] = o.Token + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Annotations) { + toSerialize["annotations"] = o.Annotations + } + return toSerialize, nil +} + +type NullableCredentialPatchRequest struct { + value *CredentialPatchRequest + isSet bool +} + +func (v NullableCredentialPatchRequest) Get() *CredentialPatchRequest { + return v.value +} + +func (v *NullableCredentialPatchRequest) Set(val *CredentialPatchRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCredentialPatchRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCredentialPatchRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredentialPatchRequest(val *CredentialPatchRequest) *NullableCredentialPatchRequest { + return &NullableCredentialPatchRequest{value: val, isSet: true} +} + +func (v NullableCredentialPatchRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredentialPatchRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/components/ambient-api-server/pkg/api/openapi/model_credential_token_response.go b/components/ambient-api-server/pkg/api/openapi/model_credential_token_response.go new file mode 100644 index 000000000..b7d7fbc27 --- /dev/null +++ b/components/ambient-api-server/pkg/api/openapi/model_credential_token_response.go @@ -0,0 +1,216 @@ +/* +Ambient API Server + +Ambient API Server + +API version: 1.0.0 +Contact: ambient-code@redhat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CredentialTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CredentialTokenResponse{} + +// CredentialTokenResponse struct for CredentialTokenResponse +type CredentialTokenResponse struct { + // ID of the credential + CredentialId string `json:"credential_id"` + // Provider type for this credential + Provider string `json:"provider"` + // Decrypted token value + Token string `json:"token"` +} + +type _CredentialTokenResponse CredentialTokenResponse + +// NewCredentialTokenResponse instantiates a new CredentialTokenResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCredentialTokenResponse(credentialId string, provider string, token string) *CredentialTokenResponse { + this := CredentialTokenResponse{} + this.CredentialId = credentialId + this.Provider = provider + this.Token = token + return &this +} + +// NewCredentialTokenResponseWithDefaults instantiates a new CredentialTokenResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCredentialTokenResponseWithDefaults() *CredentialTokenResponse { + this := CredentialTokenResponse{} + return &this +} + +// GetCredentialId returns the CredentialId field value +func (o *CredentialTokenResponse) GetCredentialId() string { + if o == nil { + var ret string + return ret + } + + return o.CredentialId +} + +// GetCredentialIdOk returns a tuple with the CredentialId field value +// and a boolean to check if the value has been set. +func (o *CredentialTokenResponse) GetCredentialIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CredentialId, true +} + +// SetCredentialId sets field value +func (o *CredentialTokenResponse) SetCredentialId(v string) { + o.CredentialId = v +} + +// GetProvider returns the Provider field value +func (o *CredentialTokenResponse) GetProvider() string { + if o == nil { + var ret string + return ret + } + + return o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value +// and a boolean to check if the value has been set. +func (o *CredentialTokenResponse) GetProviderOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Provider, true +} + +// SetProvider sets field value +func (o *CredentialTokenResponse) SetProvider(v string) { + o.Provider = v +} + +// GetToken returns the Token field value +func (o *CredentialTokenResponse) GetToken() string { + if o == nil { + var ret string + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *CredentialTokenResponse) GetTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *CredentialTokenResponse) SetToken(v string) { + o.Token = v +} + +func (o CredentialTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CredentialTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["credential_id"] = o.CredentialId + toSerialize["provider"] = o.Provider + toSerialize["token"] = o.Token + return toSerialize, nil +} + +func (o *CredentialTokenResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "credential_id", + "provider", + "token", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCredentialTokenResponse := _CredentialTokenResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCredentialTokenResponse) + + if err != nil { + return err + } + + *o = CredentialTokenResponse(varCredentialTokenResponse) + + return err +} + +type NullableCredentialTokenResponse struct { + value *CredentialTokenResponse + isSet bool +} + +func (v NullableCredentialTokenResponse) Get() *CredentialTokenResponse { + return v.value +} + +func (v *NullableCredentialTokenResponse) Set(val *CredentialTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCredentialTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCredentialTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredentialTokenResponse(val *CredentialTokenResponse) *NullableCredentialTokenResponse { + return &NullableCredentialTokenResponse{value: val, isSet: true} +} + +func (v NullableCredentialTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredentialTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/components/ambient-api-server/pkg/api/openapi/model_start_response.go b/components/ambient-api-server/pkg/api/openapi/model_start_response.go index 14a04afce..720f48e84 100644 --- a/components/ambient-api-server/pkg/api/openapi/model_start_response.go +++ b/components/ambient-api-server/pkg/api/openapi/model_start_response.go @@ -22,7 +22,7 @@ var _ MappedNullable = &StartResponse{} type StartResponse struct { Session *Session `json:"session,omitempty"` // Assembled start prompt — Agent.prompt + Inbox + Session.prompt + peer roster - StartingPrompt *string `json:"starting_prompt,omitempty"` + IgnitionPrompt *string `json:"ignition_prompt,omitempty"` } // NewStartResponse instantiates a new StartResponse object @@ -74,36 +74,36 @@ func (o *StartResponse) SetSession(v Session) { o.Session = &v } -// GetStartingPrompt returns the StartingPrompt field value if set, zero value otherwise. -func (o *StartResponse) GetStartingPrompt() string { - if o == nil || IsNil(o.StartingPrompt) { +// GetIgnitionPrompt returns the IgnitionPrompt field value if set, zero value otherwise. +func (o *StartResponse) GetIgnitionPrompt() string { + if o == nil || IsNil(o.IgnitionPrompt) { var ret string return ret } - return *o.StartingPrompt + return *o.IgnitionPrompt } -// GetStartingPromptOk returns a tuple with the StartingPrompt field value if set, nil otherwise +// GetIgnitionPromptOk returns a tuple with the IgnitionPrompt field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StartResponse) GetStartingPromptOk() (*string, bool) { - if o == nil || IsNil(o.StartingPrompt) { +func (o *StartResponse) GetIgnitionPromptOk() (*string, bool) { + if o == nil || IsNil(o.IgnitionPrompt) { return nil, false } - return o.StartingPrompt, true + return o.IgnitionPrompt, true } -// HasStartingPrompt returns a boolean if a field has been set. -func (o *StartResponse) HasStartingPrompt() bool { - if o != nil && !IsNil(o.StartingPrompt) { +// HasIgnitionPrompt returns a boolean if a field has been set. +func (o *StartResponse) HasIgnitionPrompt() bool { + if o != nil && !IsNil(o.IgnitionPrompt) { return true } return false } -// SetStartingPrompt gets a reference to the given string and assigns it to the StartingPrompt field. -func (o *StartResponse) SetStartingPrompt(v string) { - o.StartingPrompt = &v +// SetIgnitionPrompt gets a reference to the given string and assigns it to the IgnitionPrompt field. +func (o *StartResponse) SetIgnitionPrompt(v string) { + o.IgnitionPrompt = &v } func (o StartResponse) MarshalJSON() ([]byte, error) { @@ -119,8 +119,8 @@ func (o StartResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.Session) { toSerialize["session"] = o.Session } - if !IsNil(o.StartingPrompt) { - toSerialize["starting_prompt"] = o.StartingPrompt + if !IsNil(o.IgnitionPrompt) { + toSerialize["ignition_prompt"] = o.IgnitionPrompt } return toSerialize, nil } diff --git a/components/ambient-api-server/pkg/rbac/permissions.go b/components/ambient-api-server/pkg/rbac/permissions.go index 4280d5ddf..d681a5da1 100644 --- a/components/ambient-api-server/pkg/rbac/permissions.go +++ b/components/ambient-api-server/pkg/rbac/permissions.go @@ -12,6 +12,7 @@ const ( ResourceBlackboard Resource = "blackboard" ResourceRole Resource = "role" ResourceRoleBinding Resource = "role_binding" + ResourceCredential Resource = "credential" ) type Action string @@ -24,8 +25,9 @@ const ( ActionList Action = "list" ActionWatch Action = "watch" ActionStart Action = "start" - ActionCheckin Action = "checkin" - ActionMessage Action = "message" + ActionCheckin Action = "checkin" + ActionMessage Action = "message" + ActionFetchToken Action = "fetch_token" ) type Permission struct { @@ -48,6 +50,10 @@ const ( RoleAgentOperator = "agent:operator" RoleAgentObserver = "agent:observer" RoleAgentRunner = "agent:runner" + + RoleCredentialOwner = "credential:owner" + RoleCredentialReader = "credential:reader" + RoleCredentialTokenReader = "credential:token-reader" ) var ( @@ -71,7 +77,7 @@ var ( PermAgentUpdate = Permission{ResourceAgent, ActionUpdate} PermAgentDelete = Permission{ResourceAgent, ActionDelete} PermAgentList = Permission{ResourceAgent, ActionList} - PermAgentStart = Permission{ResourceAgent, ActionStart} + PermAgentStart = Permission{ResourceAgent, ActionStart} PermSessionRead = Permission{ResourceSession, ActionRead} PermSessionList = Permission{ResourceSession, ActionList} @@ -91,4 +97,11 @@ var ( PermRoleBindingList = Permission{ResourceRoleBinding, ActionList} PermRoleBindingCreate = Permission{ResourceRoleBinding, ActionCreate} PermRoleBindingDelete = Permission{ResourceRoleBinding, ActionDelete} + + PermCredentialCreate = Permission{ResourceCredential, ActionCreate} + PermCredentialRead = Permission{ResourceCredential, ActionRead} + PermCredentialUpdate = Permission{ResourceCredential, ActionUpdate} + PermCredentialDelete = Permission{ResourceCredential, ActionDelete} + PermCredentialList = Permission{ResourceCredential, ActionList} + PermCredentialFetchToken = Permission{ResourceCredential, ActionFetchToken} ) diff --git a/components/ambient-api-server/plugins/credentials/dao.go b/components/ambient-api-server/plugins/credentials/dao.go new file mode 100644 index 000000000..3c629c6bd --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/dao.go @@ -0,0 +1,83 @@ +package credentials + +import ( + "context" + + "gorm.io/gorm/clause" + + "github.com/openshift-online/rh-trex-ai/pkg/api" + "github.com/openshift-online/rh-trex-ai/pkg/db" +) + +type CredentialDao interface { + Get(ctx context.Context, id string) (*Credential, error) + Create(ctx context.Context, credential *Credential) (*Credential, error) + Replace(ctx context.Context, credential *Credential) (*Credential, error) + Delete(ctx context.Context, id string) error + FindByIDs(ctx context.Context, ids []string) (CredentialList, error) + All(ctx context.Context) (CredentialList, error) +} + +var _ CredentialDao = &sqlCredentialDao{} + +type sqlCredentialDao struct { + sessionFactory *db.SessionFactory +} + +func NewCredentialDao(sessionFactory *db.SessionFactory) CredentialDao { + return &sqlCredentialDao{sessionFactory: sessionFactory} +} + +func (d *sqlCredentialDao) Get(ctx context.Context, id string) (*Credential, error) { + g2 := (*d.sessionFactory).New(ctx) + var credential Credential + if err := g2.Take(&credential, "id = ?", id).Error; err != nil { + return nil, err + } + return &credential, nil +} + +func (d *sqlCredentialDao) Create(ctx context.Context, credential *Credential) (*Credential, error) { + g2 := (*d.sessionFactory).New(ctx) + if err := g2.Omit(clause.Associations).Create(credential).Error; err != nil { + db.MarkForRollback(ctx, err) + return nil, err + } + return credential, nil +} + +func (d *sqlCredentialDao) Replace(ctx context.Context, credential *Credential) (*Credential, error) { + g2 := (*d.sessionFactory).New(ctx) + if err := g2.Omit(clause.Associations).Save(credential).Error; err != nil { + db.MarkForRollback(ctx, err) + return nil, err + } + return credential, nil +} + +func (d *sqlCredentialDao) Delete(ctx context.Context, id string) error { + g2 := (*d.sessionFactory).New(ctx) + if err := g2.Omit(clause.Associations).Delete(&Credential{Meta: api.Meta{ID: id}}).Error; err != nil { + db.MarkForRollback(ctx, err) + return err + } + return nil +} + +func (d *sqlCredentialDao) FindByIDs(ctx context.Context, ids []string) (CredentialList, error) { + g2 := (*d.sessionFactory).New(ctx) + credentials := CredentialList{} + if err := g2.Where("id in (?)", ids).Find(&credentials).Error; err != nil { + return nil, err + } + return credentials, nil +} + +func (d *sqlCredentialDao) All(ctx context.Context) (CredentialList, error) { + g2 := (*d.sessionFactory).New(ctx) + credentials := CredentialList{} + if err := g2.Find(&credentials).Error; err != nil { + return nil, err + } + return credentials, nil +} diff --git a/components/ambient-api-server/plugins/credentials/factory_test.go b/components/ambient-api-server/plugins/credentials/factory_test.go new file mode 100644 index 000000000..3e60bb143 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/factory_test.go @@ -0,0 +1,45 @@ +package credentials_test + +import ( + "context" + "fmt" + + "github.com/ambient-code/platform/components/ambient-api-server/plugins/credentials" + "github.com/openshift-online/rh-trex-ai/pkg/environments" +) + +func newCredential(id string) (*credentials.Credential, error) { + credentialService := credentials.Service(&environments.Environment().Services) + + credential := &credentials.Credential{ + Name: "test-name", + Description: stringPtr("test-description"), + Provider: "test-provider", + Token: stringPtr("test-token"), + Url: stringPtr("test-url"), + Email: stringPtr("test-email"), + Labels: stringPtr("test-labels"), + Annotations: stringPtr("test-annotations"), + } + + sub, err := credentialService.Create(context.Background(), credential) + if err != nil { + return nil, err + } + + return sub, nil +} + +func newCredentialList(namePrefix string, count int) ([]*credentials.Credential, error) { + var items []*credentials.Credential + for i := 1; i <= count; i++ { + name := fmt.Sprintf("%s_%d", namePrefix, i) + c, err := newCredential(name) + if err != nil { + return nil, err + } + items = append(items, c) + } + return items, nil +} +func stringPtr(s string) *string { return &s } diff --git a/components/ambient-api-server/plugins/credentials/handler.go b/components/ambient-api-server/plugins/credentials/handler.go new file mode 100644 index 000000000..2a674cf69 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/handler.go @@ -0,0 +1,186 @@ +package credentials + +import ( + "net/http" + + "github.com/gorilla/mux" + + "github.com/ambient-code/platform/components/ambient-api-server/pkg/api/openapi" + "github.com/openshift-online/rh-trex-ai/pkg/api/presenters" + "github.com/openshift-online/rh-trex-ai/pkg/errors" + "github.com/openshift-online/rh-trex-ai/pkg/handlers" + "github.com/openshift-online/rh-trex-ai/pkg/services" +) + +var _ handlers.RestHandler = credentialHandler{} + +type credentialHandler struct { + credential CredentialService + generic services.GenericService +} + +func NewCredentialHandler(credential CredentialService, generic services.GenericService) *credentialHandler { + return &credentialHandler{ + credential: credential, + generic: generic, + } +} + +func (h credentialHandler) Create(w http.ResponseWriter, r *http.Request) { + var credential openapi.Credential + cfg := &handlers.HandlerConfig{ + Body: &credential, + Validators: []handlers.Validate{ + handlers.ValidateEmpty(&credential, "Id", "id"), + }, + Action: func() (interface{}, *errors.ServiceError) { + ctx := r.Context() + credentialModel := ConvertCredential(credential) + credentialModel, err := h.credential.Create(ctx, credentialModel) + if err != nil { + return nil, err + } + return PresentCredential(credentialModel), nil + }, + ErrorHandler: handlers.HandleError, + } + + handlers.Handle(w, r, cfg, http.StatusCreated) +} + +func (h credentialHandler) Patch(w http.ResponseWriter, r *http.Request) { + var patch openapi.CredentialPatchRequest + + cfg := &handlers.HandlerConfig{ + Body: &patch, + Validators: []handlers.Validate{}, + Action: func() (interface{}, *errors.ServiceError) { + ctx := r.Context() + id := mux.Vars(r)["id"] + found, err := h.credential.Get(ctx, id) + if err != nil { + return nil, err + } + + if patch.Name != nil { + found.Name = *patch.Name + } + if patch.Description != nil { + found.Description = patch.Description + } + if patch.Provider != nil { + found.Provider = *patch.Provider + } + if patch.Token != nil { + found.Token = patch.Token + } + if patch.Url != nil { + found.Url = patch.Url + } + if patch.Email != nil { + found.Email = patch.Email + } + if patch.Labels != nil { + found.Labels = patch.Labels + } + if patch.Annotations != nil { + found.Annotations = patch.Annotations + } + + credentialModel, err := h.credential.Replace(ctx, found) + if err != nil { + return nil, err + } + return PresentCredential(credentialModel), nil + }, + ErrorHandler: handlers.HandleError, + } + + handlers.Handle(w, r, cfg, http.StatusOK) +} + +func (h credentialHandler) List(w http.ResponseWriter, r *http.Request) { + cfg := &handlers.HandlerConfig{ + Action: func() (interface{}, *errors.ServiceError) { + ctx := r.Context() + + listArgs := services.NewListArguments(r.URL.Query()) + var credentials []Credential + paging, err := h.generic.List(ctx, "id", listArgs, &credentials) + if err != nil { + return nil, err + } + credentialList := openapi.CredentialList{ + Kind: "CredentialList", + Page: int32(paging.Page), + Size: int32(paging.Size), + Total: int32(paging.Total), + Items: []openapi.Credential{}, + } + + for _, credential := range credentials { + converted := PresentCredential(&credential) + credentialList.Items = append(credentialList.Items, converted) + } + if listArgs.Fields != nil { + filteredItems, err := presenters.SliceFilter(listArgs.Fields, credentialList.Items) + if err != nil { + return nil, err + } + return filteredItems, nil + } + return credentialList, nil + }, + } + + handlers.HandleList(w, r, cfg) +} + +func (h credentialHandler) Get(w http.ResponseWriter, r *http.Request) { + cfg := &handlers.HandlerConfig{ + Action: func() (interface{}, *errors.ServiceError) { + id := mux.Vars(r)["id"] + ctx := r.Context() + credential, err := h.credential.Get(ctx, id) + if err != nil { + return nil, err + } + + return PresentCredential(credential), nil + }, + } + + handlers.HandleGet(w, r, cfg) +} + +func (h credentialHandler) Delete(w http.ResponseWriter, r *http.Request) { + cfg := &handlers.HandlerConfig{ + Action: func() (interface{}, *errors.ServiceError) { + id := mux.Vars(r)["id"] + ctx := r.Context() + err := h.credential.Delete(ctx, id) + if err != nil { + return nil, err + } + return nil, nil + }, + } + handlers.HandleDelete(w, r, cfg, http.StatusNoContent) +} + +func (h credentialHandler) GetToken(w http.ResponseWriter, r *http.Request) { + cfg := &handlers.HandlerConfig{ + Action: func() (interface{}, *errors.ServiceError) { + id := mux.Vars(r)["id"] + ctx := r.Context() + credential, err := h.credential.Get(ctx, id) + if err != nil { + return nil, err + } + + return PresentCredentialToken(credential), nil + }, + } + + handlers.HandleGet(w, r, cfg) +} diff --git a/components/ambient-api-server/plugins/credentials/integration_test.go b/components/ambient-api-server/plugins/credentials/integration_test.go new file mode 100644 index 000000000..11ebde53e --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/integration_test.go @@ -0,0 +1,222 @@ +package credentials_test + +import ( + "context" + "fmt" + "net/http" + "testing" + + . "github.com/onsi/gomega" + "gopkg.in/resty.v1" + + "github.com/ambient-code/platform/components/ambient-api-server/pkg/api/openapi" + "github.com/ambient-code/platform/components/ambient-api-server/test" +) + +func TestCredentialGet(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + _, _, err := client.DefaultAPI.ApiAmbientV1CredentialsIdGet(context.Background(), "foo").Execute() + Expect(err).To(HaveOccurred(), "Expected 401 but got nil error") + + _, resp, err := client.DefaultAPI.ApiAmbientV1CredentialsIdGet(ctx, "foo").Execute() + Expect(err).To(HaveOccurred(), "Expected 404") + Expect(resp.StatusCode).To(Equal(http.StatusNotFound)) + + credentialModel, err := newCredential(h.NewID()) + Expect(err).NotTo(HaveOccurred()) + + credentialOutput, resp, err := client.DefaultAPI.ApiAmbientV1CredentialsIdGet(ctx, credentialModel.ID).Execute() + Expect(err).NotTo(HaveOccurred()) + Expect(resp.StatusCode).To(Equal(http.StatusOK)) + + Expect(*credentialOutput.Id).To(Equal(credentialModel.ID), "found object does not match test object") + Expect(*credentialOutput.Kind).To(Equal("Credential")) + Expect(*credentialOutput.Href).To(Equal(fmt.Sprintf("/api/ambient/v1/credentials/%s", credentialModel.ID))) + Expect(*credentialOutput.CreatedAt).To(BeTemporally("~", credentialModel.CreatedAt)) + Expect(*credentialOutput.UpdatedAt).To(BeTemporally("~", credentialModel.UpdatedAt)) + Expect(credentialOutput.Token).To(BeNil(), "GET must never return the token value") +} + +func TestCredentialPost(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + credentialInput := openapi.Credential{ + Name: "test-name", + Description: openapi.PtrString("test-description"), + Provider: "test-provider", + Token: openapi.PtrString("test-token"), + Url: openapi.PtrString("test-url"), + Email: openapi.PtrString("test-email"), + Labels: openapi.PtrString("test-labels"), + Annotations: openapi.PtrString("test-annotations"), + } + + credentialOutput, resp, err := client.DefaultAPI.ApiAmbientV1CredentialsPost(ctx).Credential(credentialInput).Execute() + Expect(err).NotTo(HaveOccurred(), "Error posting object: %v", err) + Expect(resp.StatusCode).To(Equal(http.StatusCreated)) + Expect(*credentialOutput.Id).NotTo(BeEmpty(), "Expected ID assigned on creation") + Expect(*credentialOutput.Kind).To(Equal("Credential")) + Expect(*credentialOutput.Href).To(Equal(fmt.Sprintf("/api/ambient/v1/credentials/%s", *credentialOutput.Id))) + Expect(credentialOutput.Token).To(BeNil(), "POST response must never return the token value") + + jwtToken := ctx.Value(openapi.ContextAccessToken) + restyResp, restyErr := resty.R(). + SetHeader("Content-Type", "application/json"). + SetHeader("Authorization", fmt.Sprintf("Bearer %s", jwtToken)). + SetBody(`{ this is invalid }`). + Post(h.RestURL("/credentials")) + + Expect(restyErr).NotTo(HaveOccurred()) + Expect(restyResp.StatusCode()).To(Equal(http.StatusBadRequest)) +} + +func TestCredentialPatch(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + credentialModel, err := newCredential(h.NewID()) + Expect(err).NotTo(HaveOccurred()) + + credentialOutput, resp, err := client.DefaultAPI.ApiAmbientV1CredentialsIdPatch(ctx, credentialModel.ID).CredentialPatchRequest(openapi.CredentialPatchRequest{}).Execute() + Expect(err).NotTo(HaveOccurred(), "Error posting object: %v", err) + Expect(resp.StatusCode).To(Equal(http.StatusOK)) + Expect(*credentialOutput.Id).To(Equal(credentialModel.ID)) + Expect(*credentialOutput.CreatedAt).To(BeTemporally("~", credentialModel.CreatedAt)) + Expect(*credentialOutput.Kind).To(Equal("Credential")) + Expect(*credentialOutput.Href).To(Equal(fmt.Sprintf("/api/ambient/v1/credentials/%s", *credentialOutput.Id))) + + jwtToken := ctx.Value(openapi.ContextAccessToken) + restyResp, restyErr := resty.R(). + SetHeader("Content-Type", "application/json"). + SetHeader("Authorization", fmt.Sprintf("Bearer %s", jwtToken)). + SetBody(`{ this is invalid }`). + Patch(h.RestURL("/credentials/foo")) + + Expect(restyErr).NotTo(HaveOccurred()) + Expect(restyResp.StatusCode()).To(Equal(http.StatusBadRequest)) +} + +func TestCredentialPaging(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + _, err := newCredentialList("Bronto", 20) + Expect(err).NotTo(HaveOccurred()) + + list, _, err := client.DefaultAPI.ApiAmbientV1CredentialsGet(ctx).Execute() + Expect(err).NotTo(HaveOccurred(), "Error getting credential list: %v", err) + Expect(len(list.Items)).To(Equal(20)) + Expect(list.Size).To(Equal(int32(20))) + Expect(list.Total).To(Equal(int32(20))) + Expect(list.Page).To(Equal(int32(1))) + + list, _, err = client.DefaultAPI.ApiAmbientV1CredentialsGet(ctx).Page(2).Size(5).Execute() + Expect(err).NotTo(HaveOccurred(), "Error getting credential list: %v", err) + Expect(len(list.Items)).To(Equal(5)) + Expect(list.Size).To(Equal(int32(5))) + Expect(list.Total).To(Equal(int32(20))) + Expect(list.Page).To(Equal(int32(2))) +} + +func TestCredentialListSearch(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + credentials, err := newCredentialList("bronto", 20) + Expect(err).NotTo(HaveOccurred()) + + search := fmt.Sprintf("id in ('%s')", credentials[0].ID) + list, _, err := client.DefaultAPI.ApiAmbientV1CredentialsGet(ctx).Search(search).Execute() + Expect(err).NotTo(HaveOccurred(), "Error getting credential list: %v", err) + Expect(len(list.Items)).To(Equal(1)) + Expect(list.Total).To(Equal(int32(1))) + Expect(*list.Items[0].Id).To(Equal(credentials[0].ID)) +} + +func TestCredentialListTokenOmitted(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + created, err := newCredential(h.NewID()) + Expect(err).NotTo(HaveOccurred()) + + list, _, err := client.DefaultAPI.ApiAmbientV1CredentialsGet(ctx).Execute() + Expect(err).NotTo(HaveOccurred()) + + var found *openapi.Credential + for i := range list.Items { + if *list.Items[i].Id == created.ID { + found = &list.Items[i] + break + } + } + Expect(found).NotTo(BeNil(), "created credential must appear in list") + Expect(found.Token).To(BeNil(), "LIST must never return the token value") +} + +func TestCredentialToken(t *testing.T) { + h, _ := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + created, err := newCredential(h.NewID()) + Expect(err).NotTo(HaveOccurred()) + + jwtToken := ctx.Value(openapi.ContextAccessToken) + + restyResp, restyErr := resty.R(). + SetHeader("Authorization", fmt.Sprintf("Bearer %s", jwtToken)). + Get(h.RestURL(fmt.Sprintf("/credentials/%s/token", created.ID))) + Expect(restyErr).NotTo(HaveOccurred()) + Expect(restyResp.StatusCode()).To(Equal(http.StatusOK)) + Expect(restyResp.String()).To(ContainSubstring(`"token"`)) + Expect(restyResp.String()).To(ContainSubstring(`"provider"`)) + Expect(restyResp.String()).To(ContainSubstring(`"credential_id"`)) + + restyResp, restyErr = resty.R(). + Get(h.RestURL(fmt.Sprintf("/credentials/%s/token", created.ID))) + Expect(restyErr).NotTo(HaveOccurred()) + Expect(restyResp.StatusCode()).To(Equal(http.StatusUnauthorized), "unauthenticated request to /token must be rejected") +} + +func TestCredentialDelete(t *testing.T) { + h, client := test.RegisterIntegration(t) + + account := h.NewRandAccount() + ctx := h.NewAuthenticatedContext(account) + + created, err := newCredential(h.NewID()) + Expect(err).NotTo(HaveOccurred()) + + _, resp, err := client.DefaultAPI.ApiAmbientV1CredentialsIdGet(ctx, created.ID).Execute() + Expect(err).NotTo(HaveOccurred()) + Expect(resp.StatusCode).To(Equal(http.StatusOK)) + + resp, err = client.DefaultAPI.ApiAmbientV1CredentialsIdDelete(ctx, created.ID).Execute() + Expect(err).NotTo(HaveOccurred()) + Expect(resp.StatusCode).To(Equal(http.StatusNoContent)) + + _, resp, err = client.DefaultAPI.ApiAmbientV1CredentialsIdGet(ctx, created.ID).Execute() + Expect(err).To(HaveOccurred(), "Expected 404 after delete") + Expect(resp.StatusCode).To(Equal(http.StatusNotFound)) + + resp, err = client.DefaultAPI.ApiAmbientV1CredentialsIdDelete(context.Background(), created.ID).Execute() + Expect(err).To(HaveOccurred(), "Expected 401 for unauthenticated delete") + _ = resp +} diff --git a/components/ambient-api-server/plugins/credentials/migration.go b/components/ambient-api-server/plugins/credentials/migration.go new file mode 100644 index 000000000..54089b6f4 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/migration.go @@ -0,0 +1,32 @@ +package credentials + +import ( + "gorm.io/gorm" + + "github.com/go-gormigrate/gormigrate/v2" + "github.com/openshift-online/rh-trex-ai/pkg/db" +) + +func migration() *gormigrate.Migration { + type Credential struct { + db.Model + Name string + Description *string + Provider string + Token *string + Url *string + Email *string + Labels *string + Annotations *string + } + + return &gormigrate.Migration{ + ID: "202603311215", + Migrate: func(tx *gorm.DB) error { + return tx.AutoMigrate(&Credential{}) + }, + Rollback: func(tx *gorm.DB) error { + return tx.Migrator().DropTable(&Credential{}) + }, + } +} diff --git a/components/ambient-api-server/plugins/credentials/mock_dao.go b/components/ambient-api-server/plugins/credentials/mock_dao.go new file mode 100644 index 000000000..a740c7221 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/mock_dao.go @@ -0,0 +1,49 @@ +package credentials + +import ( + "context" + + "gorm.io/gorm" + + "github.com/openshift-online/rh-trex-ai/pkg/errors" +) + +var _ CredentialDao = &credentialDaoMock{} + +type credentialDaoMock struct { + credentials CredentialList +} + +func NewMockCredentialDao() *credentialDaoMock { + return &credentialDaoMock{} +} + +func (d *credentialDaoMock) Get(ctx context.Context, id string) (*Credential, error) { + for _, credential := range d.credentials { + if credential.ID == id { + return credential, nil + } + } + return nil, gorm.ErrRecordNotFound +} + +func (d *credentialDaoMock) Create(ctx context.Context, credential *Credential) (*Credential, error) { + d.credentials = append(d.credentials, credential) + return credential, nil +} + +func (d *credentialDaoMock) Replace(ctx context.Context, credential *Credential) (*Credential, error) { + return nil, errors.NotImplemented("Credential").AsError() +} + +func (d *credentialDaoMock) Delete(ctx context.Context, id string) error { + return errors.NotImplemented("Credential").AsError() +} + +func (d *credentialDaoMock) FindByIDs(ctx context.Context, ids []string) (CredentialList, error) { + return nil, errors.NotImplemented("Credential").AsError() +} + +func (d *credentialDaoMock) All(ctx context.Context) (CredentialList, error) { + return d.credentials, nil +} diff --git a/components/ambient-api-server/plugins/credentials/model.go b/components/ambient-api-server/plugins/credentials/model.go new file mode 100644 index 000000000..cb0782d80 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/model.go @@ -0,0 +1,45 @@ +package credentials + +import ( + "github.com/openshift-online/rh-trex-ai/pkg/api" + "gorm.io/gorm" +) + +type Credential struct { + api.Meta + Name string `json:"name"` + Description *string `json:"description"` + Provider string `json:"provider"` + Token *string `json:"token"` + Url *string `json:"url"` + Email *string `json:"email"` + Labels *string `json:"labels"` + Annotations *string `json:"annotations"` +} + +type CredentialList []*Credential +type CredentialIndex map[string]*Credential + +func (l CredentialList) Index() CredentialIndex { + index := CredentialIndex{} + for _, o := range l { + index[o.ID] = o + } + return index +} + +func (d *Credential) BeforeCreate(tx *gorm.DB) error { + d.ID = api.NewID() + return nil +} + +type CredentialPatchRequest struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Provider *string `json:"provider,omitempty"` + Token *string `json:"token,omitempty"` + Url *string `json:"url,omitempty"` + Email *string `json:"email,omitempty"` + Labels *string `json:"labels,omitempty"` + Annotations *string `json:"annotations,omitempty"` +} diff --git a/components/ambient-api-server/plugins/credentials/plugin.go b/components/ambient-api-server/plugins/credentials/plugin.go new file mode 100644 index 000000000..8a5ec8270 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/plugin.go @@ -0,0 +1,85 @@ +package credentials + +import ( + "net/http" + + pkgrbac "github.com/ambient-code/platform/components/ambient-api-server/plugins/rbac" + "github.com/gorilla/mux" + "github.com/openshift-online/rh-trex-ai/pkg/api" + "github.com/openshift-online/rh-trex-ai/pkg/api/presenters" + "github.com/openshift-online/rh-trex-ai/pkg/auth" + "github.com/openshift-online/rh-trex-ai/pkg/controllers" + "github.com/openshift-online/rh-trex-ai/pkg/db" + "github.com/openshift-online/rh-trex-ai/pkg/environments" + "github.com/openshift-online/rh-trex-ai/pkg/registry" + pkgserver "github.com/openshift-online/rh-trex-ai/pkg/server" + "github.com/openshift-online/rh-trex-ai/plugins/events" + "github.com/openshift-online/rh-trex-ai/plugins/generic" +) + +type ServiceLocator func() CredentialService + +func NewServiceLocator(env *environments.Env) ServiceLocator { + return func() CredentialService { + return NewCredentialService( + db.NewAdvisoryLockFactory(env.Database.SessionFactory), + NewCredentialDao(&env.Database.SessionFactory), + events.Service(&env.Services), + ) + } +} + +func Service(s *environments.Services) CredentialService { + if s == nil { + return nil + } + if obj := s.GetService("Credentials"); obj != nil { + locator := obj.(ServiceLocator) + return locator() + } + return nil +} + +func init() { + registry.RegisterService("Credentials", func(env interface{}) interface{} { + return NewServiceLocator(env.(*environments.Env)) + }) + + pkgserver.RegisterRoutes("credentials", func(apiV1Router *mux.Router, services pkgserver.ServicesInterface, authMiddleware environments.JWTMiddleware, authzMiddleware auth.AuthorizationMiddleware) { + envServices := services.(*environments.Services) + if dbAuthz := pkgrbac.Middleware(envServices); dbAuthz != nil { + authzMiddleware = dbAuthz + } + credentialHandler := NewCredentialHandler(Service(envServices), generic.Service(envServices)) + + credentialsRouter := apiV1Router.PathPrefix("/credentials").Subrouter() + credentialsRouter.HandleFunc("", credentialHandler.List).Methods(http.MethodGet) + credentialsRouter.HandleFunc("/{id}", credentialHandler.Get).Methods(http.MethodGet) + credentialsRouter.HandleFunc("/{id}/token", credentialHandler.GetToken).Methods(http.MethodGet) + credentialsRouter.HandleFunc("", credentialHandler.Create).Methods(http.MethodPost) + credentialsRouter.HandleFunc("/{id}", credentialHandler.Patch).Methods(http.MethodPatch) + credentialsRouter.HandleFunc("/{id}", credentialHandler.Delete).Methods(http.MethodDelete) + credentialsRouter.Use(authMiddleware.AuthenticateAccountJWT) + credentialsRouter.Use(authzMiddleware.AuthorizeApi) + }) + + pkgserver.RegisterController("Credentials", func(manager *controllers.KindControllerManager, services pkgserver.ServicesInterface) { + credentialServices := Service(services.(*environments.Services)) + + manager.Add(&controllers.ControllerConfig{ + Source: "Credentials", + Handlers: map[api.EventType][]controllers.ControllerHandlerFunc{ + api.CreateEventType: {credentialServices.OnUpsert}, + api.UpdateEventType: {credentialServices.OnUpsert}, + api.DeleteEventType: {credentialServices.OnDelete}, + }, + }) + }) + + presenters.RegisterPath(Credential{}, "credentials") + presenters.RegisterPath(&Credential{}, "credentials") + presenters.RegisterKind(Credential{}, "Credential") + presenters.RegisterKind(&Credential{}, "Credential") + + db.RegisterMigration(migration()) +} diff --git a/components/ambient-api-server/plugins/credentials/presenter.go b/components/ambient-api-server/plugins/credentials/presenter.go new file mode 100644 index 000000000..6248d5a61 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/presenter.go @@ -0,0 +1,57 @@ +package credentials + +import ( + "github.com/ambient-code/platform/components/ambient-api-server/pkg/api/openapi" + "github.com/openshift-online/rh-trex-ai/pkg/api" + "github.com/openshift-online/rh-trex-ai/pkg/api/presenters" + "github.com/openshift-online/rh-trex-ai/pkg/util" +) + +func ConvertCredential(credential openapi.Credential) *Credential { + c := &Credential{ + Meta: api.Meta{ + ID: util.NilToEmptyString(credential.Id), + }, + } + c.Name = credential.Name + c.Description = credential.Description + c.Provider = credential.Provider + c.Token = credential.Token + c.Url = credential.Url + c.Email = credential.Email + c.Labels = credential.Labels + c.Annotations = credential.Annotations + + if credential.CreatedAt != nil { + c.CreatedAt = *credential.CreatedAt + c.UpdatedAt = *credential.UpdatedAt + } + + return c +} + +func PresentCredential(credential *Credential) openapi.Credential { + reference := presenters.PresentReference(credential.ID, credential) + return openapi.Credential{ + Id: reference.Id, + Kind: reference.Kind, + Href: reference.Href, + CreatedAt: openapi.PtrTime(credential.CreatedAt), + UpdatedAt: openapi.PtrTime(credential.UpdatedAt), + Name: credential.Name, + Description: credential.Description, + Provider: credential.Provider, + Url: credential.Url, + Email: credential.Email, + Labels: credential.Labels, + Annotations: credential.Annotations, + } +} + +func PresentCredentialToken(credential *Credential) openapi.CredentialTokenResponse { + return openapi.CredentialTokenResponse{ + CredentialId: credential.ID, + Provider: credential.Provider, + Token: util.NilToEmptyString(credential.Token), + } +} diff --git a/components/ambient-api-server/plugins/credentials/service.go b/components/ambient-api-server/plugins/credentials/service.go new file mode 100644 index 000000000..911385a7f --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/service.go @@ -0,0 +1,162 @@ +package credentials + +import ( + "context" + + "github.com/openshift-online/rh-trex-ai/pkg/api" + "github.com/openshift-online/rh-trex-ai/pkg/db" + "github.com/openshift-online/rh-trex-ai/pkg/errors" + "github.com/openshift-online/rh-trex-ai/pkg/logger" + "github.com/openshift-online/rh-trex-ai/pkg/services" +) + +const credentialsLockType db.LockType = "credentials" + +var ( + DisableAdvisoryLock = false + UseBlockingAdvisoryLock = true +) + +type CredentialService interface { + Get(ctx context.Context, id string) (*Credential, *errors.ServiceError) + Create(ctx context.Context, credential *Credential) (*Credential, *errors.ServiceError) + Replace(ctx context.Context, credential *Credential) (*Credential, *errors.ServiceError) + Delete(ctx context.Context, id string) *errors.ServiceError + All(ctx context.Context) (CredentialList, *errors.ServiceError) + + FindByIDs(ctx context.Context, ids []string) (CredentialList, *errors.ServiceError) + + OnUpsert(ctx context.Context, id string) error + OnDelete(ctx context.Context, id string) error +} + +func NewCredentialService(lockFactory db.LockFactory, credentialDao CredentialDao, events services.EventService) CredentialService { + return &sqlCredentialService{ + lockFactory: lockFactory, + credentialDao: credentialDao, + events: events, + } +} + +var _ CredentialService = &sqlCredentialService{} + +type sqlCredentialService struct { + lockFactory db.LockFactory + credentialDao CredentialDao + events services.EventService +} + +func (s *sqlCredentialService) OnUpsert(ctx context.Context, id string) error { + logger := logger.NewLogger(ctx) + + credential, err := s.credentialDao.Get(ctx, id) + if err != nil { + return err + } + + logger.Infof("Do idempotent somethings with this credential: %s", credential.ID) + + return nil +} + +func (s *sqlCredentialService) OnDelete(ctx context.Context, id string) error { + logger := logger.NewLogger(ctx) + logger.Infof("This credential has been deleted: %s", id) + return nil +} + +func (s *sqlCredentialService) Get(ctx context.Context, id string) (*Credential, *errors.ServiceError) { + credential, err := s.credentialDao.Get(ctx, id) + if err != nil { + return nil, services.HandleGetError("Credential", "id", id, err) + } + return credential, nil +} + +func (s *sqlCredentialService) Create(ctx context.Context, credential *Credential) (*Credential, *errors.ServiceError) { + credential, err := s.credentialDao.Create(ctx, credential) + if err != nil { + return nil, services.HandleCreateError("Credential", err) + } + + _, evErr := s.events.Create(ctx, &api.Event{ + Source: "Credentials", + SourceID: credential.ID, + EventType: api.CreateEventType, + }) + if evErr != nil { + return nil, services.HandleCreateError("Credential", evErr) + } + + return credential, nil +} + +func (s *sqlCredentialService) Replace(ctx context.Context, credential *Credential) (*Credential, *errors.ServiceError) { + if !DisableAdvisoryLock { + if UseBlockingAdvisoryLock { + lockOwnerID, err := s.lockFactory.NewAdvisoryLock(ctx, credential.ID, credentialsLockType) + if err != nil { + return nil, errors.DatabaseAdvisoryLock(err) + } + defer s.lockFactory.Unlock(ctx, lockOwnerID) + } else { + lockOwnerID, locked, err := s.lockFactory.NewNonBlockingLock(ctx, credential.ID, credentialsLockType) + if err != nil { + return nil, errors.DatabaseAdvisoryLock(err) + } + if !locked { + return nil, services.HandleCreateError("Credential", errors.New(errors.ErrorConflict, "row locked")) + } + defer s.lockFactory.Unlock(ctx, lockOwnerID) + } + } + + credential, err := s.credentialDao.Replace(ctx, credential) + if err != nil { + return nil, services.HandleUpdateError("Credential", err) + } + + _, evErr := s.events.Create(ctx, &api.Event{ + Source: "Credentials", + SourceID: credential.ID, + EventType: api.UpdateEventType, + }) + if evErr != nil { + return nil, services.HandleUpdateError("Credential", evErr) + } + + return credential, nil +} + +func (s *sqlCredentialService) Delete(ctx context.Context, id string) *errors.ServiceError { + if err := s.credentialDao.Delete(ctx, id); err != nil { + return services.HandleDeleteError("Credential", errors.GeneralError("Unable to delete credential: %s", err)) + } + + _, evErr := s.events.Create(ctx, &api.Event{ + Source: "Credentials", + SourceID: id, + EventType: api.DeleteEventType, + }) + if evErr != nil { + return services.HandleDeleteError("Credential", evErr) + } + + return nil +} + +func (s *sqlCredentialService) FindByIDs(ctx context.Context, ids []string) (CredentialList, *errors.ServiceError) { + credentials, err := s.credentialDao.FindByIDs(ctx, ids) + if err != nil { + return nil, errors.GeneralError("Unable to get all credentials: %s", err) + } + return credentials, nil +} + +func (s *sqlCredentialService) All(ctx context.Context) (CredentialList, *errors.ServiceError) { + credentials, err := s.credentialDao.All(ctx) + if err != nil { + return nil, errors.GeneralError("Unable to get all credentials: %s", err) + } + return credentials, nil +} diff --git a/components/ambient-api-server/plugins/credentials/testmain_test.go b/components/ambient-api-server/plugins/credentials/testmain_test.go new file mode 100644 index 000000000..db2f2f071 --- /dev/null +++ b/components/ambient-api-server/plugins/credentials/testmain_test.go @@ -0,0 +1,21 @@ +package credentials_test + +import ( + "flag" + "os" + "runtime" + "testing" + + "github.com/golang/glog" + + "github.com/ambient-code/platform/components/ambient-api-server/test" +) + +func TestMain(m *testing.M) { + flag.Parse() + glog.Infof("Starting credentials integration test using go version %s", runtime.Version()) + helper := test.NewHelper(&testing.T{}) + exitCode := m.Run() + helper.Teardown() + os.Exit(exitCode) +} diff --git a/components/ambient-cli/cmd/acpctl/credential/cmd.go b/components/ambient-cli/cmd/acpctl/credential/cmd.go new file mode 100644 index 000000000..03fef6079 --- /dev/null +++ b/components/ambient-cli/cmd/acpctl/credential/cmd.go @@ -0,0 +1,406 @@ +package credential + +import ( + "context" + "fmt" + "time" + + "github.com/ambient-code/platform/components/ambient-cli/pkg/config" + "github.com/ambient-code/platform/components/ambient-cli/pkg/connection" + "github.com/ambient-code/platform/components/ambient-cli/pkg/output" + sdktypes "github.com/ambient-code/platform/components/ambient-sdk/go-sdk/types" + "github.com/spf13/cobra" +) + +var Cmd = &cobra.Command{ + Use: "credential", + Short: "Manage credentials", + Long: `Manage credentials for external service integrations. + +Subcommands: + list List credentials + get Get a specific credential + create Create a credential + update Update a credential's fields + delete Delete a credential + token Retrieve the token for a credential`, + RunE: func(cmd *cobra.Command, args []string) error { + return cmd.Help() + }, +} + +var listArgs struct { + outputFormat string + limit int + provider string +} + +var listCmd = &cobra.Command{ + Use: "list", + Short: "List credentials", + Example: ` acpctl credential list + acpctl credential list --provider github -o json`, + RunE: func(cmd *cobra.Command, args []string) error { + client, err := connection.NewClientFromConfig() + if err != nil { + return err + } + + cfg, err := config.Load() + if err != nil { + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), cfg.GetRequestTimeout()) + defer cancel() + + format, err := output.ParseFormat(listArgs.outputFormat) + if err != nil { + return err + } + printer := output.NewPrinter(format, cmd.OutOrStdout()) + + opts := sdktypes.NewListOptions().Size(listArgs.limit).Build() + if listArgs.provider != "" { + opts.Search = fmt.Sprintf("provider='%s'", listArgs.provider) + } + list, err := client.Credentials().List(ctx, opts) + if err != nil { + return fmt.Errorf("list credentials: %w", err) + } + + if printer.Format() == output.FormatJSON { + return printer.PrintJSON(list) + } + + return printCredentialTable(printer, list.Items) + }, +} + +var getArgs struct { + outputFormat string +} + +var getCmd = &cobra.Command{ + Use: "get ", + Short: "Get a specific credential", + Args: cobra.ExactArgs(1), + Example: ` acpctl credential get + acpctl credential get -o json`, + RunE: func(cmd *cobra.Command, args []string) error { + client, err := connection.NewClientFromConfig() + if err != nil { + return err + } + + cfg, err := config.Load() + if err != nil { + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), cfg.GetRequestTimeout()) + defer cancel() + + credential, err := client.Credentials().Get(ctx, args[0]) + if err != nil { + return fmt.Errorf("get credential %q: %w", args[0], err) + } + + format, err := output.ParseFormat(getArgs.outputFormat) + if err != nil { + return err + } + printer := output.NewPrinter(format, cmd.OutOrStdout()) + + if printer.Format() == output.FormatJSON { + return printer.PrintJSON(credential) + } + return printCredentialTable(printer, []sdktypes.Credential{*credential}) + }, +} + +var createArgs struct { + name string + provider string + token string + description string + url string + email string + labels string + annotations string + outputFormat string +} + +var createCmd = &cobra.Command{ + Use: "create", + Short: "Create a credential", + Example: ` acpctl credential create --name github-main --provider github --token ghp_xxx + acpctl credential create --name jira-corp --provider jira --url https://corp.atlassian.net --token xxx`, + RunE: func(cmd *cobra.Command, args []string) error { + if createArgs.name == "" { + return fmt.Errorf("--name is required") + } + if createArgs.provider == "" { + return fmt.Errorf("--provider is required") + } + + client, err := connection.NewClientFromConfig() + if err != nil { + return err + } + + cfg, err := config.Load() + if err != nil { + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), cfg.GetRequestTimeout()) + defer cancel() + + builder := sdktypes.NewCredentialBuilder(). + Name(createArgs.name). + Provider(createArgs.provider) + + if createArgs.token != "" { + builder = builder.Token(createArgs.token) + } + if createArgs.description != "" { + builder = builder.Description(createArgs.description) + } + if createArgs.url != "" { + builder = builder.Url(createArgs.url) + } + if createArgs.email != "" { + builder = builder.Email(createArgs.email) + } + if createArgs.labels != "" { + builder = builder.Labels(createArgs.labels) + } + if createArgs.annotations != "" { + builder = builder.Annotations(createArgs.annotations) + } + + cred, err := builder.Build() + if err != nil { + return fmt.Errorf("build credential: %w", err) + } + + created, err := client.Credentials().Create(ctx, cred) + if err != nil { + return fmt.Errorf("create credential: %w", err) + } + + format, err := output.ParseFormat(createArgs.outputFormat) + if err != nil { + return err + } + printer := output.NewPrinter(format, cmd.OutOrStdout()) + + if printer.Format() == output.FormatJSON { + return printer.PrintJSON(created) + } + fmt.Fprintf(cmd.OutOrStdout(), "credential/%s created\n", created.Name) + return nil + }, +} + +var updateArgs struct { + name string + token string + description string + url string + email string + labels string + annotations string +} + +var updateCmd = &cobra.Command{ + Use: "update ", + Short: "Update a credential", + Args: cobra.ExactArgs(1), + Example: ` acpctl credential update --token ghp_newtoken + acpctl credential update --description "updated description"`, + RunE: func(cmd *cobra.Command, args []string) error { + client, err := connection.NewClientFromConfig() + if err != nil { + return err + } + + cfg, err := config.Load() + if err != nil { + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), cfg.GetRequestTimeout()) + defer cancel() + + patch := sdktypes.NewCredentialPatchBuilder() + if cmd.Flags().Changed("name") { + patch = patch.Name(updateArgs.name) + } + if cmd.Flags().Changed("token") { + patch = patch.Token(updateArgs.token) + } + if cmd.Flags().Changed("description") { + patch = patch.Description(updateArgs.description) + } + if cmd.Flags().Changed("url") { + patch = patch.Url(updateArgs.url) + } + if cmd.Flags().Changed("email") { + patch = patch.Email(updateArgs.email) + } + if cmd.Flags().Changed("labels") { + patch = patch.Labels(updateArgs.labels) + } + if cmd.Flags().Changed("annotations") { + patch = patch.Annotations(updateArgs.annotations) + } + + updated, err := client.Credentials().Update(ctx, args[0], patch.Build()) + if err != nil { + return fmt.Errorf("update credential: %w", err) + } + + fmt.Fprintf(cmd.OutOrStdout(), "credential/%s updated\n", updated.Name) + return nil + }, +} + +var deleteArgs struct { + confirm bool +} + +var deleteCmd = &cobra.Command{ + Use: "delete ", + Short: "Delete a credential", + Args: cobra.ExactArgs(1), + Example: ` acpctl credential delete --confirm`, + RunE: func(cmd *cobra.Command, args []string) error { + if !deleteArgs.confirm { + return fmt.Errorf("add --confirm to delete credential/%s", args[0]) + } + + client, err := connection.NewClientFromConfig() + if err != nil { + return err + } + + cfg, err := config.Load() + if err != nil { + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), cfg.GetRequestTimeout()) + defer cancel() + + if err := client.Credentials().Delete(ctx, args[0]); err != nil { + return fmt.Errorf("delete credential: %w", err) + } + + fmt.Fprintf(cmd.OutOrStdout(), "credential/%s deleted\n", args[0]) + return nil + }, +} + +var tokenArgs struct { + outputFormat string +} + +var tokenCmd = &cobra.Command{ + Use: "token ", + Short: "Retrieve the token for a credential", + Args: cobra.ExactArgs(1), + Example: ` acpctl credential token + acpctl credential token -o json`, + RunE: func(cmd *cobra.Command, args []string) error { + client, err := connection.NewClientFromConfig() + if err != nil { + return err + } + + cfg, err := config.Load() + if err != nil { + return err + } + + ctx, cancel := context.WithTimeout(context.Background(), cfg.GetRequestTimeout()) + defer cancel() + + resp, err := client.Credentials().GetToken(ctx, args[0]) + if err != nil { + return fmt.Errorf("get token for credential %q: %w", args[0], err) + } + + format, err := output.ParseFormat(tokenArgs.outputFormat) + if err != nil { + return err + } + printer := output.NewPrinter(format, cmd.OutOrStdout()) + + if printer.Format() == output.FormatJSON { + return printer.PrintJSON(resp) + } + fmt.Fprintf(cmd.OutOrStdout(), "%s\n", resp.Token) + return nil + }, +} + +func init() { + Cmd.AddCommand(listCmd) + Cmd.AddCommand(getCmd) + Cmd.AddCommand(createCmd) + Cmd.AddCommand(updateCmd) + Cmd.AddCommand(deleteCmd) + Cmd.AddCommand(tokenCmd) + + listCmd.Flags().StringVarP(&listArgs.outputFormat, "output", "o", "", "Output format: json") + listCmd.Flags().IntVar(&listArgs.limit, "limit", 100, "Maximum number of items to return") + listCmd.Flags().StringVar(&listArgs.provider, "provider", "", "Filter by provider (github|gitlab|jira|google)") + + getCmd.Flags().StringVarP(&getArgs.outputFormat, "output", "o", "", "Output format: json") + + createCmd.Flags().StringVar(&createArgs.name, "name", "", "Credential name (required)") + createCmd.Flags().StringVar(&createArgs.provider, "provider", "", "Provider (github|gitlab|jira|google) (required)") + createCmd.Flags().StringVar(&createArgs.token, "token", "", "Secret token or API key") + createCmd.Flags().StringVar(&createArgs.description, "description", "", "Description") + createCmd.Flags().StringVar(&createArgs.url, "url", "", "Service URL") + createCmd.Flags().StringVar(&createArgs.email, "email", "", "Associated email") + createCmd.Flags().StringVar(&createArgs.labels, "labels", "", "Labels (JSON string)") + createCmd.Flags().StringVar(&createArgs.annotations, "annotations", "", "Annotations (JSON string)") + createCmd.Flags().StringVarP(&createArgs.outputFormat, "output", "o", "", "Output format: json") + + updateCmd.Flags().StringVar(&updateArgs.name, "name", "", "New credential name") + updateCmd.Flags().StringVar(&updateArgs.token, "token", "", "New secret token or API key") + updateCmd.Flags().StringVar(&updateArgs.description, "description", "", "New description") + updateCmd.Flags().StringVar(&updateArgs.url, "url", "", "New service URL") + updateCmd.Flags().StringVar(&updateArgs.email, "email", "", "New associated email") + updateCmd.Flags().StringVar(&updateArgs.labels, "labels", "", "New labels (JSON string)") + updateCmd.Flags().StringVar(&updateArgs.annotations, "annotations", "", "New annotations (JSON string)") + + deleteCmd.Flags().BoolVar(&deleteArgs.confirm, "confirm", false, "Confirm deletion") + + tokenCmd.Flags().StringVarP(&tokenArgs.outputFormat, "output", "o", "", "Output format: json") +} + +func printCredentialTable(printer *output.Printer, credentials []sdktypes.Credential) error { + columns := []output.Column{ + {Name: "ID", Width: 27}, + {Name: "NAME", Width: 24}, + {Name: "PROVIDER", Width: 12}, + {Name: "DESCRIPTION", Width: 32}, + {Name: "AGE", Width: 10}, + } + + table := output.NewTable(printer.Writer(), columns) + table.WriteHeaders() + + for _, c := range credentials { + age := "" + if c.CreatedAt != nil { + age = output.FormatAge(time.Since(*c.CreatedAt)) + } + table.WriteRow(c.ID, c.Name, c.Provider, c.Description, age) + } + return nil +} diff --git a/components/ambient-cli/cmd/acpctl/main.go b/components/ambient-cli/cmd/acpctl/main.go index 5f6f08337..4d74a0e2e 100644 --- a/components/ambient-cli/cmd/acpctl/main.go +++ b/components/ambient-cli/cmd/acpctl/main.go @@ -7,13 +7,14 @@ import ( "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/agent" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/ambient" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/apply" - "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/inbox" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/completion" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/config" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/create" + "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/credential" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/delete" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/describe" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/get" + "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/inbox" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/login" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/logout" "github.com/ambient-code/platform/components/ambient-cli/cmd/acpctl/project" @@ -54,6 +55,7 @@ func init() { root.AddCommand(project.Cmd) root.AddCommand(session.Cmd) root.AddCommand(agent.Cmd) + root.AddCommand(credential.Cmd) root.AddCommand(inbox.Cmd) root.AddCommand(get.Cmd) root.AddCommand(create.Cmd) diff --git a/components/ambient-sdk/go-sdk/client/credential_api.go b/components/ambient-sdk/go-sdk/client/credential_api.go new file mode 100644 index 000000000..023494bd6 --- /dev/null +++ b/components/ambient-sdk/go-sdk/client/credential_api.go @@ -0,0 +1,79 @@ +package client + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/ambient-code/platform/components/ambient-sdk/go-sdk/types" +) + +type CredentialAPI struct { + client *Client +} + +func (c *Client) Credentials() *CredentialAPI { + return &CredentialAPI{client: c} +} + +func (a *CredentialAPI) Create(ctx context.Context, resource *types.Credential) (*types.Credential, error) { + body, err := json.Marshal(resource) + if err != nil { + return nil, fmt.Errorf("marshal credential: %w", err) + } + var result types.Credential + if err := a.client.do(ctx, http.MethodPost, "/credentials", body, http.StatusCreated, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *CredentialAPI) Get(ctx context.Context, id string) (*types.Credential, error) { + var result types.Credential + if err := a.client.do(ctx, http.MethodGet, "/credentials/"+url.PathEscape(id), nil, http.StatusOK, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *CredentialAPI) List(ctx context.Context, opts *types.ListOptions) (*types.CredentialList, error) { + var result types.CredentialList + if err := a.client.doWithQuery(ctx, http.MethodGet, "/credentials", nil, http.StatusOK, &result, opts); err != nil { + return nil, err + } + return &result, nil +} + +func (a *CredentialAPI) Update(ctx context.Context, id string, patch map[string]any) (*types.Credential, error) { + body, err := json.Marshal(patch) + if err != nil { + return nil, fmt.Errorf("marshal patch: %w", err) + } + var result types.Credential + if err := a.client.do(ctx, http.MethodPatch, "/credentials/"+url.PathEscape(id), body, http.StatusOK, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *CredentialAPI) Delete(ctx context.Context, id string) error { + return a.client.do(ctx, http.MethodDelete, "/credentials/"+url.PathEscape(id), nil, http.StatusNoContent, nil) +} + +func (a *CredentialAPI) GetToken(ctx context.Context, id string) (*types.CredentialTokenResponse, error) { + var result types.CredentialTokenResponse + if err := a.client.do(ctx, http.MethodGet, "/credentials/"+url.PathEscape(id)+"/token", nil, http.StatusOK, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *CredentialAPI) ListAll(ctx context.Context, opts *types.ListOptions) *Iterator[types.Credential] { + return NewIterator(func(page int) (*types.CredentialList, error) { + o := *opts + o.Page = page + return a.List(ctx, &o) + }) +} diff --git a/components/ambient-sdk/go-sdk/types/credential.go b/components/ambient-sdk/go-sdk/types/credential.go new file mode 100644 index 000000000..3d49c1b8a --- /dev/null +++ b/components/ambient-sdk/go-sdk/types/credential.go @@ -0,0 +1,144 @@ +package types + +import ( + "errors" + "fmt" +) + +type Credential struct { + ObjectReference + + Annotations string `json:"annotations,omitempty"` + Description string `json:"description,omitempty"` + Email string `json:"email,omitempty"` + Labels string `json:"labels,omitempty"` + Name string `json:"name"` + Provider string `json:"provider"` + Token string `json:"token,omitempty"` + Url string `json:"url,omitempty"` +} + +type CredentialList struct { + ListMeta + Items []Credential `json:"items"` +} + +func (l *CredentialList) GetItems() []Credential { return l.Items } +func (l *CredentialList) GetTotal() int { return l.Total } +func (l *CredentialList) GetPage() int { return l.Page } +func (l *CredentialList) GetSize() int { return l.Size } + +type CredentialTokenResponse struct { + CredentialID string `json:"credential_id"` + Provider string `json:"provider"` + Token string `json:"token"` +} + +type CredentialBuilder struct { + resource Credential + errors []error +} + +func NewCredentialBuilder() *CredentialBuilder { + return &CredentialBuilder{} +} + +func (b *CredentialBuilder) Name(v string) *CredentialBuilder { + b.resource.Name = v + return b +} + +func (b *CredentialBuilder) Provider(v string) *CredentialBuilder { + b.resource.Provider = v + return b +} + +func (b *CredentialBuilder) Token(v string) *CredentialBuilder { + b.resource.Token = v + return b +} + +func (b *CredentialBuilder) Description(v string) *CredentialBuilder { + b.resource.Description = v + return b +} + +func (b *CredentialBuilder) Url(v string) *CredentialBuilder { + b.resource.Url = v + return b +} + +func (b *CredentialBuilder) Email(v string) *CredentialBuilder { + b.resource.Email = v + return b +} + +func (b *CredentialBuilder) Labels(v string) *CredentialBuilder { + b.resource.Labels = v + return b +} + +func (b *CredentialBuilder) Annotations(v string) *CredentialBuilder { + b.resource.Annotations = v + return b +} + +func (b *CredentialBuilder) Build() (*Credential, error) { + if b.resource.Name == "" { + b.errors = append(b.errors, fmt.Errorf("name is required")) + } + if b.resource.Provider == "" { + b.errors = append(b.errors, fmt.Errorf("provider is required")) + } + if len(b.errors) > 0 { + return nil, fmt.Errorf("validation failed: %w", errors.Join(b.errors...)) + } + return &b.resource, nil +} + +type CredentialPatchBuilder struct { + patch map[string]any +} + +func NewCredentialPatchBuilder() *CredentialPatchBuilder { + return &CredentialPatchBuilder{patch: make(map[string]any)} +} + +func (b *CredentialPatchBuilder) Name(v string) *CredentialPatchBuilder { + b.patch["name"] = v + return b +} + +func (b *CredentialPatchBuilder) Token(v string) *CredentialPatchBuilder { + b.patch["token"] = v + return b +} + +func (b *CredentialPatchBuilder) Description(v string) *CredentialPatchBuilder { + b.patch["description"] = v + return b +} + +func (b *CredentialPatchBuilder) Url(v string) *CredentialPatchBuilder { + b.patch["url"] = v + return b +} + +func (b *CredentialPatchBuilder) Email(v string) *CredentialPatchBuilder { + b.patch["email"] = v + return b +} + +func (b *CredentialPatchBuilder) Labels(v string) *CredentialPatchBuilder { + b.patch["labels"] = v + return b +} + +func (b *CredentialPatchBuilder) Annotations(v string) *CredentialPatchBuilder { + b.patch["annotations"] = v + return b +} + +func (b *CredentialPatchBuilder) Build() map[string]any { + return b.patch +} diff --git a/docs/internal/design/ambient-model.spec.md b/docs/internal/design/ambient-model.spec.md index 15f2a231b..27ed21f93 100644 --- a/docs/internal/design/ambient-model.spec.md +++ b/docs/internal/design/ambient-model.spec.md @@ -2,8 +2,9 @@ **Date:** 2026-03-20 **Status:** Proposed — Pending Consensus -**Last Updated:** 2026-03-21 — collapsed Agent+ProjectAgent into single project-scoped Agent; Agent.prompt is mutable +**Last Updated:** 2026-03-31 — added Credential Kind; extended RoleBinding.scope with `credential`; new credential roles and API endpoints **Guide:** `ambient-model.guide.md` — implementation waves, gap table, build commands, run log +**Design:** `credentials-session.md` — full Credential Kind design spec and rationale --- @@ -11,8 +12,13 @@ The Ambient API server provides a coordination layer for orchestrating fleets of persistent agents across projects. The model is intentionally simple: +- **Project** — a workspace. Groups agents and provides shared context (`prompt`) injected into every session ignition. - **Agent** — a project-scoped, mutable definition. Agents belong to exactly one Project. `prompt` defines who the agent is and is directly editable (subject to RBAC). - **Session** — an ephemeral Kubernetes execution run, created exclusively via agent ignition. Only one active session per Agent at a time. +- **Message** — a single AG-UI event in the LLM conversation. Append-only; the canonical record of what happened in a session. +- **Inbox** — a persistent message queue on an Agent. Messages survive across sessions and are drained into the ignition context at the next run. +- **Credential** — a platform-scoped, RBAC-owned secret. Stores a Personal Access Token or equivalent for an external provider (GitHub, GitLab, Jira, Google). Consumed by runners at session start. +- **RoleBinding** — binds a Resource to a Role at a given scope (`global`, `project`, `agent`, `session`, `credential`). Ownership and access for all Kinds is expressed through RoleBindings. The stable address of an agent is `{project_name}/{agent_name}`. It holds the inbox and links to the active session. @@ -142,13 +148,30 @@ erDiagram string ID PK string user_id FK string role_id FK - string scope "global | project | agent | session" + string scope "global | project | agent | session | credential" string scope_id "empty for global" time created_at time updated_at time deleted_at } + %% ── Credential (platform-scoped PAT/token store) ───────────────────────── + + Credential { + string ID PK "KSUID" + string name "human-readable" + string description + string provider "github | gitlab | jira | google" + string token "write-only; stored encrypted" + string url "nullable; service instance URL" + string email "nullable; required for Jira" + jsonb labels + jsonb annotations + time created_at + time updated_at + time deleted_at + } + %% ── Relationships ──────────────────────────────────────────────────────── Project ||--o{ ProjectSettings : "has" @@ -157,6 +180,7 @@ erDiagram User ||--o{ RoleBinding : "bound_to" RoleBinding }o--o| Agent : "owns" + RoleBinding }o--o| Credential : "owns_or_accesses" Agent ||--o{ Session : "runs" Agent ||--o| Session : "current_session" @@ -293,6 +317,19 @@ The `acpctl` CLI mirrors the API 1-for-1. Every REST operation has a correspondi | `POST /sessions/{id}/messages` | `acpctl session send --body ` | ✅ implemented | | `GET /sessions/{id}/events` | `acpctl session events ` | ✅ implemented | +#### Credentials + +| REST API | `acpctl` Command | Status | +|---|---|---| +| `GET /credentials` | `acpctl credential list` | 🔲 planned | +| `GET /credentials?provider={p}` | `acpctl credential list --provider

` | 🔲 planned | +| `POST /credentials` | `acpctl credential create --name --provider

--token [--url ] [--email ] [--description ]` | 🔲 planned | +| `GET /credentials/{id}` | `acpctl credential get ` | 🔲 planned | +| `PATCH /credentials/{id}` | `acpctl credential update [--token ] [--description ]` | 🔲 planned | +| `DELETE /credentials/{id}` | `acpctl credential delete --confirm` | 🔲 planned | +| `GET /credentials/{id}/role_bindings` | _(not yet exposed)_ | 🔲 planned | +| `GET /credentials/{id}/token` | `acpctl credential token ` | 🔲 planned | + #### RBAC | REST API | `acpctl` Command | Status | @@ -323,6 +360,7 @@ The `acpctl` CLI mirrors the API 1-for-1. Every REST operation has a correspondi |---|---| | `Project` | `name`, `description`, `prompt`, `labels`, `annotations` | | `Agent` | `name`, `prompt`, `labels`, `annotations`, `inbox` (seed messages) | +| `Credential` | `name`, `description`, `provider`, `token` (env var reference), `url`, `email`, `labels`, `annotations` | `Agent` resources in `.ambient/teams/` files also carry an `inbox` list of seed messages. On apply, any message in the list is posted to the agent's inbox if an identical message (same `from_name` + `body`) does not already exist there. @@ -529,6 +567,45 @@ GET /api/ambient/v1/sessions/{id}/events SSE AG-UI event str GET /api/ambient/v1/sessions/{id}/role_bindings RBAC bindings ``` +### Credentials + +``` +GET /api/ambient/v1/credentials list credentials visible to the caller +GET /api/ambient/v1/credentials?provider={provider} filter by provider +POST /api/ambient/v1/credentials create a credential +GET /api/ambient/v1/credentials/{id} read credential (metadata only; token never returned) +PATCH /api/ambient/v1/credentials/{id} update credential +DELETE /api/ambient/v1/credentials/{id} soft delete +GET /api/ambient/v1/credentials/{id}/role_bindings RBAC bindings on this credential +GET /api/ambient/v1/credentials/{id}/token fetch raw token — restricted to credential:token-reader +``` + +`token` is accepted on `POST` and `PATCH` but **never returned** by the standard read endpoints. It is stored encrypted in the database. The database row is the authoritative store; a future Vault integration can be adopted by pointing the row at a Vault path without changing the API surface. + +`GET /credentials/{id}/token` is the **only** endpoint that returns the raw token. It is gated by the `credential:token-reader` role — a distinct role not implied by `credential:reader`. Runners are granted `credential:token-reader` by the platform at session start. Human users and service accounts do not hold this role by default. + +#### Provider Enum + +| Provider | Service | Token type | `url` | `email` | +|----------|---------|------------|-------|---------| +| `github` | GitHub.com or GitHub Enterprise | Personal Access Token | optional; required for GHE | — | +| `gitlab` | GitLab.com or self-hosted | Personal Access Token | optional; required for self-hosted | — | +| `jira` | Jira Cloud (Atlassian) | API Token | required (Atlassian instance URL) | required (used in Basic auth) | +| `google` | Google Cloud / Workspace | Service Account JSON serialized to string | — | — | + +#### Token Response Shape (Runner) + +When a runner fetches a credential, the response payload shape is consistent across providers: + +```json +{ "provider": "gitlab", "token": "glpat-...", "url": "https://gitlab.myco.com" } +{ "provider": "github", "token": "github_pat_...", "url": "https://github.com" } +{ "provider": "jira", "token": "ATATT3x...", "url": "https://myco.atlassian.net", "email": "bot@myco.com" } +{ "provider": "google", "token": "{\"type\":\"service_account\", ...}" } +``` + +`token` is always present. `url` and `email` are included when set. Google's token field carries the full Service Account JSON serialized as a string. + --- ## RBAC @@ -541,8 +618,30 @@ GET /api/ambient/v1/sessions/{id}/role_bindings RBAC bindings | `project` | Applies to all Agents and sessions in a project | | `agent` | Applies to one Agent and all its sessions | | `session` | Applies to one session run only | +| `credential` | Applies to one Credential resource | + +Effective permissions = union of all applicable bindings (global ∪ project ∪ agent ∪ session ∪ credential). No deny rules. + +For Credential resolution at session start, the resolver walks agent → project → global and returns the most specific matching credential for the requested provider. A narrower scope always wins. -Effective permissions = union of all applicable bindings (global ∪ project ∪ agent ∪ session). No deny rules. +#### Credential Scope — Access Granularity + +A credential is a platform-level resource. What determines who and what can use it is entirely the RoleBinding scope. The same credential can be shared at any granularity: + +| RoleBinding scope | scope_id | Effect | +|-------------------|----------|--------| +| `credential` | `credential_id` | Ownership or explicit per-credential grant. Auto-created as `credential:owner` at creation. | +| `agent` | `agent_id` | Only one specific agent (and its sessions) can use this credential. | +| `project` | `project_id` | All agents in a project share this credential automatically. | +| `global` | _(empty)_ | Platform-wide fallback; every session resolves this credential when no narrower binding exists. | + +Named patterns: +- **Personal PAT** — user creates credential; `credential:owner` binding is private to them. +- **Project Robot Account** — shared credential with a `project`-scoped `credential:reader` binding; all agents in the project use it. +- **Agent-specific identity** — `agent`-scoped binding; one agent runs as a specific identity without exposing it to siblings. +- **Platform-wide credential** — `global`-scoped binding; acts as the org-wide fallback for any session on the platform. + +Users may hold many credentials and share them across many projects. RBAC expresses sharing; there is no hardcoded ownership field. ### Built-in Roles @@ -557,6 +656,9 @@ Effective permissions = union of all applicable bindings (global ∪ project ∪ | `agent:editor` | Update prompt and metadata on a specific Agent | | `agent:observer` | Read a specific Agent and its sessions | | `agent:runner` | Minimum viable pod credential: read agent, push messages, send inbox | +| `credential:owner` | Full control of a Credential: update token, delete, manage bindings. Auto-granted at creation. | +| `credential:reader` | Read credential metadata (name, provider, url, email). Token value is never included. | +| `credential:token-reader` | Fetch the raw token via `GET /credentials/{id}/token`. Granted only to runner service accounts. Human users do not hold this role. | ### Permission Matrix @@ -571,6 +673,9 @@ Effective permissions = union of all applicable bindings (global ∪ project ∪ | `agent:editor` | — | update | — | — | — | — | | `agent:observer` | — | read | read/list | — | — | — | | `agent:runner` | — | read | read | send | — | — | +| `credential:owner` | — | — | — | — | — | manage bindings | metadata: full | token: — | +| `credential:reader` | — | — | — | — | — | — | metadata: read | token: — | +| `credential:token-reader` | — | — | — | — | — | — | metadata: — | token: read | ### RBAC Endpoints @@ -589,6 +694,12 @@ GET /api/ambient/v1/users/{id}/role_bindings GET /api/ambient/v1/projects/{id}/role_bindings GET /api/ambient/v1/projects/{id}/agents/{agent_id}/role_bindings GET /api/ambient/v1/sessions/{id}/role_bindings +GET /api/ambient/v1/credentials/{id}/role_bindings +``` + +The `credential:token-reader` role is granted to the runner service account by the platform at session start. It is never granted via user-facing `POST /role_bindings`. It is a platform-internal binding managed by the operator. + +``` ``` --- @@ -602,7 +713,7 @@ Every first-class Kind carries two JSONB columns: | `labels` | Queryable key/value tags. Use for filtering, grouping, and selection. | `{"env": "prod", "team": "platform", "tier": "critical"}` | | `annotations` | Freeform key/value metadata. Use for tooling notes, human remarks, external references. | `{"last-reviewed": "2026-03-21", "jira": "PLAT-123", "owner-slack": "@mturansk"}` | -**Kinds with `labels` + `annotations`:** User, Project, Agent, Session +**Kinds with `labels` + `annotations`:** User, Project, Agent, Session, Credential **Kinds without:** Inbox (ephemeral message queue), SessionMessage (append-only event stream), Role, RoleBinding (RBAC internals — structured by design) @@ -615,9 +726,10 @@ Instead of a separate `metadata` table (requires joins) or a polymorphic EAV tab - **GIN-indexed**: PostgreSQL JSONB supports `GIN` (Generalized Inverted Index), making containment queries (`@>`) nearly as fast as standard column lookups at scale. ```sql -CREATE INDEX idx_projects_labels ON projects USING GIN (labels); -CREATE INDEX idx_agents_labels ON agents USING GIN (labels); -CREATE INDEX idx_sessions_labels ON sessions USING GIN (labels); +CREATE INDEX idx_projects_labels ON projects USING GIN (labels); +CREATE INDEX idx_agents_labels ON agents USING GIN (labels); +CREATE INDEX idx_sessions_labels ON sessions USING GIN (labels); +CREATE INDEX idx_credentials_labels ON credentials USING GIN (labels); ``` ### Query patterns @@ -726,6 +838,10 @@ This structure means you can define and compose bespoke agent suites — entire | Agent is project-scoped, not global | Simplicity. An agent's identity and prompt are contextual to the project it serves. No indirection via a global registry. | | Agent.prompt is mutable | Prompt editing is a routine operational task. RBAC controls who can change it. No versioning overhead. | | Agent ownership via RBAC, not a hardcoded FK | Ownership is expressed as a RoleBinding (`scope=agent`, `scope_id=agent_id`). Enables multi-owner and delegated ownership consistently across all Kinds. | +| Credential ownership via RBAC, same pattern | `RoleBinding(scope=credential, scope_id=credential_id, role=credential:owner)` auto-created at credential creation. Enables shared Robot Accounts and team-wide PATs without schema changes. | +| Credential is platform-scoped, not project-scoped | Credentials (especially Robot Accounts) are shared across teams and projects. Nesting under a project would force duplication. | +| Credential token is write-only | Prevents token exfiltration via the standard REST API. Raw token only surfaced to runners via the runtime credentials path, not to end users. | +| Five-scope RBAC (`global`, `project`, `agent`, `session`, `credential`) | `credential` scope enables per-credential access grants; combined with project/global scope it allows Robot Accounts shared at any granularity. | | One active Session per Agent | Avoids concurrent conflicting runs; ignition is idempotent | | Inbox on Agent, not Session | Messages persist across re-ignitions; addressed to the agent, not the run | | Inbox drained at ignition | Unread messages become part of the ignition context; session picks up where things left off | @@ -733,7 +849,6 @@ This structure means you can define and compose bespoke agent suites — entire | Sessions created only via ignite | Sessions are run artifacts; direct `POST /sessions` does not exist | | Every layer carries a `prompt` | Project.prompt = workspace context; Agent.prompt = who the agent is; Session.prompt = what this run does; Inbox = prior requests. Pokes roll downhill. | | `SessionMessage` is append-only | Canonical record of the LLM conversation; never edited or deleted | -| Four-scope RBAC (`global`, `project`, `agent`, `session`) | `agent` scope enables sharing one agent without exposing the whole project | | `agent:editor` role | Allows prompt updates without full operator access | | `agent:runner` role | Pods get minimum viable credential: read agent definition, push session messages, send inbox | | Union-only permissions | No deny rules — simpler mental model for fleet operators | @@ -743,6 +858,65 @@ This structure means you can define and compose bespoke agent suites — entire --- +## Credential — Usage + +```sh +# Create a GitLab PAT — token via env var (avoids shell history exposure) +acpctl credential create --name my-gitlab-pat --provider gitlab \ + --token "$GITLAB_PAT" --url https://gitlab.myco.com +# credential/my-gitlab-pat created + +# Token via stdin (also avoids shell history) +echo "$GITLAB_PAT" | acpctl credential create --name my-gitlab-pat --provider gitlab \ + --token @- --url https://gitlab.myco.com + +# List credentials +acpctl credential list +# NAME PROVIDER URL CREATED +# my-gitlab-pat gitlab https://gitlab.myco.com 2026-03-31 + +# Rotate a token +acpctl credential update my-gitlab-pat --token "$GITLAB_PAT_NEW" + +# Share a Robot Account with an entire project +acpctl create role-binding --user-id alice@myco.com --role-id credential:reader \ + --scope project --scope-id my-project + +# Declarative apply — token sourced from env var +``` + +```yaml +kind: Credential +metadata: + name: platform-gitlab-pat +spec: + provider: gitlab + token: $GITLAB_PAT + url: https://gitlab.myco.com + labels: + team: platform +``` + +```sh +acpctl apply -f credential.yaml +# credential/platform-gitlab-pat created +``` + +--- + +## Design Decisions — Credential + +| Decision | Rationale | +|----------|-----------| +| Token stored in database, encrypted at rest | Single authoritative store. A future Vault integration can be adopted by pointing the DB row at a Vault path without changing the API surface. | +| `google` token serialized as a string | Service Account JSON is serialized into the single `token` field. Keeps the schema uniform across all providers. | +| No validation on creation | First-use error is acceptable. Avoids a network call to the provider at creation time and the failure modes that come with it. | +| Credential rotation is user-managed | Users update the token via `PATCH` or `acpctl credential update`. No platform-side rotation or expiry tracking. | +| No migration utility for existing K8s Secrets | Users re-enter credentials via the new API. The old Secret-based path is removed when the new API is live. | +| Users may hold many credentials, share across many projects | RBAC expresses sharing. No limit on how many credentials a user holds or how many projects a credential is shared to. | + +--- + ## Implementation Coverage Matrix _Last updated: 2026-03-22. Use this as the authoritative index — click into component source to verify._ @@ -764,7 +938,10 @@ _Last updated: 2026-03-22. Use this as the authoritative index — click into co | **Projects — labels/annotations** | ✅ PATCH accepts `labels`/`annotations` | ✅ fields on `Project` type; `ProjectAPI.Update(patch map[string]any)` | ⚠️ no dedicated subcommand | | | **RBAC — roles** | ✅ | ✅ `RoleAPI` | ✅ `create role` only; list/get not exposed | | | **RBAC — role bindings** | ✅ | ✅ `RoleBindingAPI` | ✅ `create role-binding` only; list/delete not exposed | | +| **Credentials — CRUD** | 🔲 | 🔲 | 🔲 `credential list/get/create/update/delete` | New Kind; not yet implemented | +| **Credentials — token fetch (runner)** | 🔲 `GET /credentials/{id}/token` | 🔲 | n/a | Gated by `credential:token-reader`; granted to runner SA by operator | | **Declarative apply** | n/a | uses SDK | ✅ `apply -f`, `apply -k` | Upsert semantics; supports inbox seeding | +| **Declarative apply — Credential kind** | n/a | 🔲 | 🔲 | Planned; token sourced from env var in YAML | ### Labels/Annotations — SDK Ergonomics Gap diff --git a/docs/internal/design/control-plane.guide.md b/docs/internal/design/control-plane.guide.md index 6b5361ec4..8ce4e3073 100644 --- a/docs/internal/design/control-plane.guide.md +++ b/docs/internal/design/control-plane.guide.md @@ -148,6 +148,7 @@ acpctl messages -f hang CLI closed replaced g acpctl send -f CLI closed added --follow flag; calls streamMessages after push assistant payload JSON blob (grpc_transport) Runner closed _write_message() now pushes plain text (Run 8) TenantSA RBAC race on namespace re-create CP open see Known Races below +Runner credential fetch → /credentials/{id}/token Runner open blocked on Wave 4 BE (Credential CRUD + /token endpoint); see Wave 5 below ``` --- @@ -362,6 +363,52 @@ curl -N http://localhost:8000/api/ambient/v1/sessions/{id}/events --- +#### Wave 5 — Runner: Migrate credential fetch to Credential Kind API + +**File:** `components/runners/ambient-runner/ambient_runner/platform/auth.py` + +**Blocked on:** Wave 4 BE (Credential CRUD + `GET /credentials/{id}/token` endpoint live in ambient-api-server) + +**What to do:** + +1. The CP must inject a `CREDENTIAL_IDS` env var into the runner pod — a JSON-encoded map of `provider → credential_id` resolved for this session. Resolution follows the RBAC scope resolver (agent → project → global, narrower wins per provider). The CP must read visible credentials from the api-server and build this map before pod creation. + +2. The runner's `_fetch_credential(context, credential_type)` must be updated to call the new endpoint: + +```python +# Instead of: +url = f"{base}/projects/{project}/agentic-sessions/{session_id}/credentials/{credential_type}" + +# New: +credential_ids = json.loads(os.getenv("CREDENTIAL_IDS", "{}")) +credential_id = credential_ids.get(credential_type) +if not credential_id: + logger.warning(f"No credential_id for provider {credential_type}") + return {} +url = f"{base}/api/ambient/v1/credentials/{credential_id}/token" +``` + +3. The hostname allowlist on `BACKEND_API_URL` must be preserved (same env var, same check). + +4. The response field mapping in `populate_runtime_credentials()` must be updated — the new token response shape uses `token` uniformly (no more `apiToken` for Jira): + +| Provider | Old field | New field | +|----------|-----------|-----------| +| `github` | `token` | `token` | +| `gitlab` | `token` | `token` | +| `jira` | `apiToken` | `token` | +| `google` | `accessToken` | `token` (full SA JSON string) | + +5. The CP must grant `credential:token-reader` on each injected credential ID to the runner pod's service account at session start. This is a platform-internal RoleBinding created by the CP's KubeReconciler, not via user-facing `POST /role_bindings`. + +**Acceptance:** +- Create a `gitlab` Credential via `acpctl credential create` +- Create a session; verify CP injects `CREDENTIAL_IDS={"gitlab": ""}` env var into the pod +- Runner fetches `GET /credentials//token`; `GITLAB_TOKEN` is set in the pod +- `ruff format .` and `ruff check .` pass + +--- + #### Wave 4 — CLI: `acpctl session events` **Repo:** `platform-control-plane/components/ambient-cli/` diff --git a/docs/internal/design/control-plane.spec.md b/docs/internal/design/control-plane.spec.md index e492ea88a..e094e51e9 100644 --- a/docs/internal/design/control-plane.spec.md +++ b/docs/internal/design/control-plane.spec.md @@ -116,6 +116,7 @@ Each section is joined with `\n\n`. Empty sections are omitted. If all four are | `USE_VERTEX` / `ANTHROPIC_VERTEX_PROJECT_ID` / `CLOUD_ML_REGION` | CP config | Vertex AI config (when enabled) | | `GOOGLE_APPLICATION_CREDENTIALS` | `/app/vertex/ambient-code-key.json` | Vertex service account path | | `LLM_MODEL` / `LLM_TEMPERATURE` / `LLM_MAX_TOKENS` | session fields | Per-session model config | +| `CREDENTIAL_IDS` | JSON map `{provider: credential_id}` | Resolved credentials for this session; runner calls `/credentials/{id}/token` per provider | --- @@ -356,6 +357,49 @@ Status: 🔲 planned --- +## Runner Credential Fetch + +The runner fetches provider credentials at session start before invoking Claude. Credentials are resolved by the CP and injected into the runner pod as `CREDENTIAL_IDS` — a JSON-encoded map of `provider → credential_id`: + +``` +CREDENTIAL_IDS={"gitlab": "01JX...", "github": "01JY...", "jira": "01JZ..."} +``` + +The CP builds this map from the Credential Kind RBAC resolver: for each provider, walk agent → project → global scope and take the most specific matching credential. Credentials not visible to this session are excluded. + +The runner calls `GET /api/ambient/v1/credentials/{id}/token` for each provider present in `CREDENTIAL_IDS`. The token endpoint is gated by `credential:token-reader` — the CP grants this role to the runner pod's service account at session start for each injected credential ID. + +**Token response shape:** + +```json +{ "provider": "gitlab", "token": "glpat-...", "url": "https://gitlab.myco.com" } +{ "provider": "github", "token": "github_pat_...", "url": "https://github.com" } +{ "provider": "jira", "token": "ATATT3x...", "url": "https://myco.atlassian.net", "email": "bot@myco.com" } +{ "provider": "google", "token": "{\"type\":\"service_account\", ...}" } +{ "provider": "other", "token": "...", "url": "https://my-service.example.com" } +``` + +`token` is always present. `url` and `email` are included when set on the Credential. The runner maps each response to environment variables and on-disk files consumed by Claude Code and its tools. + +### Environment Variables Set by Runner After Credential Fetch + +| Provider | Env vars set | Files written | +|----------|-------------|---------------| +| `google` | `USER_GOOGLE_EMAIL` | `credentials.json` (token value is full SA JSON) | +| `jira` | `JIRA_URL`, `JIRA_API_TOKEN`, `JIRA_EMAIL` | — | +| `gitlab` | `GITLAB_TOKEN` | `/tmp/.ambient_gitlab_token` | +| `github` | `GITHUB_TOKEN` | `/tmp/.ambient_github_token` | + +### Additional Environment Variable Injected by CP + +| Var | Value | Purpose | +|-----|-------|---------| +| `CREDENTIAL_IDS` | JSON map `{provider: id}` | Resolved credential IDs for this session; runner uses to call `/credentials/{id}/token` | + +Status: 🔲 planned — blocked on Credential Kind (ambient-model.spec.md Wave 4 BE) + +--- + ## Namespace Deletion RBAC Gap The CP's `cleanupSession` calls `kube.DeleteNamespace()`. This currently fails in kind with: