diff --git a/cmd/stackpack.go b/cmd/stackpack.go index 0f7fc83f..4dd582f5 100644 --- a/cmd/stackpack.go +++ b/cmd/stackpack.go @@ -33,6 +33,7 @@ func StackPackCommand(cli *di.Deps) *cobra.Command { cmd.AddCommand(stackpack.StackpackScaffoldCommand(cli)) cmd.AddCommand(stackpack.StackpackPackageCommand(cli)) cmd.AddCommand(stackpack.StackpackTestDeployCommand(cli)) + cmd.AddCommand(stackpack.StackpackValidateCommand(cli)) } return cmd diff --git a/cmd/stackpack/stackpack_validate.go b/cmd/stackpack/stackpack_validate.go new file mode 100644 index 00000000..82746d0f --- /dev/null +++ b/cmd/stackpack/stackpack_validate.go @@ -0,0 +1,177 @@ +package stackpack + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/internal/common" + "github.com/stackvista/stackstate-cli/internal/di" +) + +// ValidateArgs contains arguments for stackpack validate command +type ValidateArgs struct { + Name string + StackpackDir string + StackpackFile string + DockerImage string + + dockerRunner func([]string) error +} + +// StackpackValidateCommand creates the validate subcommand +func StackpackValidateCommand(cli *di.Deps) *cobra.Command { + return stackpackValidateCommandWithArgs(cli, &ValidateArgs{}) +} + +// stackpackValidateCommandWithArgs creates the validate command with injected args (for testing) +func stackpackValidateCommandWithArgs(cli *di.Deps, args *ValidateArgs) *cobra.Command { + cmd := &cobra.Command{ + Use: "validate", + Short: "Validate a stackpack", + Long: `Validate a stackpack using either the API or Docker mode. + +In API mode (when a configured backend context is active), this command calls POST /stackpack/{name}/validate +against the live instance. + +In Docker mode (when --image is specified), it spins up quay.io/stackstate/stackstate-server: +with stack-pack-validator as the entrypoint. + +This command is experimental and requires STS_EXPERIMENTAL_STACKPACK environment variable to be set.`, + Example: `# Validate using API +sts stackpack validate --name my-stackpack + +# Validate using Docker with a directory +sts stackpack validate --image quay.io/stackstate/stackstate-server:latest --stackpack-directory ./my-stackpack + +# Validate using Docker with a file +sts stackpack validate --image quay.io/stackstate/stackstate-server:latest --stackpack-file ./my-stackpack.sts`, + RunE: cli.CmdRunE(RunStackpackValidateCommand(args)), + } + + cmd.Flags().StringVarP(&args.Name, "name", "n", "", "Stackpack name (required for API mode)") + cmd.Flags().StringVarP(&args.StackpackDir, "stackpack-directory", "d", "", "Path to stackpack directory (Docker mode)") + cmd.Flags().StringVarP(&args.StackpackFile, "stackpack-file", "f", "", "Path to .sts file (Docker mode)") + cmd.Flags().StringVar(&args.DockerImage, "image", "", "Docker image reference (triggers Docker mode)") + + // Set default docker runner if not already set + if args.dockerRunner == nil { + args.dockerRunner = defaultDockerRunner + } + + return cmd +} + +// RunStackpackValidateCommand executes the validate command +func RunStackpackValidateCommand(args *ValidateArgs) func(cli *di.Deps, cmd *cobra.Command) common.CLIError { + return func(cli *di.Deps, cmd *cobra.Command) common.CLIError { + // Determine mode: use Docker if image is provided, otherwise check if context is available + useDocker := args.DockerImage != "" + if !useDocker { + // Try to load context if not already loaded + if cli.CurrentContext == nil { + _ = cli.LoadContext(cmd) // Silently ignore error, context is optional + } + // Use docker mode if no context or no URL + useDocker = cli.CurrentContext == nil || cli.CurrentContext.URL == "" + } + + if useDocker { + return runDockerValidation(args) + } + return runAPIValidation(cli, cmd, args) + } +} + +// runAPIValidation validates stackpack via API +func runAPIValidation(cli *di.Deps, cmd *cobra.Command, args *ValidateArgs) common.CLIError { + if args.Name == "" { + return common.NewCLIArgParseError(fmt.Errorf("stackpack name is required (use --name)")) + } + + // Ensure client is loaded + if cli.Client == nil { + err := cli.LoadClient(cmd, cli.CurrentContext) + if err != nil { + return err + } + } + + // Connect to API + api, _, connectErr := cli.Client.Connect() + if connectErr != nil { + return common.NewRuntimeError(fmt.Errorf("failed to connect to API: %w", connectErr)) + } + + // Call validate endpoint + _, resp, validateErr := api.StackpackApi.ValidateStackPack(cli.Context, args.Name).Execute() + if validateErr != nil { + return common.NewResponseError(validateErr, resp) + } + + if cli.IsJson() { + cli.Printer.PrintJson(map[string]interface{}{ + "success": true, + }) + } else { + cli.Printer.Success("Stackpack validation successful!") + } + + return nil +} + +// runDockerValidation validates stackpack via Docker +func runDockerValidation(args *ValidateArgs) common.CLIError { + // Validate required flags + if args.DockerImage == "" { + return common.NewCLIArgParseError(fmt.Errorf("--image is required for Docker mode")) + } + + // Validate exactly one of directory or file is set + if (args.StackpackDir == "" && args.StackpackFile == "") || + (args.StackpackDir != "" && args.StackpackFile != "") { + return common.NewCLIArgParseError(fmt.Errorf("exactly one of --stackpack-directory or --stackpack-file must be specified")) + } + + // Check docker is available + if _, err := exec.LookPath("docker"); err != nil { + return common.NewRuntimeError(fmt.Errorf("docker is not available: %w", err)) + } + + // Build docker command arguments + dockerArgs := []string{"run", "--rm", "--entrypoint", "/opt/docker/bin/stack-pack-validator"} + + if args.StackpackDir != "" { + // Convert to absolute path + absDir, err := filepath.Abs(args.StackpackDir) + if err != nil { + return common.NewRuntimeError(fmt.Errorf("failed to resolve stackpack directory: %w", err)) + } + dockerArgs = append(dockerArgs, "-v", fmt.Sprintf("%s:/stackpack", absDir), args.DockerImage, "-directory", "/stackpack") + } else { + // Convert to absolute path + absFile, err := filepath.Abs(args.StackpackFile) + if err != nil { + return common.NewRuntimeError(fmt.Errorf("failed to resolve stackpack file: %w", err)) + } + dockerArgs = append(dockerArgs, "-v", fmt.Sprintf("%s:/stackpack.sts", absFile), args.DockerImage, "-file", "/stackpack.sts") + } + + // Execute docker command + if err := args.dockerRunner(dockerArgs); err != nil { + return common.NewRuntimeError(fmt.Errorf("docker validation failed: %w", err)) + } + + return nil +} + +// defaultDockerRunner executes docker command with streaming output +func defaultDockerRunner(dockerArgs []string) error { + cmd := exec.CommandContext(context.Background(), "docker", dockerArgs...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + return cmd.Run() +} diff --git a/cmd/stackpack/stackpack_validate_test.go b/cmd/stackpack/stackpack_validate_test.go new file mode 100644 index 00000000..7e9b6c1c --- /dev/null +++ b/cmd/stackpack/stackpack_validate_test.go @@ -0,0 +1,237 @@ +package stackpack + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/internal/config" + "github.com/stackvista/stackstate-cli/internal/di" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// setupValidateCmd creates a test command with API mode context (URL set) +func setupValidateCmd(t *testing.T) (*di.MockDeps, *cobra.Command) { + cli := di.NewMockDeps(t) + cli.CurrentContext = &config.StsContext{ + URL: "https://test-server.example.com", + } + cmd := StackpackValidateCommand(&cli.Deps) + return &cli, cmd +} + +// setupValidateCmdWithMockDocker creates a test command with Docker mode (no URL) and captures docker args +func setupValidateCmdWithMockDocker(t *testing.T) (*di.MockDeps, *cobra.Command, *[][]string) { + cli := di.NewMockDeps(t) + cli.CurrentContext = &config.StsContext{ + URL: "", // No URL = docker mode + } + args := &ValidateArgs{} + dockerArgsCaptured := [][]string{} + + args.dockerRunner = func(dockerArgs []string) error { + dockerArgsCaptured = append(dockerArgsCaptured, dockerArgs) + return nil + } + + cmd := stackpackValidateCommandWithArgs(&cli.Deps, args) + return &cli, cmd, &dockerArgsCaptured +} + +// createTestStackpackDir creates a minimal stackpack directory with stackpack.yaml +func createTestStackpackDir(t *testing.T, dir string, name string, version string) { + require.NoError(t, os.MkdirAll(filepath.Join(dir, "settings"), 0755)) + require.NoError(t, os.MkdirAll(filepath.Join(dir, "resources"), 0755)) + + stackpackConf := fmt.Sprintf(`name: "%s" +version: "%s" +`, name, version) + require.NoError(t, os.WriteFile(filepath.Join(dir, "stackpack.yaml"), []byte(stackpackConf), 0644)) +} + +// ===== API Mode Tests ===== + +func TestValidate_APIMode_ByName(t *testing.T) { + cli, cmd := setupValidateCmd(t) + + _, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--name", "my-stackpack") + require.NoError(t, err) + + // Verify success message + require.NotEmpty(t, *cli.MockPrinter.SuccessCalls) + successCall := (*cli.MockPrinter.SuccessCalls)[0] + assert.Contains(t, successCall, "validation successful") +} + +func TestValidate_APIMode_RequiresName(t *testing.T) { + cli, cmd := setupValidateCmd(t) + + tempDir, err := os.MkdirTemp("", "stackpack-validate-test-*") + require.NoError(t, err) + defer os.RemoveAll(tempDir) + + stackpackDir := filepath.Join(tempDir, "test-stackpack") + require.NoError(t, os.MkdirAll(stackpackDir, 0755)) + createTestStackpackDir(t, stackpackDir, "test-stackpack", "1.0.0") + + // API mode requires --name flag, not --stackpack-directory + _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, "--stackpack-directory", stackpackDir) + require.Error(t, err) + assert.Contains(t, err.Error(), "name is required") +} + +func TestValidate_APIMode_JSONOutput(t *testing.T) { + cli, cmd := setupValidateCmd(t) + + _, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--name", "test-pack", "-o", "json") + require.NoError(t, err) + + // Verify JSON was called + require.Len(t, *cli.MockPrinter.PrintJsonCalls, 1) + jsonOutput := (*cli.MockPrinter.PrintJsonCalls)[0] + + assert.Equal(t, true, jsonOutput["success"]) +} + +func TestValidate_APIMode_MissingName(t *testing.T) { + cli, cmd := setupValidateCmd(t) + + _, err := di.ExecuteCommandWithContext(&cli.Deps, cmd) + require.Error(t, err) + assert.Contains(t, err.Error(), "name is required") +} + +// ===== Docker Mode Tests ===== + +func TestValidate_DockerMode_MissingImage(t *testing.T) { + cli, cmd, _ := setupValidateCmdWithMockDocker(t) + + tempDir, err := os.MkdirTemp("", "stackpack-validate-test-*") + require.NoError(t, err) + defer os.RemoveAll(tempDir) + + _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, "-d", tempDir) + require.Error(t, err) + assert.Contains(t, err.Error(), "--image is required") +} + +func TestValidate_DockerMode_MissingPath(t *testing.T) { + cli, cmd, _ := setupValidateCmdWithMockDocker(t) + + _, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--image", "quay.io/stackstate/stackstate-server:latest") + require.Error(t, err) + assert.Contains(t, err.Error(), "exactly one of") +} + +func TestValidate_DockerMode_MutuallyExclusive(t *testing.T) { + cli, cmd, _ := setupValidateCmdWithMockDocker(t) + + tempDir, err := os.MkdirTemp("", "stackpack-validate-test-*") + require.NoError(t, err) + defer os.RemoveAll(tempDir) + + stackpackDir := filepath.Join(tempDir, "stackpack") + require.NoError(t, os.MkdirAll(stackpackDir, 0755)) + + stackpackFile := filepath.Join(tempDir, "test.sts") + require.NoError(t, os.WriteFile(stackpackFile, []byte("test"), 0644)) + + _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, + "--image", "quay.io/stackstate/stackstate-server:latest", + "-d", stackpackDir, + "-f", stackpackFile) + require.Error(t, err) + assert.Contains(t, err.Error(), "exactly one of") +} + +func TestValidate_DockerMode_WithDirectory(t *testing.T) { + cli, cmd, capturedArgs := setupValidateCmdWithMockDocker(t) + + tempDir, err := os.MkdirTemp("", "stackpack-validate-test-*") + require.NoError(t, err) + defer os.RemoveAll(tempDir) + + stackpackDir := filepath.Join(tempDir, "test-stackpack") + require.NoError(t, os.MkdirAll(stackpackDir, 0755)) + + _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, + "--image", "quay.io/stackstate/stackstate-server:latest", + "-d", stackpackDir) + require.NoError(t, err) + + // Verify docker args were captured + require.Len(t, *capturedArgs, 1) + dockerArgs := (*capturedArgs)[0] + + // Check essential arguments + assert.Contains(t, dockerArgs, "run") + assert.Contains(t, dockerArgs, "--rm") + assert.Contains(t, dockerArgs, "--entrypoint") + assert.Contains(t, dockerArgs, "/opt/docker/bin/stack-pack-validator") + assert.Contains(t, dockerArgs, "quay.io/stackstate/stackstate-server:latest") + assert.Contains(t, dockerArgs, "-directory") + assert.Contains(t, dockerArgs, "/stackpack") + + // Verify -v flag is present with correct path + foundVolume := false + for i, arg := range dockerArgs { + if arg == "-v" && i+1 < len(dockerArgs) { + volumeArg := dockerArgs[i+1] + if volumeArg == stackpackDir+":/stackpack" { + foundVolume = true + break + } + } + } + assert.True(t, foundVolume, "Expected volume mount for stackpack directory") +} + +func TestValidate_DockerMode_WithFile(t *testing.T) { + cli, cmd, capturedArgs := setupValidateCmdWithMockDocker(t) + + tempDir, err := os.MkdirTemp("", "stackpack-validate-test-*") + require.NoError(t, err) + defer os.RemoveAll(tempDir) + + stackpackFile := filepath.Join(tempDir, "test.sts") + require.NoError(t, os.WriteFile(stackpackFile, []byte("test content"), 0644)) + + _, err = di.ExecuteCommandWithContext(&cli.Deps, cmd, + "--image", "quay.io/stackstate/stackstate-server:latest", + "-f", stackpackFile) + require.NoError(t, err) + + // Verify docker args were captured + require.Len(t, *capturedArgs, 1) + dockerArgs := (*capturedArgs)[0] + + // Check essential arguments + assert.Contains(t, dockerArgs, "run") + assert.Contains(t, dockerArgs, "--rm") + assert.Contains(t, dockerArgs, "--entrypoint") + assert.Contains(t, dockerArgs, "/opt/docker/bin/stack-pack-validator") + assert.Contains(t, dockerArgs, "quay.io/stackstate/stackstate-server:latest") + assert.Contains(t, dockerArgs, "-file") + assert.Contains(t, dockerArgs, "/stackpack.sts") + + // Verify -v flag is present with correct path + foundVolume := false + for i, arg := range dockerArgs { + if arg == "-v" && i+1 < len(dockerArgs) { + volumeArg := dockerArgs[i+1] + if volumeArg == stackpackFile+":/stackpack.sts" { + foundVolume = true + break + } + } + } + assert.True(t, foundVolume, "Expected volume mount for stackpack file") +} + +// ===== Mock Helper (using the real stackstate_api type) ===== + +// Note: We use the real stackstate_api.StackPackValidationSuccess type directly +// in tests via the mock API setup diff --git a/generated/stackstate_api/README.md b/generated/stackstate_api/README.md index 3c5dc9a7..cf1967cf 100644 --- a/generated/stackstate_api/README.md +++ b/generated/stackstate_api/README.md @@ -228,6 +228,7 @@ Class | Method | HTTP request | Description *StackpackApi* | [**StackPackList**](docs/StackpackApi.md#stackpacklist) | **Get** /stackpack | StackPack API *StackpackApi* | [**StackPackUpload**](docs/StackpackApi.md#stackpackupload) | **Post** /stackpack | StackPack API *StackpackApi* | [**UpgradeStackPack**](docs/StackpackApi.md#upgradestackpack) | **Post** /stackpack/{stackPackName}/upgrade | Upgrade API +*StackpackApi* | [**ValidateStackPack**](docs/StackpackApi.md#validatestackpack) | **Post** /stackpack/{stackPackName}/validate | Validate API *SubjectApi* | [**CreateSubject**](docs/SubjectApi.md#createsubject) | **Put** /security/subjects/{subject} | Create a subject *SubjectApi* | [**DeleteSubject**](docs/SubjectApi.md#deletesubject) | **Delete** /security/subjects/{subject} | Delete a subject *SubjectApi* | [**GetSubject**](docs/SubjectApi.md#getsubject) | **Get** /security/subjects/{subject} | Get subject diff --git a/generated/stackstate_api/api/openapi.yaml b/generated/stackstate_api/api/openapi.yaml index d5f64d5a..465c781a 100644 --- a/generated/stackstate_api/api/openapi.yaml +++ b/generated/stackstate_api/api/openapi.yaml @@ -403,6 +403,40 @@ paths: summary: Provision API tags: - stackpack + /stackpack/{stackPackName}/validate: + post: + description: Validate a stackpack's setting declarations + operationId: validateStackPack + parameters: + - in: path + name: stackPackName + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: string + description: validation successful + "400": + content: + application/json: + schema: + items: + type: string + type: array + description: bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/GenericErrorsResponse' + description: Error when handling the request on the server side. + summary: Validate API + tags: + - stackpack /stackpack/{stackPackName}/deprovision/{stackPackInstanceId}: post: description: Provision details @@ -9054,8 +9088,8 @@ components: dummy: true component: identifier: identifier - iconbase64: iconbase64 name: name + icon: icon id: 1 type: type troubleshootingSteps: troubleshootingSteps @@ -9187,8 +9221,8 @@ components: MonitorCheckStatusComponent: example: identifier: identifier - iconbase64: iconbase64 name: name + icon: icon id: 1 type: type properties: @@ -9201,7 +9235,7 @@ components: type: string type: type: string - iconbase64: + icon: type: string required: - id @@ -9235,8 +9269,8 @@ components: - identifier: identifier component: identifier: identifier - iconbase64: iconbase64 name: name + icon: icon id: 1 type: type triggeredTimestamp: 1 @@ -9248,8 +9282,8 @@ components: - identifier: identifier component: identifier: identifier - iconbase64: iconbase64 name: name + icon: icon id: 1 type: type triggeredTimestamp: 1 @@ -9277,8 +9311,8 @@ components: identifier: identifier component: identifier: identifier - iconbase64: iconbase64 name: name + icon: icon id: 1 type: type triggeredTimestamp: 1 @@ -10311,7 +10345,7 @@ components: items: type: string type: array - iconbase64: + icon: type: string required: - _type @@ -13904,8 +13938,8 @@ components: tags: - tags - tags - iconbase64: iconbase64 typeName: typeName + icon: icon boundTraces: filter: traceId: @@ -14002,7 +14036,7 @@ components: properties: typeName: type: string - iconbase64: + icon: type: string data: $ref: '#/components/schemas/ComponentData' @@ -15021,8 +15055,8 @@ components: tags: - tags - tags - iconbase64: iconbase64 typeName: typeName + icon: icon boundTraces: filter: traceId: @@ -15209,8 +15243,8 @@ components: tags: - tags - tags - iconbase64: iconbase64 typeName: typeName + icon: icon boundTraces: filter: traceId: @@ -17023,11 +17057,11 @@ components: presentation: overview: mainMenu: - iconbase64: iconbase64 + icon: icon group: group order: 0.8008281904610115 title: title - iconbase64: iconbase64 + icon: icon name: plural: plural singular: singular @@ -17056,16 +17090,16 @@ components: example: overview: mainMenu: - iconbase64: iconbase64 + icon: icon group: group order: 0.8008281904610115 title: title - iconbase64: iconbase64 + icon: icon name: plural: plural singular: singular properties: - iconbase64: + icon: type: string name: $ref: '#/components/schemas/PresentationName' @@ -17088,7 +17122,7 @@ components: PresentationOverview: example: mainMenu: - iconbase64: iconbase64 + icon: icon group: group order: 0.8008281904610115 title: title @@ -17102,13 +17136,13 @@ components: type: object PresentationMainMenu: example: - iconbase64: iconbase64 + icon: icon group: group order: 0.8008281904610115 properties: group: type: string - iconbase64: + icon: type: string order: format: double @@ -17127,16 +17161,16 @@ components: MainMenuGroup: example: identifier: identifier - iconbase64: iconbase64 name: name + icon: icon description: description defaultOpen: true items: - identifier: identifier - iconbase64: iconbase64 + icon: icon title: title - identifier: identifier - iconbase64: iconbase64 + icon: icon title: title properties: name: @@ -17147,7 +17181,7 @@ components: type: string defaultOpen: type: boolean - iconbase64: + icon: type: string items: items: @@ -17155,13 +17189,13 @@ components: type: array required: - defaultOpen - - iconbase64 + - icon - items - name MainMenuViewItem: example: identifier: identifier - iconbase64: iconbase64 + icon: icon title: title properties: identifier: @@ -17169,7 +17203,7 @@ components: type: string title: type: string - iconbase64: + icon: type: string required: - identifier diff --git a/generated/stackstate_api/api_stackpack.go b/generated/stackstate_api/api_stackpack.go index 8ebe39cf..9cbc045c 100644 --- a/generated/stackstate_api/api_stackpack.go +++ b/generated/stackstate_api/api_stackpack.go @@ -112,6 +112,21 @@ type StackpackApi interface { // UpgradeStackPackExecute executes the request // @return string UpgradeStackPackExecute(r ApiUpgradeStackPackRequest) (string, *http.Response, error) + + /* + ValidateStackPack Validate API + + Validate a stackpack's setting declarations + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param stackPackName + @return ApiValidateStackPackRequest + */ + ValidateStackPack(ctx context.Context, stackPackName string) ApiValidateStackPackRequest + + // ValidateStackPackExecute executes the request + // @return string + ValidateStackPackExecute(r ApiValidateStackPackRequest) (string, *http.Response, error) } // StackpackApiService StackpackApi service @@ -1128,6 +1143,171 @@ func (a *StackpackApiService) UpgradeStackPackExecute(r ApiUpgradeStackPackReque return localVarReturnValue, localVarHTTPResponse, nil } +type ApiValidateStackPackRequest struct { + ctx context.Context + ApiService StackpackApi + stackPackName string +} + +func (r ApiValidateStackPackRequest) Execute() (string, *http.Response, error) { + return r.ApiService.ValidateStackPackExecute(r) +} + +/* +ValidateStackPack Validate API + +Validate a stackpack's setting declarations + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param stackPackName + @return ApiValidateStackPackRequest +*/ +func (a *StackpackApiService) ValidateStackPack(ctx context.Context, stackPackName string) ApiValidateStackPackRequest { + return ApiValidateStackPackRequest{ + ApiService: a, + ctx: ctx, + stackPackName: stackPackName, + } +} + +// Execute executes the request +// +// @return string +func (a *StackpackApiService) ValidateStackPackExecute(r ApiValidateStackPackRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StackpackApiService.ValidateStackPack") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/stackpack/{stackPackName}/validate" + localVarPath = strings.Replace(localVarPath, "{"+"stackPackName"+"}", url.PathEscape(parameterToString(r.stackPackName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiToken"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ServiceBearer"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-ServiceBearer"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ServiceToken"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v []string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorsResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // --------------------------------------------- // ------------------ MOCKS -------------------- // --------------------------------------------- @@ -1145,6 +1325,8 @@ type StackpackApiMock struct { StackPackUploadResponse StackPackUploadMockResponse UpgradeStackPackCalls *[]UpgradeStackPackCall UpgradeStackPackResponse UpgradeStackPackMockResponse + ValidateStackPackCalls *[]ValidateStackPackCall + ValidateStackPackResponse ValidateStackPackMockResponse } func NewStackpackApiMock() StackpackApiMock { @@ -1154,6 +1336,7 @@ func NewStackpackApiMock() StackpackApiMock { xStackPackListCalls := make([]StackPackListCall, 0) xStackPackUploadCalls := make([]StackPackUploadCall, 0) xUpgradeStackPackCalls := make([]UpgradeStackPackCall, 0) + xValidateStackPackCalls := make([]ValidateStackPackCall, 0) return StackpackApiMock{ ConfirmManualStepsCalls: &xConfirmManualStepsCalls, ProvisionDetailsCalls: &xProvisionDetailsCalls, @@ -1161,6 +1344,7 @@ func NewStackpackApiMock() StackpackApiMock { StackPackListCalls: &xStackPackListCalls, StackPackUploadCalls: &xStackPackUploadCalls, UpgradeStackPackCalls: &xUpgradeStackPackCalls, + ValidateStackPackCalls: &xValidateStackPackCalls, } } @@ -1326,3 +1510,29 @@ func (mock StackpackApiMock) UpgradeStackPackExecute(r ApiUpgradeStackPackReques *mock.UpgradeStackPackCalls = append(*mock.UpgradeStackPackCalls, p) return mock.UpgradeStackPackResponse.Result, mock.UpgradeStackPackResponse.Response, mock.UpgradeStackPackResponse.Error } + +type ValidateStackPackMockResponse struct { + Result string + Response *http.Response + Error error +} + +type ValidateStackPackCall struct { + PstackPackName string +} + +func (mock StackpackApiMock) ValidateStackPack(ctx context.Context, stackPackName string) ApiValidateStackPackRequest { + return ApiValidateStackPackRequest{ + ApiService: mock, + ctx: ctx, + stackPackName: stackPackName, + } +} + +func (mock StackpackApiMock) ValidateStackPackExecute(r ApiValidateStackPackRequest) (string, *http.Response, error) { + p := ValidateStackPackCall{ + PstackPackName: r.stackPackName, + } + *mock.ValidateStackPackCalls = append(*mock.ValidateStackPackCalls, p) + return mock.ValidateStackPackResponse.Result, mock.ValidateStackPackResponse.Response, mock.ValidateStackPackResponse.Error +} diff --git a/generated/stackstate_api/docs/EventComponent.md b/generated/stackstate_api/docs/EventComponent.md index 39f16d41..16155b1a 100644 --- a/generated/stackstate_api/docs/EventComponent.md +++ b/generated/stackstate_api/docs/EventComponent.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **TypeName** | **string** | | **Name** | **string** | | **Identifiers** | **[]string** | | -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] ## Methods @@ -130,30 +130,30 @@ and a boolean to check if the value has been set. SetIdentifiers sets Identifiers field to given value. -### GetIconbase64 +### GetIcon -`func (o *EventComponent) GetIconbase64() string` +`func (o *EventComponent) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *EventComponent) GetIconbase64Ok() (*string, bool)` +`func (o *EventComponent) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *EventComponent) SetIconbase64(v string)` +`func (o *EventComponent) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *EventComponent) HasIconbase64() bool` +`func (o *EventComponent) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/stackstate_api/docs/EventElement.md b/generated/stackstate_api/docs/EventElement.md index 5324aa95..cc2e6e4f 100644 --- a/generated/stackstate_api/docs/EventElement.md +++ b/generated/stackstate_api/docs/EventElement.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **TypeName** | **string** | | **Name** | **string** | | **Identifiers** | **[]string** | | -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] **Source** | [**EventComponent**](EventComponent.md) | | **Target** | [**EventComponent**](EventComponent.md) | | **DependencyDirection** | [**DependencyDirection**](DependencyDirection.md) | | @@ -133,30 +133,30 @@ and a boolean to check if the value has been set. SetIdentifiers sets Identifiers field to given value. -### GetIconbase64 +### GetIcon -`func (o *EventElement) GetIconbase64() string` +`func (o *EventElement) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *EventElement) GetIconbase64Ok() (*string, bool)` +`func (o *EventElement) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *EventElement) SetIconbase64(v string)` +`func (o *EventElement) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *EventElement) HasIconbase64() bool` +`func (o *EventElement) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. ### GetSource diff --git a/generated/stackstate_api/docs/FullComponent.md b/generated/stackstate_api/docs/FullComponent.md index eb30f6ad..8926a619 100644 --- a/generated/stackstate_api/docs/FullComponent.md +++ b/generated/stackstate_api/docs/FullComponent.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **TypeName** | **string** | | -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] **Data** | [**ComponentData**](ComponentData.md) | | **Highlights** | Pointer to [**ComponentTypeHighlights**](ComponentTypeHighlights.md) | | [optional] **Actions** | [**[]ComponentAction**](ComponentAction.md) | | @@ -51,30 +51,30 @@ and a boolean to check if the value has been set. SetTypeName sets TypeName field to given value. -### GetIconbase64 +### GetIcon -`func (o *FullComponent) GetIconbase64() string` +`func (o *FullComponent) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *FullComponent) GetIconbase64Ok() (*string, bool)` +`func (o *FullComponent) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *FullComponent) SetIconbase64(v string)` +`func (o *FullComponent) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *FullComponent) HasIconbase64() bool` +`func (o *FullComponent) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. ### GetData diff --git a/generated/stackstate_api/docs/MainMenuGroup.md b/generated/stackstate_api/docs/MainMenuGroup.md index a5d04102..56aebc45 100644 --- a/generated/stackstate_api/docs/MainMenuGroup.md +++ b/generated/stackstate_api/docs/MainMenuGroup.md @@ -8,14 +8,14 @@ Name | Type | Description | Notes **Identifier** | Pointer to **string** | | [optional] **Description** | Pointer to **string** | | [optional] **DefaultOpen** | **bool** | | -**Iconbase64** | **string** | | +**Icon** | **string** | | **Items** | [**[]MainMenuViewItem**](MainMenuViewItem.md) | | ## Methods ### NewMainMenuGroup -`func NewMainMenuGroup(name string, defaultOpen bool, iconbase64 string, items []MainMenuViewItem, ) *MainMenuGroup` +`func NewMainMenuGroup(name string, defaultOpen bool, icon string, items []MainMenuViewItem, ) *MainMenuGroup` NewMainMenuGroup instantiates a new MainMenuGroup object This constructor will assign default values to properties that have it defined, @@ -120,24 +120,24 @@ and a boolean to check if the value has been set. SetDefaultOpen sets DefaultOpen field to given value. -### GetIconbase64 +### GetIcon -`func (o *MainMenuGroup) GetIconbase64() string` +`func (o *MainMenuGroup) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *MainMenuGroup) GetIconbase64Ok() (*string, bool)` +`func (o *MainMenuGroup) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *MainMenuGroup) SetIconbase64(v string)` +`func (o *MainMenuGroup) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. ### GetItems diff --git a/generated/stackstate_api/docs/MainMenuViewItem.md b/generated/stackstate_api/docs/MainMenuViewItem.md index 5e5cee1c..e1b246d0 100644 --- a/generated/stackstate_api/docs/MainMenuViewItem.md +++ b/generated/stackstate_api/docs/MainMenuViewItem.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Identifier** | **string** | Either a viewIdentifier or a componentPresentationIdentifier | **Title** | **string** | | -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] ## Methods @@ -67,30 +67,30 @@ and a boolean to check if the value has been set. SetTitle sets Title field to given value. -### GetIconbase64 +### GetIcon -`func (o *MainMenuViewItem) GetIconbase64() string` +`func (o *MainMenuViewItem) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *MainMenuViewItem) GetIconbase64Ok() (*string, bool)` +`func (o *MainMenuViewItem) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *MainMenuViewItem) SetIconbase64(v string)` +`func (o *MainMenuViewItem) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *MainMenuViewItem) HasIconbase64() bool` +`func (o *MainMenuViewItem) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/stackstate_api/docs/MonitorCheckStatusComponent.md b/generated/stackstate_api/docs/MonitorCheckStatusComponent.md index eb6b842e..c3902f76 100644 --- a/generated/stackstate_api/docs/MonitorCheckStatusComponent.md +++ b/generated/stackstate_api/docs/MonitorCheckStatusComponent.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **Identifier** | **string** | | **Name** | **string** | | **Type** | **string** | | -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] ## Methods @@ -109,30 +109,30 @@ and a boolean to check if the value has been set. SetType sets Type field to given value. -### GetIconbase64 +### GetIcon -`func (o *MonitorCheckStatusComponent) GetIconbase64() string` +`func (o *MonitorCheckStatusComponent) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *MonitorCheckStatusComponent) GetIconbase64Ok() (*string, bool)` +`func (o *MonitorCheckStatusComponent) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *MonitorCheckStatusComponent) SetIconbase64(v string)` +`func (o *MonitorCheckStatusComponent) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *MonitorCheckStatusComponent) HasIconbase64() bool` +`func (o *MonitorCheckStatusComponent) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/stackstate_api/docs/PresentationDefinition.md b/generated/stackstate_api/docs/PresentationDefinition.md index 3a9f9fb5..ea74496b 100644 --- a/generated/stackstate_api/docs/PresentationDefinition.md +++ b/generated/stackstate_api/docs/PresentationDefinition.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] **Name** | Pointer to [**PresentationName**](PresentationName.md) | | [optional] **Overview** | Pointer to [**PresentationOverview**](PresentationOverview.md) | | [optional] @@ -27,30 +27,30 @@ NewPresentationDefinitionWithDefaults instantiates a new PresentationDefinition This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set -### GetIconbase64 +### GetIcon -`func (o *PresentationDefinition) GetIconbase64() string` +`func (o *PresentationDefinition) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *PresentationDefinition) GetIconbase64Ok() (*string, bool)` +`func (o *PresentationDefinition) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *PresentationDefinition) SetIconbase64(v string)` +`func (o *PresentationDefinition) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *PresentationDefinition) HasIconbase64() bool` +`func (o *PresentationDefinition) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. ### GetName diff --git a/generated/stackstate_api/docs/PresentationMainMenu.md b/generated/stackstate_api/docs/PresentationMainMenu.md index c9b46c41..2a4f6c47 100644 --- a/generated/stackstate_api/docs/PresentationMainMenu.md +++ b/generated/stackstate_api/docs/PresentationMainMenu.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Group** | **string** | | -**Iconbase64** | Pointer to **string** | | [optional] +**Icon** | Pointer to **string** | | [optional] **Order** | **float64** | | ## Methods @@ -47,30 +47,30 @@ and a boolean to check if the value has been set. SetGroup sets Group field to given value. -### GetIconbase64 +### GetIcon -`func (o *PresentationMainMenu) GetIconbase64() string` +`func (o *PresentationMainMenu) GetIcon() string` -GetIconbase64 returns the Iconbase64 field if non-nil, zero value otherwise. +GetIcon returns the Icon field if non-nil, zero value otherwise. -### GetIconbase64Ok +### GetIconOk -`func (o *PresentationMainMenu) GetIconbase64Ok() (*string, bool)` +`func (o *PresentationMainMenu) GetIconOk() (*string, bool)` -GetIconbase64Ok returns a tuple with the Iconbase64 field if it's non-nil, zero value otherwise +GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetIconbase64 +### SetIcon -`func (o *PresentationMainMenu) SetIconbase64(v string)` +`func (o *PresentationMainMenu) SetIcon(v string)` -SetIconbase64 sets Iconbase64 field to given value. +SetIcon sets Icon field to given value. -### HasIconbase64 +### HasIcon -`func (o *PresentationMainMenu) HasIconbase64() bool` +`func (o *PresentationMainMenu) HasIcon() bool` -HasIconbase64 returns a boolean if a field has been set. +HasIcon returns a boolean if a field has been set. ### GetOrder diff --git a/generated/stackstate_api/docs/StackpackApi.md b/generated/stackstate_api/docs/StackpackApi.md index 9c4fc4de..649364cb 100644 --- a/generated/stackstate_api/docs/StackpackApi.md +++ b/generated/stackstate_api/docs/StackpackApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**StackPackList**](StackpackApi.md#StackPackList) | **Get** /stackpack | StackPack API [**StackPackUpload**](StackpackApi.md#StackPackUpload) | **Post** /stackpack | StackPack API [**UpgradeStackPack**](StackpackApi.md#UpgradeStackPack) | **Post** /stackpack/{stackPackName}/upgrade | Upgrade API +[**ValidateStackPack**](StackpackApi.md#ValidateStackPack) | **Post** /stackpack/{stackPackName}/validate | Validate API @@ -431,3 +432,73 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## ValidateStackPack + +> string ValidateStackPack(ctx, stackPackName).Execute() + +Validate API + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + stackPackName := "stackPackName_example" // string | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.StackpackApi.ValidateStackPack(context.Background(), stackPackName).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StackpackApi.ValidateStackPack``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ValidateStackPack`: string + fmt.Fprintf(os.Stdout, "Response from `StackpackApi.ValidateStackPack`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stackPackName** | **string** | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiValidateStackPackRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +**string** + +### Authorization + +[ApiToken](../README.md#ApiToken), [ServiceBearer](../README.md#ServiceBearer), [ServiceToken](../README.md#ServiceToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/generated/stackstate_api/model_event_component.go b/generated/stackstate_api/model_event_component.go index 17ced566..60e87144 100644 --- a/generated/stackstate_api/model_event_component.go +++ b/generated/stackstate_api/model_event_component.go @@ -22,7 +22,7 @@ type EventComponent struct { TypeName string `json:"typeName" yaml:"typeName"` Name string `json:"name" yaml:"name"` Identifiers []string `json:"identifiers" yaml:"identifiers"` - Iconbase64 *string `json:"iconbase64,omitempty" yaml:"iconbase64,omitempty"` + Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"` } // NewEventComponent instantiates a new EventComponent object @@ -167,36 +167,36 @@ func (o *EventComponent) SetIdentifiers(v []string) { o.Identifiers = v } -// GetIconbase64 returns the Iconbase64 field value if set, zero value otherwise. -func (o *EventComponent) GetIconbase64() string { - if o == nil || o.Iconbase64 == nil { +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *EventComponent) GetIcon() string { + if o == nil || o.Icon == nil { var ret string return ret } - return *o.Iconbase64 + return *o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value if set, nil otherwise +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *EventComponent) GetIconbase64Ok() (*string, bool) { - if o == nil || o.Iconbase64 == nil { +func (o *EventComponent) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { return nil, false } - return o.Iconbase64, true + return o.Icon, true } -// HasIconbase64 returns a boolean if a field has been set. -func (o *EventComponent) HasIconbase64() bool { - if o != nil && o.Iconbase64 != nil { +// HasIcon returns a boolean if a field has been set. +func (o *EventComponent) HasIcon() bool { + if o != nil && o.Icon != nil { return true } return false } -// SetIconbase64 gets a reference to the given string and assigns it to the Iconbase64 field. -func (o *EventComponent) SetIconbase64(v string) { - o.Iconbase64 = &v +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *EventComponent) SetIcon(v string) { + o.Icon = &v } func (o EventComponent) MarshalJSON() ([]byte, error) { @@ -216,8 +216,8 @@ func (o EventComponent) MarshalJSON() ([]byte, error) { if true { toSerialize["identifiers"] = o.Identifiers } - if o.Iconbase64 != nil { - toSerialize["iconbase64"] = o.Iconbase64 + if o.Icon != nil { + toSerialize["icon"] = o.Icon } return json.Marshal(toSerialize) } diff --git a/generated/stackstate_api/model_full_component.go b/generated/stackstate_api/model_full_component.go index 26ad426f..1019577c 100644 --- a/generated/stackstate_api/model_full_component.go +++ b/generated/stackstate_api/model_full_component.go @@ -18,7 +18,7 @@ import ( // FullComponent struct for FullComponent type FullComponent struct { TypeName string `json:"typeName" yaml:"typeName"` - Iconbase64 *string `json:"iconbase64,omitempty" yaml:"iconbase64,omitempty"` + Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"` Data ComponentData `json:"data" yaml:"data"` Highlights *ComponentTypeHighlights `json:"highlights,omitempty" yaml:"highlights,omitempty"` Actions []ComponentAction `json:"actions" yaml:"actions"` @@ -71,36 +71,36 @@ func (o *FullComponent) SetTypeName(v string) { o.TypeName = v } -// GetIconbase64 returns the Iconbase64 field value if set, zero value otherwise. -func (o *FullComponent) GetIconbase64() string { - if o == nil || o.Iconbase64 == nil { +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *FullComponent) GetIcon() string { + if o == nil || o.Icon == nil { var ret string return ret } - return *o.Iconbase64 + return *o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value if set, nil otherwise +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *FullComponent) GetIconbase64Ok() (*string, bool) { - if o == nil || o.Iconbase64 == nil { +func (o *FullComponent) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { return nil, false } - return o.Iconbase64, true + return o.Icon, true } -// HasIconbase64 returns a boolean if a field has been set. -func (o *FullComponent) HasIconbase64() bool { - if o != nil && o.Iconbase64 != nil { +// HasIcon returns a boolean if a field has been set. +func (o *FullComponent) HasIcon() bool { + if o != nil && o.Icon != nil { return true } return false } -// SetIconbase64 gets a reference to the given string and assigns it to the Iconbase64 field. -func (o *FullComponent) SetIconbase64(v string) { - o.Iconbase64 = &v +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *FullComponent) SetIcon(v string) { + o.Icon = &v } // GetData returns the Data field value @@ -244,8 +244,8 @@ func (o FullComponent) MarshalJSON() ([]byte, error) { if true { toSerialize["typeName"] = o.TypeName } - if o.Iconbase64 != nil { - toSerialize["iconbase64"] = o.Iconbase64 + if o.Icon != nil { + toSerialize["icon"] = o.Icon } if true { toSerialize["data"] = o.Data diff --git a/generated/stackstate_api/model_main_menu_group.go b/generated/stackstate_api/model_main_menu_group.go index 351f2508..cd2bfb1a 100644 --- a/generated/stackstate_api/model_main_menu_group.go +++ b/generated/stackstate_api/model_main_menu_group.go @@ -21,7 +21,7 @@ type MainMenuGroup struct { Identifier *string `json:"identifier,omitempty" yaml:"identifier,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` DefaultOpen bool `json:"defaultOpen" yaml:"defaultOpen"` - Iconbase64 string `json:"iconbase64" yaml:"iconbase64"` + Icon string `json:"icon" yaml:"icon"` Items []MainMenuViewItem `json:"items" yaml:"items"` } @@ -29,11 +29,11 @@ type MainMenuGroup struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewMainMenuGroup(name string, defaultOpen bool, iconbase64 string, items []MainMenuViewItem) *MainMenuGroup { +func NewMainMenuGroup(name string, defaultOpen bool, icon string, items []MainMenuViewItem) *MainMenuGroup { this := MainMenuGroup{} this.Name = name this.DefaultOpen = defaultOpen - this.Iconbase64 = iconbase64 + this.Icon = icon this.Items = items return &this } @@ -158,28 +158,28 @@ func (o *MainMenuGroup) SetDefaultOpen(v bool) { o.DefaultOpen = v } -// GetIconbase64 returns the Iconbase64 field value -func (o *MainMenuGroup) GetIconbase64() string { +// GetIcon returns the Icon field value +func (o *MainMenuGroup) GetIcon() string { if o == nil { var ret string return ret } - return o.Iconbase64 + return o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value +// GetIconOk returns a tuple with the Icon field value // and a boolean to check if the value has been set. -func (o *MainMenuGroup) GetIconbase64Ok() (*string, bool) { +func (o *MainMenuGroup) GetIconOk() (*string, bool) { if o == nil { return nil, false } - return &o.Iconbase64, true + return &o.Icon, true } -// SetIconbase64 sets field value -func (o *MainMenuGroup) SetIconbase64(v string) { - o.Iconbase64 = v +// SetIcon sets field value +func (o *MainMenuGroup) SetIcon(v string) { + o.Icon = v } // GetItems returns the Items field value @@ -221,7 +221,7 @@ func (o MainMenuGroup) MarshalJSON() ([]byte, error) { toSerialize["defaultOpen"] = o.DefaultOpen } if true { - toSerialize["iconbase64"] = o.Iconbase64 + toSerialize["icon"] = o.Icon } if true { toSerialize["items"] = o.Items diff --git a/generated/stackstate_api/model_main_menu_view_item.go b/generated/stackstate_api/model_main_menu_view_item.go index 635fe14d..2829308c 100644 --- a/generated/stackstate_api/model_main_menu_view_item.go +++ b/generated/stackstate_api/model_main_menu_view_item.go @@ -20,7 +20,7 @@ type MainMenuViewItem struct { // Either a viewIdentifier or a componentPresentationIdentifier Identifier string `json:"identifier" yaml:"identifier"` Title string `json:"title" yaml:"title"` - Iconbase64 *string `json:"iconbase64,omitempty" yaml:"iconbase64,omitempty"` + Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"` } // NewMainMenuViewItem instantiates a new MainMenuViewItem object @@ -90,36 +90,36 @@ func (o *MainMenuViewItem) SetTitle(v string) { o.Title = v } -// GetIconbase64 returns the Iconbase64 field value if set, zero value otherwise. -func (o *MainMenuViewItem) GetIconbase64() string { - if o == nil || o.Iconbase64 == nil { +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *MainMenuViewItem) GetIcon() string { + if o == nil || o.Icon == nil { var ret string return ret } - return *o.Iconbase64 + return *o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value if set, nil otherwise +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *MainMenuViewItem) GetIconbase64Ok() (*string, bool) { - if o == nil || o.Iconbase64 == nil { +func (o *MainMenuViewItem) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { return nil, false } - return o.Iconbase64, true + return o.Icon, true } -// HasIconbase64 returns a boolean if a field has been set. -func (o *MainMenuViewItem) HasIconbase64() bool { - if o != nil && o.Iconbase64 != nil { +// HasIcon returns a boolean if a field has been set. +func (o *MainMenuViewItem) HasIcon() bool { + if o != nil && o.Icon != nil { return true } return false } -// SetIconbase64 gets a reference to the given string and assigns it to the Iconbase64 field. -func (o *MainMenuViewItem) SetIconbase64(v string) { - o.Iconbase64 = &v +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *MainMenuViewItem) SetIcon(v string) { + o.Icon = &v } func (o MainMenuViewItem) MarshalJSON() ([]byte, error) { @@ -130,8 +130,8 @@ func (o MainMenuViewItem) MarshalJSON() ([]byte, error) { if true { toSerialize["title"] = o.Title } - if o.Iconbase64 != nil { - toSerialize["iconbase64"] = o.Iconbase64 + if o.Icon != nil { + toSerialize["icon"] = o.Icon } return json.Marshal(toSerialize) } diff --git a/generated/stackstate_api/model_monitor_check_status_component.go b/generated/stackstate_api/model_monitor_check_status_component.go index 185d0d55..55fb5ed3 100644 --- a/generated/stackstate_api/model_monitor_check_status_component.go +++ b/generated/stackstate_api/model_monitor_check_status_component.go @@ -21,7 +21,7 @@ type MonitorCheckStatusComponent struct { Identifier string `json:"identifier" yaml:"identifier"` Name string `json:"name" yaml:"name"` Type string `json:"type" yaml:"type"` - Iconbase64 *string `json:"iconbase64,omitempty" yaml:"iconbase64,omitempty"` + Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"` } // NewMonitorCheckStatusComponent instantiates a new MonitorCheckStatusComponent object @@ -141,36 +141,36 @@ func (o *MonitorCheckStatusComponent) SetType(v string) { o.Type = v } -// GetIconbase64 returns the Iconbase64 field value if set, zero value otherwise. -func (o *MonitorCheckStatusComponent) GetIconbase64() string { - if o == nil || o.Iconbase64 == nil { +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *MonitorCheckStatusComponent) GetIcon() string { + if o == nil || o.Icon == nil { var ret string return ret } - return *o.Iconbase64 + return *o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value if set, nil otherwise +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *MonitorCheckStatusComponent) GetIconbase64Ok() (*string, bool) { - if o == nil || o.Iconbase64 == nil { +func (o *MonitorCheckStatusComponent) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { return nil, false } - return o.Iconbase64, true + return o.Icon, true } -// HasIconbase64 returns a boolean if a field has been set. -func (o *MonitorCheckStatusComponent) HasIconbase64() bool { - if o != nil && o.Iconbase64 != nil { +// HasIcon returns a boolean if a field has been set. +func (o *MonitorCheckStatusComponent) HasIcon() bool { + if o != nil && o.Icon != nil { return true } return false } -// SetIconbase64 gets a reference to the given string and assigns it to the Iconbase64 field. -func (o *MonitorCheckStatusComponent) SetIconbase64(v string) { - o.Iconbase64 = &v +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *MonitorCheckStatusComponent) SetIcon(v string) { + o.Icon = &v } func (o MonitorCheckStatusComponent) MarshalJSON() ([]byte, error) { @@ -187,8 +187,8 @@ func (o MonitorCheckStatusComponent) MarshalJSON() ([]byte, error) { if true { toSerialize["type"] = o.Type } - if o.Iconbase64 != nil { - toSerialize["iconbase64"] = o.Iconbase64 + if o.Icon != nil { + toSerialize["icon"] = o.Icon } return json.Marshal(toSerialize) } diff --git a/generated/stackstate_api/model_presentation_definition.go b/generated/stackstate_api/model_presentation_definition.go index f4cf059b..c3feb1fe 100644 --- a/generated/stackstate_api/model_presentation_definition.go +++ b/generated/stackstate_api/model_presentation_definition.go @@ -17,9 +17,9 @@ import ( // PresentationDefinition struct for PresentationDefinition type PresentationDefinition struct { - Iconbase64 *string `json:"iconbase64,omitempty" yaml:"iconbase64,omitempty"` - Name *PresentationName `json:"name,omitempty" yaml:"name,omitempty"` - Overview *PresentationOverview `json:"overview,omitempty" yaml:"overview,omitempty"` + Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"` + Name *PresentationName `json:"name,omitempty" yaml:"name,omitempty"` + Overview *PresentationOverview `json:"overview,omitempty" yaml:"overview,omitempty"` } // NewPresentationDefinition instantiates a new PresentationDefinition object @@ -39,36 +39,36 @@ func NewPresentationDefinitionWithDefaults() *PresentationDefinition { return &this } -// GetIconbase64 returns the Iconbase64 field value if set, zero value otherwise. -func (o *PresentationDefinition) GetIconbase64() string { - if o == nil || o.Iconbase64 == nil { +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *PresentationDefinition) GetIcon() string { + if o == nil || o.Icon == nil { var ret string return ret } - return *o.Iconbase64 + return *o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value if set, nil otherwise +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PresentationDefinition) GetIconbase64Ok() (*string, bool) { - if o == nil || o.Iconbase64 == nil { +func (o *PresentationDefinition) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { return nil, false } - return o.Iconbase64, true + return o.Icon, true } -// HasIconbase64 returns a boolean if a field has been set. -func (o *PresentationDefinition) HasIconbase64() bool { - if o != nil && o.Iconbase64 != nil { +// HasIcon returns a boolean if a field has been set. +func (o *PresentationDefinition) HasIcon() bool { + if o != nil && o.Icon != nil { return true } return false } -// SetIconbase64 gets a reference to the given string and assigns it to the Iconbase64 field. -func (o *PresentationDefinition) SetIconbase64(v string) { - o.Iconbase64 = &v +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *PresentationDefinition) SetIcon(v string) { + o.Icon = &v } // GetName returns the Name field value if set, zero value otherwise. @@ -137,8 +137,8 @@ func (o *PresentationDefinition) SetOverview(v PresentationOverview) { func (o PresentationDefinition) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Iconbase64 != nil { - toSerialize["iconbase64"] = o.Iconbase64 + if o.Icon != nil { + toSerialize["icon"] = o.Icon } if o.Name != nil { toSerialize["name"] = o.Name diff --git a/generated/stackstate_api/model_presentation_main_menu.go b/generated/stackstate_api/model_presentation_main_menu.go index 21981432..6d1a7072 100644 --- a/generated/stackstate_api/model_presentation_main_menu.go +++ b/generated/stackstate_api/model_presentation_main_menu.go @@ -17,9 +17,9 @@ import ( // PresentationMainMenu struct for PresentationMainMenu type PresentationMainMenu struct { - Group string `json:"group" yaml:"group"` - Iconbase64 *string `json:"iconbase64,omitempty" yaml:"iconbase64,omitempty"` - Order float64 `json:"order" yaml:"order"` + Group string `json:"group" yaml:"group"` + Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"` + Order float64 `json:"order" yaml:"order"` } // NewPresentationMainMenu instantiates a new PresentationMainMenu object @@ -65,36 +65,36 @@ func (o *PresentationMainMenu) SetGroup(v string) { o.Group = v } -// GetIconbase64 returns the Iconbase64 field value if set, zero value otherwise. -func (o *PresentationMainMenu) GetIconbase64() string { - if o == nil || o.Iconbase64 == nil { +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *PresentationMainMenu) GetIcon() string { + if o == nil || o.Icon == nil { var ret string return ret } - return *o.Iconbase64 + return *o.Icon } -// GetIconbase64Ok returns a tuple with the Iconbase64 field value if set, nil otherwise +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PresentationMainMenu) GetIconbase64Ok() (*string, bool) { - if o == nil || o.Iconbase64 == nil { +func (o *PresentationMainMenu) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { return nil, false } - return o.Iconbase64, true + return o.Icon, true } -// HasIconbase64 returns a boolean if a field has been set. -func (o *PresentationMainMenu) HasIconbase64() bool { - if o != nil && o.Iconbase64 != nil { +// HasIcon returns a boolean if a field has been set. +func (o *PresentationMainMenu) HasIcon() bool { + if o != nil && o.Icon != nil { return true } return false } -// SetIconbase64 gets a reference to the given string and assigns it to the Iconbase64 field. -func (o *PresentationMainMenu) SetIconbase64(v string) { - o.Iconbase64 = &v +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *PresentationMainMenu) SetIcon(v string) { + o.Icon = &v } // GetOrder returns the Order field value @@ -126,8 +126,8 @@ func (o PresentationMainMenu) MarshalJSON() ([]byte, error) { if true { toSerialize["group"] = o.Group } - if o.Iconbase64 != nil { - toSerialize["iconbase64"] = o.Iconbase64 + if o.Icon != nil { + toSerialize["icon"] = o.Icon } if true { toSerialize["order"] = o.Order diff --git a/stackstate_openapi/openapi_version b/stackstate_openapi/openapi_version index 51986b0b..ce845be3 100644 --- a/stackstate_openapi/openapi_version +++ b/stackstate_openapi/openapi_version @@ -1 +1 @@ -86eab764e5f831277671d3eb9bf029f523d9a96c +7dda64436db2c041092b31af19b541977a3699dc