diff --git a/api/openapispec/docs.go b/api/openapispec/docs.go index bd4c8e8..d5fe706 100644 --- a/api/openapispec/docs.go +++ b/api/openapispec/docs.go @@ -3038,6 +3038,113 @@ const docTemplate = `{ } }, "/api/v1/stacks/{stackID}/preview": { + "post": { + "description": "Preview stack information by stack ID", + "produces": [ + "application/json" + ], + "tags": [ + "stack" + ], + "summary": "Preview stack", + "operationId": "previewStack", + "parameters": [ + { + "type": "integer", + "description": "Stack ID", + "name": "stackID", + "in": "path", + "required": true + }, + { + "description": "The resources to import during the stack preview", + "name": "importedResources", + "in": "body", + "schema": { + "$ref": "#/definitions/request.StackImportRequest" + } + }, + { + "type": "string", + "description": "The target workspace to preview the spec in.", + "name": "workspace", + "in": "query", + "required": true + }, + { + "type": "boolean", + "description": "Import existing resources during the stack preview", + "name": "importResources", + "in": "query" + }, + { + "type": "string", + "description": "Output format. Choices are: json, default. Default to default output format in Kusion.", + "name": "output", + "in": "query" + }, + { + "type": "boolean", + "description": "Show detailed output", + "name": "detail", + "in": "query" + }, + { + "type": "string", + "description": "The Spec ID to use for the preview. Default to the last one generated.", + "name": "specID", + "in": "query" + }, + { + "type": "boolean", + "description": "Force the preview even when the stack is locked", + "name": "force", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/handler.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.Changes" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": {} + }, + "401": { + "description": "Unauthorized", + "schema": {} + }, + "404": { + "description": "Not Found", + "schema": {} + }, + "429": { + "description": "Too Many Requests", + "schema": {} + }, + "500": { + "description": "Internal Server Error", + "schema": {} + } + } + } + }, + "/api/v1/stacks/{stackID}/preview/async": { "post": { "description": "Start a run and asynchronously preview stack changes by stack ID", "produces": [ diff --git a/api/openapispec/swagger.json b/api/openapispec/swagger.json index 3ee77eb..bcacf91 100644 --- a/api/openapispec/swagger.json +++ b/api/openapispec/swagger.json @@ -3027,6 +3027,113 @@ } }, "/api/v1/stacks/{stackID}/preview": { + "post": { + "description": "Preview stack information by stack ID", + "produces": [ + "application/json" + ], + "tags": [ + "stack" + ], + "summary": "Preview stack", + "operationId": "previewStack", + "parameters": [ + { + "type": "integer", + "description": "Stack ID", + "name": "stackID", + "in": "path", + "required": true + }, + { + "description": "The resources to import during the stack preview", + "name": "importedResources", + "in": "body", + "schema": { + "$ref": "#/definitions/request.StackImportRequest" + } + }, + { + "type": "string", + "description": "The target workspace to preview the spec in.", + "name": "workspace", + "in": "query", + "required": true + }, + { + "type": "boolean", + "description": "Import existing resources during the stack preview", + "name": "importResources", + "in": "query" + }, + { + "type": "string", + "description": "Output format. Choices are: json, default. Default to default output format in Kusion.", + "name": "output", + "in": "query" + }, + { + "type": "boolean", + "description": "Show detailed output", + "name": "detail", + "in": "query" + }, + { + "type": "string", + "description": "The Spec ID to use for the preview. Default to the last one generated.", + "name": "specID", + "in": "query" + }, + { + "type": "boolean", + "description": "Force the preview even when the stack is locked", + "name": "force", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/handler.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.Changes" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": {} + }, + "401": { + "description": "Unauthorized", + "schema": {} + }, + "404": { + "description": "Not Found", + "schema": {} + }, + "429": { + "description": "Too Many Requests", + "schema": {} + }, + "500": { + "description": "Internal Server Error", + "schema": {} + } + } + } + }, + "/api/v1/stacks/{stackID}/preview/async": { "post": { "description": "Start a run and asynchronously preview stack changes by stack ID", "produces": [ diff --git a/api/openapispec/swagger.yaml b/api/openapispec/swagger.yaml index 9247f9b..6c9bedc 100644 --- a/api/openapispec/swagger.yaml +++ b/api/openapispec/swagger.yaml @@ -3394,6 +3394,77 @@ paths: tags: - stack /api/v1/stacks/{stackID}/preview: + post: + description: Preview stack information by stack ID + operationId: previewStack + parameters: + - description: Stack ID + in: path + name: stackID + required: true + type: integer + - description: The resources to import during the stack preview + in: body + name: importedResources + schema: + $ref: '#/definitions/request.StackImportRequest' + - description: The target workspace to preview the spec in. + in: query + name: workspace + required: true + type: string + - description: Import existing resources during the stack preview + in: query + name: importResources + type: boolean + - description: 'Output format. Choices are: json, default. Default to default + output format in Kusion.' + in: query + name: output + type: string + - description: Show detailed output + in: query + name: detail + type: boolean + - description: The Spec ID to use for the preview. Default to the last one generated. + in: query + name: specID + type: string + - description: Force the preview even when the stack is locked + in: query + name: force + type: boolean + produces: + - application/json + responses: + "200": + description: Success + schema: + allOf: + - $ref: '#/definitions/handler.Response' + - properties: + data: + $ref: '#/definitions/models.Changes' + type: object + "400": + description: Bad Request + schema: {} + "401": + description: Unauthorized + schema: {} + "404": + description: Not Found + schema: {} + "429": + description: Too Many Requests + schema: {} + "500": + description: Internal Server Error + schema: {} + summary: Preview stack + tags: + - stack + /api/v1/stacks/{stackID}/preview/async: post: description: Start a run and asynchronously preview stack changes by stack ID operationId: previewStackAsync diff --git a/package.json b/package.json index 19efb7a..430f503 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kusionstack/kusion-api-client-sdk", - "version": "1.1.3", + "version": "1.1.4", "description": "Kusion API Client SDK", "main": "dist/src/client/index.js", "types": "dist/src/client/index.d.ts", diff --git a/src/client/sdk.gen.ts b/src/client/sdk.gen.ts index c1240c7..0d08f34 100644 --- a/src/client/sdk.gen.ts +++ b/src/client/sdk.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch'; -import type { ListBackendData, ListBackendError, ListBackendResponse, CreateBackendData, CreateBackendError, CreateBackendResponse, DeleteBackendData, DeleteBackendError, DeleteBackendResponse, GetBackendData, GetBackendError, GetBackendResponse, UpdateBackendData, UpdateBackendError, UpdateBackendResponse, GetEndpointsError, GetEndpointsResponse, ListModuleData, ListModuleError, ListModuleResponse, CreateModuleData, CreateModuleError, CreateModuleResponse, DeleteModuleData, DeleteModuleError, DeleteModuleResponse, GetModuleData, GetModuleError, GetModuleResponse, UpdateModuleData, UpdateModuleError, UpdateModuleResponse, ListOrganizationData, ListOrganizationError, ListOrganizationResponse, CreateOrganizationData, CreateOrganizationError, CreateOrganizationResponse, DeleteOrganizationData, DeleteOrganizationError, DeleteOrganizationResponse, GetOrganizationData, GetOrganizationError, GetOrganizationResponse, UpdateOrganizationData, UpdateOrganizationError, UpdateOrganizationResponse, ListProjectData, ListProjectError, ListProjectResponse, CreateProjectData, CreateProjectError, CreateProjectResponse, DeleteProjectData, DeleteProjectError, DeleteProjectResponse, GetProjectData, GetProjectError, GetProjectResponse, UpdateProjectData, UpdateProjectError, UpdateProjectResponse, ListResourceData, ListResourceError, ListResourceResponse, GetResourceData, GetResourceError, GetResourceResponse, GetResourceGraphData, GetResourceGraphError, GetResourceGraphResponse, GetRunData, GetRunError, GetRunResponse, GetRunResultData, GetRunResultError, GetRunResultResponse, ListSourceData, ListSourceError, ListSourceResponse, CreateSourceData, CreateSourceError, CreateSourceResponse, DeleteSourceData, DeleteSourceError, DeleteSourceResponse, GetSourceData, GetSourceError, GetSourceResponse, UpdateSourceData, UpdateSourceError, UpdateSourceResponse, ListRunData, ListRunError, ListRunResponse, ListStackData, ListStackError, ListStackResponse, CreateStackData, CreateStackError, CreateStackResponse, DeleteStackData, DeleteStackError, DeleteStackResponse, GetStackData, GetStackError, GetStackResponse, UpdateStackData, UpdateStackError, UpdateStackResponse, ApplyStackData, ApplyStackError, ApplyStackResponse, ApplyStackAsyncData, ApplyStackAsyncError, ApplyStackAsyncResponse, DestroyStackData, DestroyStackError, DestroyStackResponse, DestroyStackAsyncData, DestroyStackAsyncError, DestroyStackAsyncResponse, GenerateStackData, GenerateStackError, GenerateStackResponse, GenerateStackAsyncData, GenerateStackAsyncError, GenerateStackAsyncResponse, PreviewStackAsyncData, PreviewStackAsyncError, PreviewStackAsyncResponse, ListWorkspaceData, ListWorkspaceError, ListWorkspaceResponse, CreateWorkspaceData, CreateWorkspaceError, CreateWorkspaceResponse, DeleteWorkspaceData, DeleteWorkspaceError, DeleteWorkspaceResponse, GetWorkspaceData, GetWorkspaceError, GetWorkspaceResponse, UpdateWorkspaceData, UpdateWorkspaceError, UpdateWorkspaceResponse, GetWorkspaceConfigsData, GetWorkspaceConfigsError, GetWorkspaceConfigsResponse, UpdateWorkspaceConfigsData, UpdateWorkspaceConfigsError, UpdateWorkspaceConfigsResponse, CreateWorkspaceModDepsData, CreateWorkspaceModDepsError, CreateWorkspaceModDepsResponse, ValidateWorkspaceConfigsData, ValidateWorkspaceConfigsError, ValidateWorkspaceConfigsResponse } from './types.gen'; +import type { ListBackendData, ListBackendError, ListBackendResponse, CreateBackendData, CreateBackendError, CreateBackendResponse, DeleteBackendData, DeleteBackendError, DeleteBackendResponse, GetBackendData, GetBackendError, GetBackendResponse, UpdateBackendData, UpdateBackendError, UpdateBackendResponse, GetEndpointsError, GetEndpointsResponse, ListModuleData, ListModuleError, ListModuleResponse, CreateModuleData, CreateModuleError, CreateModuleResponse, DeleteModuleData, DeleteModuleError, DeleteModuleResponse, GetModuleData, GetModuleError, GetModuleResponse, UpdateModuleData, UpdateModuleError, UpdateModuleResponse, ListOrganizationData, ListOrganizationError, ListOrganizationResponse, CreateOrganizationData, CreateOrganizationError, CreateOrganizationResponse, DeleteOrganizationData, DeleteOrganizationError, DeleteOrganizationResponse, GetOrganizationData, GetOrganizationError, GetOrganizationResponse, UpdateOrganizationData, UpdateOrganizationError, UpdateOrganizationResponse, ListProjectData, ListProjectError, ListProjectResponse, CreateProjectData, CreateProjectError, CreateProjectResponse, DeleteProjectData, DeleteProjectError, DeleteProjectResponse, GetProjectData, GetProjectError, GetProjectResponse, UpdateProjectData, UpdateProjectError, UpdateProjectResponse, ListResourceData, ListResourceError, ListResourceResponse, GetResourceData, GetResourceError, GetResourceResponse, GetResourceGraphData, GetResourceGraphError, GetResourceGraphResponse, GetRunData, GetRunError, GetRunResponse, GetRunResultData, GetRunResultError, GetRunResultResponse, ListSourceData, ListSourceError, ListSourceResponse, CreateSourceData, CreateSourceError, CreateSourceResponse, DeleteSourceData, DeleteSourceError, DeleteSourceResponse, GetSourceData, GetSourceError, GetSourceResponse, UpdateSourceData, UpdateSourceError, UpdateSourceResponse, ListRunData, ListRunError, ListRunResponse, ListStackData, ListStackError, ListStackResponse, CreateStackData, CreateStackError, CreateStackResponse, DeleteStackData, DeleteStackError, DeleteStackResponse, GetStackData, GetStackError, GetStackResponse, UpdateStackData, UpdateStackError, UpdateStackResponse, ApplyStackData, ApplyStackError, ApplyStackResponse, ApplyStackAsyncData, ApplyStackAsyncError, ApplyStackAsyncResponse, DestroyStackData, DestroyStackError, DestroyStackResponse, DestroyStackAsyncData, DestroyStackAsyncError, DestroyStackAsyncResponse, GenerateStackData, GenerateStackError, GenerateStackResponse, GenerateStackAsyncData, GenerateStackAsyncError, GenerateStackAsyncResponse, PreviewStackData, PreviewStackError, PreviewStackResponse, PreviewStackAsyncData, PreviewStackAsyncError, PreviewStackAsyncResponse, ListWorkspaceData, ListWorkspaceError, ListWorkspaceResponse, CreateWorkspaceData, CreateWorkspaceError, CreateWorkspaceResponse, DeleteWorkspaceData, DeleteWorkspaceError, DeleteWorkspaceResponse, GetWorkspaceData, GetWorkspaceError, GetWorkspaceResponse, UpdateWorkspaceData, UpdateWorkspaceError, UpdateWorkspaceResponse, GetWorkspaceConfigsData, GetWorkspaceConfigsError, GetWorkspaceConfigsResponse, UpdateWorkspaceConfigsData, UpdateWorkspaceConfigsError, UpdateWorkspaceConfigsResponse, CreateWorkspaceModDepsData, CreateWorkspaceModDepsError, CreateWorkspaceModDepsResponse, ValidateWorkspaceConfigsData, ValidateWorkspaceConfigsError, ValidateWorkspaceConfigsResponse } from './types.gen'; export const client = createClient(createConfig()); @@ -503,6 +503,17 @@ export class StackService { }); } + /** + * Preview stack + * Preview stack information by stack ID + */ + public static previewStack(options: OptionsLegacyParser) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v1/stacks/{stackID}/preview' + }); + } + /** * Asynchronously preview stack * Start a run and asynchronously preview stack changes by stack ID @@ -510,7 +521,7 @@ export class StackService { public static previewStackAsync(options: OptionsLegacyParser) { return (options?.client ?? client).post({ ...options, - url: '/api/v1/stacks/{stackID}/preview' + url: '/api/v1/stacks/{stackID}/preview/async' }); } diff --git a/src/client/types.gen.ts b/src/client/types.gen.ts index aca1c00..dbddf34 100644 --- a/src/client/types.gen.ts +++ b/src/client/types.gen.ts @@ -2228,6 +2228,51 @@ export type GenerateStackAsyncResponse = ((handler_Response & { export type GenerateStackAsyncError = (unknown); +export type PreviewStackData = { + /** + * The resources to import during the stack preview + */ + body?: request_StackImportRequest; + path: { + /** + * Stack ID + */ + stackID: number; + }; + query: { + /** + * Show detailed output + */ + detail?: boolean; + /** + * Force the preview even when the stack is locked + */ + force?: boolean; + /** + * Import existing resources during the stack preview + */ + importResources?: boolean; + /** + * Output format. Choices are: json, default. Default to default output format in Kusion. + */ + output?: string; + /** + * The Spec ID to use for the preview. Default to the last one generated. + */ + specID?: string; + /** + * The target workspace to preview the spec in. + */ + workspace: string; + }; +}; + +export type PreviewStackResponse = ((handler_Response & { + data?: models_Changes; +})); + +export type PreviewStackError = (unknown); + export type PreviewStackAsyncData = { /** * The resources to import during the stack preview