From 95db21b94be3fabcb55696dc5ba9efdb0068bdec Mon Sep 17 00:00:00 2001 From: Alejandro Acevedo Date: Tue, 23 Sep 2025 12:33:04 +0200 Subject: [PATCH 1/3] STAC-22985: List mappings and show their status --- cmd/otelcomponentmapping.go | 20 + .../otelcomponentmapping_list.go | 43 + .../otelcomponentmapping_list_test.go | 53 ++ .../otelcomponentmapping_status.go | 23 + .../otelcomponentmapping_status_test.go | 67 ++ cmd/otelmapping/otelmapping.go | 130 +++ cmd/otelmapping/test_data.go | 53 ++ cmd/otelrelationmapping.go | 20 + .../otelrelationmapping_list.go | 43 + .../otelrelationmapping_list_test.go | 53 ++ .../otelrelationmapping_status.go | 23 + .../otelrelationmapping_status_test.go | 67 ++ cmd/sts.go | 6 + .../stackstate_api/.openapi-generator/FILES | 14 + generated/stackstate_api/README.md | 10 + generated/stackstate_api/api/openapi.yaml | 238 +++++ generated/stackstate_api/api_otel_mapping.go | 821 ++++++++++++++++++ generated/stackstate_api/client.go | 3 + .../stackstate_api/docs/OtelMappingApi.md | 266 ++++++ .../docs/OtelMappingApiError.md | 51 ++ .../stackstate_api/docs/OtelMappingError.md | 98 +++ .../stackstate_api/docs/OtelMappingItem.md | 77 ++ .../stackstate_api/docs/OtelMappingMetrics.md | 77 ++ .../stackstate_api/docs/OtelMappingStatus.md | 98 +++ .../docs/OtelMappingStatusItem.md | 119 +++ .../model_otel_mapping_api_error.go | 107 +++ .../model_otel_mapping_error.go | 172 ++++ .../stackstate_api/model_otel_mapping_item.go | 143 +++ .../model_otel_mapping_metrics.go | 143 +++ .../model_otel_mapping_status.go | 172 ++++ .../model_otel_mapping_status_item.go | 201 +++++ internal/common/common_flags.go | 2 +- internal/di/mock_stackstate_client.go | 4 + stackstate_openapi/openapi_version | 2 +- 34 files changed, 3417 insertions(+), 2 deletions(-) create mode 100644 cmd/otelcomponentmapping.go create mode 100644 cmd/otelcomponentmapping/otelcomponentmapping_list.go create mode 100644 cmd/otelcomponentmapping/otelcomponentmapping_list_test.go create mode 100644 cmd/otelcomponentmapping/otelcomponentmapping_status.go create mode 100644 cmd/otelcomponentmapping/otelcomponentmapping_status_test.go create mode 100644 cmd/otelmapping/otelmapping.go create mode 100644 cmd/otelmapping/test_data.go create mode 100644 cmd/otelrelationmapping.go create mode 100644 cmd/otelrelationmapping/otelrelationmapping_list.go create mode 100644 cmd/otelrelationmapping/otelrelationmapping_list_test.go create mode 100644 cmd/otelrelationmapping/otelrelationmapping_status.go create mode 100644 cmd/otelrelationmapping/otelrelationmapping_status_test.go create mode 100644 generated/stackstate_api/api_otel_mapping.go create mode 100644 generated/stackstate_api/docs/OtelMappingApi.md create mode 100644 generated/stackstate_api/docs/OtelMappingApiError.md create mode 100644 generated/stackstate_api/docs/OtelMappingError.md create mode 100644 generated/stackstate_api/docs/OtelMappingItem.md create mode 100644 generated/stackstate_api/docs/OtelMappingMetrics.md create mode 100644 generated/stackstate_api/docs/OtelMappingStatus.md create mode 100644 generated/stackstate_api/docs/OtelMappingStatusItem.md create mode 100644 generated/stackstate_api/model_otel_mapping_api_error.go create mode 100644 generated/stackstate_api/model_otel_mapping_error.go create mode 100644 generated/stackstate_api/model_otel_mapping_item.go create mode 100644 generated/stackstate_api/model_otel_mapping_metrics.go create mode 100644 generated/stackstate_api/model_otel_mapping_status.go create mode 100644 generated/stackstate_api/model_otel_mapping_status_item.go diff --git a/cmd/otelcomponentmapping.go b/cmd/otelcomponentmapping.go new file mode 100644 index 00000000..6f01a956 --- /dev/null +++ b/cmd/otelcomponentmapping.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/cmd/otelcomponentmapping" + "github.com/stackvista/stackstate-cli/internal/di" +) + +func OtelComponentMappingCommand(deps *di.Deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "otel-component-mapping", + Short: "Manage the Otel Component Mapping", + Long: "Manage the Otel Component Mapping.", + } + + cmd.AddCommand(otelcomponentmapping.OtelComponentMappingListCommand(deps)) + cmd.AddCommand(otelcomponentmapping.OtelComponentMappingStatusCommand(deps)) + + return cmd +} diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_list.go b/cmd/otelcomponentmapping/otelcomponentmapping_list.go new file mode 100644 index 00000000..bf84382c --- /dev/null +++ b/cmd/otelcomponentmapping/otelcomponentmapping_list.go @@ -0,0 +1,43 @@ +package otelcomponentmapping + +import ( + "sort" + + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/generated/stackstate_api" + "github.com/stackvista/stackstate-cli/internal/common" + "github.com/stackvista/stackstate-cli/internal/di" +) + +func OtelComponentMappingListCommand(deps *di.Deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Lists active Otel Component Mappings", + Long: "Lists active Otel Component Mappings.", + RunE: deps.CmdRunEWithApi(RunListComponentCommand), + } + + return cmd +} + +func RunListComponentCommand(cmd *cobra.Command, cli *di.Deps, api *stackstate_api.APIClient, serverInfo *stackstate_api.ServerInfo) common.CLIError { + mappingsList, resp, err := api.OtelMappingApi.GetOtelComponentMappings(cli.Context).Execute() + if err != nil { + return common.NewResponseError(err, resp) + } + + sort.SliceStable(mappingsList, func(i, j int) bool { + return mappingsList[i].Name < mappingsList[j].Name + }) + + if cli.IsJson() { + cli.Printer.PrintJson(map[string]interface{}{ + "otel component mappings": mappingsList, + }) + } else { + cli.Printer.Table(otelmapping.FormatOtelMappingTable(mappingsList)) + } + + return nil +} diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go b/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go new file mode 100644 index 00000000..fff85405 --- /dev/null +++ b/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go @@ -0,0 +1,53 @@ +package otelcomponentmapping + +import ( + "testing" + + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/internal/di" + "github.com/stackvista/stackstate-cli/internal/printer" + "github.com/stretchr/testify/assert" +) + +func TestListOtelComponentMappingsJson(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelComponentMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsResponse.Result = otelmapping.TestAllMappingItems + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "-o", "json") + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsCalls + assert.Len(t, calls, 1) + + expected := []map[string]interface{}{ + { + "otel component mappings": otelmapping.TestAllMappingItems, + }, + } + + assert.Equal(t, expected, *cli.MockPrinter.PrintJsonCalls) +} + +func TestOtelComponentMappingListTable(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelComponentMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsResponse.Result = otelmapping.TestAllMappingItems + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd) + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsCalls + assert.Len(t, calls, 1) + + expectedTableCall := []printer.TableData{ + { + Header: []string{"Name", "Identifier"}, + Data: [][]interface{}{ + {otelmapping.TestSomeOtelMappingItem.Name, "identifier"}, + {otelmapping.TestSomeOtelMappingItem2.Name, "identifier2"}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, + }, + } + + assert.Equal(t, expectedTableCall, *cli.MockPrinter.TableCalls) +} diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_status.go b/cmd/otelcomponentmapping/otelcomponentmapping_status.go new file mode 100644 index 00000000..21a38670 --- /dev/null +++ b/cmd/otelcomponentmapping/otelcomponentmapping_status.go @@ -0,0 +1,23 @@ +package otelcomponentmapping + +import ( + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/internal/common" + "github.com/stackvista/stackstate-cli/internal/di" +) + +// if cli.IsJson() { +// cli.Printer.PrintJson( + +func OtelComponentMappingStatusCommand(deps *di.Deps) *cobra.Command { + args := &otelmapping.StatusArgs{} + cmd := &cobra.Command{ + Use: "status", + Short: "Get the status of an Otel Component Mappings", + Long: "Get the status of an Otel Component Mappings.", + RunE: deps.CmdRunEWithApi(otelmapping.RunStatus(args, "component", otelmapping.FetchComponentStatus)), + } + common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier of the Otel Component Mapping") + return cmd +} diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go b/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go new file mode 100644 index 00000000..00815711 --- /dev/null +++ b/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go @@ -0,0 +1,67 @@ +package otelcomponentmapping + +import ( + "testing" + + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/internal/di" + "github.com/stackvista/stackstate-cli/internal/printer" + "github.com/stretchr/testify/assert" +) + +func TestOtelComponentMappingStatusJson(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelComponentMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier", "-o", "json") + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusCalls + assert.Len(t, calls, 1) + + expected := []map[string]interface{}{ + { + "otel-component-mapping": otelmapping.TestSomeOtelMappingStatus, + }, + } + + assert.Equal(t, expected, *cli.MockPrinter.PrintJsonCalls) +} + +func TestOtelComponentMappingStatusTable(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelComponentMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier") + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusCalls + assert.Len(t, calls, 1) + + expectedTableCall := []printer.TableData{ + { + Header: []string{"Name", "Identifier", "Components", "Relations"}, + Data: [][]interface{}{ + {otelmapping.TestSomeOtelMappingStatusItem.Name, "identifier", otelmapping.TestComponentCount, otelmapping.TestRelationCount}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, + }, + { + Header: []string{"Metric", "10s ago", "10-20s ago", "20-30s ago"}, + Data: [][]interface{}{ + {"latency seconds", otelmapping.TestMetricValue, otelmapping.TestMetricValue, otelmapping.TestMetricValue}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "metrics"}, + }, + { + Header: []string{"Issue Id", "Level", "Message"}, + Data: [][]interface{}{ + {"-", otelmapping.TestError1.Level, otelmapping.TestError1.Message}, + {"-", otelmapping.TestError2.Level, otelmapping.TestError2.Message}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel component mapping errors"}, + }, + } + + assert.Equal(t, expectedTableCall, *cli.MockPrinter.TableCalls) +} diff --git a/cmd/otelmapping/otelmapping.go b/cmd/otelmapping/otelmapping.go new file mode 100644 index 00000000..4ad9d652 --- /dev/null +++ b/cmd/otelmapping/otelmapping.go @@ -0,0 +1,130 @@ +package otelmapping + +import ( + "fmt" + "net/http" + + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/generated/stackstate_api" + "github.com/stackvista/stackstate-cli/internal/common" + "github.com/stackvista/stackstate-cli/internal/di" + "github.com/stackvista/stackstate-cli/internal/printer" + "golang.org/x/text/cases" + "golang.org/x/text/language" +) + +type StatusArgs struct { + Identifier string +} + +func FormatOtelMappingStatusTable(otelmappings []stackstate_api.OtelMappingStatusItem) printer.TableData { + data := make([][]interface{}, len(otelmappings)) + + for i, otelmapping := range otelmappings { + identifier := "-" + if otelmapping.HasIdentifier() { + identifier = otelmapping.GetIdentifier() + } + data[i] = []interface{}{ + otelmapping.Name, + identifier, + otelmapping.ComponentCount, + otelmapping.RelationCount, + } + } + return printer.TableData{ + Header: []string{"Name", "Identifier", "Components", "Relations"}, + Data: data, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, + } +} + +func FormatOtelMappingTable(otelmappings []stackstate_api.OtelMappingItem) printer.TableData { + data := make([][]interface{}, len(otelmappings)) + + for i, otelmapping := range otelmappings { + identifier := "-" + if otelmapping.HasIdentifier() { + identifier = otelmapping.GetIdentifier() + } + data[i] = []interface{}{ + otelmapping.Name, + identifier, + } + } + return printer.TableData{ + Header: []string{"Name", "Identifier"}, + Data: data, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, + } +} + +type StatusFetcher func(cli *di.Deps, api *stackstate_api.APIClient, identifier string) (*stackstate_api.OtelMappingStatus, *http.Response, error) + +func FetchComponentStatus(cli *di.Deps, api *stackstate_api.APIClient, identifier string) (*stackstate_api.OtelMappingStatus, *http.Response, error) { + return api.OtelMappingApi.GetOtelComponentMappingStatus(cli.Context, identifier).Execute() +} + +func FetchRelationStatus(cli *di.Deps, api *stackstate_api.APIClient, identifier string) (*stackstate_api.OtelMappingStatus, *http.Response, error) { + return api.OtelMappingApi.GetOtelRelationMappingStatus(cli.Context, identifier).Execute() +} + +func RunStatus(args *StatusArgs, mappingType string, fetch StatusFetcher) di.CmdWithApiFn { + return func(cmd *cobra.Command, cli *di.Deps, api *stackstate_api.APIClient, serverInfo *stackstate_api.ServerInfo) common.CLIError { + mappingStatus, resp, err := fetch(cli, api, args.Identifier) + if err != nil { + return common.NewResponseError(err, resp) + } + + jsonKey := fmt.Sprintf("otel-%s-mapping", mappingType) + title := cases.Title(language.English).String(mappingType) + mappingTitle := fmt.Sprintf("Otel %s Mapping:", title) + metricsTitle := fmt.Sprintf("Otel %s Mapping Metrics:", title) + errorsTitle := fmt.Sprintf("Otel %s Mapping Errors:", title) + errorsNotFoundMsg := fmt.Sprintf("otel %s mapping errors", mappingType) + + if cli.IsJson() { + cli.Printer.PrintJson(map[string]interface{}{ + jsonKey: mappingStatus, + }) + } else { + cli.Printer.PrintLn("\n") + cli.Printer.PrintLn(mappingTitle) + cli.Printer.Table(FormatOtelMappingStatusTable([]stackstate_api.OtelMappingStatusItem{ + mappingStatus.Item, + })) + + if mappingStatus.HasMetrics() { + cli.Printer.PrintLn("\n") + cli.Printer.PrintLn(metricsTitle) + size := mappingStatus.Metrics.BucketSizeSeconds + cli.Printer.Table(printer.TableData{ + Header: []string{"Metric", fmt.Sprintf("%ds ago", size), fmt.Sprintf("%d-%ds ago", size, 2*size), fmt.Sprintf("%d-%ds ago", 2*size, 3*size)}, //nolint:mnd + Data: [][]interface{}{ + printer.MetricBucketToRow("latency seconds", mappingStatus.Metrics.LatencySeconds), + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "metrics"}, + }) + } + + data := make([][]interface{}, len(mappingStatus.ErrorDetails)) + for i, error := range mappingStatus.ErrorDetails { + id := "-" + if error.HasIssueId() { + id = *error.IssueId + } + data[i] = []interface{}{id, error.Level, error.Message} + } + + cli.Printer.PrintLn("\n") + cli.Printer.PrintLn(errorsTitle) + cli.Printer.Table(printer.TableData{ + Header: []string{"Issue Id", "Level", "Message"}, + Data: data, + MissingTableDataMsg: printer.NotFoundMsg{Types: errorsNotFoundMsg}, + }) + } + + return nil + } +} diff --git a/cmd/otelmapping/test_data.go b/cmd/otelmapping/test_data.go new file mode 100644 index 00000000..79aeee76 --- /dev/null +++ b/cmd/otelmapping/test_data.go @@ -0,0 +1,53 @@ +package otelmapping + +import ( + "github.com/stackvista/stackstate-cli/generated/stackstate_api" +) + +const ( + TestMetricValue = float64(23.5) + TestComponentCount = int64(200) + TestRelationCount = int64(100) +) + +var ( + TestError1 = stackstate_api.NewOtelMappingError(stackstate_api.MESSAGELEVEL_WARN, "Oops") + TestError2 = stackstate_api.NewOtelMappingError(stackstate_api.MESSAGELEVEL_ERROR, "Oops2") + TestSomeErrors = []stackstate_api.OtelMappingError{ + *TestError1, + *TestError2, + } + TestMetricBucketValue = (func() *stackstate_api.MetricBucketValue { + v := stackstate_api.NewMetricBucketValue() + v.SetValue(float64(TestMetricValue)) + return v + })() + TestSomeMetrics = stackstate_api.OtelMappingMetrics{ + BucketSizeSeconds: 10, + LatencySeconds: []stackstate_api.MetricBucketValue{*TestMetricBucketValue, *TestMetricBucketValue, *TestMetricBucketValue}, + } + TestSomeOtelMappingStatusItem = (func() *stackstate_api.OtelMappingStatusItem { + v := stackstate_api.NewOtelMappingStatusItem("name", TestRelationCount, TestComponentCount) + v.SetIdentifier("identifier") + return v + })() + TestSomeOtelMappingStatus = (func() *stackstate_api.OtelMappingStatus { + v := stackstate_api.NewOtelMappingStatus(*TestSomeOtelMappingStatusItem, TestSomeErrors) + v.SetMetrics(TestSomeMetrics) + return v + })() +) + +var ( + TestSomeOtelMappingItem = (func() *stackstate_api.OtelMappingItem { + v := stackstate_api.NewOtelMappingItem("name") + v.SetIdentifier("identifier") + return v + })() + TestSomeOtelMappingItem2 = (func() *stackstate_api.OtelMappingItem { + v := stackstate_api.NewOtelMappingItem("name2") + v.SetIdentifier("identifier2") + return v + })() + TestAllMappingItems = []stackstate_api.OtelMappingItem{*TestSomeOtelMappingItem, *TestSomeOtelMappingItem2} +) diff --git a/cmd/otelrelationmapping.go b/cmd/otelrelationmapping.go new file mode 100644 index 00000000..39e02e3b --- /dev/null +++ b/cmd/otelrelationmapping.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/cmd/otelrelationmapping" + "github.com/stackvista/stackstate-cli/internal/di" +) + +func OtelRelationtMappingCommand(deps *di.Deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "otel-relation-mapping", + Short: "Manage the Otel Relation Mapping", + Long: "Manage the Otel Relation Mapping.", + } + + cmd.AddCommand(otelrelationmapping.OtelRelationMappingListCommand(deps)) + cmd.AddCommand(otelrelationmapping.OtelRelationMappingStatusCommand(deps)) + + return cmd +} diff --git a/cmd/otelrelationmapping/otelrelationmapping_list.go b/cmd/otelrelationmapping/otelrelationmapping_list.go new file mode 100644 index 00000000..399f4e51 --- /dev/null +++ b/cmd/otelrelationmapping/otelrelationmapping_list.go @@ -0,0 +1,43 @@ +package otelrelationmapping + +import ( + "sort" + + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/generated/stackstate_api" + "github.com/stackvista/stackstate-cli/internal/common" + "github.com/stackvista/stackstate-cli/internal/di" +) + +func OtelRelationMappingListCommand(deps *di.Deps) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Lists active Otel Component Mappings", + Long: "Lists active Otel Component Mappings.", + RunE: deps.CmdRunEWithApi(RunListComponentCommand), + } + + return cmd +} + +func RunListComponentCommand(cmd *cobra.Command, cli *di.Deps, api *stackstate_api.APIClient, serverInfo *stackstate_api.ServerInfo) common.CLIError { + mappingsList, resp, err := api.OtelMappingApi.GetOtelRelationMappings(cli.Context).Execute() + if err != nil { + return common.NewResponseError(err, resp) + } + + sort.SliceStable(mappingsList, func(i, j int) bool { + return mappingsList[i].Name < mappingsList[j].Name + }) + + if cli.IsJson() { + cli.Printer.PrintJson(map[string]interface{}{ + "otel relation mappings": mappingsList, + }) + } else { + cli.Printer.Table(otelmapping.FormatOtelMappingTable(mappingsList)) + } + + return nil +} diff --git a/cmd/otelrelationmapping/otelrelationmapping_list_test.go b/cmd/otelrelationmapping/otelrelationmapping_list_test.go new file mode 100644 index 00000000..77c4d814 --- /dev/null +++ b/cmd/otelrelationmapping/otelrelationmapping_list_test.go @@ -0,0 +1,53 @@ +package otelrelationmapping + +import ( + "testing" + + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/internal/di" + "github.com/stackvista/stackstate-cli/internal/printer" + "github.com/stretchr/testify/assert" +) + +func TestOtelRelationMappingListJson(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelRelationMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsResponse.Result = otelmapping.TestAllMappingItems + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "-o", "json") + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsCalls + assert.Len(t, calls, 1) + + expected := []map[string]interface{}{ + { + "otel relation mappings": otelmapping.TestAllMappingItems, + }, + } + + assert.Equal(t, expected, *cli.MockPrinter.PrintJsonCalls) +} + +func TestOtelRelationMappingListTable(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelRelationMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsResponse.Result = otelmapping.TestAllMappingItems + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd) + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsCalls + assert.Len(t, calls, 1) + + expectedTableCall := []printer.TableData{ + { + Header: []string{"Name", "Identifier"}, + Data: [][]interface{}{ + {otelmapping.TestSomeOtelMappingItem.Name, "identifier"}, + {otelmapping.TestSomeOtelMappingItem2.Name, "identifier2"}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, + }, + } + + assert.Equal(t, expectedTableCall, *cli.MockPrinter.TableCalls) +} diff --git a/cmd/otelrelationmapping/otelrelationmapping_status.go b/cmd/otelrelationmapping/otelrelationmapping_status.go new file mode 100644 index 00000000..dd9adafc --- /dev/null +++ b/cmd/otelrelationmapping/otelrelationmapping_status.go @@ -0,0 +1,23 @@ +package otelrelationmapping + +import ( + "github.com/spf13/cobra" + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/internal/common" + "github.com/stackvista/stackstate-cli/internal/di" +) + +// if cli.IsJson() { +// cli.Printer.PrintJson( + +func OtelRelationMappingStatusCommand(deps *di.Deps) *cobra.Command { + args := &otelmapping.StatusArgs{} + cmd := &cobra.Command{ + Use: "status", + Short: "Get the status of an Otel Relation Mappings", + Long: "Get the status of an Otel Relation Mappings.", + RunE: deps.CmdRunEWithApi(otelmapping.RunStatus(args, "relation", otelmapping.FetchRelationStatus)), + } + common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier of the Otel Relation Mapping") + return cmd +} diff --git a/cmd/otelrelationmapping/otelrelationmapping_status_test.go b/cmd/otelrelationmapping/otelrelationmapping_status_test.go new file mode 100644 index 00000000..42a9c19b --- /dev/null +++ b/cmd/otelrelationmapping/otelrelationmapping_status_test.go @@ -0,0 +1,67 @@ +package otelrelationmapping + +import ( + "testing" + + "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/internal/di" + "github.com/stackvista/stackstate-cli/internal/printer" + "github.com/stretchr/testify/assert" +) + +func TestOtelRelationMappingStatusJson(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelRelationMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier", "-o", "json") + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusCalls + assert.Len(t, calls, 1) + + expected := []map[string]interface{}{ + { + "otel-relation-mapping": otelmapping.TestSomeOtelMappingStatus, + }, + } + + assert.Equal(t, expected, *cli.MockPrinter.PrintJsonCalls) +} + +func TestOtelRelationMappingStatusTable(t *testing.T) { + cli := di.NewMockDeps(t) + cmd := OtelRelationMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + + di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier") + + calls := *cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusCalls + assert.Len(t, calls, 1) + + expectedTableCall := []printer.TableData{ + { + Header: []string{"Name", "Identifier", "Components", "Relations"}, + Data: [][]interface{}{ + {otelmapping.TestSomeOtelMappingStatusItem.Name, "identifier", otelmapping.TestComponentCount, otelmapping.TestRelationCount}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, + }, + { + Header: []string{"Metric", "10s ago", "10-20s ago", "20-30s ago"}, + Data: [][]interface{}{ + {"latency seconds", otelmapping.TestMetricValue, otelmapping.TestMetricValue, otelmapping.TestMetricValue}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "metrics"}, + }, + { + Header: []string{"Issue Id", "Level", "Message"}, + Data: [][]interface{}{ + {"-", otelmapping.TestError1.Level, otelmapping.TestError1.Message}, + {"-", otelmapping.TestError2.Level, otelmapping.TestError2.Message}, + }, + MissingTableDataMsg: printer.NotFoundMsg{Types: "otel relation mapping errors"}, + }, + } + + assert.Equal(t, expectedTableCall, *cli.MockPrinter.TableCalls) +} diff --git a/cmd/sts.go b/cmd/sts.go index 46d47356..3aa6ebe0 100644 --- a/cmd/sts.go +++ b/cmd/sts.go @@ -33,6 +33,12 @@ func STSCommand(cli *di.Deps) *cobra.Command { cmd.AddCommand(AgentCommand(cli)) cmd.AddCommand(UserSessionCommand(cli)) + // Experimental commands forotel mapping + if os.Getenv("STS_EXPERIMENTAL_OTEL_MAPPING") != "" { + cmd.AddCommand(OtelComponentMappingCommand(cli)) + cmd.AddCommand(OtelRelationtMappingCommand(cli)) + } + // Only add dashboard command if experimental feature is enabled if os.Getenv("STS_EXPERIMENTAL_DASHBOARD") != "" { cmd.AddCommand(DashboardCommand(cli)) diff --git a/generated/stackstate_api/.openapi-generator/FILES b/generated/stackstate_api/.openapi-generator/FILES index 345d1aac..dc2a0e85 100644 --- a/generated/stackstate_api/.openapi-generator/FILES +++ b/generated/stackstate_api/.openapi-generator/FILES @@ -21,6 +21,7 @@ api_monitor_check_status.go api_node.go api_notification_channels.go api_notification_configurations.go +api_otel_mapping.go api_permissions.go api_problem.go api_scripting.go @@ -290,6 +291,13 @@ docs/OpsgeniePriority.md docs/OpsgenieRegion.md docs/OpsgenieResponder.md docs/OpsgenieResponderType.md +docs/OtelMappingApi.md +docs/OtelMappingApiError.md +docs/OtelMappingError.md +docs/OtelMappingItem.md +docs/OtelMappingMetrics.md +docs/OtelMappingStatus.md +docs/OtelMappingStatusItem.md docs/PermissionDescription.md docs/Permissions.md docs/PermissionsApi.md @@ -696,6 +704,12 @@ model_opsgenie_priority.go model_opsgenie_region.go model_opsgenie_responder.go model_opsgenie_responder_type.go +model_otel_mapping_api_error.go +model_otel_mapping_error.go +model_otel_mapping_item.go +model_otel_mapping_metrics.go +model_otel_mapping_status.go +model_otel_mapping_status_item.go model_permission_description.go model_permissions.go model_perses_dashboard.go diff --git a/generated/stackstate_api/README.md b/generated/stackstate_api/README.md index 2d7ca968..4123cbd3 100644 --- a/generated/stackstate_api/README.md +++ b/generated/stackstate_api/README.md @@ -190,6 +190,10 @@ Class | Method | HTTP request | Description *NotificationConfigurationsApi* | [**GetNotificationConfigurationChannels**](docs/NotificationConfigurationsApi.md#getnotificationconfigurationchannels) | **Get** /notifications/configurations/{notificationConfigurationIdOrUrn}/channels | Get the channels for the notification configuration *NotificationConfigurationsApi* | [**GetNotificationConfigurations**](docs/NotificationConfigurationsApi.md#getnotificationconfigurations) | **Get** /notifications/configurations | Get all notification configurations *NotificationConfigurationsApi* | [**UpdateNotificationConfiguration**](docs/NotificationConfigurationsApi.md#updatenotificationconfiguration) | **Put** /notifications/configurations/{notificationConfigurationIdOrUrn} | Update the notification configuration +*OtelMappingApi* | [**GetOtelComponentMappingStatus**](docs/OtelMappingApi.md#getotelcomponentmappingstatus) | **Get** /otel-component-mappings/{identifier}/status | Get the status of an otel component mapping synchronization. +*OtelMappingApi* | [**GetOtelComponentMappings**](docs/OtelMappingApi.md#getotelcomponentmappings) | **Get** /otel-component-mappings | Get all otel component mappings. +*OtelMappingApi* | [**GetOtelRelationMappingStatus**](docs/OtelMappingApi.md#getotelrelationmappingstatus) | **Get** /otel-relation-mappings/{identifier}/status | Get the status of an otel relation mapping synchronization. +*OtelMappingApi* | [**GetOtelRelationMappings**](docs/OtelMappingApi.md#getotelrelationmappings) | **Get** /otel-relation-mappings | Get all otel relation mappings. *PermissionsApi* | [**DescribePermissions**](docs/PermissionsApi.md#describepermissions) | **Get** /security/permissions/{subject} | Describe permissions *PermissionsApi* | [**GetPermissions**](docs/PermissionsApi.md#getpermissions) | **Get** /security/permissions/list | List permissions *PermissionsApi* | [**GrantPermissions**](docs/PermissionsApi.md#grantpermissions) | **Post** /security/permissions/{subject} | Grant permissions @@ -470,6 +474,12 @@ Class | Method | HTTP request | Description - [OpsgenieRegion](docs/OpsgenieRegion.md) - [OpsgenieResponder](docs/OpsgenieResponder.md) - [OpsgenieResponderType](docs/OpsgenieResponderType.md) + - [OtelMappingApiError](docs/OtelMappingApiError.md) + - [OtelMappingError](docs/OtelMappingError.md) + - [OtelMappingItem](docs/OtelMappingItem.md) + - [OtelMappingMetrics](docs/OtelMappingMetrics.md) + - [OtelMappingStatus](docs/OtelMappingStatus.md) + - [OtelMappingStatusItem](docs/OtelMappingStatusItem.md) - [PermissionDescription](docs/PermissionDescription.md) - [Permissions](docs/Permissions.md) - [PersesDashboard](docs/PersesDashboard.md) diff --git a/generated/stackstate_api/api/openapi.yaml b/generated/stackstate_api/api/openapi.yaml index 02cdf818..d32b1252 100644 --- a/generated/stackstate_api/api/openapi.yaml +++ b/generated/stackstate_api/api/openapi.yaml @@ -5836,6 +5836,122 @@ paths: summary: Clone a dashboard tags: - dashboards + /otel-component-mappings: + get: + operationId: getOtelComponentMappings + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/OtelMappingItem' + type: array + description: A list of all Otel Component Mappings + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Error when handling the request on the server side. + summary: Get all otel component mappings. + tags: + - otelMapping + /otel-component-mappings/{identifier}/status: + get: + operationId: getOtelComponentMappingStatus + parameters: + - in: path + name: identifier + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingStatus' + description: Otel Component Mappping Status data + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Otel mapping with given identifier not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Error when handling the request on the server side. + summary: Get the status of an otel component mapping synchronization. + tags: + - otelMapping + parameters: + - in: path + name: identifier + required: true + schema: + type: string + /otel-relation-mappings: + get: + operationId: getOtelRelationMappings + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/OtelMappingItem' + type: array + description: A list of all Otel Relation Mappings + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Error when handling the request on the server side. + summary: Get all otel relation mappings. + tags: + - otelMapping + /otel-relation-mappings/{identifier}/status: + get: + operationId: getOtelRelationMappingStatus + parameters: + - in: path + name: identifier + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingStatus' + description: Otel Relation Mapping Status data + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Otel mapping with given identifier not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Error when handling the request on the server side. + summary: Get the status of an otel relation mapping synchronization. + tags: + - otelMapping + parameters: + - in: path + name: identifier + required: true + schema: + type: string /dummy/dummy: get: description: "" @@ -6614,6 +6730,18 @@ components: schema: $ref: '#/components/schemas/DashboardAuthorizationError' description: Dashboard not found. + OtelMappingErrorResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Error when handling the request on the server side. + OtelMappingNotFound: + content: + application/json: + schema: + $ref: '#/components/schemas/OtelMappingApiError' + description: Otel mapping with given identifier not found stackElementNotFound: content: application/json: @@ -13867,6 +13995,116 @@ components: required: - name type: object + OtelMappingItem: + example: + identifier: identifier + name: name + properties: + name: + type: string + identifier: + type: string + required: + - name + type: object + OtelMappingApiError: + properties: + message: + type: string + required: + - message + type: object + OtelMappingStatus: + example: + item: + identifier: identifier + componentCount: 6 + name: name + relationCount: 0 + metrics: + latencySeconds: + - value: 5.637376656633329 + - value: 5.637376656633329 + bucketSizeSeconds: 1 + errorDetails: + - issueId: issueId + level: null + message: message + - issueId: issueId + level: null + message: message + properties: + item: + $ref: '#/components/schemas/OtelMappingStatusItem' + errorDetails: + items: + $ref: '#/components/schemas/OtelMappingError' + type: array + metrics: + $ref: '#/components/schemas/OtelMappingMetrics' + required: + - errorDetails + - item + type: object + OtelMappingStatusItem: + example: + identifier: identifier + componentCount: 6 + name: name + relationCount: 0 + properties: + name: + type: string + identifier: + type: string + relationCount: + format: int64 + type: integer + componentCount: + format: int64 + type: integer + required: + - componentCount + - name + - relationCount + - status + type: object + OtelMappingErrors: + items: + $ref: '#/components/schemas/OtelMappingError' + type: array + OtelMappingError: + example: + issueId: issueId + level: null + message: message + properties: + level: + $ref: '#/components/schemas/MessageLevel' + message: + type: string + issueId: + type: string + required: + - level + - message + type: object + OtelMappingMetrics: + example: + latencySeconds: + - value: 5.637376656633329 + - value: 5.637376656633329 + bucketSizeSeconds: 1 + properties: + bucketSizeSeconds: + type: integer + latencySeconds: + items: + $ref: '#/components/schemas/MetricBucketValue' + type: array + required: + - bucketSizeSeconds + type: object StackElementNotFound: discriminator: propertyName: _type diff --git a/generated/stackstate_api/api_otel_mapping.go b/generated/stackstate_api/api_otel_mapping.go new file mode 100644 index 00000000..1b406d68 --- /dev/null +++ b/generated/stackstate_api/api_otel_mapping.go @@ -0,0 +1,821 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +type OtelMappingApi interface { + + /* + GetOtelComponentMappingStatus Get the status of an otel component mapping synchronization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param identifier + @return ApiGetOtelComponentMappingStatusRequest + */ + GetOtelComponentMappingStatus(ctx context.Context, identifier string) ApiGetOtelComponentMappingStatusRequest + + // GetOtelComponentMappingStatusExecute executes the request + // @return OtelMappingStatus + GetOtelComponentMappingStatusExecute(r ApiGetOtelComponentMappingStatusRequest) (*OtelMappingStatus, *http.Response, error) + + /* + GetOtelComponentMappings Get all otel component mappings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetOtelComponentMappingsRequest + */ + GetOtelComponentMappings(ctx context.Context) ApiGetOtelComponentMappingsRequest + + // GetOtelComponentMappingsExecute executes the request + // @return []OtelMappingItem + GetOtelComponentMappingsExecute(r ApiGetOtelComponentMappingsRequest) ([]OtelMappingItem, *http.Response, error) + + /* + GetOtelRelationMappingStatus Get the status of an otel relation mapping synchronization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param identifier + @return ApiGetOtelRelationMappingStatusRequest + */ + GetOtelRelationMappingStatus(ctx context.Context, identifier string) ApiGetOtelRelationMappingStatusRequest + + // GetOtelRelationMappingStatusExecute executes the request + // @return OtelMappingStatus + GetOtelRelationMappingStatusExecute(r ApiGetOtelRelationMappingStatusRequest) (*OtelMappingStatus, *http.Response, error) + + /* + GetOtelRelationMappings Get all otel relation mappings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetOtelRelationMappingsRequest + */ + GetOtelRelationMappings(ctx context.Context) ApiGetOtelRelationMappingsRequest + + // GetOtelRelationMappingsExecute executes the request + // @return []OtelMappingItem + GetOtelRelationMappingsExecute(r ApiGetOtelRelationMappingsRequest) ([]OtelMappingItem, *http.Response, error) +} + +// OtelMappingApiService OtelMappingApi service +type OtelMappingApiService service + +type ApiGetOtelComponentMappingStatusRequest struct { + ctx context.Context + ApiService OtelMappingApi + identifier string +} + +func (r ApiGetOtelComponentMappingStatusRequest) Execute() (*OtelMappingStatus, *http.Response, error) { + return r.ApiService.GetOtelComponentMappingStatusExecute(r) +} + +/* +GetOtelComponentMappingStatus Get the status of an otel component mapping synchronization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param identifier + @return ApiGetOtelComponentMappingStatusRequest +*/ +func (a *OtelMappingApiService) GetOtelComponentMappingStatus(ctx context.Context, identifier string) ApiGetOtelComponentMappingStatusRequest { + return ApiGetOtelComponentMappingStatusRequest{ + ApiService: a, + ctx: ctx, + identifier: identifier, + } +} + +// Execute executes the request +// @return OtelMappingStatus +func (a *OtelMappingApiService) GetOtelComponentMappingStatusExecute(r ApiGetOtelComponentMappingStatusRequest) (*OtelMappingStatus, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OtelMappingStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OtelMappingApiService.GetOtelComponentMappingStatus") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/otel-component-mappings/{identifier}/status" + localVarPath = strings.Replace(localVarPath, "{"+"identifier"+"}", url.PathEscape(parameterToString(r.identifier, "")), -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 == 404 { + var v OtelMappingApiError + 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 OtelMappingApiError + 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 +} + +type ApiGetOtelComponentMappingsRequest struct { + ctx context.Context + ApiService OtelMappingApi +} + +func (r ApiGetOtelComponentMappingsRequest) Execute() ([]OtelMappingItem, *http.Response, error) { + return r.ApiService.GetOtelComponentMappingsExecute(r) +} + +/* +GetOtelComponentMappings Get all otel component mappings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetOtelComponentMappingsRequest +*/ +func (a *OtelMappingApiService) GetOtelComponentMappings(ctx context.Context) ApiGetOtelComponentMappingsRequest { + return ApiGetOtelComponentMappingsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []OtelMappingItem +func (a *OtelMappingApiService) GetOtelComponentMappingsExecute(r ApiGetOtelComponentMappingsRequest) ([]OtelMappingItem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []OtelMappingItem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OtelMappingApiService.GetOtelComponentMappings") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/otel-component-mappings" + + 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 == 500 { + var v OtelMappingApiError + 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 +} + +type ApiGetOtelRelationMappingStatusRequest struct { + ctx context.Context + ApiService OtelMappingApi + identifier string +} + +func (r ApiGetOtelRelationMappingStatusRequest) Execute() (*OtelMappingStatus, *http.Response, error) { + return r.ApiService.GetOtelRelationMappingStatusExecute(r) +} + +/* +GetOtelRelationMappingStatus Get the status of an otel relation mapping synchronization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param identifier + @return ApiGetOtelRelationMappingStatusRequest +*/ +func (a *OtelMappingApiService) GetOtelRelationMappingStatus(ctx context.Context, identifier string) ApiGetOtelRelationMappingStatusRequest { + return ApiGetOtelRelationMappingStatusRequest{ + ApiService: a, + ctx: ctx, + identifier: identifier, + } +} + +// Execute executes the request +// @return OtelMappingStatus +func (a *OtelMappingApiService) GetOtelRelationMappingStatusExecute(r ApiGetOtelRelationMappingStatusRequest) (*OtelMappingStatus, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OtelMappingStatus + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OtelMappingApiService.GetOtelRelationMappingStatus") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/otel-relation-mappings/{identifier}/status" + localVarPath = strings.Replace(localVarPath, "{"+"identifier"+"}", url.PathEscape(parameterToString(r.identifier, "")), -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 == 404 { + var v OtelMappingApiError + 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 OtelMappingApiError + 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 +} + +type ApiGetOtelRelationMappingsRequest struct { + ctx context.Context + ApiService OtelMappingApi +} + +func (r ApiGetOtelRelationMappingsRequest) Execute() ([]OtelMappingItem, *http.Response, error) { + return r.ApiService.GetOtelRelationMappingsExecute(r) +} + +/* +GetOtelRelationMappings Get all otel relation mappings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetOtelRelationMappingsRequest +*/ +func (a *OtelMappingApiService) GetOtelRelationMappings(ctx context.Context) ApiGetOtelRelationMappingsRequest { + return ApiGetOtelRelationMappingsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []OtelMappingItem +func (a *OtelMappingApiService) GetOtelRelationMappingsExecute(r ApiGetOtelRelationMappingsRequest) ([]OtelMappingItem, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []OtelMappingItem + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OtelMappingApiService.GetOtelRelationMappings") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/otel-relation-mappings" + + 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 == 500 { + var v OtelMappingApiError + 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 -------------------- +// --------------------------------------------- + +type OtelMappingApiMock struct { + GetOtelComponentMappingStatusCalls *[]GetOtelComponentMappingStatusCall + GetOtelComponentMappingStatusResponse GetOtelComponentMappingStatusMockResponse + GetOtelComponentMappingsCalls *[]GetOtelComponentMappingsCall + GetOtelComponentMappingsResponse GetOtelComponentMappingsMockResponse + GetOtelRelationMappingStatusCalls *[]GetOtelRelationMappingStatusCall + GetOtelRelationMappingStatusResponse GetOtelRelationMappingStatusMockResponse + GetOtelRelationMappingsCalls *[]GetOtelRelationMappingsCall + GetOtelRelationMappingsResponse GetOtelRelationMappingsMockResponse +} + +func NewOtelMappingApiMock() OtelMappingApiMock { + xGetOtelComponentMappingStatusCalls := make([]GetOtelComponentMappingStatusCall, 0) + xGetOtelComponentMappingsCalls := make([]GetOtelComponentMappingsCall, 0) + xGetOtelRelationMappingStatusCalls := make([]GetOtelRelationMappingStatusCall, 0) + xGetOtelRelationMappingsCalls := make([]GetOtelRelationMappingsCall, 0) + return OtelMappingApiMock{ + GetOtelComponentMappingStatusCalls: &xGetOtelComponentMappingStatusCalls, + GetOtelComponentMappingsCalls: &xGetOtelComponentMappingsCalls, + GetOtelRelationMappingStatusCalls: &xGetOtelRelationMappingStatusCalls, + GetOtelRelationMappingsCalls: &xGetOtelRelationMappingsCalls, + } +} + +type GetOtelComponentMappingStatusMockResponse struct { + Result OtelMappingStatus + Response *http.Response + Error error +} + +type GetOtelComponentMappingStatusCall struct { + Pidentifier string +} + +func (mock OtelMappingApiMock) GetOtelComponentMappingStatus(ctx context.Context, identifier string) ApiGetOtelComponentMappingStatusRequest { + return ApiGetOtelComponentMappingStatusRequest{ + ApiService: mock, + ctx: ctx, + identifier: identifier, + } +} + +func (mock OtelMappingApiMock) GetOtelComponentMappingStatusExecute(r ApiGetOtelComponentMappingStatusRequest) (*OtelMappingStatus, *http.Response, error) { + p := GetOtelComponentMappingStatusCall{ + Pidentifier: r.identifier, + } + *mock.GetOtelComponentMappingStatusCalls = append(*mock.GetOtelComponentMappingStatusCalls, p) + return &mock.GetOtelComponentMappingStatusResponse.Result, mock.GetOtelComponentMappingStatusResponse.Response, mock.GetOtelComponentMappingStatusResponse.Error +} + +type GetOtelComponentMappingsMockResponse struct { + Result []OtelMappingItem + Response *http.Response + Error error +} + +type GetOtelComponentMappingsCall struct { +} + +func (mock OtelMappingApiMock) GetOtelComponentMappings(ctx context.Context) ApiGetOtelComponentMappingsRequest { + return ApiGetOtelComponentMappingsRequest{ + ApiService: mock, + ctx: ctx, + } +} + +func (mock OtelMappingApiMock) GetOtelComponentMappingsExecute(r ApiGetOtelComponentMappingsRequest) ([]OtelMappingItem, *http.Response, error) { + p := GetOtelComponentMappingsCall{} + *mock.GetOtelComponentMappingsCalls = append(*mock.GetOtelComponentMappingsCalls, p) + return mock.GetOtelComponentMappingsResponse.Result, mock.GetOtelComponentMappingsResponse.Response, mock.GetOtelComponentMappingsResponse.Error +} + +type GetOtelRelationMappingStatusMockResponse struct { + Result OtelMappingStatus + Response *http.Response + Error error +} + +type GetOtelRelationMappingStatusCall struct { + Pidentifier string +} + +func (mock OtelMappingApiMock) GetOtelRelationMappingStatus(ctx context.Context, identifier string) ApiGetOtelRelationMappingStatusRequest { + return ApiGetOtelRelationMappingStatusRequest{ + ApiService: mock, + ctx: ctx, + identifier: identifier, + } +} + +func (mock OtelMappingApiMock) GetOtelRelationMappingStatusExecute(r ApiGetOtelRelationMappingStatusRequest) (*OtelMappingStatus, *http.Response, error) { + p := GetOtelRelationMappingStatusCall{ + Pidentifier: r.identifier, + } + *mock.GetOtelRelationMappingStatusCalls = append(*mock.GetOtelRelationMappingStatusCalls, p) + return &mock.GetOtelRelationMappingStatusResponse.Result, mock.GetOtelRelationMappingStatusResponse.Response, mock.GetOtelRelationMappingStatusResponse.Error +} + +type GetOtelRelationMappingsMockResponse struct { + Result []OtelMappingItem + Response *http.Response + Error error +} + +type GetOtelRelationMappingsCall struct { +} + +func (mock OtelMappingApiMock) GetOtelRelationMappings(ctx context.Context) ApiGetOtelRelationMappingsRequest { + return ApiGetOtelRelationMappingsRequest{ + ApiService: mock, + ctx: ctx, + } +} + +func (mock OtelMappingApiMock) GetOtelRelationMappingsExecute(r ApiGetOtelRelationMappingsRequest) ([]OtelMappingItem, *http.Response, error) { + p := GetOtelRelationMappingsCall{} + *mock.GetOtelRelationMappingsCalls = append(*mock.GetOtelRelationMappingsCalls, p) + return mock.GetOtelRelationMappingsResponse.Result, mock.GetOtelRelationMappingsResponse.Response, mock.GetOtelRelationMappingsResponse.Error +} diff --git a/generated/stackstate_api/client.go b/generated/stackstate_api/client.go index 02b8c83f..61b4a982 100644 --- a/generated/stackstate_api/client.go +++ b/generated/stackstate_api/client.go @@ -86,6 +86,8 @@ type APIClient struct { NotificationConfigurationsApi NotificationConfigurationsApi + OtelMappingApi OtelMappingApi + PermissionsApi PermissionsApi ProblemApi ProblemApi @@ -153,6 +155,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.NodeApi = (*NodeApiService)(&c.common) c.NotificationChannelsApi = (*NotificationChannelsApiService)(&c.common) c.NotificationConfigurationsApi = (*NotificationConfigurationsApiService)(&c.common) + c.OtelMappingApi = (*OtelMappingApiService)(&c.common) c.PermissionsApi = (*PermissionsApiService)(&c.common) c.ProblemApi = (*ProblemApiService)(&c.common) c.ScriptingApi = (*ScriptingApiService)(&c.common) diff --git a/generated/stackstate_api/docs/OtelMappingApi.md b/generated/stackstate_api/docs/OtelMappingApi.md new file mode 100644 index 00000000..ec7fd2a1 --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingApi.md @@ -0,0 +1,266 @@ +# \OtelMappingApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetOtelComponentMappingStatus**](OtelMappingApi.md#GetOtelComponentMappingStatus) | **Get** /otel-component-mappings/{identifier}/status | Get the status of an otel component mapping synchronization. +[**GetOtelComponentMappings**](OtelMappingApi.md#GetOtelComponentMappings) | **Get** /otel-component-mappings | Get all otel component mappings. +[**GetOtelRelationMappingStatus**](OtelMappingApi.md#GetOtelRelationMappingStatus) | **Get** /otel-relation-mappings/{identifier}/status | Get the status of an otel relation mapping synchronization. +[**GetOtelRelationMappings**](OtelMappingApi.md#GetOtelRelationMappings) | **Get** /otel-relation-mappings | Get all otel relation mappings. + + + +## GetOtelComponentMappingStatus + +> OtelMappingStatus GetOtelComponentMappingStatus(ctx, identifier).Execute() + +Get the status of an otel component mapping synchronization. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + identifier := "identifier_example" // string | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.OtelMappingApi.GetOtelComponentMappingStatus(context.Background(), identifier).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OtelMappingApi.GetOtelComponentMappingStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOtelComponentMappingStatus`: OtelMappingStatus + fmt.Fprintf(os.Stdout, "Response from `OtelMappingApi.GetOtelComponentMappingStatus`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**identifier** | **string** | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOtelComponentMappingStatusRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**OtelMappingStatus**](OtelMappingStatus.md) + +### 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) + + +## GetOtelComponentMappings + +> []OtelMappingItem GetOtelComponentMappings(ctx).Execute() + +Get all otel component mappings. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.OtelMappingApi.GetOtelComponentMappings(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OtelMappingApi.GetOtelComponentMappings``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOtelComponentMappings`: []OtelMappingItem + fmt.Fprintf(os.Stdout, "Response from `OtelMappingApi.GetOtelComponentMappings`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOtelComponentMappingsRequest struct via the builder pattern + + +### Return type + +[**[]OtelMappingItem**](OtelMappingItem.md) + +### 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) + + +## GetOtelRelationMappingStatus + +> OtelMappingStatus GetOtelRelationMappingStatus(ctx, identifier).Execute() + +Get the status of an otel relation mapping synchronization. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + identifier := "identifier_example" // string | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.OtelMappingApi.GetOtelRelationMappingStatus(context.Background(), identifier).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OtelMappingApi.GetOtelRelationMappingStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOtelRelationMappingStatus`: OtelMappingStatus + fmt.Fprintf(os.Stdout, "Response from `OtelMappingApi.GetOtelRelationMappingStatus`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**identifier** | **string** | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOtelRelationMappingStatusRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**OtelMappingStatus**](OtelMappingStatus.md) + +### 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) + + +## GetOtelRelationMappings + +> []OtelMappingItem GetOtelRelationMappings(ctx).Execute() + +Get all otel relation mappings. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.OtelMappingApi.GetOtelRelationMappings(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OtelMappingApi.GetOtelRelationMappings``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOtelRelationMappings`: []OtelMappingItem + fmt.Fprintf(os.Stdout, "Response from `OtelMappingApi.GetOtelRelationMappings`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOtelRelationMappingsRequest struct via the builder pattern + + +### Return type + +[**[]OtelMappingItem**](OtelMappingItem.md) + +### 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/docs/OtelMappingApiError.md b/generated/stackstate_api/docs/OtelMappingApiError.md new file mode 100644 index 00000000..781f8eda --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingApiError.md @@ -0,0 +1,51 @@ +# OtelMappingApiError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **string** | | + +## Methods + +### NewOtelMappingApiError + +`func NewOtelMappingApiError(message string, ) *OtelMappingApiError` + +NewOtelMappingApiError instantiates a new OtelMappingApiError object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOtelMappingApiErrorWithDefaults + +`func NewOtelMappingApiErrorWithDefaults() *OtelMappingApiError` + +NewOtelMappingApiErrorWithDefaults instantiates a new OtelMappingApiError object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMessage + +`func (o *OtelMappingApiError) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *OtelMappingApiError) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *OtelMappingApiError) SetMessage(v string)` + +SetMessage sets Message field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/stackstate_api/docs/OtelMappingError.md b/generated/stackstate_api/docs/OtelMappingError.md new file mode 100644 index 00000000..03c843b9 --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingError.md @@ -0,0 +1,98 @@ +# OtelMappingError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Level** | [**MessageLevel**](MessageLevel.md) | | +**Message** | **string** | | +**IssueId** | Pointer to **string** | | [optional] + +## Methods + +### NewOtelMappingError + +`func NewOtelMappingError(level MessageLevel, message string, ) *OtelMappingError` + +NewOtelMappingError instantiates a new OtelMappingError object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOtelMappingErrorWithDefaults + +`func NewOtelMappingErrorWithDefaults() *OtelMappingError` + +NewOtelMappingErrorWithDefaults instantiates a new OtelMappingError object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLevel + +`func (o *OtelMappingError) GetLevel() MessageLevel` + +GetLevel returns the Level field if non-nil, zero value otherwise. + +### GetLevelOk + +`func (o *OtelMappingError) GetLevelOk() (*MessageLevel, bool)` + +GetLevelOk returns a tuple with the Level field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLevel + +`func (o *OtelMappingError) SetLevel(v MessageLevel)` + +SetLevel sets Level field to given value. + + +### GetMessage + +`func (o *OtelMappingError) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *OtelMappingError) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *OtelMappingError) SetMessage(v string)` + +SetMessage sets Message field to given value. + + +### GetIssueId + +`func (o *OtelMappingError) GetIssueId() string` + +GetIssueId returns the IssueId field if non-nil, zero value otherwise. + +### GetIssueIdOk + +`func (o *OtelMappingError) GetIssueIdOk() (*string, bool)` + +GetIssueIdOk returns a tuple with the IssueId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIssueId + +`func (o *OtelMappingError) SetIssueId(v string)` + +SetIssueId sets IssueId field to given value. + +### HasIssueId + +`func (o *OtelMappingError) HasIssueId() bool` + +HasIssueId 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/OtelMappingItem.md b/generated/stackstate_api/docs/OtelMappingItem.md new file mode 100644 index 00000000..19dcb1f5 --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingItem.md @@ -0,0 +1,77 @@ +# OtelMappingItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**Identifier** | Pointer to **string** | | [optional] + +## Methods + +### NewOtelMappingItem + +`func NewOtelMappingItem(name string, ) *OtelMappingItem` + +NewOtelMappingItem instantiates a new OtelMappingItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOtelMappingItemWithDefaults + +`func NewOtelMappingItemWithDefaults() *OtelMappingItem` + +NewOtelMappingItemWithDefaults instantiates a new OtelMappingItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *OtelMappingItem) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *OtelMappingItem) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *OtelMappingItem) SetName(v string)` + +SetName sets Name field to given value. + + +### GetIdentifier + +`func (o *OtelMappingItem) GetIdentifier() string` + +GetIdentifier returns the Identifier field if non-nil, zero value otherwise. + +### GetIdentifierOk + +`func (o *OtelMappingItem) GetIdentifierOk() (*string, bool)` + +GetIdentifierOk returns a tuple with the Identifier field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIdentifier + +`func (o *OtelMappingItem) SetIdentifier(v string)` + +SetIdentifier sets Identifier field to given value. + +### HasIdentifier + +`func (o *OtelMappingItem) HasIdentifier() bool` + +HasIdentifier 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/OtelMappingMetrics.md b/generated/stackstate_api/docs/OtelMappingMetrics.md new file mode 100644 index 00000000..cb790a24 --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingMetrics.md @@ -0,0 +1,77 @@ +# OtelMappingMetrics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BucketSizeSeconds** | **int32** | | +**LatencySeconds** | Pointer to [**[]MetricBucketValue**](MetricBucketValue.md) | | [optional] + +## Methods + +### NewOtelMappingMetrics + +`func NewOtelMappingMetrics(bucketSizeSeconds int32, ) *OtelMappingMetrics` + +NewOtelMappingMetrics instantiates a new OtelMappingMetrics object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOtelMappingMetricsWithDefaults + +`func NewOtelMappingMetricsWithDefaults() *OtelMappingMetrics` + +NewOtelMappingMetricsWithDefaults instantiates a new OtelMappingMetrics object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBucketSizeSeconds + +`func (o *OtelMappingMetrics) GetBucketSizeSeconds() int32` + +GetBucketSizeSeconds returns the BucketSizeSeconds field if non-nil, zero value otherwise. + +### GetBucketSizeSecondsOk + +`func (o *OtelMappingMetrics) GetBucketSizeSecondsOk() (*int32, bool)` + +GetBucketSizeSecondsOk returns a tuple with the BucketSizeSeconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBucketSizeSeconds + +`func (o *OtelMappingMetrics) SetBucketSizeSeconds(v int32)` + +SetBucketSizeSeconds sets BucketSizeSeconds field to given value. + + +### GetLatencySeconds + +`func (o *OtelMappingMetrics) GetLatencySeconds() []MetricBucketValue` + +GetLatencySeconds returns the LatencySeconds field if non-nil, zero value otherwise. + +### GetLatencySecondsOk + +`func (o *OtelMappingMetrics) GetLatencySecondsOk() (*[]MetricBucketValue, bool)` + +GetLatencySecondsOk returns a tuple with the LatencySeconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLatencySeconds + +`func (o *OtelMappingMetrics) SetLatencySeconds(v []MetricBucketValue)` + +SetLatencySeconds sets LatencySeconds field to given value. + +### HasLatencySeconds + +`func (o *OtelMappingMetrics) HasLatencySeconds() bool` + +HasLatencySeconds 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/OtelMappingStatus.md b/generated/stackstate_api/docs/OtelMappingStatus.md new file mode 100644 index 00000000..f69c2c6c --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingStatus.md @@ -0,0 +1,98 @@ +# OtelMappingStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Item** | [**OtelMappingStatusItem**](OtelMappingStatusItem.md) | | +**ErrorDetails** | [**[]OtelMappingError**](OtelMappingError.md) | | +**Metrics** | Pointer to [**OtelMappingMetrics**](OtelMappingMetrics.md) | | [optional] + +## Methods + +### NewOtelMappingStatus + +`func NewOtelMappingStatus(item OtelMappingStatusItem, errorDetails []OtelMappingError, ) *OtelMappingStatus` + +NewOtelMappingStatus instantiates a new OtelMappingStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOtelMappingStatusWithDefaults + +`func NewOtelMappingStatusWithDefaults() *OtelMappingStatus` + +NewOtelMappingStatusWithDefaults instantiates a new OtelMappingStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetItem + +`func (o *OtelMappingStatus) GetItem() OtelMappingStatusItem` + +GetItem returns the Item field if non-nil, zero value otherwise. + +### GetItemOk + +`func (o *OtelMappingStatus) GetItemOk() (*OtelMappingStatusItem, bool)` + +GetItemOk returns a tuple with the Item field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetItem + +`func (o *OtelMappingStatus) SetItem(v OtelMappingStatusItem)` + +SetItem sets Item field to given value. + + +### GetErrorDetails + +`func (o *OtelMappingStatus) GetErrorDetails() []OtelMappingError` + +GetErrorDetails returns the ErrorDetails field if non-nil, zero value otherwise. + +### GetErrorDetailsOk + +`func (o *OtelMappingStatus) GetErrorDetailsOk() (*[]OtelMappingError, bool)` + +GetErrorDetailsOk returns a tuple with the ErrorDetails field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorDetails + +`func (o *OtelMappingStatus) SetErrorDetails(v []OtelMappingError)` + +SetErrorDetails sets ErrorDetails field to given value. + + +### GetMetrics + +`func (o *OtelMappingStatus) GetMetrics() OtelMappingMetrics` + +GetMetrics returns the Metrics field if non-nil, zero value otherwise. + +### GetMetricsOk + +`func (o *OtelMappingStatus) GetMetricsOk() (*OtelMappingMetrics, bool)` + +GetMetricsOk returns a tuple with the Metrics field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetrics + +`func (o *OtelMappingStatus) SetMetrics(v OtelMappingMetrics)` + +SetMetrics sets Metrics field to given value. + +### HasMetrics + +`func (o *OtelMappingStatus) HasMetrics() bool` + +HasMetrics 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/OtelMappingStatusItem.md b/generated/stackstate_api/docs/OtelMappingStatusItem.md new file mode 100644 index 00000000..f6e4a64e --- /dev/null +++ b/generated/stackstate_api/docs/OtelMappingStatusItem.md @@ -0,0 +1,119 @@ +# OtelMappingStatusItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**Identifier** | Pointer to **string** | | [optional] +**RelationCount** | **int64** | | +**ComponentCount** | **int64** | | + +## Methods + +### NewOtelMappingStatusItem + +`func NewOtelMappingStatusItem(name string, relationCount int64, componentCount int64, ) *OtelMappingStatusItem` + +NewOtelMappingStatusItem instantiates a new OtelMappingStatusItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOtelMappingStatusItemWithDefaults + +`func NewOtelMappingStatusItemWithDefaults() *OtelMappingStatusItem` + +NewOtelMappingStatusItemWithDefaults instantiates a new OtelMappingStatusItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *OtelMappingStatusItem) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *OtelMappingStatusItem) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *OtelMappingStatusItem) SetName(v string)` + +SetName sets Name field to given value. + + +### GetIdentifier + +`func (o *OtelMappingStatusItem) GetIdentifier() string` + +GetIdentifier returns the Identifier field if non-nil, zero value otherwise. + +### GetIdentifierOk + +`func (o *OtelMappingStatusItem) GetIdentifierOk() (*string, bool)` + +GetIdentifierOk returns a tuple with the Identifier field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIdentifier + +`func (o *OtelMappingStatusItem) SetIdentifier(v string)` + +SetIdentifier sets Identifier field to given value. + +### HasIdentifier + +`func (o *OtelMappingStatusItem) HasIdentifier() bool` + +HasIdentifier returns a boolean if a field has been set. + +### GetRelationCount + +`func (o *OtelMappingStatusItem) GetRelationCount() int64` + +GetRelationCount returns the RelationCount field if non-nil, zero value otherwise. + +### GetRelationCountOk + +`func (o *OtelMappingStatusItem) GetRelationCountOk() (*int64, bool)` + +GetRelationCountOk returns a tuple with the RelationCount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelationCount + +`func (o *OtelMappingStatusItem) SetRelationCount(v int64)` + +SetRelationCount sets RelationCount field to given value. + + +### GetComponentCount + +`func (o *OtelMappingStatusItem) GetComponentCount() int64` + +GetComponentCount returns the ComponentCount field if non-nil, zero value otherwise. + +### GetComponentCountOk + +`func (o *OtelMappingStatusItem) GetComponentCountOk() (*int64, bool)` + +GetComponentCountOk returns a tuple with the ComponentCount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComponentCount + +`func (o *OtelMappingStatusItem) SetComponentCount(v int64)` + +SetComponentCount sets ComponentCount field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/stackstate_api/model_otel_mapping_api_error.go b/generated/stackstate_api/model_otel_mapping_api_error.go new file mode 100644 index 00000000..47f573d5 --- /dev/null +++ b/generated/stackstate_api/model_otel_mapping_api_error.go @@ -0,0 +1,107 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" +) + +// OtelMappingApiError struct for OtelMappingApiError +type OtelMappingApiError struct { + Message string `json:"message"` +} + +// NewOtelMappingApiError instantiates a new OtelMappingApiError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtelMappingApiError(message string) *OtelMappingApiError { + this := OtelMappingApiError{} + this.Message = message + return &this +} + +// NewOtelMappingApiErrorWithDefaults instantiates a new OtelMappingApiError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtelMappingApiErrorWithDefaults() *OtelMappingApiError { + this := OtelMappingApiError{} + return &this +} + +// GetMessage returns the Message field value +func (o *OtelMappingApiError) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *OtelMappingApiError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *OtelMappingApiError) SetMessage(v string) { + o.Message = v +} + +func (o OtelMappingApiError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["message"] = o.Message + } + return json.Marshal(toSerialize) +} + +type NullableOtelMappingApiError struct { + value *OtelMappingApiError + isSet bool +} + +func (v NullableOtelMappingApiError) Get() *OtelMappingApiError { + return v.value +} + +func (v *NullableOtelMappingApiError) Set(val *OtelMappingApiError) { + v.value = val + v.isSet = true +} + +func (v NullableOtelMappingApiError) IsSet() bool { + return v.isSet +} + +func (v *NullableOtelMappingApiError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtelMappingApiError(val *OtelMappingApiError) *NullableOtelMappingApiError { + return &NullableOtelMappingApiError{value: val, isSet: true} +} + +func (v NullableOtelMappingApiError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtelMappingApiError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/stackstate_api/model_otel_mapping_error.go b/generated/stackstate_api/model_otel_mapping_error.go new file mode 100644 index 00000000..a484ad2e --- /dev/null +++ b/generated/stackstate_api/model_otel_mapping_error.go @@ -0,0 +1,172 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" +) + +// OtelMappingError struct for OtelMappingError +type OtelMappingError struct { + Level MessageLevel `json:"level"` + Message string `json:"message"` + IssueId *string `json:"issueId,omitempty"` +} + +// NewOtelMappingError instantiates a new OtelMappingError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtelMappingError(level MessageLevel, message string) *OtelMappingError { + this := OtelMappingError{} + this.Level = level + this.Message = message + return &this +} + +// NewOtelMappingErrorWithDefaults instantiates a new OtelMappingError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtelMappingErrorWithDefaults() *OtelMappingError { + this := OtelMappingError{} + return &this +} + +// GetLevel returns the Level field value +func (o *OtelMappingError) GetLevel() MessageLevel { + if o == nil { + var ret MessageLevel + return ret + } + + return o.Level +} + +// GetLevelOk returns a tuple with the Level field value +// and a boolean to check if the value has been set. +func (o *OtelMappingError) GetLevelOk() (*MessageLevel, bool) { + if o == nil { + return nil, false + } + return &o.Level, true +} + +// SetLevel sets field value +func (o *OtelMappingError) SetLevel(v MessageLevel) { + o.Level = v +} + +// GetMessage returns the Message field value +func (o *OtelMappingError) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *OtelMappingError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *OtelMappingError) SetMessage(v string) { + o.Message = v +} + +// GetIssueId returns the IssueId field value if set, zero value otherwise. +func (o *OtelMappingError) GetIssueId() string { + if o == nil || o.IssueId == nil { + var ret string + return ret + } + return *o.IssueId +} + +// GetIssueIdOk returns a tuple with the IssueId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OtelMappingError) GetIssueIdOk() (*string, bool) { + if o == nil || o.IssueId == nil { + return nil, false + } + return o.IssueId, true +} + +// HasIssueId returns a boolean if a field has been set. +func (o *OtelMappingError) HasIssueId() bool { + if o != nil && o.IssueId != nil { + return true + } + + return false +} + +// SetIssueId gets a reference to the given string and assigns it to the IssueId field. +func (o *OtelMappingError) SetIssueId(v string) { + o.IssueId = &v +} + +func (o OtelMappingError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["level"] = o.Level + } + if true { + toSerialize["message"] = o.Message + } + if o.IssueId != nil { + toSerialize["issueId"] = o.IssueId + } + return json.Marshal(toSerialize) +} + +type NullableOtelMappingError struct { + value *OtelMappingError + isSet bool +} + +func (v NullableOtelMappingError) Get() *OtelMappingError { + return v.value +} + +func (v *NullableOtelMappingError) Set(val *OtelMappingError) { + v.value = val + v.isSet = true +} + +func (v NullableOtelMappingError) IsSet() bool { + return v.isSet +} + +func (v *NullableOtelMappingError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtelMappingError(val *OtelMappingError) *NullableOtelMappingError { + return &NullableOtelMappingError{value: val, isSet: true} +} + +func (v NullableOtelMappingError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtelMappingError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/stackstate_api/model_otel_mapping_item.go b/generated/stackstate_api/model_otel_mapping_item.go new file mode 100644 index 00000000..e647be81 --- /dev/null +++ b/generated/stackstate_api/model_otel_mapping_item.go @@ -0,0 +1,143 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" +) + +// OtelMappingItem struct for OtelMappingItem +type OtelMappingItem struct { + Name string `json:"name"` + Identifier *string `json:"identifier,omitempty"` +} + +// NewOtelMappingItem instantiates a new OtelMappingItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtelMappingItem(name string) *OtelMappingItem { + this := OtelMappingItem{} + this.Name = name + return &this +} + +// NewOtelMappingItemWithDefaults instantiates a new OtelMappingItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtelMappingItemWithDefaults() *OtelMappingItem { + this := OtelMappingItem{} + return &this +} + +// GetName returns the Name field value +func (o *OtelMappingItem) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *OtelMappingItem) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *OtelMappingItem) SetName(v string) { + o.Name = v +} + +// GetIdentifier returns the Identifier field value if set, zero value otherwise. +func (o *OtelMappingItem) GetIdentifier() string { + if o == nil || o.Identifier == nil { + var ret string + return ret + } + return *o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OtelMappingItem) GetIdentifierOk() (*string, bool) { + if o == nil || o.Identifier == nil { + return nil, false + } + return o.Identifier, true +} + +// HasIdentifier returns a boolean if a field has been set. +func (o *OtelMappingItem) HasIdentifier() bool { + if o != nil && o.Identifier != nil { + return true + } + + return false +} + +// SetIdentifier gets a reference to the given string and assigns it to the Identifier field. +func (o *OtelMappingItem) SetIdentifier(v string) { + o.Identifier = &v +} + +func (o OtelMappingItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if o.Identifier != nil { + toSerialize["identifier"] = o.Identifier + } + return json.Marshal(toSerialize) +} + +type NullableOtelMappingItem struct { + value *OtelMappingItem + isSet bool +} + +func (v NullableOtelMappingItem) Get() *OtelMappingItem { + return v.value +} + +func (v *NullableOtelMappingItem) Set(val *OtelMappingItem) { + v.value = val + v.isSet = true +} + +func (v NullableOtelMappingItem) IsSet() bool { + return v.isSet +} + +func (v *NullableOtelMappingItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtelMappingItem(val *OtelMappingItem) *NullableOtelMappingItem { + return &NullableOtelMappingItem{value: val, isSet: true} +} + +func (v NullableOtelMappingItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtelMappingItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/stackstate_api/model_otel_mapping_metrics.go b/generated/stackstate_api/model_otel_mapping_metrics.go new file mode 100644 index 00000000..09733787 --- /dev/null +++ b/generated/stackstate_api/model_otel_mapping_metrics.go @@ -0,0 +1,143 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" +) + +// OtelMappingMetrics struct for OtelMappingMetrics +type OtelMappingMetrics struct { + BucketSizeSeconds int32 `json:"bucketSizeSeconds"` + LatencySeconds []MetricBucketValue `json:"latencySeconds,omitempty"` +} + +// NewOtelMappingMetrics instantiates a new OtelMappingMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtelMappingMetrics(bucketSizeSeconds int32) *OtelMappingMetrics { + this := OtelMappingMetrics{} + this.BucketSizeSeconds = bucketSizeSeconds + return &this +} + +// NewOtelMappingMetricsWithDefaults instantiates a new OtelMappingMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtelMappingMetricsWithDefaults() *OtelMappingMetrics { + this := OtelMappingMetrics{} + return &this +} + +// GetBucketSizeSeconds returns the BucketSizeSeconds field value +func (o *OtelMappingMetrics) GetBucketSizeSeconds() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.BucketSizeSeconds +} + +// GetBucketSizeSecondsOk returns a tuple with the BucketSizeSeconds field value +// and a boolean to check if the value has been set. +func (o *OtelMappingMetrics) GetBucketSizeSecondsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.BucketSizeSeconds, true +} + +// SetBucketSizeSeconds sets field value +func (o *OtelMappingMetrics) SetBucketSizeSeconds(v int32) { + o.BucketSizeSeconds = v +} + +// GetLatencySeconds returns the LatencySeconds field value if set, zero value otherwise. +func (o *OtelMappingMetrics) GetLatencySeconds() []MetricBucketValue { + if o == nil || o.LatencySeconds == nil { + var ret []MetricBucketValue + return ret + } + return o.LatencySeconds +} + +// GetLatencySecondsOk returns a tuple with the LatencySeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OtelMappingMetrics) GetLatencySecondsOk() ([]MetricBucketValue, bool) { + if o == nil || o.LatencySeconds == nil { + return nil, false + } + return o.LatencySeconds, true +} + +// HasLatencySeconds returns a boolean if a field has been set. +func (o *OtelMappingMetrics) HasLatencySeconds() bool { + if o != nil && o.LatencySeconds != nil { + return true + } + + return false +} + +// SetLatencySeconds gets a reference to the given []MetricBucketValue and assigns it to the LatencySeconds field. +func (o *OtelMappingMetrics) SetLatencySeconds(v []MetricBucketValue) { + o.LatencySeconds = v +} + +func (o OtelMappingMetrics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["bucketSizeSeconds"] = o.BucketSizeSeconds + } + if o.LatencySeconds != nil { + toSerialize["latencySeconds"] = o.LatencySeconds + } + return json.Marshal(toSerialize) +} + +type NullableOtelMappingMetrics struct { + value *OtelMappingMetrics + isSet bool +} + +func (v NullableOtelMappingMetrics) Get() *OtelMappingMetrics { + return v.value +} + +func (v *NullableOtelMappingMetrics) Set(val *OtelMappingMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableOtelMappingMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableOtelMappingMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtelMappingMetrics(val *OtelMappingMetrics) *NullableOtelMappingMetrics { + return &NullableOtelMappingMetrics{value: val, isSet: true} +} + +func (v NullableOtelMappingMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtelMappingMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/stackstate_api/model_otel_mapping_status.go b/generated/stackstate_api/model_otel_mapping_status.go new file mode 100644 index 00000000..2bba4e77 --- /dev/null +++ b/generated/stackstate_api/model_otel_mapping_status.go @@ -0,0 +1,172 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" +) + +// OtelMappingStatus struct for OtelMappingStatus +type OtelMappingStatus struct { + Item OtelMappingStatusItem `json:"item"` + ErrorDetails []OtelMappingError `json:"errorDetails"` + Metrics *OtelMappingMetrics `json:"metrics,omitempty"` +} + +// NewOtelMappingStatus instantiates a new OtelMappingStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtelMappingStatus(item OtelMappingStatusItem, errorDetails []OtelMappingError) *OtelMappingStatus { + this := OtelMappingStatus{} + this.Item = item + this.ErrorDetails = errorDetails + return &this +} + +// NewOtelMappingStatusWithDefaults instantiates a new OtelMappingStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtelMappingStatusWithDefaults() *OtelMappingStatus { + this := OtelMappingStatus{} + return &this +} + +// GetItem returns the Item field value +func (o *OtelMappingStatus) GetItem() OtelMappingStatusItem { + if o == nil { + var ret OtelMappingStatusItem + return ret + } + + return o.Item +} + +// GetItemOk returns a tuple with the Item field value +// and a boolean to check if the value has been set. +func (o *OtelMappingStatus) GetItemOk() (*OtelMappingStatusItem, bool) { + if o == nil { + return nil, false + } + return &o.Item, true +} + +// SetItem sets field value +func (o *OtelMappingStatus) SetItem(v OtelMappingStatusItem) { + o.Item = v +} + +// GetErrorDetails returns the ErrorDetails field value +func (o *OtelMappingStatus) GetErrorDetails() []OtelMappingError { + if o == nil { + var ret []OtelMappingError + return ret + } + + return o.ErrorDetails +} + +// GetErrorDetailsOk returns a tuple with the ErrorDetails field value +// and a boolean to check if the value has been set. +func (o *OtelMappingStatus) GetErrorDetailsOk() ([]OtelMappingError, bool) { + if o == nil { + return nil, false + } + return o.ErrorDetails, true +} + +// SetErrorDetails sets field value +func (o *OtelMappingStatus) SetErrorDetails(v []OtelMappingError) { + o.ErrorDetails = v +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *OtelMappingStatus) GetMetrics() OtelMappingMetrics { + if o == nil || o.Metrics == nil { + var ret OtelMappingMetrics + return ret + } + return *o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OtelMappingStatus) GetMetricsOk() (*OtelMappingMetrics, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *OtelMappingStatus) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given OtelMappingMetrics and assigns it to the Metrics field. +func (o *OtelMappingStatus) SetMetrics(v OtelMappingMetrics) { + o.Metrics = &v +} + +func (o OtelMappingStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["item"] = o.Item + } + if true { + toSerialize["errorDetails"] = o.ErrorDetails + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + return json.Marshal(toSerialize) +} + +type NullableOtelMappingStatus struct { + value *OtelMappingStatus + isSet bool +} + +func (v NullableOtelMappingStatus) Get() *OtelMappingStatus { + return v.value +} + +func (v *NullableOtelMappingStatus) Set(val *OtelMappingStatus) { + v.value = val + v.isSet = true +} + +func (v NullableOtelMappingStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableOtelMappingStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtelMappingStatus(val *OtelMappingStatus) *NullableOtelMappingStatus { + return &NullableOtelMappingStatus{value: val, isSet: true} +} + +func (v NullableOtelMappingStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtelMappingStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/stackstate_api/model_otel_mapping_status_item.go b/generated/stackstate_api/model_otel_mapping_status_item.go new file mode 100644 index 00000000..65169190 --- /dev/null +++ b/generated/stackstate_api/model_otel_mapping_status_item.go @@ -0,0 +1,201 @@ +/* +StackState API + +This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes. Each request sent to the StackState server API must be authenticated using one of the available authentication methods. *Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.* For more information on StackState, refer to the [StackState documentation](https://docs.stackstate.com). + +API version: 5.2.0 +Contact: info@stackstate.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package stackstate_api + +import ( + "encoding/json" +) + +// OtelMappingStatusItem struct for OtelMappingStatusItem +type OtelMappingStatusItem struct { + Name string `json:"name"` + Identifier *string `json:"identifier,omitempty"` + RelationCount int64 `json:"relationCount"` + ComponentCount int64 `json:"componentCount"` +} + +// NewOtelMappingStatusItem instantiates a new OtelMappingStatusItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtelMappingStatusItem(name string, relationCount int64, componentCount int64) *OtelMappingStatusItem { + this := OtelMappingStatusItem{} + this.Name = name + this.RelationCount = relationCount + this.ComponentCount = componentCount + return &this +} + +// NewOtelMappingStatusItemWithDefaults instantiates a new OtelMappingStatusItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtelMappingStatusItemWithDefaults() *OtelMappingStatusItem { + this := OtelMappingStatusItem{} + return &this +} + +// GetName returns the Name field value +func (o *OtelMappingStatusItem) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *OtelMappingStatusItem) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *OtelMappingStatusItem) SetName(v string) { + o.Name = v +} + +// GetIdentifier returns the Identifier field value if set, zero value otherwise. +func (o *OtelMappingStatusItem) GetIdentifier() string { + if o == nil || o.Identifier == nil { + var ret string + return ret + } + return *o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OtelMappingStatusItem) GetIdentifierOk() (*string, bool) { + if o == nil || o.Identifier == nil { + return nil, false + } + return o.Identifier, true +} + +// HasIdentifier returns a boolean if a field has been set. +func (o *OtelMappingStatusItem) HasIdentifier() bool { + if o != nil && o.Identifier != nil { + return true + } + + return false +} + +// SetIdentifier gets a reference to the given string and assigns it to the Identifier field. +func (o *OtelMappingStatusItem) SetIdentifier(v string) { + o.Identifier = &v +} + +// GetRelationCount returns the RelationCount field value +func (o *OtelMappingStatusItem) GetRelationCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.RelationCount +} + +// GetRelationCountOk returns a tuple with the RelationCount field value +// and a boolean to check if the value has been set. +func (o *OtelMappingStatusItem) GetRelationCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.RelationCount, true +} + +// SetRelationCount sets field value +func (o *OtelMappingStatusItem) SetRelationCount(v int64) { + o.RelationCount = v +} + +// GetComponentCount returns the ComponentCount field value +func (o *OtelMappingStatusItem) GetComponentCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.ComponentCount +} + +// GetComponentCountOk returns a tuple with the ComponentCount field value +// and a boolean to check if the value has been set. +func (o *OtelMappingStatusItem) GetComponentCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.ComponentCount, true +} + +// SetComponentCount sets field value +func (o *OtelMappingStatusItem) SetComponentCount(v int64) { + o.ComponentCount = v +} + +func (o OtelMappingStatusItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if o.Identifier != nil { + toSerialize["identifier"] = o.Identifier + } + if true { + toSerialize["relationCount"] = o.RelationCount + } + if true { + toSerialize["componentCount"] = o.ComponentCount + } + return json.Marshal(toSerialize) +} + +type NullableOtelMappingStatusItem struct { + value *OtelMappingStatusItem + isSet bool +} + +func (v NullableOtelMappingStatusItem) Get() *OtelMappingStatusItem { + return v.value +} + +func (v *NullableOtelMappingStatusItem) Set(val *OtelMappingStatusItem) { + v.value = val + v.isSet = true +} + +func (v NullableOtelMappingStatusItem) IsSet() bool { + return v.isSet +} + +func (v *NullableOtelMappingStatusItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtelMappingStatusItem(val *OtelMappingStatusItem) *NullableOtelMappingStatusItem { + return &NullableOtelMappingStatusItem{value: val, isSet: true} +} + +func (v NullableOtelMappingStatusItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtelMappingStatusItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/common/common_flags.go b/internal/common/common_flags.go index 15f93b73..f2a4c2a7 100644 --- a/internal/common/common_flags.go +++ b/internal/common/common_flags.go @@ -38,7 +38,7 @@ func AddIdentifierFlagVar(cmd *cobra.Command, v *string, use string) { func AddRequiredIdentifierFlagVar(cmd *cobra.Command, v *string, use string) { AddIdentifierFlagVar(cmd, v, use) - cmd.MarkFlagRequired(IDFlag) //nolint:errcheck + cmd.MarkFlagRequired(IdentifierFlag) //nolint:errcheck } func AddNameFlagVar(cmd *cobra.Command, v *string, use string) { diff --git a/internal/di/mock_stackstate_client.go b/internal/di/mock_stackstate_client.go index 7911a5c4..e483d9e4 100644 --- a/internal/di/mock_stackstate_client.go +++ b/internal/di/mock_stackstate_client.go @@ -35,6 +35,7 @@ type ApiMocks struct { TopicApi *stackstate_api.TopicApiMock AgentRegistrationsApi *stackstate_api.AgentRegistrationsApiMock DashboardsApi *stackstate_api.DashboardsApiMock + OtelMappingApi *stackstate_api.OtelMappingApiMock // Admin API: RetentionApi *stackstate_admin_api.RetentionApiMock // MISSING MOCK? You have to manually add new mocks here after generating a new API! @@ -61,6 +62,7 @@ func NewMockStackStateClient() MockStackStateClient { retentionApi := stackstate_admin_api.NewRetentionApiMock() agentRegistrationsApi := stackstate_api.NewAgentRegistrationsApiMock() dashboardsApi := stackstate_api.NewDashboardsApiMock() + otelMappingApi := stackstate_api.NewOtelMappingApiMock() apiMocks := ApiMocks{ ApiTokenApi: &apiTokenApi, @@ -83,6 +85,7 @@ func NewMockStackStateClient() MockStackStateClient { RetentionApi: &retentionApi, AgentRegistrationsApi: &agentRegistrationsApi, DashboardsApi: &dashboardsApi, + OtelMappingApi: &otelMappingApi, } apiClient := &stackstate_api.APIClient{ @@ -105,6 +108,7 @@ func NewMockStackStateClient() MockStackStateClient { TopicApi: apiMocks.TopicApi, AgentRegistrationsApi: apiMocks.AgentRegistrationsApi, DashboardsApi: apiMocks.DashboardsApi, + OtelMappingApi: apiMocks.OtelMappingApi, } adminApiClient := &stackstate_admin_api.APIClient{ diff --git a/stackstate_openapi/openapi_version b/stackstate_openapi/openapi_version index 46e4653b..f142d326 100644 --- a/stackstate_openapi/openapi_version +++ b/stackstate_openapi/openapi_version @@ -1 +1 @@ -e53e53b60b43d118b823b297ec01807434d7eaad +321d2fe79a136b37095f5fb797e7782ff321cdf1 \ No newline at end of file From 18b67e8b7fd7ae44d716fed6fec120127b58c8c7 Mon Sep 17 00:00:00 2001 From: Alejandro Acevedo Date: Thu, 2 Oct 2025 15:05:17 +0200 Subject: [PATCH 2/3] Update cmd/sts.go Co-authored-by: Alessio Biancalana --- cmd/sts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/sts.go b/cmd/sts.go index 3aa6ebe0..7e343384 100644 --- a/cmd/sts.go +++ b/cmd/sts.go @@ -33,7 +33,7 @@ func STSCommand(cli *di.Deps) *cobra.Command { cmd.AddCommand(AgentCommand(cli)) cmd.AddCommand(UserSessionCommand(cli)) - // Experimental commands forotel mapping + // Experimental commands for otel mapping if os.Getenv("STS_EXPERIMENTAL_OTEL_MAPPING") != "" { cmd.AddCommand(OtelComponentMappingCommand(cli)) cmd.AddCommand(OtelRelationtMappingCommand(cli)) From d3388af2300daecc7684891f02e6454b2412c25a Mon Sep 17 00:00:00 2001 From: Alejandro Acevedo Date: Fri, 3 Oct 2025 14:52:24 +0200 Subject: [PATCH 3/3] STAC-22985: Address review comments --- cmd/cmd_rules_test.go | 11 +++++++++ .../otelcomponentmapping_list_test.go | 19 +++++++-------- .../otelcomponentmapping_status.go | 3 --- .../otelcomponentmapping_status_test.go | 23 ++++++++++--------- .../test_data.go | 2 +- .../otelrelationmapping_list_test.go | 19 +++++++-------- .../otelrelationmapping_status.go | 3 --- .../otelrelationmapping_status_test.go | 23 ++++++++++--------- stackstate-cli.iml | 10 ++++++++ 9 files changed, 66 insertions(+), 47 deletions(-) rename cmd/{otelmapping => otelmapping_test}/test_data.go (98%) create mode 100644 stackstate-cli.iml diff --git a/cmd/cmd_rules_test.go b/cmd/cmd_rules_test.go index 23fcb256..fbbdb2c4 100644 --- a/cmd/cmd_rules_test.go +++ b/cmd/cmd_rules_test.go @@ -34,16 +34,27 @@ func TestNounsAndVerbsExistAsFilesInDirectories(t *testing.T) { } func TestVerbCommandCheckForJsonOuput(t *testing.T) { + var jsonCheckAllowList = map[string]struct{}{ + "otelcomponentmapping/otelcomponentmapping_status.go": {}, + "otelrelationmapping/otelrelationmapping_status.go": {}, + } + root := setupCmd(t) for _, nounCmd := range root.Commands() { for _, verbCmd := range nounCmd.Commands() { nounName := strings.ReplaceAll(nounCmd.Name(), "-", "") verbName := strings.ReplaceAll(verbCmd.Name(), "-", "_") verCmdGoFile := fmt.Sprintf("%s/%s_%s.go", nounName, nounName, verbName) + + if _, ok := jsonCheckAllowList[verCmdGoFile]; ok { + continue + } + verbCmdGoCode, err := os.ReadFile(verCmdGoFile) if err != nil { t.Fatal(err) } + if !strings.Contains(string(verbCmdGoCode), "if cli.IsJson() {") { t.Errorf("%s does not check whether to print to json!", verCmdGoFile) } diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go b/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go index fff85405..2ae14711 100644 --- a/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go +++ b/cmd/otelcomponentmapping/otelcomponentmapping_list_test.go @@ -1,9 +1,10 @@ -package otelcomponentmapping +package otelcomponentmapping_test import ( "testing" - "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/cmd/otelcomponentmapping" + "github.com/stackvista/stackstate-cli/cmd/otelmapping_test" "github.com/stackvista/stackstate-cli/internal/di" "github.com/stackvista/stackstate-cli/internal/printer" "github.com/stretchr/testify/assert" @@ -11,8 +12,8 @@ import ( func TestListOtelComponentMappingsJson(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelComponentMappingListCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsResponse.Result = otelmapping.TestAllMappingItems + cmd := otelcomponentmapping.OtelComponentMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsResponse.Result = otelmapping_test.TestAllMappingItems di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "-o", "json") @@ -21,7 +22,7 @@ func TestListOtelComponentMappingsJson(t *testing.T) { expected := []map[string]interface{}{ { - "otel component mappings": otelmapping.TestAllMappingItems, + "otel component mappings": otelmapping_test.TestAllMappingItems, }, } @@ -30,8 +31,8 @@ func TestListOtelComponentMappingsJson(t *testing.T) { func TestOtelComponentMappingListTable(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelComponentMappingListCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsResponse.Result = otelmapping.TestAllMappingItems + cmd := otelcomponentmapping.OtelComponentMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingsResponse.Result = otelmapping_test.TestAllMappingItems di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd) @@ -42,8 +43,8 @@ func TestOtelComponentMappingListTable(t *testing.T) { { Header: []string{"Name", "Identifier"}, Data: [][]interface{}{ - {otelmapping.TestSomeOtelMappingItem.Name, "identifier"}, - {otelmapping.TestSomeOtelMappingItem2.Name, "identifier2"}, + {otelmapping_test.TestSomeOtelMappingItem.Name, "identifier"}, + {otelmapping_test.TestSomeOtelMappingItem2.Name, "identifier2"}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, }, diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_status.go b/cmd/otelcomponentmapping/otelcomponentmapping_status.go index 21a38670..a321645a 100644 --- a/cmd/otelcomponentmapping/otelcomponentmapping_status.go +++ b/cmd/otelcomponentmapping/otelcomponentmapping_status.go @@ -7,9 +7,6 @@ import ( "github.com/stackvista/stackstate-cli/internal/di" ) -// if cli.IsJson() { -// cli.Printer.PrintJson( - func OtelComponentMappingStatusCommand(deps *di.Deps) *cobra.Command { args := &otelmapping.StatusArgs{} cmd := &cobra.Command{ diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go b/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go index 00815711..006aa501 100644 --- a/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go +++ b/cmd/otelcomponentmapping/otelcomponentmapping_status_test.go @@ -1,9 +1,10 @@ -package otelcomponentmapping +package otelcomponentmapping_test import ( "testing" - "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/cmd/otelcomponentmapping" + "github.com/stackvista/stackstate-cli/cmd/otelmapping_test" "github.com/stackvista/stackstate-cli/internal/di" "github.com/stackvista/stackstate-cli/internal/printer" "github.com/stretchr/testify/assert" @@ -11,8 +12,8 @@ import ( func TestOtelComponentMappingStatusJson(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelComponentMappingStatusCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + cmd := otelcomponentmapping.OtelComponentMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusResponse.Result = *otelmapping_test.TestSomeOtelMappingStatus di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier", "-o", "json") @@ -21,7 +22,7 @@ func TestOtelComponentMappingStatusJson(t *testing.T) { expected := []map[string]interface{}{ { - "otel-component-mapping": otelmapping.TestSomeOtelMappingStatus, + "otel-component-mapping": otelmapping_test.TestSomeOtelMappingStatus, }, } @@ -30,8 +31,8 @@ func TestOtelComponentMappingStatusJson(t *testing.T) { func TestOtelComponentMappingStatusTable(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelComponentMappingStatusCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + cmd := otelcomponentmapping.OtelComponentMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelComponentMappingStatusResponse.Result = *otelmapping_test.TestSomeOtelMappingStatus di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier") @@ -42,22 +43,22 @@ func TestOtelComponentMappingStatusTable(t *testing.T) { { Header: []string{"Name", "Identifier", "Components", "Relations"}, Data: [][]interface{}{ - {otelmapping.TestSomeOtelMappingStatusItem.Name, "identifier", otelmapping.TestComponentCount, otelmapping.TestRelationCount}, + {otelmapping_test.TestSomeOtelMappingStatusItem.Name, "identifier", otelmapping_test.TestComponentCount, otelmapping_test.TestRelationCount}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, }, { Header: []string{"Metric", "10s ago", "10-20s ago", "20-30s ago"}, Data: [][]interface{}{ - {"latency seconds", otelmapping.TestMetricValue, otelmapping.TestMetricValue, otelmapping.TestMetricValue}, + {"latency seconds", otelmapping_test.TestMetricValue, otelmapping_test.TestMetricValue, otelmapping_test.TestMetricValue}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "metrics"}, }, { Header: []string{"Issue Id", "Level", "Message"}, Data: [][]interface{}{ - {"-", otelmapping.TestError1.Level, otelmapping.TestError1.Message}, - {"-", otelmapping.TestError2.Level, otelmapping.TestError2.Message}, + {"-", otelmapping_test.TestError1.Level, otelmapping_test.TestError1.Message}, + {"-", otelmapping_test.TestError2.Level, otelmapping_test.TestError2.Message}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "otel component mapping errors"}, }, diff --git a/cmd/otelmapping/test_data.go b/cmd/otelmapping_test/test_data.go similarity index 98% rename from cmd/otelmapping/test_data.go rename to cmd/otelmapping_test/test_data.go index 79aeee76..7798c4f1 100644 --- a/cmd/otelmapping/test_data.go +++ b/cmd/otelmapping_test/test_data.go @@ -1,4 +1,4 @@ -package otelmapping +package otelmapping_test import ( "github.com/stackvista/stackstate-cli/generated/stackstate_api" diff --git a/cmd/otelrelationmapping/otelrelationmapping_list_test.go b/cmd/otelrelationmapping/otelrelationmapping_list_test.go index 77c4d814..b41046ac 100644 --- a/cmd/otelrelationmapping/otelrelationmapping_list_test.go +++ b/cmd/otelrelationmapping/otelrelationmapping_list_test.go @@ -1,9 +1,10 @@ -package otelrelationmapping +package otelrelationmapping_test import ( "testing" - "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/cmd/otelmapping_test" + "github.com/stackvista/stackstate-cli/cmd/otelrelationmapping" "github.com/stackvista/stackstate-cli/internal/di" "github.com/stackvista/stackstate-cli/internal/printer" "github.com/stretchr/testify/assert" @@ -11,8 +12,8 @@ import ( func TestOtelRelationMappingListJson(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelRelationMappingListCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsResponse.Result = otelmapping.TestAllMappingItems + cmd := otelrelationmapping.OtelRelationMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsResponse.Result = otelmapping_test.TestAllMappingItems di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "-o", "json") @@ -21,7 +22,7 @@ func TestOtelRelationMappingListJson(t *testing.T) { expected := []map[string]interface{}{ { - "otel relation mappings": otelmapping.TestAllMappingItems, + "otel relation mappings": otelmapping_test.TestAllMappingItems, }, } @@ -30,8 +31,8 @@ func TestOtelRelationMappingListJson(t *testing.T) { func TestOtelRelationMappingListTable(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelRelationMappingListCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsResponse.Result = otelmapping.TestAllMappingItems + cmd := otelrelationmapping.OtelRelationMappingListCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingsResponse.Result = otelmapping_test.TestAllMappingItems di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd) @@ -42,8 +43,8 @@ func TestOtelRelationMappingListTable(t *testing.T) { { Header: []string{"Name", "Identifier"}, Data: [][]interface{}{ - {otelmapping.TestSomeOtelMappingItem.Name, "identifier"}, - {otelmapping.TestSomeOtelMappingItem2.Name, "identifier2"}, + {otelmapping_test.TestSomeOtelMappingItem.Name, "identifier"}, + {otelmapping_test.TestSomeOtelMappingItem2.Name, "identifier2"}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, }, diff --git a/cmd/otelrelationmapping/otelrelationmapping_status.go b/cmd/otelrelationmapping/otelrelationmapping_status.go index dd9adafc..c2c02844 100644 --- a/cmd/otelrelationmapping/otelrelationmapping_status.go +++ b/cmd/otelrelationmapping/otelrelationmapping_status.go @@ -7,9 +7,6 @@ import ( "github.com/stackvista/stackstate-cli/internal/di" ) -// if cli.IsJson() { -// cli.Printer.PrintJson( - func OtelRelationMappingStatusCommand(deps *di.Deps) *cobra.Command { args := &otelmapping.StatusArgs{} cmd := &cobra.Command{ diff --git a/cmd/otelrelationmapping/otelrelationmapping_status_test.go b/cmd/otelrelationmapping/otelrelationmapping_status_test.go index 42a9c19b..3647544f 100644 --- a/cmd/otelrelationmapping/otelrelationmapping_status_test.go +++ b/cmd/otelrelationmapping/otelrelationmapping_status_test.go @@ -1,9 +1,10 @@ -package otelrelationmapping +package otelrelationmapping_test import ( "testing" - "github.com/stackvista/stackstate-cli/cmd/otelmapping" + "github.com/stackvista/stackstate-cli/cmd/otelmapping_test" + "github.com/stackvista/stackstate-cli/cmd/otelrelationmapping" "github.com/stackvista/stackstate-cli/internal/di" "github.com/stackvista/stackstate-cli/internal/printer" "github.com/stretchr/testify/assert" @@ -11,8 +12,8 @@ import ( func TestOtelRelationMappingStatusJson(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelRelationMappingStatusCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + cmd := otelrelationmapping.OtelRelationMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusResponse.Result = *otelmapping_test.TestSomeOtelMappingStatus di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier", "-o", "json") @@ -21,7 +22,7 @@ func TestOtelRelationMappingStatusJson(t *testing.T) { expected := []map[string]interface{}{ { - "otel-relation-mapping": otelmapping.TestSomeOtelMappingStatus, + "otel-relation-mapping": otelmapping_test.TestSomeOtelMappingStatus, }, } @@ -30,8 +31,8 @@ func TestOtelRelationMappingStatusJson(t *testing.T) { func TestOtelRelationMappingStatusTable(t *testing.T) { cli := di.NewMockDeps(t) - cmd := OtelRelationMappingStatusCommand(&cli.Deps) - cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusResponse.Result = *otelmapping.TestSomeOtelMappingStatus + cmd := otelrelationmapping.OtelRelationMappingStatusCommand(&cli.Deps) + cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingStatusResponse.Result = *otelmapping_test.TestSomeOtelMappingStatus di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "identifier") @@ -42,22 +43,22 @@ func TestOtelRelationMappingStatusTable(t *testing.T) { { Header: []string{"Name", "Identifier", "Components", "Relations"}, Data: [][]interface{}{ - {otelmapping.TestSomeOtelMappingStatusItem.Name, "identifier", otelmapping.TestComponentCount, otelmapping.TestRelationCount}, + {otelmapping_test.TestSomeOtelMappingStatusItem.Name, "identifier", otelmapping_test.TestComponentCount, otelmapping_test.TestRelationCount}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "otel mappings"}, }, { Header: []string{"Metric", "10s ago", "10-20s ago", "20-30s ago"}, Data: [][]interface{}{ - {"latency seconds", otelmapping.TestMetricValue, otelmapping.TestMetricValue, otelmapping.TestMetricValue}, + {"latency seconds", otelmapping_test.TestMetricValue, otelmapping_test.TestMetricValue, otelmapping_test.TestMetricValue}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "metrics"}, }, { Header: []string{"Issue Id", "Level", "Message"}, Data: [][]interface{}{ - {"-", otelmapping.TestError1.Level, otelmapping.TestError1.Message}, - {"-", otelmapping.TestError2.Level, otelmapping.TestError2.Message}, + {"-", otelmapping_test.TestError1.Level, otelmapping_test.TestError1.Message}, + {"-", otelmapping_test.TestError2.Level, otelmapping_test.TestError2.Message}, }, MissingTableDataMsg: printer.NotFoundMsg{Types: "otel relation mapping errors"}, }, diff --git a/stackstate-cli.iml b/stackstate-cli.iml new file mode 100644 index 00000000..49df094a --- /dev/null +++ b/stackstate-cli.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file