diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 31feffa2..123481c8 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -2252,7 +2252,8 @@ paths: Returns a fast control-plane health snapshot for the project and its deployed resources. The endpoint does not run live provider probes. A successful request returns 200 even when the project status is - `unhealthy`; transport and authorization failures use HTTP errors. + `degraded` or `critical`; transport and authorization failures use HTTP + errors. operationId: getProjectHealth security: - UserToken: [] @@ -4188,6 +4189,12 @@ paths: - Function must have `visibility: public` - Function receives payload only (no `__volcano_auth`) + **Reserved payload keys:** the top-level `__volcano_auth` and + `__volcano_http` keys are reserved. Volcano removes caller-supplied + values for both before the function runs; only an auth user token adds + a server-built `__volcano_auth`, and only HTTP-mode ingress sets + `__volcano_http: true`. + **Transport and CORS:** - This operation is the authenticated direct RPC endpoint and always uses the POST `{payload: ...}` contract, including for functions whose DNS ingress is @@ -6205,6 +6212,173 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' + /projects/{id}/issues/{issueId}/autofix-runs: + post: + tags: + - Autofix + summary: Diagnose an issue + description: | + Queues a run that diagnoses the issue with AI. The run reads the + issue's runtime logs and, when a push to the project's connected + repository built the deployment that was live when the issue was + last seen, its source at that commit. Poll the run until its status is + `succeeded`, `failed`, or `canceled`. + + Autofix must be on for the project. An issue has at most one queued or + running run, a project runs one at a time, and a project starts at most + 25 runs, manual and automatic, in any 24 hours. + + Project access tokens are refused. A run spends model tokens on the + project's provider, so a person starts it with a platform token or in + the dashboard. + operationId: startAutofixRun + security: + - UserToken: [] + parameters: + - $ref: '#/components/parameters/ProjectId' + - $ref: '#/components/parameters/IssueId' + responses: + '202': + description: Queued + content: + application/json: + schema: + $ref: '#/components/schemas/AutofixRun' + '400': + description: Code `feature_unavailable` means the project's provider is `volcano` and Volcano-managed models are not available in this environment. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '403': + description: The owner's plan does not include autofix, or the request used a project access token. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: Project or issue not found. Code `feature_unavailable` means autofix is not available in this environment. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '409': + description: Autofix is off for the project, or the issue already has a queued or running run. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '429': + description: The project started its limit of runs in the last 24 hours. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '501': + description: Autofix is not available in local mode. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '503': + description: The owner's plan could not be resolved. Retry later. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /projects/{id}/autofix-runs: + get: + tags: + - Autofix + summary: List autofix runs + description: | + Lists the project's autofix runs, newest first. Runs stay readable after + autofix is turned off, and where autofix is not available. + + Project access tokens can list runs, including read-only ones. + operationId: listAutofixRuns + security: + - UserToken: [] + - ProjectAccessToken: [] + parameters: + - $ref: '#/components/parameters/ProjectId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/IssueCursor' + - name: issue_id + in: query + required: false + description: Return only runs for this issue. + schema: + type: string + format: uuid + - name: status + in: query + required: false + description: Return only runs in this status. + schema: + $ref: '#/components/schemas/AutofixRunStatus' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedAutofixRuns' + '400': + description: A filter or the cursor is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '404': + description: Project not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '501': + description: Autofix is not available in local mode. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /projects/{id}/autofix-runs/{runId}: + get: + tags: + - Autofix + summary: Get an autofix run + description: | + Returns one run: its status, the diagnosis once it succeeds, why it + failed or was canceled, and the model tokens it used. Runs stay readable + where autofix is not available. + + Project access tokens can read runs, including read-only ones. + operationId: getAutofixRun + security: + - UserToken: [] + - ProjectAccessToken: [] + parameters: + - $ref: '#/components/parameters/ProjectId' + - $ref: '#/components/parameters/AutofixRunId' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/AutofixRun' + '404': + description: Project or run not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '501': + description: Autofix is not available in local mode. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' /projects/{id}/durable-approvals: get: tags: @@ -6560,7 +6734,7 @@ paths: 22.x or 24.x. The Node.js runtime is inferred from `package.json` `engines.node`; if omitted, Volcano uses Node.js 22.x. The selected Node.js family must also satisfy the installed Next.js package's - `engines.node` constraint. Volcano tests Next 15.5.27 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next 16.4.0 (`>=20.9.0`). + `engines.node` constraint. Volcano tests Next 15.5.28 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next 16.4.2 (`>=20.9.0`). Source archive size is enforced by the API with `SOURCE_ARCHIVE_SIZE_LIMIT_MB`; the CLI does not apply its own source archive size limit. After the final container images are built, the publish build enforces `LAMBDA_TARGET_CONTAINER_SIZE_LIMIT_MB` before pushing. @@ -9814,6 +9988,9 @@ paths: operationId: authGetPasswordPolicy security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' responses: '200': description: Effective password policy @@ -9822,7 +9999,7 @@ paths: schema: $ref: '#/components/schemas/AuthPasswordPolicy' '401': - description: Invalid, missing, or revoked anon key + description: Invalid, missing, or revoked anon key; or invalid auth proxy metadata content: application/json: schema: @@ -9854,6 +10031,9 @@ paths: operationId: authSignup security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: true content: @@ -9888,7 +10068,9 @@ paths: description: Invalid input (bad email/password format) '401': description: | - Unauthorized - Invalid, tampered, revoked, or wrong-project anon key + Unauthorized - Invalid, tampered, revoked, or wrong-project anon key. + Also returned for invalid, repeated, or under-scoped auth proxy metadata + (`invalid auth proxy metadata`). '403': description: | Forbidden - Signups disabled, anon key lacks signup permission, or the @@ -9920,6 +10102,9 @@ paths: operationId: authSignin security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: true content: @@ -9950,7 +10135,7 @@ paths: '401': description: | Unauthorized - Invalid credentials, invalid/tampered/revoked anon key, - or account banned/deleted + or account banned/deleted; or invalid auth proxy metadata '403': description: | Forbidden - Anon key lacks signin permission, or the email domain is @@ -9976,6 +10161,9 @@ paths: operationId: authRefresh security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: false content: @@ -9997,7 +10185,7 @@ paths: schema: $ref: '#/components/schemas/AuthTokenResponse' '401': - description: Invalid or expired refresh token + description: Invalid or expired refresh token; or invalid auth proxy metadata content: application/json: schema: @@ -10031,6 +10219,9 @@ paths: operationId: authLogout security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: false content: @@ -10047,6 +10238,12 @@ paths: responses: '204': description: Logged out successfully + '401': + description: Missing, invalid, or revoked anon key; or invalid, repeated, or under-scoped auth proxy metadata + content: + application/json: + schema: + $ref: '#/components/schemas/Error' /auth/forgot-password: post: tags: @@ -10059,6 +10256,9 @@ paths: operationId: authForgotPassword security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: true content: @@ -10082,6 +10282,12 @@ paths: message: type: string example: If the email exists, a password reset link has been sent + '401': + description: Missing, invalid, or revoked anon key; or invalid, repeated, or under-scoped auth proxy metadata + content: + application/json: + schema: + $ref: '#/components/schemas/Error' '403': description: Password reset is disabled for this project content: @@ -10105,6 +10311,9 @@ paths: operationId: authResetPassword security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: true content: @@ -10136,7 +10345,7 @@ paths: '400': description: Password doesn't meet requirements '401': - description: Invalid or expired token + description: Invalid or expired token; or invalid auth proxy metadata '503': description: Compromised-password screening is temporarily unavailable content: @@ -10247,6 +10456,9 @@ paths: operationId: authSignupAnonymous security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: description: Optional user metadata content: @@ -10268,6 +10480,12 @@ paths: application/json: schema: $ref: '#/components/schemas/AuthTokenResponse' + '401': + description: Missing, invalid, or revoked anon key; or invalid, repeated, or under-scoped auth proxy metadata + content: + application/json: + schema: + $ref: '#/components/schemas/Error' '403': description: Anonymous signins disabled /auth/user/convert-anonymous: @@ -12702,6 +12920,9 @@ paths: operationId: authOAuthExchange security: - AnonKey: [] + parameters: + - $ref: '#/components/parameters/AuthProxyAuthorization' + - $ref: '#/components/parameters/AuthProxyClientIP' requestBody: required: true content: @@ -12727,7 +12948,7 @@ paths: '400': description: Invalid, expired, consumed, or redirect-mismatched code '401': - description: Missing or invalid project anon key + description: Missing or invalid project anon key; or invalid auth proxy metadata '403': description: | Email confirmation is now required, or the account's email domain is not @@ -13982,7 +14203,9 @@ paths: for backward compatibility. Provide an explicit list (e.g. ["functions.invoke", "locks.manage"]) to restrict the key; "*" grants everything. Scope enforcement applies to function invocation, - storage object operations, and project locks. + storage object operations, project locks, and server-side auth proxy + metadata (auth.signin, auth.signup, auth.refresh, auth.logout, + auth.password_reset). example: - functions.invoke - locks.manage @@ -14256,6 +14479,12 @@ paths: responses: '200': description: Policy deleted + '404': + description: Project, bucket, or policy not found. Also returned when the policy ID is malformed or belongs to another bucket. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' /projects/{id}/storage/objects: get: tags: @@ -15577,6 +15806,32 @@ components: project access token cannot create, list, read, or revoke project access tokens. parameters: + AuthProxyAuthorization: + name: X-Volcano-Proxy-Authorization + in: header + required: false + description: | + Trusted server-side auth proxy credential in `Bearer SERVICE_KEY` + form. When supplied, `X-Volcano-Client-IP` is also required. The service + key must belong to the anon key's project and hold this operation's scope: + `auth.signup` for signup and anonymous signup, `auth.signin` for signin + and OAuth code exchange, `auth.refresh` for refresh, `auth.logout` for + logout, and `auth.password_reset` for forgot-password and reset-password. + The password policy accepts any service key for the project. Never expose + a service key to browser code. + schema: + type: string + AuthProxyClientIP: + name: X-Volcano-Client-IP + in: header + required: false + description: | + Original browser IPv4 or IPv6 address supplied by a trusted server-side + auth proxy. The proxy must derive this value from its platform-verified + request metadata, never from a browser-supplied header. Requires a valid + `X-Volcano-Proxy-Authorization` header. + schema: + type: string BackupName: name: backupName in: path @@ -15723,6 +15978,14 @@ components: description: | Opaque cursor from a previous response's `next_cursor`. Pages forward; keep the same filters while paging. + AutofixRunId: + name: runId + in: path + required: true + schema: + type: string + format: uuid + description: Autofix run ID DurableApprovalFunctionFilter: name: function in: query @@ -20742,6 +21005,9 @@ components: } } ``` + + The top-level `__volcano_auth` and `__volcano_http` keys are reserved; + Volcano removes caller-supplied values for both. FunctionInvocationResponse: type: object description: Raw function response body returned by the invoked function. @@ -21936,6 +22202,289 @@ components: description: Your own API key for `provider`, such as an Anthropic key for `anthropic`. Omit it to keep the stored key. Encrypted at rest and never returned. required: - enabled + AutofixRunStatus: + type: string + enum: + - queued + - running + - succeeded + - failed + - canceled + x-enum-varnames: + - AutofixRunStatusQueued + - AutofixRunStatusRunning + - AutofixRunStatusSucceeded + - AutofixRunStatusFailed + - AutofixRunStatusCanceled + description: Where a run is. `canceled` means the project's settings or plan stopped allowing the run before it finished; `failure_code` says which. + AutofixRunTrigger: + type: string + enum: + - manual + - new_issue + - regression + x-enum-varnames: + - AutofixRunTriggerManual + - AutofixRunTriggerNewIssue + - AutofixRunTriggerRegression + description: What started the run. `manual` is a request; `new_issue` and `regression` are automatic runs for an issue that appeared or reopened. + AutofixEvidence: + type: object + additionalProperties: false + properties: + kind: + type: string + enum: + - log + - code + - other + x-enum-varnames: + - AutofixEvidenceKindLog + - AutofixEvidenceKindCode + - AutofixEvidenceKindOther + detail: + type: string + location: + type: string + description: A file and line, or a log timestamp. Absent when the evidence has none. + required: + - kind + - detail + AutofixDiagnosis: + type: object + additionalProperties: false + properties: + summary: + type: string + description: One or two sentences on what goes wrong. + root_cause: + type: string + evidence: + type: array + items: + $ref: '#/components/schemas/AutofixEvidence' + suggested_fix: + type: string + confidence: + type: string + enum: + - low + - medium + - high + x-enum-varnames: + - AutofixConfidenceLow + - AutofixConfidenceMedium + - AutofixConfidenceHigh + fixable: + type: boolean + description: Whether a change to the project's code would fix the issue. + files: + type: array + description: Repository paths a fix would change. + items: + type: string + required: + - summary + - root_cause + - evidence + - suggested_fix + - confidence + - fixable + - files + AutofixRunUsage: + type: object + additionalProperties: false + description: Model tokens the run used across every attempt. + properties: + input_tokens: + type: integer + format: int64 + output_tokens: + type: integer + format: int64 + cache_read_input_tokens: + type: integer + format: int64 + cache_creation_input_tokens: + type: integer + format: int64 + required: + - input_tokens + - output_tokens + - cache_read_input_tokens + - cache_creation_input_tokens + AutofixEdit: + type: object + additionalProperties: false + description: One exact text replacement. An empty `old_text` creates the file. + properties: + path: + type: string + old_text: + type: string + new_text: + type: string + required: + - path + - old_text + - new_text + AutofixPatch: + type: object + additionalProperties: false + description: The fix the model proposed, applied to the deployed commit. Present whenever the run opened a pull request, and when a valid fix could not be published. + properties: + title: + type: string + edits: + type: array + items: + $ref: '#/components/schemas/AutofixEdit' + required: + - title + - edits + AutofixPullRequestState: + type: string + enum: + - open + - merged + - closed + x-enum-varnames: + - AutofixPullRequestStateOpen + - AutofixPullRequestStateMerged + - AutofixPullRequestStateClosed + AutofixPullRequest: + type: object + additionalProperties: false + description: The draft pull request the run opened on the connected repository. + properties: + number: + type: integer + format: int64 + url: + type: string + format: uri + branch: + type: string + description: The branch the fix is on, `volcano/autofix/`. + state: + $ref: '#/components/schemas/AutofixPullRequestState' + closed_at: + type: string + format: date-time + description: When the pull request was merged or closed. + deployed_at: + type: string + format: date-time + description: When a deployment that includes the merged fix went live. The issue resolves then, unless it occurred again since. When more than 20 deployments went live after the merge before Volcano checked, it is the merge time instead. + required: + - number + - url + - branch + - state + AutofixPullRequestSkipped: + type: string + enum: + - source_unavailable + - pull_request_open + - not_fixable + - low_confidence + - no_patch + - permission_missing + - repository_changed + - publish_failed + x-enum-varnames: + - AutofixPullRequestSkippedSourceUnavailable + - AutofixPullRequestSkippedPullRequestOpen + - AutofixPullRequestSkippedNotFixable + - AutofixPullRequestSkippedLowConfidence + - AutofixPullRequestSkippedNoPatch + - AutofixPullRequestSkippedPermissionMissing + - AutofixPullRequestSkippedRepositoryChanged + - AutofixPullRequestSkippedPublishFailed + description: Why a run whose `max_stage` is `pull_request` opened no pull request. The diagnosis stands either way. + AutofixRun: + type: object + additionalProperties: false + properties: + id: + type: string + format: uuid + project_id: + type: string + format: uuid + issue_id: + type: string + format: uuid + trigger: + $ref: '#/components/schemas/AutofixRunTrigger' + status: + $ref: '#/components/schemas/AutofixRunStatus' + max_stage: + $ref: '#/components/schemas/AutofixStage' + stage_reached: + $ref: '#/components/schemas/AutofixStage' + provider: + $ref: '#/components/schemas/AutofixProvider' + model: + $ref: '#/components/schemas/AutofixModel' + diagnosis: + $ref: '#/components/schemas/AutofixDiagnosis' + patch: + $ref: '#/components/schemas/AutofixPatch' + pull_request: + $ref: '#/components/schemas/AutofixPullRequest' + pull_request_skipped: + $ref: '#/components/schemas/AutofixPullRequestSkipped' + commit_sha: + type: string + description: The commit the diagnosis read, when a push to the connected repository deployed the resource. Absent when the run read logs only. + failure_code: + type: string + description: Why the run failed or was canceled, or why its last attempt will be retried. One of `api_key_rejected`, `model_request_rejected`, `model_unavailable`, `model_refused`, `no_diagnosis`, `budget_exhausted`, `timed_out`, `attempts_exhausted`, `autofix_disabled`, `plan_required`, `managed_models_unavailable`, `settings_changed`, `issue_not_found`, or `internal_error`. + failure_message: + type: string + usage: + $ref: '#/components/schemas/AutofixRunUsage' + created_at: + type: string + format: date-time + started_at: + type: string + format: date-time + completed_at: + type: string + format: date-time + required: + - id + - project_id + - issue_id + - trigger + - status + - max_stage + - provider + - model + - usage + - created_at + PaginatedAutofixRuns: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/AutofixRun' + limit: + type: integer + description: Number of items per page + has_more: + type: boolean + description: Whether a next page exists + next_cursor: + type: string + description: Opaque cursor for the next page (present if has_more is true) + required: + - data + - limit + - has_more PaginatedProjectCustomDomains: type: object properties: @@ -23118,6 +23667,7 @@ components: - function - frontend - database + - database_branch id: type: string format: uuid @@ -23206,8 +23756,11 @@ components: - findings ProjectHealthStatus: type: string + description: empty means no functions, frontends, databases, storage, Volcano Auth users, or Sandbox resources are listed. needs_attention means an operation needs review without confirmed service impairment, or a serving frontend whose edge recovery gave up needs a redeploy. degraded means a resource is only partly available or is unavailable for an expected, temporary reason, such as a frontend whose edge synchronization did not complete or a database being restored; critical means use is blocked. A failed workflow or deployment record alone does not establish an outage. Findings remain available for empty projects. enum: + - empty - healthy + - needs_attention - degraded - critical - unknown diff --git a/src/volcano_sdk/_generated/api/authentication/auth_forgot_password.py b/src/volcano_sdk/_generated/api/authentication/auth_forgot_password.py index 8e99a5c9..570079cd 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_forgot_password.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_forgot_password.py @@ -11,6 +11,7 @@ from ...models.auth_forgot_password_body import AuthForgotPasswordBody from ...models.auth_forgot_password_response_200 import AuthForgotPasswordResponse200 from ...models.error import Error +from ...types import UNSET, Unset from typing import cast @@ -18,9 +19,17 @@ def request_kwargs( *, body: AuthForgotPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -49,6 +58,13 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return response_200 + if response.status_code == 401: + response_401 = Error.from_dict(response.json()) + + + + return response_401 + if response.status_code == 403: response_403 = Error.from_dict(response.json()) @@ -82,6 +98,8 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthForgotPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[AuthForgotPasswordResponse200 | Error]: """ Request password reset @@ -91,6 +109,8 @@ def sync_detailed( Project is identified via the anon key. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthForgotPasswordBody): Raises: @@ -104,6 +124,8 @@ def sync_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -117,6 +139,8 @@ def sync( *, client: AuthenticatedClient, body: AuthForgotPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> AuthForgotPasswordResponse200 | Error | None: """ Request password reset @@ -126,6 +150,8 @@ def sync( Project is identified via the anon key. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthForgotPasswordBody): Raises: @@ -140,6 +166,8 @@ def sync( return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -147,6 +175,8 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthForgotPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[AuthForgotPasswordResponse200 | Error]: """ Request password reset @@ -156,6 +186,8 @@ async def asyncio_detailed( Project is identified via the anon key. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthForgotPasswordBody): Raises: @@ -169,6 +201,8 @@ async def asyncio_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -182,6 +216,8 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthForgotPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> AuthForgotPasswordResponse200 | Error | None: """ Request password reset @@ -191,6 +227,8 @@ async def asyncio( Project is identified via the anon key. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthForgotPasswordBody): Raises: @@ -205,5 +243,7 @@ async def asyncio( return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_get_password_policy.py b/src/volcano_sdk/_generated/api/authentication/auth_get_password_policy.py index e54e0304..0afc3245 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_get_password_policy.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_get_password_policy.py @@ -10,14 +10,25 @@ from ...models.auth_password_policy import AuthPasswordPolicy from ...models.error import Error +from ...types import UNSET, Unset from typing import cast def request_kwargs( - + *, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, + ) -> dict[str, Any]: - + headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + + @@ -29,6 +40,7 @@ def request_kwargs( } + _kwargs["headers"] = headers return _kwargs @@ -73,6 +85,8 @@ def build_response(*, client: AuthenticatedClient | Client, response: httpx.Resp def sync_detailed( *, client: AuthenticatedClient, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[AuthPasswordPolicy | Error]: """ Get the effective password policy @@ -81,6 +95,10 @@ def sync_detailed( screening status for the project identified by the anon key. A valid anon key is required, but no route-specific auth permission is needed. + Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): + Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. @@ -91,7 +109,9 @@ def sync_detailed( kwargs = request_kwargs( - + x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, + ) response = client.get_httpx_client().request( @@ -103,6 +123,8 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> AuthPasswordPolicy | Error | None: """ Get the effective password policy @@ -111,6 +133,10 @@ def sync( screening status for the project identified by the anon key. A valid anon key is required, but no route-specific auth permission is needed. + Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): + Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. @@ -122,12 +148,16 @@ def sync( return sync_detailed( client=client, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed async def asyncio_detailed( *, client: AuthenticatedClient, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[AuthPasswordPolicy | Error]: """ Get the effective password policy @@ -136,6 +166,10 @@ async def asyncio_detailed( screening status for the project identified by the anon key. A valid anon key is required, but no route-specific auth permission is needed. + Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): + Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. @@ -146,7 +180,9 @@ async def asyncio_detailed( kwargs = request_kwargs( - + x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, + ) response = await client.get_async_httpx_client().request( @@ -158,6 +194,8 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> AuthPasswordPolicy | Error | None: """ Get the effective password policy @@ -166,6 +204,10 @@ async def asyncio( screening status for the project identified by the anon key. A valid anon key is required, but no route-specific auth permission is needed. + Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): + Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. @@ -177,5 +219,7 @@ async def asyncio( return (await asyncio_detailed( client=client, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_logout.py b/src/volcano_sdk/_generated/api/authentication/auth_logout.py index 39c21187..8a0e74c9 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_logout.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_logout.py @@ -9,6 +9,7 @@ from ... import errors from ...models.auth_logout_body import AuthLogoutBody +from ...models.error import Error from ...types import UNSET, Unset from typing import cast @@ -17,9 +18,17 @@ def request_kwargs( *, body: AuthLogoutBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -42,9 +51,17 @@ def request_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None: if response.status_code == 204: - return None + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 401: + response_401 = Error.from_dict(response.json()) + + + + return response_401 if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) @@ -52,7 +69,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,8 +82,10 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthLogoutBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, -) -> Response[Any]: +) -> Response[Any | Error]: """ Logout (revoke refresh token) Invalidate a refresh token. Requires an anon key. @@ -76,6 +95,8 @@ def sync_detailed( token; logout remains idempotent when the cookie is missing or expired. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthLogoutBody | Unset): Raises: @@ -83,12 +104,14 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Any | Error] """ kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -98,13 +121,52 @@ def sync_detailed( return build_response(client=client, response=response) +def sync( + *, + client: AuthenticatedClient, + body: AuthLogoutBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, + +) -> Any | Error | None: + """ Logout (revoke refresh token) + + Invalidate a refresh token. Requires an anon key. + + Send `refresh_token` for the default flow. An eligible cookie-mode + browser request may instead send `session_mode: cookie` with an empty + token; logout remains idempotent when the cookie is missing or expired. + + Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): + body (AuthLogoutBody | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | Error + """ + + + return sync_detailed( + client=client, +body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, + + ).parsed async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthLogoutBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, -) -> Response[Any]: +) -> Response[Any | Error]: """ Logout (revoke refresh token) Invalidate a refresh token. Requires an anon key. @@ -114,6 +176,8 @@ async def asyncio_detailed( token; logout remains idempotent when the cookie is missing or expired. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthLogoutBody | Unset): Raises: @@ -121,12 +185,14 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Any | Error] """ kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -136,3 +202,40 @@ async def asyncio_detailed( return build_response(client=client, response=response) +async def asyncio( + *, + client: AuthenticatedClient, + body: AuthLogoutBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, + +) -> Any | Error | None: + """ Logout (revoke refresh token) + + Invalidate a refresh token. Requires an anon key. + + Send `refresh_token` for the default flow. An eligible cookie-mode + browser request may instead send `session_mode: cookie` with an empty + token; logout remains idempotent when the cookie is missing or expired. + + Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): + body (AuthLogoutBody | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | Error + """ + + + return (await asyncio_detailed( + client=client, +body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, + + )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_refresh.py b/src/volcano_sdk/_generated/api/authentication/auth_refresh.py index bb68bd60..ff639f08 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_refresh.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_refresh.py @@ -19,9 +19,17 @@ def request_kwargs( *, body: AuthRefreshBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -92,6 +100,8 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthRefreshBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[AuthTokenResponse | Error]: """ Refresh access token @@ -105,6 +115,8 @@ def sync_detailed( response. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthRefreshBody | Unset): Raises: @@ -118,6 +130,8 @@ def sync_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -131,6 +145,8 @@ def sync( *, client: AuthenticatedClient, body: AuthRefreshBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> AuthTokenResponse | Error | None: """ Refresh access token @@ -144,6 +160,8 @@ def sync( response. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthRefreshBody | Unset): Raises: @@ -158,6 +176,8 @@ def sync( return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -165,6 +185,8 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthRefreshBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[AuthTokenResponse | Error]: """ Refresh access token @@ -178,6 +200,8 @@ async def asyncio_detailed( response. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthRefreshBody | Unset): Raises: @@ -191,6 +215,8 @@ async def asyncio_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -204,6 +230,8 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthRefreshBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> AuthTokenResponse | Error | None: """ Refresh access token @@ -217,6 +245,8 @@ async def asyncio( response. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthRefreshBody | Unset): Raises: @@ -231,5 +261,7 @@ async def asyncio( return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_reset_password.py b/src/volcano_sdk/_generated/api/authentication/auth_reset_password.py index fa12e70a..4147b7cc 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_reset_password.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_reset_password.py @@ -11,6 +11,7 @@ from ...models.auth_reset_password_body import AuthResetPasswordBody from ...models.auth_reset_password_response_200 import AuthResetPasswordResponse200 from ...models.error import Error +from ...types import UNSET, Unset from typing import cast @@ -18,9 +19,17 @@ def request_kwargs( *, body: AuthResetPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -83,6 +92,8 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthResetPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthResetPasswordResponse200 | Error]: """ Reset password with recovery token @@ -91,6 +102,8 @@ def sync_detailed( Revokes all existing sessions for security. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthResetPasswordBody): Raises: @@ -104,6 +117,8 @@ def sync_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -117,6 +132,8 @@ def sync( *, client: AuthenticatedClient, body: AuthResetPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthResetPasswordResponse200 | Error | None: """ Reset password with recovery token @@ -125,6 +142,8 @@ def sync( Revokes all existing sessions for security. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthResetPasswordBody): Raises: @@ -139,6 +158,8 @@ def sync( return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -146,6 +167,8 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthResetPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthResetPasswordResponse200 | Error]: """ Reset password with recovery token @@ -154,6 +177,8 @@ async def asyncio_detailed( Revokes all existing sessions for security. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthResetPasswordBody): Raises: @@ -167,6 +192,8 @@ async def asyncio_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -180,6 +207,8 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthResetPasswordBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthResetPasswordResponse200 | Error | None: """ Reset password with recovery token @@ -188,6 +217,8 @@ async def asyncio( Revokes all existing sessions for security. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthResetPasswordBody): Raises: @@ -202,5 +233,7 @@ async def asyncio( return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_signin.py b/src/volcano_sdk/_generated/api/authentication/auth_signin.py index 8bf251a6..bf84ceca 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_signin.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_signin.py @@ -10,6 +10,7 @@ from ...models.auth_signin_body import AuthSigninBody from ...models.auth_token_response import AuthTokenResponse +from ...types import UNSET, Unset from typing import cast @@ -17,9 +18,17 @@ def request_kwargs( *, body: AuthSigninBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -83,6 +92,8 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthSigninBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthTokenResponse]: """ Sign in an auth user @@ -97,6 +108,8 @@ def sync_detailed( token. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSigninBody): Raises: @@ -110,6 +123,8 @@ def sync_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -123,6 +138,8 @@ def sync( *, client: AuthenticatedClient, body: AuthSigninBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthTokenResponse | None: """ Sign in an auth user @@ -137,6 +154,8 @@ def sync( token. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSigninBody): Raises: @@ -151,6 +170,8 @@ def sync( return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -158,6 +179,8 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthSigninBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthTokenResponse]: """ Sign in an auth user @@ -172,6 +195,8 @@ async def asyncio_detailed( token. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSigninBody): Raises: @@ -185,6 +210,8 @@ async def asyncio_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -198,6 +225,8 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthSigninBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthTokenResponse | None: """ Sign in an auth user @@ -212,6 +241,8 @@ async def asyncio( token. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSigninBody): Raises: @@ -226,5 +257,7 @@ async def asyncio( return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_signup.py b/src/volcano_sdk/_generated/api/authentication/auth_signup.py index 6db72ccd..6fec9bab 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_signup.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_signup.py @@ -11,6 +11,7 @@ from ...models.auth_signup_body import AuthSignupBody from ...models.auth_signup_response import AuthSignupResponse from ...models.error import Error +from ...types import UNSET, Unset from typing import cast @@ -18,9 +19,17 @@ def request_kwargs( *, body: AuthSignupBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -91,6 +100,8 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthSignupBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthSignupResponse | Error]: """ Sign up a new auth user @@ -109,6 +120,8 @@ def sync_detailed( response cannot be used to discover which emails are registered. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupBody): Raises: @@ -122,6 +135,8 @@ def sync_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -135,6 +150,8 @@ def sync( *, client: AuthenticatedClient, body: AuthSignupBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthSignupResponse | Error | None: """ Sign up a new auth user @@ -153,6 +170,8 @@ def sync( response cannot be used to discover which emails are registered. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupBody): Raises: @@ -167,6 +186,8 @@ def sync( return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -174,6 +195,8 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthSignupBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthSignupResponse | Error]: """ Sign up a new auth user @@ -192,6 +215,8 @@ async def asyncio_detailed( response cannot be used to discover which emails are registered. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupBody): Raises: @@ -205,6 +230,8 @@ async def asyncio_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -218,6 +245,8 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthSignupBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthSignupResponse | Error | None: """ Sign up a new auth user @@ -236,6 +265,8 @@ async def asyncio( response cannot be used to discover which emails are registered. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupBody): Raises: @@ -250,5 +281,7 @@ async def asyncio( return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/authentication/auth_signup_anonymous.py b/src/volcano_sdk/_generated/api/authentication/auth_signup_anonymous.py index 620257a7..4ab1e4a2 100644 --- a/src/volcano_sdk/_generated/api/authentication/auth_signup_anonymous.py +++ b/src/volcano_sdk/_generated/api/authentication/auth_signup_anonymous.py @@ -10,6 +10,7 @@ from ...models.auth_signup_anonymous_body import AuthSignupAnonymousBody from ...models.auth_token_response import AuthTokenResponse +from ...models.error import Error from ...types import UNSET, Unset from typing import cast @@ -18,9 +19,17 @@ def request_kwargs( *, body: AuthSignupAnonymousBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -43,7 +52,7 @@ def request_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | AuthTokenResponse | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | AuthTokenResponse | Error | None: if response.status_code == 201: response_201 = AuthTokenResponse.from_dict(response.json()) @@ -51,6 +60,13 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return response_201 + if response.status_code == 401: + response_401 = Error.from_dict(response.json()) + + + + return response_401 + if response.status_code == 403: response_403 = cast(Any, None) return response_403 @@ -61,7 +77,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | AuthTokenResponse]: +def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | AuthTokenResponse | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,8 +90,10 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthSignupAnonymousBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, -) -> Response[Any | AuthTokenResponse]: +) -> Response[Any | AuthTokenResponse | Error]: """ Create anonymous user Create guest user without email/password. @@ -84,6 +102,8 @@ def sync_detailed( Requires enable_anonymous_signins to be true. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupAnonymousBody | Unset): Raises: @@ -91,12 +111,14 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | AuthTokenResponse] + Response[Any | AuthTokenResponse | Error] """ kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -110,8 +132,10 @@ def sync( *, client: AuthenticatedClient, body: AuthSignupAnonymousBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, -) -> Any | AuthTokenResponse | None: +) -> Any | AuthTokenResponse | Error | None: """ Create anonymous user Create guest user without email/password. @@ -120,6 +144,8 @@ def sync( Requires enable_anonymous_signins to be true. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupAnonymousBody | Unset): Raises: @@ -127,13 +153,15 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | AuthTokenResponse + Any | AuthTokenResponse | Error """ return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -141,8 +169,10 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthSignupAnonymousBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, -) -> Response[Any | AuthTokenResponse]: +) -> Response[Any | AuthTokenResponse | Error]: """ Create anonymous user Create guest user without email/password. @@ -151,6 +181,8 @@ async def asyncio_detailed( Requires enable_anonymous_signins to be true. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupAnonymousBody | Unset): Raises: @@ -158,12 +190,14 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | AuthTokenResponse] + Response[Any | AuthTokenResponse | Error] """ kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -177,8 +211,10 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthSignupAnonymousBody | Unset = UNSET, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, -) -> Any | AuthTokenResponse | None: +) -> Any | AuthTokenResponse | Error | None: """ Create anonymous user Create guest user without email/password. @@ -187,6 +223,8 @@ async def asyncio( Requires enable_anonymous_signins to be true. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthSignupAnonymousBody | Unset): Raises: @@ -194,12 +232,14 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | AuthTokenResponse + Any | AuthTokenResponse | Error """ return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/autofix/get_autofix_run.py b/src/volcano_sdk/_generated/api/autofix/get_autofix_run.py new file mode 100644 index 00000000..d79f218c --- /dev/null +++ b/src/volcano_sdk/_generated/api/autofix/get_autofix_run.py @@ -0,0 +1,224 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ...client import AuthenticatedClient, Client +from ...types import Response, UNSET +from ... import errors + +from ...models.autofix_run import AutofixRun +from ...models.error import Error +from typing import cast +from uuid import UUID + + + +def request_kwargs( + id: UUID | str, + run_id: UUID | str, + +) -> dict[str, Any]: + + + + + + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/projects/{id}/autofix-runs/{run_id}".format(id=quote(str(id), safe=""),run_id=quote(str(run_id), safe=""),), + } + + + return _kwargs + + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AutofixRun | Error | None: + if response.status_code == 200: + response_200 = AutofixRun.from_dict(response.json()) + + + + return response_200 + + if response.status_code == 404: + response_404 = Error.from_dict(response.json()) + + + + return response_404 + + if response.status_code == 501: + response_501 = Error.from_dict(response.json()) + + + + return response_501 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AutofixRun | Error]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: UUID | str, + run_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> Response[AutofixRun | Error]: + """ Get an autofix run + + Returns one run: its status, the diagnosis once it succeeds, why it + failed or was canceled, and the model tokens it used. Runs stay readable + where autofix is not available. + + Project access tokens can read runs, including read-only ones. + + Args: + id (UUID): + run_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AutofixRun | Error] + """ + + + kwargs = request_kwargs( + id=id, +run_id=run_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return build_response(client=client, response=response) + +def sync( + id: UUID | str, + run_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> AutofixRun | Error | None: + """ Get an autofix run + + Returns one run: its status, the diagnosis once it succeeds, why it + failed or was canceled, and the model tokens it used. Runs stay readable + where autofix is not available. + + Project access tokens can read runs, including read-only ones. + + Args: + id (UUID): + run_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AutofixRun | Error + """ + + + return sync_detailed( + id=id, +run_id=run_id, +client=client, + + ).parsed + +async def asyncio_detailed( + id: UUID | str, + run_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> Response[AutofixRun | Error]: + """ Get an autofix run + + Returns one run: its status, the diagnosis once it succeeds, why it + failed or was canceled, and the model tokens it used. Runs stay readable + where autofix is not available. + + Project access tokens can read runs, including read-only ones. + + Args: + id (UUID): + run_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AutofixRun | Error] + """ + + + kwargs = request_kwargs( + id=id, +run_id=run_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return build_response(client=client, response=response) + +async def asyncio( + id: UUID | str, + run_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> AutofixRun | Error | None: + """ Get an autofix run + + Returns one run: its status, the diagnosis once it succeeds, why it + failed or was canceled, and the model tokens it used. Runs stay readable + where autofix is not available. + + Project access tokens can read runs, including read-only ones. + + Args: + id (UUID): + run_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AutofixRun | Error + """ + + + return (await asyncio_detailed( + id=id, +run_id=run_id, +client=client, + + )).parsed diff --git a/src/volcano_sdk/_generated/api/autofix/list_autofix_runs.py b/src/volcano_sdk/_generated/api/autofix/list_autofix_runs.py new file mode 100644 index 00000000..0d90897a --- /dev/null +++ b/src/volcano_sdk/_generated/api/autofix/list_autofix_runs.py @@ -0,0 +1,294 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ...client import AuthenticatedClient, Client +from ...types import Response, UNSET +from ... import errors + +from ...models.autofix_run_status import AutofixRunStatus +from ...models.autofix_run_status import check_autofix_run_status +from ...models.error import Error +from ...models.paginated_autofix_runs import PaginatedAutofixRuns +from ...types import UNSET, Unset +from typing import cast +from uuid import UUID + + + +def request_kwargs( + id: UUID | str, + *, + limit: int | Unset = 10, + cursor: str | Unset = UNSET, + issue_id: UUID | str | Unset = UNSET, + status: AutofixRunStatus | Unset = UNSET, + +) -> dict[str, Any]: + + + + + params: dict[str, Any] = {} + + params["limit"] = limit + + params["cursor"] = cursor + + json_issue_id: str | Unset = UNSET + if not isinstance(issue_id, Unset): + json_issue_id = str(issue_id) + params["issue_id"] = json_issue_id + + json_status: str | Unset = UNSET + if not isinstance(status, Unset): + json_status = status + + params["status"] = json_status + + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/projects/{id}/autofix-runs".format(id=quote(str(id), safe=""),), + "params": params, + } + + + return _kwargs + + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | PaginatedAutofixRuns | None: + if response.status_code == 200: + response_200 = PaginatedAutofixRuns.from_dict(response.json()) + + + + return response_200 + + if response.status_code == 400: + response_400 = Error.from_dict(response.json()) + + + + return response_400 + + if response.status_code == 404: + response_404 = Error.from_dict(response.json()) + + + + return response_404 + + if response.status_code == 501: + response_501 = Error.from_dict(response.json()) + + + + return response_501 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | PaginatedAutofixRuns]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: UUID | str, + *, + client: AuthenticatedClient, + limit: int | Unset = 10, + cursor: str | Unset = UNSET, + issue_id: UUID | str | Unset = UNSET, + status: AutofixRunStatus | Unset = UNSET, + +) -> Response[Error | PaginatedAutofixRuns]: + """ List autofix runs + + Lists the project's autofix runs, newest first. Runs stay readable after + autofix is turned off, and where autofix is not available. + + Project access tokens can list runs, including read-only ones. + + Args: + id (UUID): + limit (int | Unset): Default: 10. + cursor (str | Unset): + issue_id (UUID | Unset): + status (AutofixRunStatus | Unset): Where a run is. `canceled` means the project's settings + or plan stopped allowing the run before it finished; `failure_code` says which. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Error | PaginatedAutofixRuns] + """ + + + kwargs = request_kwargs( + id=id, +limit=limit, +cursor=cursor, +issue_id=issue_id, +status=status, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return build_response(client=client, response=response) + +def sync( + id: UUID | str, + *, + client: AuthenticatedClient, + limit: int | Unset = 10, + cursor: str | Unset = UNSET, + issue_id: UUID | str | Unset = UNSET, + status: AutofixRunStatus | Unset = UNSET, + +) -> Error | PaginatedAutofixRuns | None: + """ List autofix runs + + Lists the project's autofix runs, newest first. Runs stay readable after + autofix is turned off, and where autofix is not available. + + Project access tokens can list runs, including read-only ones. + + Args: + id (UUID): + limit (int | Unset): Default: 10. + cursor (str | Unset): + issue_id (UUID | Unset): + status (AutofixRunStatus | Unset): Where a run is. `canceled` means the project's settings + or plan stopped allowing the run before it finished; `failure_code` says which. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Error | PaginatedAutofixRuns + """ + + + return sync_detailed( + id=id, +client=client, +limit=limit, +cursor=cursor, +issue_id=issue_id, +status=status, + + ).parsed + +async def asyncio_detailed( + id: UUID | str, + *, + client: AuthenticatedClient, + limit: int | Unset = 10, + cursor: str | Unset = UNSET, + issue_id: UUID | str | Unset = UNSET, + status: AutofixRunStatus | Unset = UNSET, + +) -> Response[Error | PaginatedAutofixRuns]: + """ List autofix runs + + Lists the project's autofix runs, newest first. Runs stay readable after + autofix is turned off, and where autofix is not available. + + Project access tokens can list runs, including read-only ones. + + Args: + id (UUID): + limit (int | Unset): Default: 10. + cursor (str | Unset): + issue_id (UUID | Unset): + status (AutofixRunStatus | Unset): Where a run is. `canceled` means the project's settings + or plan stopped allowing the run before it finished; `failure_code` says which. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Error | PaginatedAutofixRuns] + """ + + + kwargs = request_kwargs( + id=id, +limit=limit, +cursor=cursor, +issue_id=issue_id, +status=status, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return build_response(client=client, response=response) + +async def asyncio( + id: UUID | str, + *, + client: AuthenticatedClient, + limit: int | Unset = 10, + cursor: str | Unset = UNSET, + issue_id: UUID | str | Unset = UNSET, + status: AutofixRunStatus | Unset = UNSET, + +) -> Error | PaginatedAutofixRuns | None: + """ List autofix runs + + Lists the project's autofix runs, newest first. Runs stay readable after + autofix is turned off, and where autofix is not available. + + Project access tokens can list runs, including read-only ones. + + Args: + id (UUID): + limit (int | Unset): Default: 10. + cursor (str | Unset): + issue_id (UUID | Unset): + status (AutofixRunStatus | Unset): Where a run is. `canceled` means the project's settings + or plan stopped allowing the run before it finished; `failure_code` says which. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Error | PaginatedAutofixRuns + """ + + + return (await asyncio_detailed( + id=id, +client=client, +limit=limit, +cursor=cursor, +issue_id=issue_id, +status=status, + + )).parsed diff --git a/src/volcano_sdk/_generated/api/autofix/start_autofix_run.py b/src/volcano_sdk/_generated/api/autofix/start_autofix_run.py new file mode 100644 index 00000000..0fee78e8 --- /dev/null +++ b/src/volcano_sdk/_generated/api/autofix/start_autofix_run.py @@ -0,0 +1,291 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ...client import AuthenticatedClient, Client +from ...types import Response, UNSET +from ... import errors + +from ...models.autofix_run import AutofixRun +from ...models.error import Error +from typing import cast +from uuid import UUID + + + +def request_kwargs( + id: UUID | str, + issue_id: UUID | str, + +) -> dict[str, Any]: + + + + + + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/projects/{id}/issues/{issue_id}/autofix-runs".format(id=quote(str(id), safe=""),issue_id=quote(str(issue_id), safe=""),), + } + + + return _kwargs + + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AutofixRun | Error | None: + if response.status_code == 202: + response_202 = AutofixRun.from_dict(response.json()) + + + + return response_202 + + if response.status_code == 400: + response_400 = Error.from_dict(response.json()) + + + + return response_400 + + if response.status_code == 403: + response_403 = Error.from_dict(response.json()) + + + + return response_403 + + if response.status_code == 404: + response_404 = Error.from_dict(response.json()) + + + + return response_404 + + if response.status_code == 409: + response_409 = Error.from_dict(response.json()) + + + + return response_409 + + if response.status_code == 429: + response_429 = Error.from_dict(response.json()) + + + + return response_429 + + if response.status_code == 501: + response_501 = Error.from_dict(response.json()) + + + + return response_501 + + if response.status_code == 503: + response_503 = Error.from_dict(response.json()) + + + + return response_503 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AutofixRun | Error]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: UUID | str, + issue_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> Response[AutofixRun | Error]: + """ Diagnose an issue + + Queues a run that diagnoses the issue with AI. The run reads the + issue's runtime logs and, when a push to the project's connected + repository built the deployment that was live when the issue was + last seen, its source at that commit. Poll the run until its status is + `succeeded`, `failed`, or `canceled`. + + Autofix must be on for the project. An issue has at most one queued or + running run, a project runs one at a time, and a project starts at most + 25 runs, manual and automatic, in any 24 hours. + + Project access tokens are refused. A run spends model tokens on the + project's provider, so a person starts it with a platform token or in + the dashboard. + + Args: + id (UUID): + issue_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AutofixRun | Error] + """ + + + kwargs = request_kwargs( + id=id, +issue_id=issue_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return build_response(client=client, response=response) + +def sync( + id: UUID | str, + issue_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> AutofixRun | Error | None: + """ Diagnose an issue + + Queues a run that diagnoses the issue with AI. The run reads the + issue's runtime logs and, when a push to the project's connected + repository built the deployment that was live when the issue was + last seen, its source at that commit. Poll the run until its status is + `succeeded`, `failed`, or `canceled`. + + Autofix must be on for the project. An issue has at most one queued or + running run, a project runs one at a time, and a project starts at most + 25 runs, manual and automatic, in any 24 hours. + + Project access tokens are refused. A run spends model tokens on the + project's provider, so a person starts it with a platform token or in + the dashboard. + + Args: + id (UUID): + issue_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AutofixRun | Error + """ + + + return sync_detailed( + id=id, +issue_id=issue_id, +client=client, + + ).parsed + +async def asyncio_detailed( + id: UUID | str, + issue_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> Response[AutofixRun | Error]: + """ Diagnose an issue + + Queues a run that diagnoses the issue with AI. The run reads the + issue's runtime logs and, when a push to the project's connected + repository built the deployment that was live when the issue was + last seen, its source at that commit. Poll the run until its status is + `succeeded`, `failed`, or `canceled`. + + Autofix must be on for the project. An issue has at most one queued or + running run, a project runs one at a time, and a project starts at most + 25 runs, manual and automatic, in any 24 hours. + + Project access tokens are refused. A run spends model tokens on the + project's provider, so a person starts it with a platform token or in + the dashboard. + + Args: + id (UUID): + issue_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AutofixRun | Error] + """ + + + kwargs = request_kwargs( + id=id, +issue_id=issue_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return build_response(client=client, response=response) + +async def asyncio( + id: UUID | str, + issue_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> AutofixRun | Error | None: + """ Diagnose an issue + + Queues a run that diagnoses the issue with AI. The run reads the + issue's runtime logs and, when a push to the project's connected + repository built the deployment that was live when the issue was + last seen, its source at that commit. Poll the run until its status is + `succeeded`, `failed`, or `canceled`. + + Autofix must be on for the project. An issue has at most one queued or + running run, a project runs one at a time, and a project starts at most + 25 runs, manual and automatic, in any 24 hours. + + Project access tokens are refused. A run spends model tokens on the + project's provider, so a person starts it with a platform token or in + the dashboard. + + Args: + id (UUID): + issue_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AutofixRun | Error + """ + + + return (await asyncio_detailed( + id=id, +issue_id=issue_id, +client=client, + + )).parsed diff --git a/src/volcano_sdk/_generated/api/frontends/create_frontend.py b/src/volcano_sdk/_generated/api/frontends/create_frontend.py index 7c94b624..1509d39f 100644 --- a/src/volcano_sdk/_generated/api/frontends/create_frontend.py +++ b/src/volcano_sdk/_generated/api/frontends/create_frontend.py @@ -152,8 +152,8 @@ def sync_detailed( 22.x or 24.x. The Node.js runtime is inferred from `package.json` `engines.node`; if omitted, Volcano uses Node.js 22.x. The selected Node.js family must also satisfy the installed Next.js package's - `engines.node` constraint. Volcano tests Next 15.5.27 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next - 16.4.0 (`>=20.9.0`). + `engines.node` constraint. Volcano tests Next 15.5.28 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next + 16.4.2 (`>=20.9.0`). Source archive size is enforced by the API with `SOURCE_ARCHIVE_SIZE_LIMIT_MB`; the CLI does not apply its own source archive size limit. After the final container images are built, the publish build enforces `LAMBDA_TARGET_CONTAINER_SIZE_LIMIT_MB` before pushing. @@ -216,8 +216,8 @@ def sync( 22.x or 24.x. The Node.js runtime is inferred from `package.json` `engines.node`; if omitted, Volcano uses Node.js 22.x. The selected Node.js family must also satisfy the installed Next.js package's - `engines.node` constraint. Volcano tests Next 15.5.27 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next - 16.4.0 (`>=20.9.0`). + `engines.node` constraint. Volcano tests Next 15.5.28 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next + 16.4.2 (`>=20.9.0`). Source archive size is enforced by the API with `SOURCE_ARCHIVE_SIZE_LIMIT_MB`; the CLI does not apply its own source archive size limit. After the final container images are built, the publish build enforces `LAMBDA_TARGET_CONTAINER_SIZE_LIMIT_MB` before pushing. @@ -275,8 +275,8 @@ async def asyncio_detailed( 22.x or 24.x. The Node.js runtime is inferred from `package.json` `engines.node`; if omitted, Volcano uses Node.js 22.x. The selected Node.js family must also satisfy the installed Next.js package's - `engines.node` constraint. Volcano tests Next 15.5.27 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next - 16.4.0 (`>=20.9.0`). + `engines.node` constraint. Volcano tests Next 15.5.28 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next + 16.4.2 (`>=20.9.0`). Source archive size is enforced by the API with `SOURCE_ARCHIVE_SIZE_LIMIT_MB`; the CLI does not apply its own source archive size limit. After the final container images are built, the publish build enforces `LAMBDA_TARGET_CONTAINER_SIZE_LIMIT_MB` before pushing. @@ -339,8 +339,8 @@ async def asyncio( 22.x or 24.x. The Node.js runtime is inferred from `package.json` `engines.node`; if omitted, Volcano uses Node.js 22.x. The selected Node.js family must also satisfy the installed Next.js package's - `engines.node` constraint. Volcano tests Next 15.5.27 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next - 16.4.0 (`>=20.9.0`). + `engines.node` constraint. Volcano tests Next 15.5.28 (`^18.18.0 || ^19.8.0 || >=20.0.0`) and Next + 16.4.2 (`>=20.9.0`). Source archive size is enforced by the API with `SOURCE_ARCHIVE_SIZE_LIMIT_MB`; the CLI does not apply its own source archive size limit. After the final container images are built, the publish build enforces `LAMBDA_TARGET_CONTAINER_SIZE_LIMIT_MB` before pushing. diff --git a/src/volcano_sdk/_generated/api/functions/invoke_function.py b/src/volcano_sdk/_generated/api/functions/invoke_function.py index 55bf0ed8..bed45f2a 100644 --- a/src/volcano_sdk/_generated/api/functions/invoke_function.py +++ b/src/volcano_sdk/_generated/api/functions/invoke_function.py @@ -151,6 +151,12 @@ def sync_detailed( - Function must have `visibility: public` - Function receives payload only (no `__volcano_auth`) + **Reserved payload keys:** the top-level `__volcano_auth` and + `__volcano_http` keys are reserved. Volcano removes caller-supplied + values for both before the function runs; only an auth user token adds + a server-built `__volcano_auth`, and only HTTP-mode ingress sets + `__volcano_http: true`. + **Transport and CORS:** - This operation is the authenticated direct RPC endpoint and always uses the POST `{payload: ...}` contract, including for functions whose DNS ingress is @@ -236,6 +242,12 @@ def sync( - Function must have `visibility: public` - Function receives payload only (no `__volcano_auth`) + **Reserved payload keys:** the top-level `__volcano_auth` and + `__volcano_http` keys are reserved. Volcano removes caller-supplied + values for both before the function runs; only an auth user token adds + a server-built `__volcano_auth`, and only HTTP-mode ingress sets + `__volcano_http: true`. + **Transport and CORS:** - This operation is the authenticated direct RPC endpoint and always uses the POST `{payload: ...}` contract, including for functions whose DNS ingress is @@ -316,6 +328,12 @@ async def asyncio_detailed( - Function must have `visibility: public` - Function receives payload only (no `__volcano_auth`) + **Reserved payload keys:** the top-level `__volcano_auth` and + `__volcano_http` keys are reserved. Volcano removes caller-supplied + values for both before the function runs; only an auth user token adds + a server-built `__volcano_auth`, and only HTTP-mode ingress sets + `__volcano_http: true`. + **Transport and CORS:** - This operation is the authenticated direct RPC endpoint and always uses the POST `{payload: ...}` contract, including for functions whose DNS ingress is @@ -401,6 +419,12 @@ async def asyncio( - Function must have `visibility: public` - Function receives payload only (no `__volcano_auth`) + **Reserved payload keys:** the top-level `__volcano_auth` and + `__volcano_http` keys are reserved. Volcano removes caller-supplied + values for both before the function runs; only an auth user token adds + a server-built `__volcano_auth`, and only HTTP-mode ingress sets + `__volcano_http: true`. + **Transport and CORS:** - This operation is the authenticated direct RPC endpoint and always uses the POST `{payload: ...}` contract, including for functions whose DNS ingress is diff --git a/src/volcano_sdk/_generated/api/o_auth_authentication/auth_o_auth_exchange.py b/src/volcano_sdk/_generated/api/o_auth_authentication/auth_o_auth_exchange.py index 27018310..24d84ce8 100644 --- a/src/volcano_sdk/_generated/api/o_auth_authentication/auth_o_auth_exchange.py +++ b/src/volcano_sdk/_generated/api/o_auth_authentication/auth_o_auth_exchange.py @@ -10,6 +10,7 @@ from ...models.auth_o_auth_exchange_body import AuthOAuthExchangeBody from ...models.auth_token_response import AuthTokenResponse +from ...types import UNSET, Unset from typing import cast @@ -17,9 +18,17 @@ def request_kwargs( *, body: AuthOAuthExchangeBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_volcano_proxy_authorization, Unset): + headers["X-Volcano-Proxy-Authorization"] = x_volcano_proxy_authorization + + if not isinstance(x_volcano_client_ip, Unset): + headers["X-Volcano-Client-IP"] = x_volcano_client_ip + @@ -83,6 +92,8 @@ def sync_detailed( *, client: AuthenticatedClient, body: AuthOAuthExchangeBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthTokenResponse]: """ Exchange OAuth authorization code @@ -92,6 +103,8 @@ def sync_detailed( redirect_url that initiated the flow. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthOAuthExchangeBody): Raises: @@ -105,6 +118,8 @@ def sync_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -118,6 +133,8 @@ def sync( *, client: AuthenticatedClient, body: AuthOAuthExchangeBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthTokenResponse | None: """ Exchange OAuth authorization code @@ -127,6 +144,8 @@ def sync( redirect_url that initiated the flow. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthOAuthExchangeBody): Raises: @@ -141,6 +160,8 @@ def sync( return sync_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ).parsed @@ -148,6 +169,8 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AuthOAuthExchangeBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Response[Any | AuthTokenResponse]: """ Exchange OAuth authorization code @@ -157,6 +180,8 @@ async def asyncio_detailed( redirect_url that initiated the flow. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthOAuthExchangeBody): Raises: @@ -170,6 +195,8 @@ async def asyncio_detailed( kwargs = request_kwargs( body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, ) @@ -183,6 +210,8 @@ async def asyncio( *, client: AuthenticatedClient, body: AuthOAuthExchangeBody, + x_volcano_proxy_authorization: str | Unset = UNSET, + x_volcano_client_ip: str | Unset = UNSET, ) -> Any | AuthTokenResponse | None: """ Exchange OAuth authorization code @@ -192,6 +221,8 @@ async def asyncio( redirect_url that initiated the flow. Args: + x_volcano_proxy_authorization (str | Unset): + x_volcano_client_ip (str | Unset): body (AuthOAuthExchangeBody): Raises: @@ -206,5 +237,7 @@ async def asyncio( return (await asyncio_detailed( client=client, body=body, +x_volcano_proxy_authorization=x_volcano_proxy_authorization, +x_volcano_client_ip=x_volcano_client_ip, )).parsed diff --git a/src/volcano_sdk/_generated/api/projects/get_project_health.py b/src/volcano_sdk/_generated/api/projects/get_project_health.py index d7d5ba24..baabcc82 100644 --- a/src/volcano_sdk/_generated/api/projects/get_project_health.py +++ b/src/volcano_sdk/_generated/api/projects/get_project_health.py @@ -97,7 +97,8 @@ def sync_detailed( Returns a fast control-plane health snapshot for the project and its deployed resources. The endpoint does not run live provider probes. A successful request returns 200 even when the project status is - `unhealthy`; transport and authorization failures use HTTP errors. + `degraded` or `critical`; transport and authorization failures use HTTP + errors. Args: id (UUID): @@ -133,7 +134,8 @@ def sync( Returns a fast control-plane health snapshot for the project and its deployed resources. The endpoint does not run live provider probes. A successful request returns 200 even when the project status is - `unhealthy`; transport and authorization failures use HTTP errors. + `degraded` or `critical`; transport and authorization failures use HTTP + errors. Args: id (UUID): @@ -164,7 +166,8 @@ async def asyncio_detailed( Returns a fast control-plane health snapshot for the project and its deployed resources. The endpoint does not run live provider probes. A successful request returns 200 even when the project status is - `unhealthy`; transport and authorization failures use HTTP errors. + `degraded` or `critical`; transport and authorization failures use HTTP + errors. Args: id (UUID): @@ -200,7 +203,8 @@ async def asyncio( Returns a fast control-plane health snapshot for the project and its deployed resources. The endpoint does not run live provider probes. A successful request returns 200 even when the project status is - `unhealthy`; transport and authorization failures use HTTP errors. + `degraded` or `critical`; transport and authorization failures use HTTP + errors. Args: id (UUID): diff --git a/src/volcano_sdk/_generated/api/storage_policies/delete_storage_policy.py b/src/volcano_sdk/_generated/api/storage_policies/delete_storage_policy.py index 5e572294..4b9c0404 100644 --- a/src/volcano_sdk/_generated/api/storage_policies/delete_storage_policy.py +++ b/src/volcano_sdk/_generated/api/storage_policies/delete_storage_policy.py @@ -8,6 +8,8 @@ from ...types import Response, UNSET from ... import errors +from ...models.error import Error +from typing import cast from uuid import UUID @@ -34,9 +36,17 @@ def request_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None: if response.status_code == 200: - return None + response_200 = cast(Any, None) + return response_200 + + if response.status_code == 404: + response_404 = Error.from_dict(response.json()) + + + + return response_404 if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) @@ -44,7 +54,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: +def build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient, -) -> Response[Any]: +) -> Response[Any | Error]: """ Delete a storage policy Args: @@ -73,7 +83,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Any | Error] """ @@ -90,6 +100,37 @@ def sync_detailed( return build_response(client=client, response=response) +def sync( + id: UUID | str, + bucket_name: str, + policy_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> Any | Error | None: + """ Delete a storage policy + + Args: + id (UUID): + bucket_name (str): + policy_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | Error + """ + + + return sync_detailed( + id=id, +bucket_name=bucket_name, +policy_id=policy_id, +client=client, + + ).parsed async def asyncio_detailed( id: UUID | str, @@ -98,7 +139,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, -) -> Response[Any]: +) -> Response[Any | Error]: """ Delete a storage policy Args: @@ -111,7 +152,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Any | Error] """ @@ -128,3 +169,34 @@ async def asyncio_detailed( return build_response(client=client, response=response) +async def asyncio( + id: UUID | str, + bucket_name: str, + policy_id: UUID | str, + *, + client: AuthenticatedClient, + +) -> Any | Error | None: + """ Delete a storage policy + + Args: + id (UUID): + bucket_name (str): + policy_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | Error + """ + + + return (await asyncio_detailed( + id=id, +bucket_name=bucket_name, +policy_id=policy_id, +client=client, + + )).parsed diff --git a/src/volcano_sdk/_generated/models/__init__.py b/src/volcano_sdk/_generated/models/__init__.py index 15421c77..5916d8d3 100644 --- a/src/volcano_sdk/_generated/models/__init__.py +++ b/src/volcano_sdk/_generated/models/__init__.py @@ -90,8 +90,21 @@ from .auth_user_app_metadata import AuthUserAppMetadata from .auth_user_status import AuthUserStatus from .auth_user_user_metadata import AuthUserUserMetadata +from .autofix_diagnosis import AutofixDiagnosis +from .autofix_diagnosis_confidence import AutofixDiagnosisConfidence +from .autofix_edit import AutofixEdit +from .autofix_evidence import AutofixEvidence +from .autofix_evidence_kind import AutofixEvidenceKind from .autofix_model import AutofixModel +from .autofix_patch import AutofixPatch from .autofix_provider import AutofixProvider +from .autofix_pull_request import AutofixPullRequest +from .autofix_pull_request_skipped import AutofixPullRequestSkipped +from .autofix_pull_request_state import AutofixPullRequestState +from .autofix_run import AutofixRun +from .autofix_run_status import AutofixRunStatus +from .autofix_run_trigger import AutofixRunTrigger +from .autofix_run_usage import AutofixRunUsage from .autofix_settings import AutofixSettings from .autofix_stage import AutofixStage from .ban_auth_user_body import BanAuthUserBody @@ -372,6 +385,7 @@ from .o_auth_error_response import OAuthErrorResponse from .open_api_spec_document import OpenAPISpecDocument from .paginated_auth_users import PaginatedAuthUsers +from .paginated_autofix_runs import PaginatedAutofixRuns from .paginated_databases import PaginatedDatabases from .paginated_durable_approvals import PaginatedDurableApprovals from .paginated_durable_executions import PaginatedDurableExecutions @@ -721,8 +735,21 @@ "AuthUserAppMetadata", "AuthUserStatus", "AuthUserUserMetadata", + "AutofixDiagnosis", + "AutofixDiagnosisConfidence", + "AutofixEdit", + "AutofixEvidence", + "AutofixEvidenceKind", "AutofixModel", + "AutofixPatch", "AutofixProvider", + "AutofixPullRequest", + "AutofixPullRequestSkipped", + "AutofixPullRequestState", + "AutofixRun", + "AutofixRunStatus", + "AutofixRunTrigger", + "AutofixRunUsage", "AutofixSettings", "AutofixStage", "BanAuthUserBody", @@ -1003,6 +1030,7 @@ "OAuthErrorResponse", "OpenAPISpecDocument", "PaginatedAuthUsers", + "PaginatedAutofixRuns", "PaginatedDatabases", "PaginatedDurableApprovals", "PaginatedDurableExecutions", diff --git a/src/volcano_sdk/_generated/models/autofix_diagnosis.py b/src/volcano_sdk/_generated/models/autofix_diagnosis.py new file mode 100644 index 00000000..26bacf89 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_diagnosis.py @@ -0,0 +1,132 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from ..models.autofix_diagnosis_confidence import AutofixDiagnosisConfidence +from ..models.autofix_diagnosis_confidence import check_autofix_diagnosis_confidence +from typing import cast + +if TYPE_CHECKING: + from ..models.autofix_evidence import AutofixEvidence + + + + + +T = TypeVar("T", bound="AutofixDiagnosis") + + + +@_attrs_define +class AutofixDiagnosis: + """ + Attributes: + summary (str): One or two sentences on what goes wrong. + root_cause (str): + evidence (list[AutofixEvidence]): + suggested_fix (str): + confidence (AutofixDiagnosisConfidence): + fixable (bool): Whether a change to the project's code would fix the issue. + files (list[str]): Repository paths a fix would change. + """ + + summary: str + root_cause: str + evidence: list[AutofixEvidence] + suggested_fix: str + confidence: AutofixDiagnosisConfidence + fixable: bool + files: list[str] + + + + + + def to_dict(self) -> dict[str, Any]: + from ..models.autofix_evidence import AutofixEvidence # noqa: PLC0415 + summary = self.summary + + root_cause = self.root_cause + + evidence = [] + for evidence_item_data in self.evidence: + evidence_item = evidence_item_data.to_dict() + evidence.append(evidence_item) + + + + suggested_fix = self.suggested_fix + + confidence: str = self.confidence + + fixable = self.fixable + + files = self.files + + + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "summary": summary, + "root_cause": root_cause, + "evidence": evidence, + "suggested_fix": suggested_fix, + "confidence": confidence, + "fixable": fixable, + "files": files, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.autofix_evidence import AutofixEvidence # noqa: PLC0415 + d = dict(src_dict) + summary = d.pop("summary") + + root_cause = d.pop("root_cause") + + evidence = [] + _evidence = d.pop("evidence") + for evidence_item_data in (_evidence): + evidence_item = AutofixEvidence.from_dict(evidence_item_data) + + + + evidence.append(evidence_item) + + + suggested_fix = d.pop("suggested_fix") + + confidence = check_autofix_diagnosis_confidence(d.pop("confidence")) + + + + + fixable = d.pop("fixable") + + files = cast(list[str], d.pop("files")) + + + autofix_diagnosis = cls( + summary=summary, + root_cause=root_cause, + evidence=evidence, + suggested_fix=suggested_fix, + confidence=confidence, + fixable=fixable, + files=files, + ) + + return autofix_diagnosis + diff --git a/src/volcano_sdk/_generated/models/autofix_diagnosis_confidence.py b/src/volcano_sdk/_generated/models/autofix_diagnosis_confidence.py new file mode 100644 index 00000000..eeec57dd --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_diagnosis_confidence.py @@ -0,0 +1,10 @@ +from typing import Literal + +AutofixDiagnosisConfidence = Literal['high', 'low', 'medium'] + +AUTOFIX_DIAGNOSIS_CONFIDENCE_VALUES: set[AutofixDiagnosisConfidence] = { 'high', 'low', 'medium', } + +def check_autofix_diagnosis_confidence(value: str) -> AutofixDiagnosisConfidence: + if value in AUTOFIX_DIAGNOSIS_CONFIDENCE_VALUES: + return value + raise TypeError(f"Unexpected value {value!r}. Expected one of {AUTOFIX_DIAGNOSIS_CONFIDENCE_VALUES!r}") diff --git a/src/volcano_sdk/_generated/models/autofix_edit.py b/src/volcano_sdk/_generated/models/autofix_edit.py new file mode 100644 index 00000000..2bcb071d --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_edit.py @@ -0,0 +1,75 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + + + + + + + +T = TypeVar("T", bound="AutofixEdit") + + + +@_attrs_define +class AutofixEdit: + """ One exact text replacement. An empty `old_text` creates the file. + + Attributes: + path (str): + old_text (str): + new_text (str): + """ + + path: str + old_text: str + new_text: str + + + + + + def to_dict(self) -> dict[str, Any]: + path = self.path + + old_text = self.old_text + + new_text = self.new_text + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "path": path, + "old_text": old_text, + "new_text": new_text, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + path = d.pop("path") + + old_text = d.pop("old_text") + + new_text = d.pop("new_text") + + autofix_edit = cls( + path=path, + old_text=old_text, + new_text=new_text, + ) + + return autofix_edit + diff --git a/src/volcano_sdk/_generated/models/autofix_evidence.py b/src/volcano_sdk/_generated/models/autofix_evidence.py new file mode 100644 index 00000000..4acd5a3d --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_evidence.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from ..models.autofix_evidence_kind import AutofixEvidenceKind +from ..models.autofix_evidence_kind import check_autofix_evidence_kind +from ..types import UNSET, Unset +from typing import cast + + + + + + +T = TypeVar("T", bound="AutofixEvidence") + + + +@_attrs_define +class AutofixEvidence: + """ + Attributes: + kind (AutofixEvidenceKind): + detail (str): + location (str | Unset): A file and line, or a log timestamp. Absent when the evidence has none. + """ + + kind: AutofixEvidenceKind + detail: str + location: str | Unset = UNSET + + + + + + def to_dict(self) -> dict[str, Any]: + kind: str = self.kind + + detail = self.detail + + location = self.location + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "kind": kind, + "detail": detail, + }) + if location is not UNSET: + field_dict["location"] = location + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + kind = check_autofix_evidence_kind(d.pop("kind")) + + + + + detail = d.pop("detail") + + location = d.pop("location", UNSET) + + autofix_evidence = cls( + kind=kind, + detail=detail, + location=location, + ) + + return autofix_evidence + diff --git a/src/volcano_sdk/_generated/models/autofix_evidence_kind.py b/src/volcano_sdk/_generated/models/autofix_evidence_kind.py new file mode 100644 index 00000000..0723fe78 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_evidence_kind.py @@ -0,0 +1,10 @@ +from typing import Literal + +AutofixEvidenceKind = Literal['code', 'log', 'other'] + +AUTOFIX_EVIDENCE_KIND_VALUES: set[AutofixEvidenceKind] = { 'code', 'log', 'other', } + +def check_autofix_evidence_kind(value: str) -> AutofixEvidenceKind: + if value in AUTOFIX_EVIDENCE_KIND_VALUES: + return value + raise TypeError(f"Unexpected value {value!r}. Expected one of {AUTOFIX_EVIDENCE_KIND_VALUES!r}") diff --git a/src/volcano_sdk/_generated/models/autofix_patch.py b/src/volcano_sdk/_generated/models/autofix_patch.py new file mode 100644 index 00000000..62ee2b03 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_patch.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from typing import cast + +if TYPE_CHECKING: + from ..models.autofix_edit import AutofixEdit + + + + + +T = TypeVar("T", bound="AutofixPatch") + + + +@_attrs_define +class AutofixPatch: + """ The fix the model proposed, applied to the deployed commit. Present whenever the run opened a pull request, and when + a valid fix could not be published. + + Attributes: + title (str): + edits (list[AutofixEdit]): + """ + + title: str + edits: list[AutofixEdit] + + + + + + def to_dict(self) -> dict[str, Any]: + from ..models.autofix_edit import AutofixEdit # noqa: PLC0415 + title = self.title + + edits = [] + for edits_item_data in self.edits: + edits_item = edits_item_data.to_dict() + edits.append(edits_item) + + + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "title": title, + "edits": edits, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.autofix_edit import AutofixEdit # noqa: PLC0415 + d = dict(src_dict) + title = d.pop("title") + + edits = [] + _edits = d.pop("edits") + for edits_item_data in (_edits): + edits_item = AutofixEdit.from_dict(edits_item_data) + + + + edits.append(edits_item) + + + autofix_patch = cls( + title=title, + edits=edits, + ) + + return autofix_patch + diff --git a/src/volcano_sdk/_generated/models/autofix_pull_request.py b/src/volcano_sdk/_generated/models/autofix_pull_request.py new file mode 100644 index 00000000..a8b58ae9 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_pull_request.py @@ -0,0 +1,131 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from ..models.autofix_pull_request_state import AutofixPullRequestState +from ..models.autofix_pull_request_state import check_autofix_pull_request_state +from ..types import UNSET, Unset +from typing import cast +import datetime + + + + + + +T = TypeVar("T", bound="AutofixPullRequest") + + + +@_attrs_define +class AutofixPullRequest: + """ The draft pull request the run opened on the connected repository. + + Attributes: + number (int): + url (str): + branch (str): The branch the fix is on, `volcano/autofix/`. + state (AutofixPullRequestState): + closed_at (datetime.datetime | Unset): When the pull request was merged or closed. + deployed_at (datetime.datetime | Unset): When a deployment that includes the merged fix went live. The issue + resolves then, unless it occurred again since. When more than 20 deployments went live after the merge before + Volcano checked, it is the merge time instead. + """ + + number: int + url: str + branch: str + state: AutofixPullRequestState + closed_at: datetime.datetime | Unset = UNSET + deployed_at: datetime.datetime | Unset = UNSET + + + + + + def to_dict(self) -> dict[str, Any]: + number = self.number + + url = self.url + + branch = self.branch + + state: str = self.state + + closed_at: str | Unset = UNSET + if not isinstance(self.closed_at, Unset): + closed_at = self.closed_at.isoformat() + + deployed_at: str | Unset = UNSET + if not isinstance(self.deployed_at, Unset): + deployed_at = self.deployed_at.isoformat() + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "number": number, + "url": url, + "branch": branch, + "state": state, + }) + if closed_at is not UNSET: + field_dict["closed_at"] = closed_at + if deployed_at is not UNSET: + field_dict["deployed_at"] = deployed_at + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + number = d.pop("number") + + url = d.pop("url") + + branch = d.pop("branch") + + state = check_autofix_pull_request_state(d.pop("state")) + + + + + _closed_at = d.pop("closed_at", UNSET) + closed_at: datetime.datetime | Unset + if isinstance(_closed_at, Unset): + closed_at = UNSET + else: + closed_at = datetime.datetime.fromisoformat(_closed_at) + + + + + _deployed_at = d.pop("deployed_at", UNSET) + deployed_at: datetime.datetime | Unset + if isinstance(_deployed_at, Unset): + deployed_at = UNSET + else: + deployed_at = datetime.datetime.fromisoformat(_deployed_at) + + + + + autofix_pull_request = cls( + number=number, + url=url, + branch=branch, + state=state, + closed_at=closed_at, + deployed_at=deployed_at, + ) + + return autofix_pull_request + diff --git a/src/volcano_sdk/_generated/models/autofix_pull_request_skipped.py b/src/volcano_sdk/_generated/models/autofix_pull_request_skipped.py new file mode 100644 index 00000000..81b39fad --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_pull_request_skipped.py @@ -0,0 +1,10 @@ +from typing import Literal + +AutofixPullRequestSkipped = Literal['low_confidence', 'no_patch', 'not_fixable', 'permission_missing', 'publish_failed', 'pull_request_open', 'repository_changed', 'source_unavailable'] + +AUTOFIX_PULL_REQUEST_SKIPPED_VALUES: set[AutofixPullRequestSkipped] = { 'low_confidence', 'no_patch', 'not_fixable', 'permission_missing', 'publish_failed', 'pull_request_open', 'repository_changed', 'source_unavailable', } + +def check_autofix_pull_request_skipped(value: str) -> AutofixPullRequestSkipped: + if value in AUTOFIX_PULL_REQUEST_SKIPPED_VALUES: + return value + raise TypeError(f"Unexpected value {value!r}. Expected one of {AUTOFIX_PULL_REQUEST_SKIPPED_VALUES!r}") diff --git a/src/volcano_sdk/_generated/models/autofix_pull_request_state.py b/src/volcano_sdk/_generated/models/autofix_pull_request_state.py new file mode 100644 index 00000000..5a7764b9 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_pull_request_state.py @@ -0,0 +1,10 @@ +from typing import Literal + +AutofixPullRequestState = Literal['closed', 'merged', 'open'] + +AUTOFIX_PULL_REQUEST_STATE_VALUES: set[AutofixPullRequestState] = { 'closed', 'merged', 'open', } + +def check_autofix_pull_request_state(value: str) -> AutofixPullRequestState: + if value in AUTOFIX_PULL_REQUEST_STATE_VALUES: + return value + raise TypeError(f"Unexpected value {value!r}. Expected one of {AUTOFIX_PULL_REQUEST_STATE_VALUES!r}") diff --git a/src/volcano_sdk/_generated/models/autofix_run.py b/src/volcano_sdk/_generated/models/autofix_run.py new file mode 100644 index 00000000..4fb1f1cb --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_run.py @@ -0,0 +1,362 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from ..models.autofix_model import AutofixModel +from ..models.autofix_model import check_autofix_model +from ..models.autofix_provider import AutofixProvider +from ..models.autofix_provider import check_autofix_provider +from ..models.autofix_pull_request_skipped import AutofixPullRequestSkipped +from ..models.autofix_pull_request_skipped import check_autofix_pull_request_skipped +from ..models.autofix_run_status import AutofixRunStatus +from ..models.autofix_run_status import check_autofix_run_status +from ..models.autofix_run_trigger import AutofixRunTrigger +from ..models.autofix_run_trigger import check_autofix_run_trigger +from ..models.autofix_stage import AutofixStage +from ..models.autofix_stage import check_autofix_stage +from ..types import UNSET, Unset +from typing import cast +from uuid import UUID +import datetime + +if TYPE_CHECKING: + from ..models.autofix_diagnosis import AutofixDiagnosis + from ..models.autofix_patch import AutofixPatch + from ..models.autofix_pull_request import AutofixPullRequest + from ..models.autofix_run_usage import AutofixRunUsage + + + + + +T = TypeVar("T", bound="AutofixRun") + + + +@_attrs_define +class AutofixRun: + """ + Attributes: + id (UUID): + project_id (UUID): + issue_id (UUID): + trigger (AutofixRunTrigger): What started the run. `manual` is a request; `new_issue` and `regression` are + automatic runs for an issue that appeared or reopened. + status (AutofixRunStatus): Where a run is. `canceled` means the project's settings or plan stopped allowing the + run before it finished; `failure_code` says which. + max_stage (AutofixStage): How far a run may go. `diagnose` stops at a root-cause diagnosis. `pull_request` may + also open a draft pull request with a fix in the project's connected repository. + provider (AutofixProvider): Who serves the model. `volcano` runs on Volcano's models. `anthropic` runs on your + own Anthropic API key. + model (AutofixModel): The Claude model a run uses. `claude-opus-5-5` is the default. + usage (AutofixRunUsage): Model tokens the run used across every attempt. + created_at (datetime.datetime): + stage_reached (AutofixStage | Unset): How far a run may go. `diagnose` stops at a root-cause diagnosis. + `pull_request` may also open a draft pull request with a fix in the project's connected repository. + diagnosis (AutofixDiagnosis | Unset): + patch (AutofixPatch | Unset): The fix the model proposed, applied to the deployed commit. Present whenever the + run opened a pull request, and when a valid fix could not be published. + pull_request (AutofixPullRequest | Unset): The draft pull request the run opened on the connected repository. + pull_request_skipped (AutofixPullRequestSkipped | Unset): Why a run whose `max_stage` is `pull_request` opened + no pull request. The diagnosis stands either way. + commit_sha (str | Unset): The commit the diagnosis read, when a push to the connected repository deployed the + resource. Absent when the run read logs only. + failure_code (str | Unset): Why the run failed or was canceled, or why its last attempt will be retried. One of + `api_key_rejected`, `model_request_rejected`, `model_unavailable`, `model_refused`, `no_diagnosis`, + `budget_exhausted`, `timed_out`, `attempts_exhausted`, `autofix_disabled`, `plan_required`, + `managed_models_unavailable`, `settings_changed`, `issue_not_found`, or `internal_error`. + failure_message (str | Unset): + started_at (datetime.datetime | Unset): + completed_at (datetime.datetime | Unset): + """ + + id: UUID + project_id: UUID + issue_id: UUID + trigger: AutofixRunTrigger + status: AutofixRunStatus + max_stage: AutofixStage + provider: AutofixProvider + model: AutofixModel + usage: AutofixRunUsage + created_at: datetime.datetime + stage_reached: AutofixStage | Unset = UNSET + diagnosis: AutofixDiagnosis | Unset = UNSET + patch: AutofixPatch | Unset = UNSET + pull_request: AutofixPullRequest | Unset = UNSET + pull_request_skipped: AutofixPullRequestSkipped | Unset = UNSET + commit_sha: str | Unset = UNSET + failure_code: str | Unset = UNSET + failure_message: str | Unset = UNSET + started_at: datetime.datetime | Unset = UNSET + completed_at: datetime.datetime | Unset = UNSET + + + + + + def to_dict(self) -> dict[str, Any]: + from ..models.autofix_diagnosis import AutofixDiagnosis # noqa: PLC0415 + from ..models.autofix_patch import AutofixPatch # noqa: PLC0415 + from ..models.autofix_pull_request import AutofixPullRequest # noqa: PLC0415 + from ..models.autofix_run_usage import AutofixRunUsage # noqa: PLC0415 + id = str(self.id) + + project_id = str(self.project_id) + + issue_id = str(self.issue_id) + + trigger: str = self.trigger + + status: str = self.status + + max_stage: str = self.max_stage + + provider: str = self.provider + + model: str = self.model + + usage = self.usage.to_dict() + + created_at = self.created_at.isoformat() + + stage_reached: str | Unset = UNSET + if not isinstance(self.stage_reached, Unset): + stage_reached = self.stage_reached + + + diagnosis: dict[str, Any] | Unset = UNSET + if not isinstance(self.diagnosis, Unset): + diagnosis = self.diagnosis.to_dict() + + patch: dict[str, Any] | Unset = UNSET + if not isinstance(self.patch, Unset): + patch = self.patch.to_dict() + + pull_request: dict[str, Any] | Unset = UNSET + if not isinstance(self.pull_request, Unset): + pull_request = self.pull_request.to_dict() + + pull_request_skipped: str | Unset = UNSET + if not isinstance(self.pull_request_skipped, Unset): + pull_request_skipped = self.pull_request_skipped + + + commit_sha = self.commit_sha + + failure_code = self.failure_code + + failure_message = self.failure_message + + started_at: str | Unset = UNSET + if not isinstance(self.started_at, Unset): + started_at = self.started_at.isoformat() + + completed_at: str | Unset = UNSET + if not isinstance(self.completed_at, Unset): + completed_at = self.completed_at.isoformat() + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "id": id, + "project_id": project_id, + "issue_id": issue_id, + "trigger": trigger, + "status": status, + "max_stage": max_stage, + "provider": provider, + "model": model, + "usage": usage, + "created_at": created_at, + }) + if stage_reached is not UNSET: + field_dict["stage_reached"] = stage_reached + if diagnosis is not UNSET: + field_dict["diagnosis"] = diagnosis + if patch is not UNSET: + field_dict["patch"] = patch + if pull_request is not UNSET: + field_dict["pull_request"] = pull_request + if pull_request_skipped is not UNSET: + field_dict["pull_request_skipped"] = pull_request_skipped + if commit_sha is not UNSET: + field_dict["commit_sha"] = commit_sha + if failure_code is not UNSET: + field_dict["failure_code"] = failure_code + if failure_message is not UNSET: + field_dict["failure_message"] = failure_message + if started_at is not UNSET: + field_dict["started_at"] = started_at + if completed_at is not UNSET: + field_dict["completed_at"] = completed_at + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.autofix_diagnosis import AutofixDiagnosis # noqa: PLC0415 + from ..models.autofix_patch import AutofixPatch # noqa: PLC0415 + from ..models.autofix_pull_request import AutofixPullRequest # noqa: PLC0415 + from ..models.autofix_run_usage import AutofixRunUsage # noqa: PLC0415 + d = dict(src_dict) + id = UUID(d.pop("id")) + + + + + project_id = UUID(d.pop("project_id")) + + + + + issue_id = UUID(d.pop("issue_id")) + + + + + trigger = check_autofix_run_trigger(d.pop("trigger")) + + + + + status = check_autofix_run_status(d.pop("status")) + + + + + max_stage = check_autofix_stage(d.pop("max_stage")) + + + + + provider = check_autofix_provider(d.pop("provider")) + + + + + model = check_autofix_model(d.pop("model")) + + + + + usage = AutofixRunUsage.from_dict(d.pop("usage")) + + + + + created_at = datetime.datetime.fromisoformat(d.pop("created_at")) + + + + + _stage_reached = d.pop("stage_reached", UNSET) + stage_reached: AutofixStage | Unset + if isinstance(_stage_reached, Unset): + stage_reached = UNSET + else: + stage_reached = check_autofix_stage(_stage_reached) + + + + + _diagnosis = d.pop("diagnosis", UNSET) + diagnosis: AutofixDiagnosis | Unset + if isinstance(_diagnosis, Unset): + diagnosis = UNSET + else: + diagnosis = AutofixDiagnosis.from_dict(_diagnosis) + + + + + _patch = d.pop("patch", UNSET) + patch: AutofixPatch | Unset + if isinstance(_patch, Unset): + patch = UNSET + else: + patch = AutofixPatch.from_dict(_patch) + + + + + _pull_request = d.pop("pull_request", UNSET) + pull_request: AutofixPullRequest | Unset + if isinstance(_pull_request, Unset): + pull_request = UNSET + else: + pull_request = AutofixPullRequest.from_dict(_pull_request) + + + + + _pull_request_skipped = d.pop("pull_request_skipped", UNSET) + pull_request_skipped: AutofixPullRequestSkipped | Unset + if isinstance(_pull_request_skipped, Unset): + pull_request_skipped = UNSET + else: + pull_request_skipped = check_autofix_pull_request_skipped(_pull_request_skipped) + + + + + commit_sha = d.pop("commit_sha", UNSET) + + failure_code = d.pop("failure_code", UNSET) + + failure_message = d.pop("failure_message", UNSET) + + _started_at = d.pop("started_at", UNSET) + started_at: datetime.datetime | Unset + if isinstance(_started_at, Unset): + started_at = UNSET + else: + started_at = datetime.datetime.fromisoformat(_started_at) + + + + + _completed_at = d.pop("completed_at", UNSET) + completed_at: datetime.datetime | Unset + if isinstance(_completed_at, Unset): + completed_at = UNSET + else: + completed_at = datetime.datetime.fromisoformat(_completed_at) + + + + + autofix_run = cls( + id=id, + project_id=project_id, + issue_id=issue_id, + trigger=trigger, + status=status, + max_stage=max_stage, + provider=provider, + model=model, + usage=usage, + created_at=created_at, + stage_reached=stage_reached, + diagnosis=diagnosis, + patch=patch, + pull_request=pull_request, + pull_request_skipped=pull_request_skipped, + commit_sha=commit_sha, + failure_code=failure_code, + failure_message=failure_message, + started_at=started_at, + completed_at=completed_at, + ) + + return autofix_run + diff --git a/src/volcano_sdk/_generated/models/autofix_run_status.py b/src/volcano_sdk/_generated/models/autofix_run_status.py new file mode 100644 index 00000000..e74d65c8 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_run_status.py @@ -0,0 +1,10 @@ +from typing import Literal + +AutofixRunStatus = Literal['canceled', 'failed', 'queued', 'running', 'succeeded'] + +AUTOFIX_RUN_STATUS_VALUES: set[AutofixRunStatus] = { 'canceled', 'failed', 'queued', 'running', 'succeeded', } + +def check_autofix_run_status(value: str) -> AutofixRunStatus: + if value in AUTOFIX_RUN_STATUS_VALUES: + return value + raise TypeError(f"Unexpected value {value!r}. Expected one of {AUTOFIX_RUN_STATUS_VALUES!r}") diff --git a/src/volcano_sdk/_generated/models/autofix_run_trigger.py b/src/volcano_sdk/_generated/models/autofix_run_trigger.py new file mode 100644 index 00000000..c4a8be9f --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_run_trigger.py @@ -0,0 +1,10 @@ +from typing import Literal + +AutofixRunTrigger = Literal['manual', 'new_issue', 'regression'] + +AUTOFIX_RUN_TRIGGER_VALUES: set[AutofixRunTrigger] = { 'manual', 'new_issue', 'regression', } + +def check_autofix_run_trigger(value: str) -> AutofixRunTrigger: + if value in AUTOFIX_RUN_TRIGGER_VALUES: + return value + raise TypeError(f"Unexpected value {value!r}. Expected one of {AUTOFIX_RUN_TRIGGER_VALUES!r}") diff --git a/src/volcano_sdk/_generated/models/autofix_run_usage.py b/src/volcano_sdk/_generated/models/autofix_run_usage.py new file mode 100644 index 00000000..a93a2e78 --- /dev/null +++ b/src/volcano_sdk/_generated/models/autofix_run_usage.py @@ -0,0 +1,83 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + + + + + + + +T = TypeVar("T", bound="AutofixRunUsage") + + + +@_attrs_define +class AutofixRunUsage: + """ Model tokens the run used across every attempt. + + Attributes: + input_tokens (int): + output_tokens (int): + cache_read_input_tokens (int): + cache_creation_input_tokens (int): + """ + + input_tokens: int + output_tokens: int + cache_read_input_tokens: int + cache_creation_input_tokens: int + + + + + + def to_dict(self) -> dict[str, Any]: + input_tokens = self.input_tokens + + output_tokens = self.output_tokens + + cache_read_input_tokens = self.cache_read_input_tokens + + cache_creation_input_tokens = self.cache_creation_input_tokens + + + field_dict: dict[str, Any] = {} + + field_dict.update({ + "input_tokens": input_tokens, + "output_tokens": output_tokens, + "cache_read_input_tokens": cache_read_input_tokens, + "cache_creation_input_tokens": cache_creation_input_tokens, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + input_tokens = d.pop("input_tokens") + + output_tokens = d.pop("output_tokens") + + cache_read_input_tokens = d.pop("cache_read_input_tokens") + + cache_creation_input_tokens = d.pop("cache_creation_input_tokens") + + autofix_run_usage = cls( + input_tokens=input_tokens, + output_tokens=output_tokens, + cache_read_input_tokens=cache_read_input_tokens, + cache_creation_input_tokens=cache_creation_input_tokens, + ) + + return autofix_run_usage + diff --git a/src/volcano_sdk/_generated/models/create_service_key_body.py b/src/volcano_sdk/_generated/models/create_service_key_body.py index f4ce6430..875d490a 100644 --- a/src/volcano_sdk/_generated/models/create_service_key_body.py +++ b/src/volcano_sdk/_generated/models/create_service_key_body.py @@ -32,7 +32,9 @@ class CreateServiceKeyBody: for backward compatibility. Provide an explicit list (e.g. ["functions.invoke", "locks.manage"]) to restrict the key; "*" grants everything. Scope enforcement applies to function invocation, - storage object operations, and project locks. + storage object operations, project locks, and server-side auth proxy + metadata (auth.signin, auth.signup, auth.refresh, auth.logout, + auth.password_reset). Example: ['functions.invoke', 'locks.manage']. """ diff --git a/src/volcano_sdk/_generated/models/function_invocation_request.py b/src/volcano_sdk/_generated/models/function_invocation_request.py index 6bc4909b..2853a9af 100644 --- a/src/volcano_sdk/_generated/models/function_invocation_request.py +++ b/src/volcano_sdk/_generated/models/function_invocation_request.py @@ -40,6 +40,9 @@ class FunctionInvocationRequest: } } ``` + + The top-level `__volcano_auth` and `__volcano_http` keys are reserved; + Volcano removes caller-supplied values for both. """ payload: FunctionInvocationRequestPayload | Unset = UNSET diff --git a/src/volcano_sdk/_generated/models/function_invocation_request_payload.py b/src/volcano_sdk/_generated/models/function_invocation_request_payload.py index f9422124..7457d0fd 100644 --- a/src/volcano_sdk/_generated/models/function_invocation_request_payload.py +++ b/src/volcano_sdk/_generated/models/function_invocation_request_payload.py @@ -35,6 +35,9 @@ class FunctionInvocationRequestPayload: } ``` + The top-level `__volcano_auth` and `__volcano_http` keys are reserved; + Volcano removes caller-supplied values for both. + """ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/src/volcano_sdk/_generated/models/paginated_autofix_runs.py b/src/volcano_sdk/_generated/models/paginated_autofix_runs.py new file mode 100644 index 00000000..a61325e1 --- /dev/null +++ b/src/volcano_sdk/_generated/models/paginated_autofix_runs.py @@ -0,0 +1,120 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from ..types import UNSET, Unset +from typing import cast + +if TYPE_CHECKING: + from ..models.autofix_run import AutofixRun + + + + + +T = TypeVar("T", bound="PaginatedAutofixRuns") + + + +@_attrs_define +class PaginatedAutofixRuns: + """ + Attributes: + data (list[AutofixRun]): + limit (int): Number of items per page + has_more (bool): Whether a next page exists + next_cursor (str | Unset): Opaque cursor for the next page (present if has_more is true) + """ + + data: list[AutofixRun] + limit: int + has_more: bool + next_cursor: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + + + + + def to_dict(self) -> dict[str, Any]: + from ..models.autofix_run import AutofixRun # noqa: PLC0415 + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + + + limit = self.limit + + has_more = self.has_more + + next_cursor = self.next_cursor + + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({ + "data": data, + "limit": limit, + "has_more": has_more, + }) + if next_cursor is not UNSET: + field_dict["next_cursor"] = next_cursor + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.autofix_run import AutofixRun # noqa: PLC0415 + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in (_data): + data_item = AutofixRun.from_dict(data_item_data) + + + + data.append(data_item) + + + limit = d.pop("limit") + + has_more = d.pop("has_more") + + next_cursor = d.pop("next_cursor", UNSET) + + paginated_autofix_runs = cls( + data=data, + limit=limit, + has_more=has_more, + next_cursor=next_cursor, + ) + + + paginated_autofix_runs.additional_properties = d + return paginated_autofix_runs + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/volcano_sdk/_generated/models/project_health_check.py b/src/volcano_sdk/_generated/models/project_health_check.py index 00998a52..f6046fb6 100644 --- a/src/volcano_sdk/_generated/models/project_health_check.py +++ b/src/volcano_sdk/_generated/models/project_health_check.py @@ -32,7 +32,12 @@ class ProjectHealthCheck: Attributes: id (str): category (ProjectHealthCategory): - status (ProjectHealthStatus): + status (ProjectHealthStatus): empty means no functions, frontends, databases, storage, Volcano Auth users, or + Sandbox resources are listed. needs_attention means an operation needs review without confirmed service + impairment, or a serving frontend whose edge recovery gave up needs a redeploy. degraded means a resource is + only partly available or is unavailable for an expected, temporary reason, such as a frontend whose edge + synchronization did not complete or a database being restored; critical means use is blocked. A failed workflow + or deployment record alone does not establish an outage. Findings remain available for empty projects. reason_code (str): scope (ProjectHealthScope): evidence (ProjectHealthEvidence): diff --git a/src/volcano_sdk/_generated/models/project_health_resource_type.py b/src/volcano_sdk/_generated/models/project_health_resource_type.py index 89cf9f74..f925e539 100644 --- a/src/volcano_sdk/_generated/models/project_health_resource_type.py +++ b/src/volcano_sdk/_generated/models/project_health_resource_type.py @@ -1,8 +1,8 @@ from typing import Literal -ProjectHealthResourceType = Literal['database', 'frontend', 'function', 'project'] +ProjectHealthResourceType = Literal['database', 'database_branch', 'frontend', 'function', 'project'] -PROJECT_HEALTH_RESOURCE_TYPE_VALUES: set[ProjectHealthResourceType] = { 'database', 'frontend', 'function', 'project', } +PROJECT_HEALTH_RESOURCE_TYPE_VALUES: set[ProjectHealthResourceType] = { 'database', 'database_branch', 'frontend', 'function', 'project', } def check_project_health_resource_type(value: str) -> ProjectHealthResourceType: if value in PROJECT_HEALTH_RESOURCE_TYPE_VALUES: diff --git a/src/volcano_sdk/_generated/models/project_health_response.py b/src/volcano_sdk/_generated/models/project_health_response.py index 6887d281..e156ee10 100644 --- a/src/volcano_sdk/_generated/models/project_health_response.py +++ b/src/volcano_sdk/_generated/models/project_health_response.py @@ -32,7 +32,12 @@ class ProjectHealthResponse: """ Attributes: project_id (UUID): - status (ProjectHealthStatus): + status (ProjectHealthStatus): empty means no functions, frontends, databases, storage, Volcano Auth users, or + Sandbox resources are listed. needs_attention means an operation needs review without confirmed service + impairment, or a serving frontend whose edge recovery gave up needs a redeploy. degraded means a resource is + only partly available or is unavailable for an expected, temporary reason, such as a frontend whose edge + synchronization did not complete or a database being restored; critical means use is blocked. A failed workflow + or deployment record alone does not establish an outage. Findings remain available for empty projects. observed_at (datetime.datetime): fresh_through (datetime.datetime): data_status (ProjectHealthDataStatus): diff --git a/src/volcano_sdk/_generated/models/project_health_status.py b/src/volcano_sdk/_generated/models/project_health_status.py index c299dfb9..4d4ff43f 100644 --- a/src/volcano_sdk/_generated/models/project_health_status.py +++ b/src/volcano_sdk/_generated/models/project_health_status.py @@ -1,8 +1,8 @@ from typing import Literal -ProjectHealthStatus = Literal['critical', 'degraded', 'healthy', 'unknown'] +ProjectHealthStatus = Literal['critical', 'degraded', 'empty', 'healthy', 'needs_attention', 'unknown'] -PROJECT_HEALTH_STATUS_VALUES: set[ProjectHealthStatus] = { 'critical', 'degraded', 'healthy', 'unknown', } +PROJECT_HEALTH_STATUS_VALUES: set[ProjectHealthStatus] = { 'critical', 'degraded', 'empty', 'healthy', 'needs_attention', 'unknown', } def check_project_health_status(value: str) -> ProjectHealthStatus: if value in PROJECT_HEALTH_STATUS_VALUES: diff --git a/src/volcano_sdk/_generated/models/project_health_summary.py b/src/volcano_sdk/_generated/models/project_health_summary.py index 804a732f..1553141c 100644 --- a/src/volcano_sdk/_generated/models/project_health_summary.py +++ b/src/volcano_sdk/_generated/models/project_health_summary.py @@ -25,7 +25,12 @@ class ProjectHealthSummary: """ Attributes: - status (ProjectHealthStatus): + status (ProjectHealthStatus): empty means no functions, frontends, databases, storage, Volcano Auth users, or + Sandbox resources are listed. needs_attention means an operation needs review without confirmed service + impairment, or a serving frontend whose edge recovery gave up needs a redeploy. degraded means a resource is + only partly available or is unavailable for an expected, temporary reason, such as a frontend whose edge + synchronization did not complete or a database being restored; critical means use is blocked. A failed workflow + or deployment record alone does not establish an outage. Findings remain available for empty projects. """ status: ProjectHealthStatus