diff --git a/Makefile.include b/Makefile.include index ae9170233f..a19dd0ed0c 100644 --- a/Makefile.include +++ b/Makefile.include @@ -43,7 +43,7 @@ gen-api: ## Generate PMM API bin/buf generate -v api - for API in api/agentlocalpb api/serverpb api/inventorypb api/managementpb api/managementpb/ia api/managementpb/alerting api/managementpb/backup api/managementpb/azure api/managementpb/role api/qanpb api/managementpb/agent api/managementpb/node api/managementpb/service api/platformpb api/userpb; do \ + for API in api/agentlocalpb api/serverpb api/inventorypb api/managementpb api/managementpb/alerting api/managementpb/backup api/managementpb/azure api/managementpb/role api/qanpb api/managementpb/agent api/managementpb/node api/managementpb/service api/platformpb api/userpb; do \ set -x ; \ bin/swagger mixin $$API/json/header.json $$API/*.swagger.json --output=$$API/json/$$(basename $$API).json --keep-spec-order; \ bin/swagger flatten --with-flatten=expand --with-flatten=remove-unused $$API/json/$$(basename $$API).json --output=$$API/json/$$(basename $$API).json ; \ @@ -83,7 +83,6 @@ gen-api: ## Generate PMM API api/userpb/json/userpb.json \ api/inventorypb/json/inventorypb.json \ api/managementpb/json/managementpb.json \ - api/managementpb/ia/json/ia.json \ api/managementpb/alerting/json/alerting.json \ api/managementpb/backup/json/backup.json \ api/managementpb/azure/json/azure.json \ @@ -122,7 +121,7 @@ clean: clean_swagger ## Remove generated files find api -name '*.pb.gw.go' -print -delete find api -name '*.validate.go' -print -delete - for API in api/agentlocalpb api/serverpb api/inventorypb api/managementpb api/managementpb/ia api/managementpb/alerting api/managementpb/backup api/managementpb/role api/managementpb/agent api/managementpb/node api/managementpb/service api/qanpb api/platformpb ; do \ + for API in api/agentlocalpb api/serverpb api/inventorypb api/managementpb api/managementpb/alerting api/managementpb/backup api/managementpb/role api/managementpb/agent api/managementpb/node api/managementpb/service api/qanpb api/platformpb ; do \ rm -fr $$API/json/client $$API/json/models $$API/json/$$(basename $$API).json ; \ done rm -f api/swagger/swagger.json api/swagger/swagger-dev.json diff --git a/api-tests/init.go b/api-tests/init.go index 8dcf91195f..5f1ab8aaf7 100644 --- a/api-tests/init.go +++ b/api-tests/init.go @@ -40,7 +40,6 @@ import ( inventoryClient "github.com/percona/pmm/api/inventorypb/json/client" alertingClient "github.com/percona/pmm/api/managementpb/alerting/json/client" backupsClient "github.com/percona/pmm/api/managementpb/backup/json/client" - iaClient "github.com/percona/pmm/api/managementpb/ia/json/client" managementClient "github.com/percona/pmm/api/managementpb/json/client" platformClient "github.com/percona/pmm/api/platformpb/json/client" serverClient "github.com/percona/pmm/api/serverpb/json/client" @@ -67,9 +66,6 @@ var ( // RunSTTTests is true if STT tests should be run. RunSTTTests bool - // RunIATests is true if IA tests should be run. - RunIATests bool - // Kubeconfig contains kubeconfig. Kubeconfig string ) @@ -138,9 +134,6 @@ func init() { // FIXME we should rethink it once https://jira.percona.com/browse/PMM-5106 is implemented runSTTTestsF := flag.Bool("pmm.run-stt-tests", false, "Run STT tests that require connected clients [PMM_RUN_STT_TESTS].") - // TODO remove once IA is out of beta: https://jira.percona.com/browse/PMM-7001 - runIATestsF := flag.Bool("pmm.run-ia-tests", false, "Run IA tests that require connected clients [PMM_RUN_IA_TESTS].") - testing.Init() flag.Parse() @@ -172,7 +165,6 @@ func init() { Debug = *debugF || *traceF RunUpdateTest = *runUpdateTestF RunSTTTests = *runSTTTestsF - RunIATests = *runIATestsF var cancel context.CancelFunc Context, cancel = context.WithCancel(context.Background()) @@ -221,7 +213,6 @@ func init() { managementClient.Default = managementClient.New(transport, nil) serverClient.Default = serverClient.New(transport, nil) amclient.Default = amclient.New(alertmanagerTransport, nil) - iaClient.Default = iaClient.New(transport, nil) backupsClient.Default = backupsClient.New(transport, nil) platformClient.Default = platformClient.New(transport, nil) alertingClient.Default = alertingClient.New(transport, nil) diff --git a/api-tests/management/alerting/alerting_test.go b/api-tests/management/alerting/alerting_test.go index 1a6ffedbb7..9036e1b250 100644 --- a/api-tests/management/alerting/alerting_test.go +++ b/api-tests/management/alerting/alerting_test.go @@ -16,109 +16,134 @@ package alerting import ( + "context" + "encoding/base64" "fmt" "os" "strings" "testing" "time" + "github.com/AlekSi/pointer" "github.com/google/uuid" "github.com/percona-platform/saas/pkg/alert" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" "gopkg.in/yaml.v3" pmmapitests "github.com/percona/pmm/api-tests" alertingClient "github.com/percona/pmm/api/managementpb/alerting/json/client" "github.com/percona/pmm/api/managementpb/alerting/json/client/alerting" + "github.com/percona/pmm/managed/services/grafana" ) -// Note: Even though the IA services check for alerting enabled or disabled before returning results -// we don't enable or disable IA explicit in our tests since it is enabled by default through -// ENABLE_ALERTING env var. -func assertTemplate(t *testing.T, expectedTemplate alert.Template, listTemplates []*alerting.ListTemplatesOKBodyTemplatesItems0) { - t.Helper() - convertParamUnit := func(u string) alert.Unit { - switch u { - case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0UnitPERCENTAGE: - return alert.Percentage - case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0UnitSECONDS: - return alert.Seconds - } - return "INVALID" - } - convertParamType := func(u string) alert.Type { - switch u { - case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0TypeFLOAT: - return alert.Float - case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0TypeSTRING: - return alert.String - case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0TypeBOOL: - return alert.Bool - } - return "INVALID" - } - var tmpl *alerting.ListTemplatesOKBodyTemplatesItems0 - for _, listTmpl := range listTemplates { - if listTmpl.Name == expectedTemplate.Name { - tmpl = listTmpl - break - } - } - require.NotNilf(t, tmpl, "template %s not found", expectedTemplate.Name) - // IDE doesn't recognize that require stops execution - if tmpl == nil { - return - } - assert.Equal(t, expectedTemplate.Expr, tmpl.Expr) - assert.Equal(t, expectedTemplate.Summary, tmpl.Summary) - assert.Equal(t, "USER_API", *tmpl.Source) - assert.Equal(t, "SEVERITY_WARNING", *tmpl.Severity) +// Note: Even though the Alerting service checks for alerting enabled or disabled before returning results +// we don't enable or disable Alerting explicit in our tests since it is enabled by default through +// DISABLE_ALERTING env var. +func TestRulesAPI(t *testing.T) { + t.Parallel() - forDuration := fmt.Sprintf("%.0fs", time.Duration(expectedTemplate.For).Seconds()) - assert.Equal(t, forDuration, tmpl.For) + t.Parallel() + client := alertingClient.Default.Alerting - require.Len(t, tmpl.Params, len(expectedTemplate.Params)) - for i, expectedParam := range expectedTemplate.Params { - param := tmpl.Params[i] - assert.Equal(t, expectedParam.Name, param.Name) - assert.Equal(t, expectedParam.Summary, param.Summary) - assert.Equal(t, expectedParam.Type, convertParamType(*param.Type)) - assert.Equal(t, expectedParam.Unit, convertParamUnit(*param.Unit)) - switch expectedParam.Type { - case alert.Float: - if expectedParam.Value != nil { - require.NotNil(t, param.Float) - value, err := expectedParam.GetValueForFloat() - require.NoError(t, err) - assert.True(t, param.Float.HasDefault) - assert.Equal(t, value, param.Float.Default) - } + // Create grafana folder for test alert rules + grafanaClient := grafana.NewClient("127.0.0.1:3000") + ctx := metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"Authorization": "Basic " + base64.StdEncoding.EncodeToString([]byte("admin:admin"))})) + folder, err := grafanaClient.CreateFolder(ctx, "test-folder-"+uuid.NewString()) + require.NoError(t, err) - if len(expectedParam.Range) != 0 { - min, max, err := expectedParam.GetRangeForFloat() - require.NoError(t, err) - assert.True(t, param.Float.HasMax) - assert.True(t, param.Float.HasMin) - assert.Equal(t, min, param.Float.Min) - assert.Equal(t, max, param.Float.Max) - } + t.Cleanup(func() { + assert.NoError(t, grafanaClient.DeleteFolder(ctx, folder.UID, true)) + }) - assert.Nil(t, param.Bool) - assert.Nil(t, param.String) - default: - } + dummyFilter := &alerting.CreateRuleParamsBodyFiltersItems0{ + Type: pointer.ToString("MATCH"), + Label: "threshold", + Regexp: "12", } - assert.Equal(t, expectedTemplate.Labels, tmpl.Labels) - assert.Equal(t, expectedTemplate.Annotations, tmpl.Annotations) + templateName := createTemplate(t) + t.Cleanup(func() { + deleteTemplate(t, alertingClient.Default.Alerting, templateName) + }) - expectedYAML, err := alert.ToYAML([]alert.Template{expectedTemplate}) - require.NoError(t, err) - assert.Equal(t, expectedYAML, tmpl.Yaml) + t.Run("add", func(t *testing.T) { + t.Parallel() - assert.NotEmpty(t, tmpl.CreatedAt) + t.Run("normal from template", func(t *testing.T) { + t.Parallel() + + params := createAlertRuleParams(templateName, folder.UID, dummyFilter) + _, err := client.CreateRule(params) + require.NoError(t, err) + }) + + t.Run("builtin_template", func(t *testing.T) { + t.Parallel() + + params := createAlertRuleParams("pmm_mongodb_restarted", folder.UID, dummyFilter) + params.Body.Params = []*alerting.CreateRuleParamsBodyParamsItems0{{ + Name: "threshold", + Type: pointer.ToString("FLOAT"), + Float: 3.14, + }} + _, err := client.CreateRule(params) + require.NoError(t, err) + }) + + t.Run("use default value for parameter", func(t *testing.T) { + t.Parallel() + + params := createAlertRuleParams(templateName, folder.UID, dummyFilter) + _, err := client.CreateRule(params) + require.NoError(t, err) + }) + + t.Run("unknown template", func(t *testing.T) { + t.Parallel() + + templateName := uuid.New().String() + params := createAlertRuleParams(templateName, folder.UID, dummyFilter) + _, err := client.CreateRule(params) + pmmapitests.AssertAPIErrorf(t, err, 404, codes.NotFound, "Unknown template %s.", templateName) + }) + + t.Run("wrong parameter", func(t *testing.T) { + t.Parallel() + + params := createAlertRuleParams(templateName, folder.UID, dummyFilter) + params.Body.Params = append( + params.Body.Params, + &alerting.CreateRuleParamsBodyParamsItems0{ + Name: "unknown parameter", + Type: pointer.ToString("FLOAT"), + Float: 12, + }) + _, err := client.CreateRule(params) + pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Expression requires 2 parameters, but got 3.") + }) + + t.Run("wrong parameter type", func(t *testing.T) { + t.Parallel() + + params := createAlertRuleParams(templateName, folder.UID, dummyFilter) + params.Body.Params = []*alerting.CreateRuleParamsBodyParamsItems0{ + { + Name: "param1", + Type: pointer.ToString("BOOL"), + Bool: true, + }, { + Name: "param2", + Type: pointer.ToString("FLOAT"), + Float: 12, + }, + } + _, err := client.CreateRule(params) + pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Parameter param1 has type bool instead of float.") + }) + }) } func TestTemplatesAPI(t *testing.T) { @@ -501,6 +526,90 @@ func TestTemplatesAPI(t *testing.T) { }) } +func assertTemplate(t *testing.T, expectedTemplate alert.Template, listTemplates []*alerting.ListTemplatesOKBodyTemplatesItems0) { + t.Helper() + convertParamUnit := func(u string) alert.Unit { + switch u { + case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0UnitPERCENTAGE: + return alert.Percentage + case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0UnitSECONDS: + return alert.Seconds + } + return "INVALID" + } + convertParamType := func(u string) alert.Type { + switch u { + case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0TypeFLOAT: + return alert.Float + case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0TypeSTRING: + return alert.String + case alerting.ListTemplatesOKBodyTemplatesItems0ParamsItems0TypeBOOL: + return alert.Bool + } + return "INVALID" + } + var tmpl *alerting.ListTemplatesOKBodyTemplatesItems0 + for _, listTmpl := range listTemplates { + if listTmpl.Name == expectedTemplate.Name { + tmpl = listTmpl + break + } + } + require.NotNilf(t, tmpl, "template %s not found", expectedTemplate.Name) + // IDE doesn't recognize that require stops execution + if tmpl == nil { + return + } + assert.Equal(t, expectedTemplate.Expr, tmpl.Expr) + assert.Equal(t, expectedTemplate.Summary, tmpl.Summary) + assert.Equal(t, "USER_API", *tmpl.Source) + assert.Equal(t, "SEVERITY_WARNING", *tmpl.Severity) + + forDuration := fmt.Sprintf("%.0fs", time.Duration(expectedTemplate.For).Seconds()) + assert.Equal(t, forDuration, tmpl.For) + + require.Len(t, tmpl.Params, len(expectedTemplate.Params)) + for i, expectedParam := range expectedTemplate.Params { + param := tmpl.Params[i] + assert.Equal(t, expectedParam.Name, param.Name) + assert.Equal(t, expectedParam.Summary, param.Summary) + assert.Equal(t, expectedParam.Type, convertParamType(*param.Type)) + assert.Equal(t, expectedParam.Unit, convertParamUnit(*param.Unit)) + switch expectedParam.Type { + case alert.Float: + if expectedParam.Value != nil { + require.NotNil(t, param.Float) + value, err := expectedParam.GetValueForFloat() + require.NoError(t, err) + assert.True(t, param.Float.HasDefault) + assert.Equal(t, value, param.Float.Default) + } + + if len(expectedParam.Range) != 0 { + min, max, err := expectedParam.GetRangeForFloat() + require.NoError(t, err) + assert.True(t, param.Float.HasMax) + assert.True(t, param.Float.HasMin) + assert.Equal(t, min, param.Float.Min) + assert.Equal(t, max, param.Float.Max) + } + + assert.Nil(t, param.Bool) + assert.Nil(t, param.String) + default: + } + } + + assert.Equal(t, expectedTemplate.Labels, tmpl.Labels) + assert.Equal(t, expectedTemplate.Annotations, tmpl.Annotations) + + expectedYAML, err := alert.ToYAML([]alert.Template{expectedTemplate}) + require.NoError(t, err) + assert.Equal(t, expectedYAML, tmpl.Yaml) + + assert.NotEmpty(t, tmpl.CreatedAt) +} + func deleteTemplate(t *testing.T, client alerting.ClientService, name string) { t.Helper() @@ -529,3 +638,55 @@ func formatTemplateYaml(t *testing.T, yml string) ([]alert.Template, string) { return r, string(s) } + +func createAlertRuleParams(templateName, folderUID string, filter *alerting.CreateRuleParamsBodyFiltersItems0) *alerting.CreateRuleParams { + rule := &alerting.CreateRuleParams{ + Body: alerting.CreateRuleBody{ + TemplateName: templateName, + Name: "test-rule-" + uuid.NewString(), + FolderUID: folderUID, + Group: "test", + Params: []*alerting.CreateRuleParamsBodyParamsItems0{ + { + Name: "param1", + Type: pointer.ToString("FLOAT"), + Float: 4, + }, + { + Name: "param2", + Type: pointer.ToString("FLOAT"), + Float: 12, + }, + }, + For: "90s", + Severity: pointer.ToString("SEVERITY_WARNING"), + CustomLabels: map[string]string{"foo": "bar"}, + }, + Context: pmmapitests.Context, + } + + if filter != nil { + rule.Body.Filters = []*alerting.CreateRuleParamsBodyFiltersItems0{filter} + } + + return rule +} + +func createTemplate(t *testing.T) string { + t.Helper() + + b, err := os.ReadFile("../../testdata/alerting/template.yaml") + require.NoError(t, err) + + templateName := uuid.New().String() + expression := "'[[ .param1 ]] > 2 and 2 < [[ .param2 ]]'" + _, err = alertingClient.Default.Alerting.CreateTemplate(&alerting.CreateTemplateParams{ + Body: alerting.CreateTemplateBody{ + Yaml: fmt.Sprintf(string(b), templateName, expression, "%", "s"), + }, + Context: pmmapitests.Context, + }) + require.NoError(t, err) + + return templateName +} diff --git a/api-tests/management/ia/alerts_test.go b/api-tests/management/ia/alerts_test.go deleted file mode 100644 index 2b8ec88450..0000000000 --- a/api-tests/management/ia/alerts_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "testing" - - "github.com/stretchr/testify/require" - - pmmapitests "github.com/percona/pmm/api-tests" - channelsClient "github.com/percona/pmm/api/managementpb/ia/json/client" - "github.com/percona/pmm/api/managementpb/ia/json/client/alerts" -) - -func TestAlertsAPI(t *testing.T) { - client := channelsClient.Default.Alerts - - t.Run("list", func(t *testing.T) { - _, err := client.ListAlerts(&alerts.ListAlertsParams{ - Body: alerts.ListAlertsBody{}, - Context: pmmapitests.Context, - }) - - require.NoError(t, err) - }) -} diff --git a/api-tests/management/ia/channels_test.go b/api-tests/management/ia/channels_test.go deleted file mode 100644 index 88bf0276ca..0000000000 --- a/api-tests/management/ia/channels_test.go +++ /dev/null @@ -1,387 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "testing" - - "github.com/brianvoe/gofakeit/v6" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - - pmmapitests "github.com/percona/pmm/api-tests" - alertingClient "github.com/percona/pmm/api/managementpb/alerting/json/client" - channelsClient "github.com/percona/pmm/api/managementpb/ia/json/client" - "github.com/percona/pmm/api/managementpb/ia/json/client/channels" -) - -// Note: Even though the IA services check for alerting enabled or disabled before returning results -// we don't enable or disable IA explicit in our tests since it is enabled by default through -// ENABLE_ALERTING env var. - -func TestChannelsAPI(t *testing.T) { //nolint:tparallel - // TODO Fix this test to run in parallel. - // t.Parallel() - client := channelsClient.Default.Channels - - t.Run("add", func(t *testing.T) { - t.Parallel() - - t.Run("normal", func(t *testing.T) { - t.Parallel() - - resp, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: gofakeit.Quote(), - Disabled: gofakeit.Bool(), - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: false, - To: []string{gofakeit.Email()}, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - defer deleteChannel(t, client, resp.Payload.ChannelID) - - assert.NotEmpty(t, resp.Payload.ChannelID) - }) - - t.Run("invalid request", func(t *testing.T) { - t.Parallel() - - resp, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: gofakeit.Quote(), - Disabled: gofakeit.Bool(), - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: false, - }, - }, - Context: pmmapitests.Context, - }) - - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "invalid AddChannelRequest.EmailConfig: embedded message failed validation | caused by: invalid EmailConfig.To: value must contain at least 1 item(s)") - assert.Nil(t, resp) - }) - - t.Run("missing config", func(t *testing.T) { - t.Parallel() - - resp, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: gofakeit.Quote(), - Disabled: gofakeit.Bool(), - }, - Context: pmmapitests.Context, - }) - - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Missing channel configuration.") - assert.Nil(t, resp) - }) - }) - - t.Run("change", func(t *testing.T) { - t.Parallel() - - t.Run("normal", func(t *testing.T) { - t.Parallel() - - resp1, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: gofakeit.Quote(), - Disabled: false, - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: false, - To: []string{gofakeit.Email()}, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - defer deleteChannel(t, client, resp1.Payload.ChannelID) - - slackChannel := uuid.New().String() - newSummary := uuid.New().String() - _, err = client.ChangeChannel(&channels.ChangeChannelParams{ - Body: channels.ChangeChannelBody{ - ChannelID: resp1.Payload.ChannelID, - Summary: newSummary, - Disabled: true, - SlackConfig: &channels.ChangeChannelParamsBodySlackConfig{ - SendResolved: true, - Channel: slackChannel, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - resp2, err := client.ListChannels(&channels.ListChannelsParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - assert.NotEmpty(t, resp2.Payload.Channels) - var found bool - for _, channel := range resp2.Payload.Channels { - if channel.ChannelID == resp1.Payload.ChannelID { - assert.Equal(t, newSummary, channel.Summary) - assert.True(t, channel.Disabled) - assert.Nil(t, channel.EmailConfig) - assert.Equal(t, slackChannel, channel.SlackConfig.Channel) - assert.True(t, channel.SlackConfig.SendResolved) - found = true - } - } - - assert.True(t, found, "Expected channel not found") - }) - }) - - t.Run("remove", func(t *testing.T) { - t.Parallel() - - t.Run("normal", func(t *testing.T) { - t.Parallel() - - summary := uuid.New().String() - resp1, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: summary, - Disabled: gofakeit.Bool(), - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: false, - To: []string{gofakeit.Email()}, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - _, err = client.RemoveChannel(&channels.RemoveChannelParams{ - Body: channels.RemoveChannelBody{ - ChannelID: resp1.Payload.ChannelID, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - resp2, err := client.ListChannels(&channels.ListChannelsParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - for _, channel := range resp2.Payload.Channels { - assert.NotEqual(t, resp1, channel.ChannelID) - } - }) - - t.Run("unknown id", func(t *testing.T) { - t.Parallel() - - resp, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: gofakeit.Quote(), - Disabled: gofakeit.Bool(), - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: false, - To: []string{gofakeit.Email()}, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - defer deleteChannel(t, client, resp.Payload.ChannelID) - - _, err = client.RemoveChannel(&channels.RemoveChannelParams{ - Body: channels.RemoveChannelBody{ - ChannelID: uuid.New().String(), - }, - Context: pmmapitests.Context, - }) - require.Error(t, err) - }) - - t.Run("channel in use", func(t *testing.T) { - t.Parallel() - - templateName := createTemplate(t) - defer deleteTemplate(t, alertingClient.Default.Alerting, templateName) - - channelID, body := createChannel(t) - defer deleteChannel(t, channelsClient.Default.Channels, channelID) - - params := createAlertRuleParams(templateName, "", channelID, nil) - rule, err := channelsClient.Default.Rules.CreateAlertRule(params) - require.NoError(t, err) - defer deleteRule(t, channelsClient.Default.Rules, rule.Payload.RuleID) - - _, err = client.RemoveChannel(&channels.RemoveChannelParams{ - Body: channels.RemoveChannelBody{ - ChannelID: channelID, - }, - Context: pmmapitests.Context, - }) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.FailedPrecondition, `You can't delete the "%s" channel when it's being used by a rule.`, body.Summary) - - resp, err := client.ListChannels(&channels.ListChannelsParams{ - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - var found bool - for _, channel := range resp.Payload.Channels { - if channelID == channel.ChannelID { - found = true - } - } - assert.Truef(t, found, "Channel with id %s not found", channelID) - }) - }) - - t.Run("list", func(t *testing.T) { - client := channelsClient.Default.Channels - - summary := uuid.New().String() - email := gofakeit.Email() - disabled := gofakeit.Bool() - resp1, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: summary, - Disabled: disabled, - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: true, - To: []string{email}, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - defer deleteChannel(t, client, resp1.Payload.ChannelID) - - t.Run("without pagination", func(t *testing.T) { - resp, err := client.ListChannels(&channels.ListChannelsParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - assert.NotEmpty(t, resp.Payload.Channels) - var found bool - for _, channel := range resp.Payload.Channels { - if channel.ChannelID == resp1.Payload.ChannelID { - assert.Equal(t, summary, channel.Summary) - assert.Equal(t, disabled, channel.Disabled) - assert.Equal(t, []string{email}, channel.EmailConfig.To) - assert.True(t, channel.EmailConfig.SendResolved) - found = true - } - } - assert.True(t, found, "Expected channel not found") - }) - - t.Run("pagination", func(t *testing.T) { - const channelsCount = 5 - - channelIds := make(map[string]struct{}) - - for i := 0; i < channelsCount; i++ { - resp, err := client.AddChannel(&channels.AddChannelParams{ - Body: channels.AddChannelBody{ - Summary: gofakeit.Name(), - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: true, - To: []string{email}, - }, - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - channelIds[resp.Payload.ChannelID] = struct{}{} - } - defer func() { - for id := range channelIds { - deleteChannel(t, client, id) - } - }() - - // list channels, so they are all on the first page - body := channels.ListChannelsBody{ - PageParams: &channels.ListChannelsParamsBodyPageParams{ - PageSize: 20, - Index: 0, - }, - } - listAllChannels, err := client.ListChannels(&channels.ListChannelsParams{ - Body: body, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - assert.GreaterOrEqual(t, len(listAllChannels.Payload.Channels), channelsCount) - assert.Equal(t, int32(len(listAllChannels.Payload.Channels)), listAllChannels.Payload.Totals.TotalItems) - assert.Equal(t, int32(1), listAllChannels.Payload.Totals.TotalPages) - - assertFindChannel := func(list []*channels.ListChannelsOKBodyChannelsItems0, id string) func() bool { - return func() bool { - for _, channel := range list { - if channel.ChannelID == id { - return true - } - } - return false - } - } - - for name := range channelIds { - assert.Conditionf(t, assertFindChannel(listAllChannels.Payload.Channels, name), "channel %s not found", name) - } - - // paginate page over page with page size 1 and check the order - it should be the same as in listAllTemplates. - // last iteration checks that there is no elements for not existing page. - for pageIndex := 0; pageIndex <= len(listAllChannels.Payload.Channels); pageIndex++ { - body := channels.ListChannelsBody{ - PageParams: &channels.ListChannelsParamsBodyPageParams{ - PageSize: 1, - Index: int32(pageIndex), - }, - } - listOneTemplate, err := client.ListChannels(&channels.ListChannelsParams{ - Body: body, Context: pmmapitests.Context, - }) - require.NoError(t, err) - - assert.Equal(t, listAllChannels.Payload.Totals.TotalItems, listOneTemplate.Payload.Totals.TotalItems) - assert.GreaterOrEqual(t, listOneTemplate.Payload.Totals.TotalPages, int32(channelsCount)) - - if pageIndex != len(listAllChannels.Payload.Channels) { - require.Len(t, listOneTemplate.Payload.Channels, 1) - assert.Equal(t, listAllChannels.Payload.Channels[pageIndex].ChannelID, listOneTemplate.Payload.Channels[0].ChannelID) - } else { - assert.Len(t, listOneTemplate.Payload.Channels, 0) - } - } - }) - }) -} - -func deleteChannel(t *testing.T, client channels.ClientService, id string) { - t.Helper() - _, err := client.RemoveChannel(&channels.RemoveChannelParams{ - Body: channels.RemoveChannelBody{ - ChannelID: id, - }, - Context: pmmapitests.Context, - }) - assert.NoError(t, err) -} diff --git a/api-tests/management/ia/rules_test.go b/api-tests/management/ia/rules_test.go deleted file mode 100644 index fe887e4ef9..0000000000 --- a/api-tests/management/ia/rules_test.go +++ /dev/null @@ -1,748 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "fmt" - "os" - "testing" - - "github.com/AlekSi/pointer" - "github.com/brianvoe/gofakeit/v6" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - - pmmapitests "github.com/percona/pmm/api-tests" - alertingClient "github.com/percona/pmm/api/managementpb/alerting/json/client" - "github.com/percona/pmm/api/managementpb/alerting/json/client/alerting" - "github.com/percona/pmm/api/managementpb/ia/json/client" - "github.com/percona/pmm/api/managementpb/ia/json/client/channels" - "github.com/percona/pmm/api/managementpb/ia/json/client/rules" -) - -// Note: Even though the IA services check for alerting enabled or disabled before returning results -// we don't enable or disable IA explicit in our tests since it is enabled by default through -// ENABLE_ALERTING env var. -func TestRulesAPI(t *testing.T) { - t.Parallel() - rulesClient := client.Default.Rules - templatesClient := alertingClient.Default.Alerting - channelsClient := client.Default.Channels - - dummyFilter := &rules.CreateAlertRuleParamsBodyFiltersItems0{ - Type: pointer.ToString("EQUAL"), - Key: "threshold", - Value: "12", - } - - templateName := createTemplate(t) - channelID, _ := createChannel(t) - newChannelID, _ := createChannel(t) - t.Cleanup(func() { - deleteTemplate(t, alertingClient.Default.Alerting, templateName) - deleteChannel(t, channelsClient, channelID) - deleteChannel(t, channelsClient, newChannelID) - }) - - t.Run("add", func(t *testing.T) { - t.Parallel() - - t.Run("normal from template", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - assert.NotEmpty(t, rule.Payload.RuleID) - }) - - t.Run("without channels and filters", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams(templateName, "", "", nil) - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - assert.NotEmpty(t, rule.Payload.RuleID) - }) - - t.Run("builtin_template", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams("pmm_mongodb_restarted", "", channelID, dummyFilter) - params.Body.Params = []*rules.CreateAlertRuleParamsBodyParamsItems0{{ - Name: "threshold", - Type: pointer.ToString("FLOAT"), - Float: 3.14, - }} - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - assert.NotEmpty(t, rule.Payload.RuleID) - }) - - t.Run("use default value for parameter", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - assert.NotEmpty(t, rule.Payload.RuleID) - }) - - t.Run("normal from other rule", func(t *testing.T) { - t.Parallel() - - sourceRuleParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - sourceRule, err := rulesClient.CreateAlertRule(sourceRuleParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, sourceRule.Payload.RuleID) - - copyRuleParams := createAlertRuleParams("", sourceRule.Payload.RuleID, channelID, dummyFilter) - copyRule, err := rulesClient.CreateAlertRule(copyRuleParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, copyRule.Payload.RuleID) - - assert.NotEmpty(t, copyRule.Payload.RuleID) - }) - - t.Run("normal from other rule with deleted template", func(t *testing.T) { - t.Parallel() - - sourceTemplateName := createTemplate(t) - sourceRuleParams := createAlertRuleParams(sourceTemplateName, "", channelID, dummyFilter) - sourceRule, err := rulesClient.CreateAlertRule(sourceRuleParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, sourceRule.Payload.RuleID) - - deleteTemplate(t, templatesClient, sourceTemplateName) - - copyRuleParams := createAlertRuleParams("", sourceRule.Payload.RuleID, channelID, dummyFilter) - copyRule, err := rulesClient.CreateAlertRule(copyRuleParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, copyRule.Payload.RuleID) - - assert.NotEmpty(t, copyRule.Payload.RuleID) - }) - - t.Run("both template name and source rule id specified", func(t *testing.T) { - t.Parallel() - - sourceRuleParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - sourceRule, err := rulesClient.CreateAlertRule(sourceRuleParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, sourceRule.Payload.RuleID) - - copyRuleParams := createAlertRuleParams(templateName, sourceRule.Payload.RuleID, channelID, dummyFilter) - _, err = rulesClient.CreateAlertRule(copyRuleParams) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Both template name and source rule id are specified.") - }) - - t.Run("both template name and source rule id are empty", func(t *testing.T) { - t.Parallel() - - sourceRuleParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - sourceRule, err := rulesClient.CreateAlertRule(sourceRuleParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, sourceRule.Payload.RuleID) - - copyRuleParams := createAlertRuleParams("", "", channelID, dummyFilter) - _, err = rulesClient.CreateAlertRule(copyRuleParams) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Template name or source rule id should be specified.") - }) - - t.Run("unknown template", func(t *testing.T) { - t.Parallel() - - templateName := uuid.New().String() - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - _, err := rulesClient.CreateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 404, codes.NotFound, "Unknown template %s.", templateName) - }) - - t.Run("unknown channel", func(t *testing.T) { - t.Parallel() - - channelID := uuid.New().String() - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - _, err := rulesClient.CreateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 404, codes.NotFound, "Failed to find all required channels: [%s].", channelID) - }) - - t.Run("wrong parameter", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - params.Body.Params = append( - params.Body.Params, - &rules.CreateAlertRuleParamsBodyParamsItems0{ - Name: "unknown parameter", - Type: pointer.ToString("FLOAT"), - Float: 12, - }) - _, err := rulesClient.CreateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Expression requires 2 parameters, but got 3.") - }) - - t.Run("wrong parameter type", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - params.Body.Params = []*rules.CreateAlertRuleParamsBodyParamsItems0{ - { - Name: "param1", - Type: pointer.ToString("BOOL"), - Bool: true, - }, { - Name: "param2", - Type: pointer.ToString("FLOAT"), - Float: 12, - }, - } - _, err := rulesClient.CreateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Parameter param1 has type bool instead of float.") - }) - }) - - t.Run("update", func(t *testing.T) { - t.Parallel() - - t.Run("normal", func(t *testing.T) { - t.Parallel() - - cParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(cParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - params := &rules.UpdateAlertRuleParams{ - Body: rules.UpdateAlertRuleBody{ - RuleID: rule.Payload.RuleID, - Disabled: false, - Params: []*rules.UpdateAlertRuleParamsBodyParamsItems0{ - { - Name: "param1", - Type: pointer.ToString("FLOAT"), - Float: 3.14, - }, - { - Name: "param2", - Type: pointer.ToString("FLOAT"), - Float: 21, - }, - }, - For: "10s", - Severity: pointer.ToString("SEVERITY_ERROR"), - CustomLabels: map[string]string{"foo": "bar", "baz": "faz"}, - Filters: []*rules.UpdateAlertRuleParamsBodyFiltersItems0{{ - Type: pointer.ToString("EQUAL"), - Key: "param1", - Value: "21", - }}, - ChannelIds: []string{channelID, newChannelID}, - }, - Context: pmmapitests.Context, - } - _, err = rulesClient.UpdateAlertRule(params) - require.NoError(t, err) - - list, err := rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - var found bool - for _, r := range list.Payload.Rules { - if r.RuleID == rule.Payload.RuleID { - assert.Equal(t, params.Body.Name, r.Name) - assert.Equal(t, "Test summary", r.Summary) - assert.Equal(t, templateName, r.TemplateName) - assert.False(t, r.Disabled) - assert.Equal(t, "300s", r.DefaultFor) - assert.Equal(t, "10s", r.For) - assert.Equal(t, "SEVERITY_WARNING", pointer.GetString(r.DefaultSeverity)) - assert.Equal(t, params.Body.Severity, r.Severity) - assert.Equal(t, params.Body.CustomLabels, r.CustomLabels) - assert.Equal(t, map[string]string{"foo": "bar"}, r.Labels) - assert.Equal(t, map[string]string{"description": "test description", "summary": "test summary"}, r.Annotations) - assert.Len(t, r.ParamsValues, 2) - assert.Equal(t, params.Body.Params[0].Type, r.ParamsValues[0].Type) - assert.Equal(t, params.Body.Params[0].Name, r.ParamsValues[0].Name) - assert.Equal(t, params.Body.Params[0].Float, r.ParamsValues[0].Float) - assert.Equal(t, params.Body.Params[0].Bool, r.ParamsValues[0].Bool) - assert.Equal(t, params.Body.Params[0].String, r.ParamsValues[0].String) - assert.Equal(t, params.Body.Params[1].Type, r.ParamsValues[1].Type) - assert.Equal(t, params.Body.Params[1].Name, r.ParamsValues[1].Name) - assert.Equal(t, params.Body.Params[1].Float, r.ParamsValues[1].Float) - assert.Equal(t, params.Body.Params[1].Bool, r.ParamsValues[1].Bool) - assert.Equal(t, params.Body.Params[1].String, r.ParamsValues[1].String) - assert.Equal(t, "[[ .param1 ]] > 2 and 2 < [[ .param2 ]]", r.ExprTemplate) - assert.Equal(t, "3.14 > 2 and 2 < 21", r.Expr) - found = true - } - } - assert.Truef(t, found, "Rule with id %s not found", rule.Payload.RuleID) - }) - - t.Run("unknown channel", func(t *testing.T) { - t.Parallel() - - cParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(cParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - unknownChannelID := uuid.New().String() - params := &rules.UpdateAlertRuleParams{ - Body: rules.UpdateAlertRuleBody{ - RuleID: rule.Payload.RuleID, - Disabled: false, - Params: []*rules.UpdateAlertRuleParamsBodyParamsItems0{ - { - Name: "param1", - Type: pointer.ToString("FLOAT"), - Float: 3.14, - }, { - Name: "param2", - Type: pointer.ToString("FLOAT"), - Float: 21, - }, - }, - For: "10s", - Severity: pointer.ToString("SEVERITY_ERROR"), - CustomLabels: map[string]string{"foo": "bar", "baz": "faz"}, - Filters: []*rules.UpdateAlertRuleParamsBodyFiltersItems0{{ - Type: pointer.ToString("EQUAL"), - Key: "param1", - Value: "21", - }}, - ChannelIds: []string{channelID, unknownChannelID}, - }, - Context: pmmapitests.Context, - } - _, err = rulesClient.UpdateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 404, codes.NotFound, "Failed to find all required channels: [%s].", unknownChannelID) - }) - - t.Run("wrong parameter", func(t *testing.T) { - t.Parallel() - - cParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(cParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - params := &rules.UpdateAlertRuleParams{ - Body: rules.UpdateAlertRuleBody{ - RuleID: rule.Payload.RuleID, - Disabled: false, - Params: []*rules.UpdateAlertRuleParamsBodyParamsItems0{{ - Name: "param2", - Type: pointer.ToString("FLOAT"), - Float: 12, - }, { - Name: "unknown parameter", - Type: pointer.ToString("FLOAT"), - Float: 21, - }}, - For: "10s", - Severity: pointer.ToString("SEVERITY_ERROR"), - CustomLabels: map[string]string{"foo": "bar", "baz": "faz"}, - Filters: []*rules.UpdateAlertRuleParamsBodyFiltersItems0{{ - Type: pointer.ToString("EQUAL"), - Key: "param1", - Value: "21", - }}, - ChannelIds: []string{channelID, newChannelID}, - }, - Context: pmmapitests.Context, - } - _, err = rulesClient.UpdateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Parameter param1 is missing.") - }) - - t.Run("missing parameters", func(t *testing.T) { - t.Parallel() - - cParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(cParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - params := &rules.UpdateAlertRuleParams{ - Body: rules.UpdateAlertRuleBody{ - RuleID: rule.Payload.RuleID, - Disabled: false, - Params: nil, - For: "10s", - Severity: pointer.ToString("SEVERITY_ERROR"), - CustomLabels: map[string]string{"foo": "bar", "baz": "faz"}, - Filters: []*rules.UpdateAlertRuleParamsBodyFiltersItems0{{ - Type: pointer.ToString("EQUAL"), - Key: "param1", - Value: "21", - }}, - ChannelIds: []string{channelID, newChannelID}, - }, - Context: pmmapitests.Context, - } - _, err = rulesClient.UpdateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Expression requires 2 parameters, but got 0.") - }) - - t.Run("wrong parameter type", func(t *testing.T) { - t.Parallel() - - cParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(cParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - params := &rules.UpdateAlertRuleParams{ - Body: rules.UpdateAlertRuleBody{ - RuleID: rule.Payload.RuleID, - Disabled: false, - Params: []*rules.UpdateAlertRuleParamsBodyParamsItems0{ - { - Name: "param1", - Type: pointer.ToString("BOOL"), - Bool: true, - }, { - Name: "param2", - Type: pointer.ToString("FLOAT"), - Float: 3.14, - }, - }, - For: "10s", - Severity: pointer.ToString("SEVERITY_ERROR"), - CustomLabels: map[string]string{"foo": "bar", "baz": "faz"}, - Filters: []*rules.UpdateAlertRuleParamsBodyFiltersItems0{{ - Type: pointer.ToString("EQUAL"), - Key: "param1", - Value: "21", - }}, - ChannelIds: []string{channelID, newChannelID}, - }, - Context: pmmapitests.Context, - } - _, err = rulesClient.UpdateAlertRule(params) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, "Parameter param1 has type bool instead of float.") - }) - }) - - t.Run("toggle", func(t *testing.T) { - t.Parallel() - - cParams := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(cParams) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - list, err := rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - var found bool - for _, r := range list.Payload.Rules { - if r.RuleID == rule.Payload.RuleID { - assert.True(t, r.Disabled) - assert.Equal(t, "SEVERITY_WARNING", pointer.GetString(r.Severity)) - found = true - } - } - assert.Truef(t, found, "Rule with id %s not found", rule.Payload.RuleID) - - _, err = rulesClient.ToggleAlertRule(&rules.ToggleAlertRuleParams{ - Body: rules.ToggleAlertRuleBody{ - RuleID: rule.Payload.RuleID, - Disabled: pointer.ToString(rules.ToggleAlertRuleBodyDisabledFALSE), - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - list, err = rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - found = false - for _, r := range list.Payload.Rules { - if r.RuleID == rule.Payload.RuleID { - assert.False(t, r.Disabled) - assert.Equal(t, "SEVERITY_WARNING", pointer.GetString(r.Severity)) - found = true - } - } - assert.Truef(t, found, "Rule with id %s not found", rule.Payload.RuleID) - }) - - t.Run("delete", func(t *testing.T) { - t.Parallel() - - t.Run("normal", func(t *testing.T) { - t.Parallel() - - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - - _, err = rulesClient.DeleteAlertRule(&rules.DeleteAlertRuleParams{ - Body: rules.DeleteAlertRuleBody{RuleID: rule.Payload.RuleID}, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - list, err := rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - for _, r := range list.Payload.Rules { - assert.NotEqual(t, rule.Payload.RuleID, r.RuleID) - } - }) - - t.Run("missing rule", func(t *testing.T) { - t.Parallel() - ruleID := uuid.New().String() - _, err := rulesClient.DeleteAlertRule(&rules.DeleteAlertRuleParams{ - Body: rules.DeleteAlertRuleBody{RuleID: ruleID}, - Context: pmmapitests.Context, - }) - pmmapitests.AssertAPIErrorf(t, err, 404, codes.NotFound, "Rule with ID %q not found.", ruleID) - }) - }) - - t.Run("list without pagination", func(t *testing.T) { - t.Run("without pagination", func(t *testing.T) { - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - defer deleteRule(t, rulesClient, rule.Payload.RuleID) - - list, err := rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Context: pmmapitests.Context}) - require.NoError(t, err) - - var found bool - for _, r := range list.Payload.Rules { - if r.RuleID == rule.Payload.RuleID { - assert.Equal(t, params.Body.TemplateName, r.TemplateName) - assert.Equal(t, "Test summary", r.Summary) - assert.True(t, r.Disabled) - assert.Equal(t, params.Body.Name, r.Name) - assert.Len(t, r.ParamsValues, 2) - assert.Equal(t, params.Body.Params[0].Type, r.ParamsValues[0].Type) - assert.Equal(t, params.Body.Params[0].Name, r.ParamsValues[0].Name) - assert.Equal(t, params.Body.Params[0].Float, r.ParamsValues[0].Float) - assert.Equal(t, params.Body.Params[0].Bool, r.ParamsValues[0].Bool) - assert.Equal(t, params.Body.Params[0].String, r.ParamsValues[0].String) - assert.Equal(t, params.Body.Params[1].Type, r.ParamsValues[1].Type) - assert.Equal(t, params.Body.Params[1].Name, r.ParamsValues[1].Name) - assert.Equal(t, params.Body.Params[1].Float, r.ParamsValues[1].Float) - assert.Equal(t, params.Body.Params[1].Bool, r.ParamsValues[1].Bool) - assert.Equal(t, params.Body.Params[1].String, r.ParamsValues[1].String) - assert.Equal(t, "300s", r.DefaultFor) - assert.Equal(t, params.Body.For, r.For) - assert.Equal(t, "SEVERITY_WARNING", pointer.GetString(r.DefaultSeverity)) - assert.Equal(t, params.Body.Severity, r.Severity) - assert.Equal(t, params.Body.CustomLabels, r.CustomLabels) - assert.Equal(t, map[string]string{"foo": "bar"}, r.Labels) - assert.Equal(t, map[string]string{"description": "test description", "summary": "test summary"}, r.Annotations) - assert.Len(t, params.Body.Filters, 1) - assert.Equal(t, params.Body.Filters[0].Type, r.Filters[0].Type) - assert.Equal(t, params.Body.Filters[0].Key, r.Filters[0].Key) - assert.Equal(t, params.Body.Filters[0].Value, r.Filters[0].Value) - assert.Len(t, r.Channels, 1) - assert.Equal(t, r.Channels[0].ChannelID, channelID) - assert.Equal(t, "[[ .param1 ]] > 2 and 2 < [[ .param2 ]]", r.ExprTemplate) - assert.Equal(t, "4 > 2 and 2 < 12", r.Expr) - found = true - } - } - assert.Truef(t, found, "Rule with id %s not found", rule.Payload.RuleID) - }) - - t.Run("with pagination", func(t *testing.T) { - const rulesCount = 5 - - ruleIDs := make(map[string]struct{}) - - for i := 0; i < rulesCount; i++ { - params := createAlertRuleParams(templateName, "", channelID, dummyFilter) - rule, err := rulesClient.CreateAlertRule(params) - require.NoError(t, err) - - ruleIDs[rule.Payload.RuleID] = struct{}{} - } - defer func() { - for id := range ruleIDs { - deleteRule(t, rulesClient, id) - } - }() - - // list rules, so they are all on the first page - body := rules.ListAlertRulesBody{ - PageParams: &rules.ListAlertRulesParamsBodyPageParams{ - PageSize: 20, - Index: 0, - }, - } - list1, err := rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Body: body, Context: pmmapitests.Context}) - require.NoError(t, err) - - lp1 := list1.Payload - // some tests didn't remove rules, so expect more elements than created in current test - assert.GreaterOrEqual(t, len(lp1.Rules), rulesCount) - assert.Equal(t, int32(len(lp1.Rules)), lp1.Totals.TotalItems) - assert.Equal(t, int32(1), lp1.Totals.TotalPages) - for id := range ruleIDs { - var found bool - for _, r := range list1.Payload.Rules { - if r.RuleID == id { - found = true - - break - } - } - - assert.Truef(t, found, "rule (%s) not found", id) - } - - // paginate page over page with page size 1 and check the order - it should be the same as in list1. - // last iteration checks that there is no elements for not existing page. - for pageIndex := 0; pageIndex <= len(lp1.Rules); pageIndex++ { - body := rules.ListAlertRulesBody{ - PageParams: &rules.ListAlertRulesParamsBodyPageParams{ - PageSize: 1, - Index: int32(pageIndex), - }, - } - list2, err := rulesClient.ListAlertRules(&rules.ListAlertRulesParams{Body: body, Context: pmmapitests.Context}) - require.NoError(t, err) - - lp2 := list2.Payload - assert.Equal(t, lp1.Totals.TotalItems, lp2.Totals.TotalItems) - assert.GreaterOrEqual(t, lp2.Totals.TotalPages, int32(rulesCount)) - - if pageIndex != len(lp1.Rules) { - require.Len(t, lp2.Rules, 1) - assert.Equal(t, lp1.Rules[pageIndex].RuleID, lp2.Rules[0].RuleID) - } else { - assert.Len(t, lp2.Rules, 0) - } - } - }) - }) -} - -func deleteRule(t *testing.T, client rules.ClientService, id string) { - t.Helper() - - _, err := client.DeleteAlertRule(&rules.DeleteAlertRuleParams{ - Body: rules.DeleteAlertRuleBody{RuleID: id}, - Context: pmmapitests.Context, - }) - require.NoError(t, err) -} - -func createAlertRuleParams(templateName, sourceRuleID, channelID string, filter *rules.CreateAlertRuleParamsBodyFiltersItems0) *rules.CreateAlertRuleParams { - rule := &rules.CreateAlertRuleParams{ - Body: rules.CreateAlertRuleBody{ - TemplateName: templateName, - SourceRuleID: sourceRuleID, - Disabled: true, - Name: "example rule", - Params: []*rules.CreateAlertRuleParamsBodyParamsItems0{ - { - Name: "param1", - Type: pointer.ToString("FLOAT"), - Float: 4, - }, - { - Name: "param2", - Type: pointer.ToString("FLOAT"), - Float: 12, - }, - }, - For: "5s", - Severity: pointer.ToString("SEVERITY_WARNING"), - CustomLabels: map[string]string{"foo": "bar"}, - }, - Context: pmmapitests.Context, - } - - if channelID != "" { - rule.Body.ChannelIds = []string{channelID} - } - - if filter != nil { - rule.Body.Filters = []*rules.CreateAlertRuleParamsBodyFiltersItems0{filter} - } - - return rule -} - -func createTemplate(t *testing.T) string { - t.Helper() - - b, err := os.ReadFile("../../testdata/ia/template.yaml") - require.NoError(t, err) - - templateName := uuid.New().String() - expression := "'[[ .param1 ]] > 2 and 2 < [[ .param2 ]]'" - _, err = alertingClient.Default.Alerting.CreateTemplate(&alerting.CreateTemplateParams{ - Body: alerting.CreateTemplateBody{ - Yaml: fmt.Sprintf(string(b), templateName, expression, "%", "s"), - }, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - - return templateName -} - -func createChannel(t *testing.T) (string, channels.AddChannelBody) { - t.Helper() - - body := channels.AddChannelBody{ - Summary: gofakeit.Quote(), - Disabled: gofakeit.Bool(), - EmailConfig: &channels.AddChannelParamsBodyEmailConfig{ - SendResolved: false, - To: []string{gofakeit.Email()}, - }, - } - resp, err := client.Default.Channels.AddChannel(&channels.AddChannelParams{ - Body: body, - Context: pmmapitests.Context, - }) - require.NoError(t, err) - return resp.Payload.ChannelID, body -} - -func deleteTemplate(t *testing.T, client alerting.ClientService, name string) { - t.Helper() - - _, err := client.DeleteTemplate(&alerting.DeleteTemplateParams{ - Body: alerting.DeleteTemplateBody{ - Name: name, - }, - Context: pmmapitests.Context, - }) - assert.NoError(t, err) -} diff --git a/api-tests/server/helpers.go b/api-tests/server/helpers.go index 60f96e5c50..c073820595 100644 --- a/api-tests/server/helpers.go +++ b/api-tests/server/helpers.go @@ -48,12 +48,10 @@ func restoreSettingsDefaults(t *testing.T) { StandardInterval: "86400s", RareInterval: "280800s", }, - DataRetention: "2592000s", - AWSPartitions: []string{"aws"}, - RemoveAlertManagerURL: true, - RemoveAlertManagerRules: true, - RemoveEmailAlertingSettings: true, - RemoveSlackAlertingSettings: true, + DataRetention: "2592000s", + AWSPartitions: []string{"aws"}, + RemoveAlertManagerURL: true, + RemoveAlertManagerRules: true, }, Context: pmmapitests.Context, }) diff --git a/api-tests/server/settings_test.go b/api-tests/server/settings_test.go index 73497ef213..6d227a11ff 100644 --- a/api-tests/server/settings_test.go +++ b/api-tests/server/settings_test.go @@ -26,7 +26,6 @@ import ( "testing" "time" - "github.com/brianvoe/gofakeit/v6" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -60,8 +59,6 @@ func TestSettings(t *testing.T) { assert.Equal(t, []string{"aws"}, res.Payload.Settings.AWSPartitions) assert.False(t, res.Payload.Settings.UpdatesDisabled) assert.True(t, res.Payload.Settings.AlertingEnabled) - assert.Empty(t, res.Payload.Settings.EmailAlertingSettings) - assert.Empty(t, res.Payload.Settings.SlackAlertingSettings) t.Run("ChangeSettings", func(t *testing.T) { defer restoreSettingsDefaults(t) @@ -115,79 +112,14 @@ func TestSettings(t *testing.T) { t.Run("ValidAlertingSettingsUpdate", func(t *testing.T) { defer restoreSettingsDefaults(t) - email := gofakeit.Email() - smarthost := "0.0.0.0:8080" - username := "username" - password := "password" - identity := "identity" - secret := "secret" - slackURL := gofakeit.URL() res, err := serverClient.Default.Server.ChangeSettings(&server.ChangeSettingsParams{ Body: server.ChangeSettingsBody{ - EnableAlerting: true, - EmailAlertingSettings: &server.ChangeSettingsParamsBodyEmailAlertingSettings{ - From: email, - Smarthost: smarthost, - Username: username, - Password: password, - Identity: identity, - Secret: secret, - }, - SlackAlertingSettings: &server.ChangeSettingsParamsBodySlackAlertingSettings{ - URL: slackURL, - }, + DisableAlerting: true, }, Context: pmmapitests.Context, }) require.NoError(t, err) - assert.True(t, res.Payload.Settings.AlertingEnabled) - assert.Equal(t, email, res.Payload.Settings.EmailAlertingSettings.From) - assert.Equal(t, smarthost, res.Payload.Settings.EmailAlertingSettings.Smarthost) - assert.Equal(t, username, res.Payload.Settings.EmailAlertingSettings.Username) - // check that we don't expose password through the API. - assert.Empty(t, res.Payload.Settings.EmailAlertingSettings.Password) - assert.Equal(t, identity, res.Payload.Settings.EmailAlertingSettings.Identity) - assert.Equal(t, secret, res.Payload.Settings.EmailAlertingSettings.Secret) - assert.Equal(t, slackURL, res.Payload.Settings.SlackAlertingSettings.URL) - }) - - t.Run("InvalidBothSlackAlertingSettingsAndRemoveSlackAlertingSettings", func(t *testing.T) { - defer restoreSettingsDefaults(t) - - res, err := serverClient.Default.Server.ChangeSettings(&server.ChangeSettingsParams{ - Body: server.ChangeSettingsBody{ - SlackAlertingSettings: &server.ChangeSettingsParamsBodySlackAlertingSettings{ - URL: gofakeit.URL(), - }, - RemoveSlackAlertingSettings: true, - }, - Context: pmmapitests.Context, - }) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, - `Invalid argument: both slack_alerting_settings and remove_slack_alerting_settings are present.`) - assert.Empty(t, res) - }) - - t.Run("InvalidBothEmailAlertingSettingsAndRemoveEmailAlertingSettings", func(t *testing.T) { - defer restoreSettingsDefaults(t) - - res, err := serverClient.Default.Server.ChangeSettings(&server.ChangeSettingsParams{ - Body: server.ChangeSettingsBody{ - EmailAlertingSettings: &server.ChangeSettingsParamsBodyEmailAlertingSettings{ - From: gofakeit.Email(), - Smarthost: "0.0.0.0:8080", - Username: "username", - Password: "password", - Identity: "identity", - Secret: "secret", - }, - RemoveEmailAlertingSettings: true, - }, - Context: pmmapitests.Context, - }) - pmmapitests.AssertAPIErrorf(t, err, 400, codes.InvalidArgument, - `Invalid argument: both email_alerting_settings and remove_email_alerting_settings are present.`) - assert.Empty(t, res) + assert.False(t, res.Payload.Settings.AlertingEnabled) }) t.Run("InvalidBothEnableAndDisableSTT", func(t *testing.T) { diff --git a/api-tests/testdata/ia/invalid-template.yaml b/api-tests/testdata/alerting/invalid-template.yaml similarity index 100% rename from api-tests/testdata/ia/invalid-template.yaml rename to api-tests/testdata/alerting/invalid-template.yaml diff --git a/api-tests/testdata/ia/multiple-templates.yaml b/api-tests/testdata/alerting/multiple-templates.yaml similarity index 100% rename from api-tests/testdata/ia/multiple-templates.yaml rename to api-tests/testdata/alerting/multiple-templates.yaml diff --git a/api-tests/testdata/ia/template.yaml b/api-tests/testdata/alerting/template.yaml similarity index 100% rename from api-tests/testdata/ia/template.yaml rename to api-tests/testdata/alerting/template.yaml diff --git a/api/managementpb/ia/alerts.pb.go b/api/managementpb/ia/alerts.pb.go deleted file mode 100644 index c8ac098177..0000000000 --- a/api/managementpb/ia/alerts.pb.go +++ /dev/null @@ -1,591 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: managementpb/ia/alerts.proto - -package iav1beta1 - -import ( - reflect "reflect" - sync "sync" - - _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - - managementpb "github.com/percona/pmm/api/managementpb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Alert represents Alert. -// -// Deprecated: Marked as deprecated in managementpb/ia/alerts.proto. -type Alert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ID. - AlertId string `protobuf:"bytes,1,opt,name=alert_id,json=alertId,proto3" json:"alert_id,omitempty"` - // Human-readable summary. - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - // Severity. - Severity managementpb.Severity `protobuf:"varint,3,opt,name=severity,proto3,enum=management.Severity" json:"severity,omitempty"` - // Status. - Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=ia.v1beta1.Status" json:"status,omitempty"` - // Combined labels. - Labels map[string]string `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // The current Alert Rule. - Rule *Rule `protobuf:"bytes,6,opt,name=rule,proto3" json:"rule,omitempty"` - // Alert creation time. - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - // Alert last update time. - UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` -} - -func (x *Alert) Reset() { - *x = Alert{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_alerts_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Alert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Alert) ProtoMessage() {} - -func (x *Alert) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_alerts_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Alert.ProtoReflect.Descriptor instead. -func (*Alert) Descriptor() ([]byte, []int) { - return file_managementpb_ia_alerts_proto_rawDescGZIP(), []int{0} -} - -func (x *Alert) GetAlertId() string { - if x != nil { - return x.AlertId - } - return "" -} - -func (x *Alert) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Alert) GetSeverity() managementpb.Severity { - if x != nil { - return x.Severity - } - return managementpb.Severity(0) -} - -func (x *Alert) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_STATUS_INVALID -} - -func (x *Alert) GetLabels() map[string]string { - if x != nil { - return x.Labels - } - return nil -} - -func (x *Alert) GetRule() *Rule { - if x != nil { - return x.Rule - } - return nil -} - -func (x *Alert) GetCreatedAt() *timestamppb.Timestamp { - if x != nil { - return x.CreatedAt - } - return nil -} - -func (x *Alert) GetUpdatedAt() *timestamppb.Timestamp { - if x != nil { - return x.UpdatedAt - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/alerts.proto. -type ListAlertsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Page request. - PageParams *managementpb.PageParams `protobuf:"bytes,1,opt,name=page_params,json=pageParams,proto3" json:"page_params,omitempty"` -} - -func (x *ListAlertsRequest) Reset() { - *x = ListAlertsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_alerts_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListAlertsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAlertsRequest) ProtoMessage() {} - -func (x *ListAlertsRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_alerts_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAlertsRequest.ProtoReflect.Descriptor instead. -func (*ListAlertsRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_alerts_proto_rawDescGZIP(), []int{1} -} - -func (x *ListAlertsRequest) GetPageParams() *managementpb.PageParams { - if x != nil { - return x.PageParams - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/alerts.proto. -type ListAlertsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Alerts []*Alert `protobuf:"bytes,1,rep,name=alerts,proto3" json:"alerts,omitempty"` - // Total items and pages. - Totals *managementpb.PageTotals `protobuf:"bytes,2,opt,name=totals,proto3" json:"totals,omitempty"` -} - -func (x *ListAlertsResponse) Reset() { - *x = ListAlertsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_alerts_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListAlertsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAlertsResponse) ProtoMessage() {} - -func (x *ListAlertsResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_alerts_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAlertsResponse.ProtoReflect.Descriptor instead. -func (*ListAlertsResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_alerts_proto_rawDescGZIP(), []int{2} -} - -func (x *ListAlertsResponse) GetAlerts() []*Alert { - if x != nil { - return x.Alerts - } - return nil -} - -func (x *ListAlertsResponse) GetTotals() *managementpb.PageTotals { - if x != nil { - return x.Totals - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/alerts.proto. -type ToggleAlertsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of alerts that silence state should be switched. If provided array is empty than all - // existing alerts are switched. - AlertIds []string `protobuf:"bytes,1,rep,name=alert_ids,json=alertIds,proto3" json:"alert_ids,omitempty"` - // Silences or unsilences alert if set. - Silenced managementpb.BooleanFlag `protobuf:"varint,2,opt,name=silenced,proto3,enum=managementpb.BooleanFlag" json:"silenced,omitempty"` -} - -func (x *ToggleAlertsRequest) Reset() { - *x = ToggleAlertsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_alerts_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToggleAlertsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToggleAlertsRequest) ProtoMessage() {} - -func (x *ToggleAlertsRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_alerts_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToggleAlertsRequest.ProtoReflect.Descriptor instead. -func (*ToggleAlertsRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_alerts_proto_rawDescGZIP(), []int{3} -} - -func (x *ToggleAlertsRequest) GetAlertIds() []string { - if x != nil { - return x.AlertIds - } - return nil -} - -func (x *ToggleAlertsRequest) GetSilenced() managementpb.BooleanFlag { - if x != nil { - return x.Silenced - } - return managementpb.BooleanFlag(0) -} - -// Deprecated: Marked as deprecated in managementpb/ia/alerts.proto. -type ToggleAlertsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ToggleAlertsResponse) Reset() { - *x = ToggleAlertsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_alerts_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToggleAlertsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToggleAlertsResponse) ProtoMessage() {} - -func (x *ToggleAlertsResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_alerts_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToggleAlertsResponse.ProtoReflect.Descriptor instead. -func (*ToggleAlertsResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_alerts_proto_rawDescGZIP(), []int{4} -} - -var File_managementpb_ia_alerts_proto protoreflect.FileDescriptor - -var file_managementpb_ia_alerts_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, - 0x61, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, - 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x5f, - 0x66, 0x6c, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, 0x61, 0x2f, 0x72, 0x75, 0x6c, 0x65, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, 0x61, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x70, 0x62, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x70, 0x62, 0x2f, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xac, 0x03, 0x0a, 0x05, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, - 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, - 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, - 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, - 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x24, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x02, 0x18, 0x01, - 0x22, 0x50, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x02, - 0x18, 0x01, 0x22, 0x73, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x06, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x12, 0x2e, 0x0a, 0x06, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x52, 0x06, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x6d, 0x0a, 0x13, 0x54, 0x6f, 0x67, 0x67, 0x6c, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, - 0x0a, 0x09, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x08, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x49, 0x64, 0x73, 0x12, 0x35, 0x0a, 0x08, 0x73, - 0x69, 0x6c, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, - 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x52, 0x08, 0x73, 0x69, 0x6c, 0x65, 0x6e, 0x63, - 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1a, 0x0a, 0x14, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x3a, 0x02, - 0x18, 0x01, 0x32, 0xce, 0x02, 0x0a, 0x06, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x12, 0x7d, 0x0a, - 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x12, 0x1d, 0x2e, 0x69, 0x61, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x92, 0x41, 0x02, 0x58, - 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x69, 0x61, 0x2f, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x88, 0x02, 0x01, 0x12, 0xc4, 0x01, 0x0a, - 0x0c, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x12, 0x1f, 0x2e, - 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x67, 0x67, 0x6c, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, - 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x67, 0x67, - 0x6c, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x71, 0x92, 0x41, 0x41, 0x1a, 0x3d, 0x50, 0x61, 0x73, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x20, - 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x20, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, - 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, - 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x69, 0x61, 0x2f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, - 0x88, 0x02, 0x01, 0x42, 0x9c, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x61, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, - 0x61, 0x3b, 0x69, 0x61, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x58, - 0x58, 0xaa, 0x02, 0x0a, 0x49, 0x61, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, - 0x0a, 0x49, 0x61, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x16, 0x49, 0x61, - 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x49, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_managementpb_ia_alerts_proto_rawDescOnce sync.Once - file_managementpb_ia_alerts_proto_rawDescData = file_managementpb_ia_alerts_proto_rawDesc -) - -func file_managementpb_ia_alerts_proto_rawDescGZIP() []byte { - file_managementpb_ia_alerts_proto_rawDescOnce.Do(func() { - file_managementpb_ia_alerts_proto_rawDescData = protoimpl.X.CompressGZIP(file_managementpb_ia_alerts_proto_rawDescData) - }) - return file_managementpb_ia_alerts_proto_rawDescData -} - -var ( - file_managementpb_ia_alerts_proto_msgTypes = make([]protoimpl.MessageInfo, 6) - file_managementpb_ia_alerts_proto_goTypes = []interface{}{ - (*Alert)(nil), // 0: ia.v1beta1.Alert - (*ListAlertsRequest)(nil), // 1: ia.v1beta1.ListAlertsRequest - (*ListAlertsResponse)(nil), // 2: ia.v1beta1.ListAlertsResponse - (*ToggleAlertsRequest)(nil), // 3: ia.v1beta1.ToggleAlertsRequest - (*ToggleAlertsResponse)(nil), // 4: ia.v1beta1.ToggleAlertsResponse - nil, // 5: ia.v1beta1.Alert.LabelsEntry - (managementpb.Severity)(0), // 6: management.Severity - (Status)(0), // 7: ia.v1beta1.Status - (*Rule)(nil), // 8: ia.v1beta1.Rule - (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp - (*managementpb.PageParams)(nil), // 10: management.PageParams - (*managementpb.PageTotals)(nil), // 11: management.PageTotals - (managementpb.BooleanFlag)(0), // 12: managementpb.BooleanFlag - } -) - -var file_managementpb_ia_alerts_proto_depIdxs = []int32{ - 6, // 0: ia.v1beta1.Alert.severity:type_name -> management.Severity - 7, // 1: ia.v1beta1.Alert.status:type_name -> ia.v1beta1.Status - 5, // 2: ia.v1beta1.Alert.labels:type_name -> ia.v1beta1.Alert.LabelsEntry - 8, // 3: ia.v1beta1.Alert.rule:type_name -> ia.v1beta1.Rule - 9, // 4: ia.v1beta1.Alert.created_at:type_name -> google.protobuf.Timestamp - 9, // 5: ia.v1beta1.Alert.updated_at:type_name -> google.protobuf.Timestamp - 10, // 6: ia.v1beta1.ListAlertsRequest.page_params:type_name -> management.PageParams - 0, // 7: ia.v1beta1.ListAlertsResponse.alerts:type_name -> ia.v1beta1.Alert - 11, // 8: ia.v1beta1.ListAlertsResponse.totals:type_name -> management.PageTotals - 12, // 9: ia.v1beta1.ToggleAlertsRequest.silenced:type_name -> managementpb.BooleanFlag - 1, // 10: ia.v1beta1.Alerts.ListAlerts:input_type -> ia.v1beta1.ListAlertsRequest - 3, // 11: ia.v1beta1.Alerts.ToggleAlerts:input_type -> ia.v1beta1.ToggleAlertsRequest - 2, // 12: ia.v1beta1.Alerts.ListAlerts:output_type -> ia.v1beta1.ListAlertsResponse - 4, // 13: ia.v1beta1.Alerts.ToggleAlerts:output_type -> ia.v1beta1.ToggleAlertsResponse - 12, // [12:14] is the sub-list for method output_type - 10, // [10:12] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name -} - -func init() { file_managementpb_ia_alerts_proto_init() } -func file_managementpb_ia_alerts_proto_init() { - if File_managementpb_ia_alerts_proto != nil { - return - } - file_managementpb_ia_rules_proto_init() - file_managementpb_ia_status_proto_init() - if !protoimpl.UnsafeEnabled { - file_managementpb_ia_alerts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Alert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_alerts_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListAlertsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_alerts_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListAlertsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_alerts_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToggleAlertsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_alerts_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToggleAlertsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_managementpb_ia_alerts_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_managementpb_ia_alerts_proto_goTypes, - DependencyIndexes: file_managementpb_ia_alerts_proto_depIdxs, - MessageInfos: file_managementpb_ia_alerts_proto_msgTypes, - }.Build() - File_managementpb_ia_alerts_proto = out.File - file_managementpb_ia_alerts_proto_rawDesc = nil - file_managementpb_ia_alerts_proto_goTypes = nil - file_managementpb_ia_alerts_proto_depIdxs = nil -} diff --git a/api/managementpb/ia/alerts.pb.gw.go b/api/managementpb/ia/alerts.pb.gw.go deleted file mode 100644 index 00ed66298e..0000000000 --- a/api/managementpb/ia/alerts.pb.gw.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: managementpb/ia/alerts.proto - -/* -Package iav1beta1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package iav1beta1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = metadata.Join -) - -func request_Alerts_ListAlerts_0(ctx context.Context, marshaler runtime.Marshaler, client AlertsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListAlertsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListAlerts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Alerts_ListAlerts_0(ctx context.Context, marshaler runtime.Marshaler, server AlertsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListAlertsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListAlerts(ctx, &protoReq) - return msg, metadata, err -} - -func request_Alerts_ToggleAlerts_0(ctx context.Context, marshaler runtime.Marshaler, client AlertsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ToggleAlertsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ToggleAlerts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Alerts_ToggleAlerts_0(ctx context.Context, marshaler runtime.Marshaler, server AlertsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ToggleAlertsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ToggleAlerts(ctx, &protoReq) - return msg, metadata, err -} - -// RegisterAlertsHandlerServer registers the http handlers for service Alerts to "mux". -// UnaryRPC :call AlertsServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAlertsHandlerFromEndpoint instead. -func RegisterAlertsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AlertsServer) error { - mux.Handle("POST", pattern_Alerts_ListAlerts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Alerts/ListAlerts", runtime.WithHTTPPathPattern("/v1/management/ia/Alerts/List")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Alerts_ListAlerts_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Alerts_ListAlerts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Alerts_ToggleAlerts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Alerts/ToggleAlerts", runtime.WithHTTPPathPattern("/v1/management/ia/Alerts/Toggle")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Alerts_ToggleAlerts_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Alerts_ToggleAlerts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -// RegisterAlertsHandlerFromEndpoint is same as RegisterAlertsHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterAlertsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterAlertsHandler(ctx, mux, conn) -} - -// RegisterAlertsHandler registers the http handlers for service Alerts to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterAlertsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterAlertsHandlerClient(ctx, mux, NewAlertsClient(conn)) -} - -// RegisterAlertsHandlerClient registers the http handlers for service Alerts -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AlertsClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AlertsClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AlertsClient" to call the correct interceptors. -func RegisterAlertsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AlertsClient) error { - mux.Handle("POST", pattern_Alerts_ListAlerts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Alerts/ListAlerts", runtime.WithHTTPPathPattern("/v1/management/ia/Alerts/List")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Alerts_ListAlerts_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Alerts_ListAlerts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Alerts_ToggleAlerts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Alerts/ToggleAlerts", runtime.WithHTTPPathPattern("/v1/management/ia/Alerts/Toggle")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Alerts_ToggleAlerts_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Alerts_ToggleAlerts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -var ( - pattern_Alerts_ListAlerts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Alerts", "List"}, "")) - - pattern_Alerts_ToggleAlerts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Alerts", "Toggle"}, "")) -) - -var ( - forward_Alerts_ListAlerts_0 = runtime.ForwardResponseMessage - - forward_Alerts_ToggleAlerts_0 = runtime.ForwardResponseMessage -) diff --git a/api/managementpb/ia/alerts.pb.validate.go b/api/managementpb/ia/alerts.pb.validate.go deleted file mode 100644 index 82f050f980..0000000000 --- a/api/managementpb/ia/alerts.pb.validate.go +++ /dev/null @@ -1,737 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: managementpb/ia/alerts.proto - -package iav1beta1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - managementpb "github.com/percona/pmm/api/managementpb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = managementpb.Severity(0) -) - -// Validate checks the field values on Alert with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Alert) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Alert with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in AlertMultiError, or nil if none found. -func (m *Alert) ValidateAll() error { - return m.validate(true) -} - -func (m *Alert) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AlertId - - // no validation rules for Summary - - // no validation rules for Severity - - // no validation rules for Status - - // no validation rules for Labels - - if all { - switch v := interface{}(m.GetRule()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AlertValidationError{ - field: "Rule", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AlertValidationError{ - field: "Rule", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRule()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AlertValidationError{ - field: "Rule", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetCreatedAt()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AlertValidationError{ - field: "CreatedAt", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AlertValidationError{ - field: "CreatedAt", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AlertValidationError{ - field: "CreatedAt", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetUpdatedAt()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AlertValidationError{ - field: "UpdatedAt", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AlertValidationError{ - field: "UpdatedAt", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AlertValidationError{ - field: "UpdatedAt", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return AlertMultiError(errors) - } - - return nil -} - -// AlertMultiError is an error wrapping multiple validation errors returned by -// Alert.ValidateAll() if the designated constraints aren't met. -type AlertMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AlertMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AlertMultiError) AllErrors() []error { return m } - -// AlertValidationError is the validation error returned by Alert.Validate if -// the designated constraints aren't met. -type AlertValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AlertValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AlertValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AlertValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AlertValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AlertValidationError) ErrorName() string { return "AlertValidationError" } - -// Error satisfies the builtin error interface -func (e AlertValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAlert.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AlertValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AlertValidationError{} - -// Validate checks the field values on ListAlertsRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ListAlertsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListAlertsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListAlertsRequestMultiError, or nil if none found. -func (m *ListAlertsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListAlertsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetPageParams()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAlertsRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAlertsRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPageParams()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAlertsRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ListAlertsRequestMultiError(errors) - } - - return nil -} - -// ListAlertsRequestMultiError is an error wrapping multiple validation errors -// returned by ListAlertsRequest.ValidateAll() if the designated constraints -// aren't met. -type ListAlertsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListAlertsRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListAlertsRequestMultiError) AllErrors() []error { return m } - -// ListAlertsRequestValidationError is the validation error returned by -// ListAlertsRequest.Validate if the designated constraints aren't met. -type ListAlertsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListAlertsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListAlertsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListAlertsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListAlertsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListAlertsRequestValidationError) ErrorName() string { - return "ListAlertsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ListAlertsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListAlertsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListAlertsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListAlertsRequestValidationError{} - -// Validate checks the field values on ListAlertsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListAlertsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListAlertsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListAlertsResponseMultiError, or nil if none found. -func (m *ListAlertsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListAlertsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetAlerts() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAlertsResponseValidationError{ - field: fmt.Sprintf("Alerts[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAlertsResponseValidationError{ - field: fmt.Sprintf("Alerts[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAlertsResponseValidationError{ - field: fmt.Sprintf("Alerts[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetTotals()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAlertsResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAlertsResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTotals()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAlertsResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ListAlertsResponseMultiError(errors) - } - - return nil -} - -// ListAlertsResponseMultiError is an error wrapping multiple validation errors -// returned by ListAlertsResponse.ValidateAll() if the designated constraints -// aren't met. -type ListAlertsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListAlertsResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListAlertsResponseMultiError) AllErrors() []error { return m } - -// ListAlertsResponseValidationError is the validation error returned by -// ListAlertsResponse.Validate if the designated constraints aren't met. -type ListAlertsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListAlertsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListAlertsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListAlertsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListAlertsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListAlertsResponseValidationError) ErrorName() string { - return "ListAlertsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ListAlertsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListAlertsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListAlertsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListAlertsResponseValidationError{} - -// Validate checks the field values on ToggleAlertsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ToggleAlertsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ToggleAlertsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ToggleAlertsRequestMultiError, or nil if none found. -func (m *ToggleAlertsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ToggleAlertsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Silenced - - if len(errors) > 0 { - return ToggleAlertsRequestMultiError(errors) - } - - return nil -} - -// ToggleAlertsRequestMultiError is an error wrapping multiple validation -// errors returned by ToggleAlertsRequest.ValidateAll() if the designated -// constraints aren't met. -type ToggleAlertsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ToggleAlertsRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ToggleAlertsRequestMultiError) AllErrors() []error { return m } - -// ToggleAlertsRequestValidationError is the validation error returned by -// ToggleAlertsRequest.Validate if the designated constraints aren't met. -type ToggleAlertsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ToggleAlertsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ToggleAlertsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ToggleAlertsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ToggleAlertsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ToggleAlertsRequestValidationError) ErrorName() string { - return "ToggleAlertsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ToggleAlertsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sToggleAlertsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ToggleAlertsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ToggleAlertsRequestValidationError{} - -// Validate checks the field values on ToggleAlertsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ToggleAlertsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ToggleAlertsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ToggleAlertsResponseMultiError, or nil if none found. -func (m *ToggleAlertsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ToggleAlertsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return ToggleAlertsResponseMultiError(errors) - } - - return nil -} - -// ToggleAlertsResponseMultiError is an error wrapping multiple validation -// errors returned by ToggleAlertsResponse.ValidateAll() if the designated -// constraints aren't met. -type ToggleAlertsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ToggleAlertsResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ToggleAlertsResponseMultiError) AllErrors() []error { return m } - -// ToggleAlertsResponseValidationError is the validation error returned by -// ToggleAlertsResponse.Validate if the designated constraints aren't met. -type ToggleAlertsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ToggleAlertsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ToggleAlertsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ToggleAlertsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ToggleAlertsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ToggleAlertsResponseValidationError) ErrorName() string { - return "ToggleAlertsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ToggleAlertsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sToggleAlertsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ToggleAlertsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ToggleAlertsResponseValidationError{} diff --git a/api/managementpb/ia/alerts.proto b/api/managementpb/ia/alerts.proto deleted file mode 100644 index f3383125e8..0000000000 --- a/api/managementpb/ia/alerts.proto +++ /dev/null @@ -1,86 +0,0 @@ -syntax = "proto3"; - -package ia.v1beta1; - -import "google/api/annotations.proto"; -import "google/protobuf/timestamp.proto"; -import "managementpb/boolean_flag.proto"; -import "managementpb/ia/rules.proto"; -import "managementpb/ia/status.proto"; -import "managementpb/pagination.proto"; -import "managementpb/severity.proto"; -import "protoc-gen-openapiv2/options/annotations.proto"; - -option go_package = "api/managementpb/ia;iav1beta1"; - -// Alert represents Alert. -message Alert { - option deprecated = true; - // ID. - string alert_id = 1; - // Human-readable summary. - string summary = 2; - // Severity. - management.Severity severity = 3; - // Status. - Status status = 4; - // Combined labels. - map labels = 5; - // The current Alert Rule. - Rule rule = 6; - // Alert creation time. - google.protobuf.Timestamp created_at = 7; - // Alert last update time. - google.protobuf.Timestamp updated_at = 8; -} - -message ListAlertsRequest { - option deprecated = true; - // Page request. - management.PageParams page_params = 1; -} - -message ListAlertsResponse { - option deprecated = true; - repeated Alert alerts = 1; - // Total items and pages. - management.PageTotals totals = 2; -} - -message ToggleAlertsRequest { - option deprecated = true; - // List of alerts that silence state should be switched. If provided array is empty than all - // existing alerts are switched. - repeated string alert_ids = 1; - // Silences or unsilences alert if set. - managementpb.BooleanFlag silenced = 2; -} - -message ToggleAlertsResponse { - option deprecated = true; -} - -// Alerts service provides public methods for managing Alerting Alerts. -service Alerts { - // ListAlerts returns a list of all Alerts. - rpc ListAlerts(ListAlertsRequest) returns (ListAlertsResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Alerts/List" - body: "*" - }; - } - // ToggleAlerts allows to switch alerts state between silenced and unsilenced. - rpc ToggleAlerts(ToggleAlertsRequest) returns (ToggleAlertsResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { - deprecated: true - description: "Pass empty list to apply toggle action to all existing alerts" - }; - option (google.api.http) = { - post: "/v1/management/ia/Alerts/Toggle" - body: "*" - }; - } -} diff --git a/api/managementpb/ia/alerts_grpc.pb.go b/api/managementpb/ia/alerts_grpc.pb.go deleted file mode 100644 index 33c9513f7a..0000000000 --- a/api/managementpb/ia/alerts_grpc.pb.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: managementpb/ia/alerts.proto - -package iav1beta1 - -import ( - context "context" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Alerts_ListAlerts_FullMethodName = "/ia.v1beta1.Alerts/ListAlerts" - Alerts_ToggleAlerts_FullMethodName = "/ia.v1beta1.Alerts/ToggleAlerts" -) - -// AlertsClient is the client API for Alerts service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type AlertsClient interface { - // Deprecated: Do not use. - // ListAlerts returns a list of all Alerts. - ListAlerts(ctx context.Context, in *ListAlertsRequest, opts ...grpc.CallOption) (*ListAlertsResponse, error) - // Deprecated: Do not use. - // ToggleAlerts allows to switch alerts state between silenced and unsilenced. - ToggleAlerts(ctx context.Context, in *ToggleAlertsRequest, opts ...grpc.CallOption) (*ToggleAlertsResponse, error) -} - -type alertsClient struct { - cc grpc.ClientConnInterface -} - -func NewAlertsClient(cc grpc.ClientConnInterface) AlertsClient { - return &alertsClient{cc} -} - -// Deprecated: Do not use. -func (c *alertsClient) ListAlerts(ctx context.Context, in *ListAlertsRequest, opts ...grpc.CallOption) (*ListAlertsResponse, error) { - out := new(ListAlertsResponse) - err := c.cc.Invoke(ctx, Alerts_ListAlerts_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *alertsClient) ToggleAlerts(ctx context.Context, in *ToggleAlertsRequest, opts ...grpc.CallOption) (*ToggleAlertsResponse, error) { - out := new(ToggleAlertsResponse) - err := c.cc.Invoke(ctx, Alerts_ToggleAlerts_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AlertsServer is the server API for Alerts service. -// All implementations must embed UnimplementedAlertsServer -// for forward compatibility -type AlertsServer interface { - // Deprecated: Do not use. - // ListAlerts returns a list of all Alerts. - ListAlerts(context.Context, *ListAlertsRequest) (*ListAlertsResponse, error) - // Deprecated: Do not use. - // ToggleAlerts allows to switch alerts state between silenced and unsilenced. - ToggleAlerts(context.Context, *ToggleAlertsRequest) (*ToggleAlertsResponse, error) - mustEmbedUnimplementedAlertsServer() -} - -// UnimplementedAlertsServer must be embedded to have forward compatible implementations. -type UnimplementedAlertsServer struct{} - -func (UnimplementedAlertsServer) ListAlerts(context.Context, *ListAlertsRequest) (*ListAlertsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAlerts not implemented") -} - -func (UnimplementedAlertsServer) ToggleAlerts(context.Context, *ToggleAlertsRequest) (*ToggleAlertsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ToggleAlerts not implemented") -} -func (UnimplementedAlertsServer) mustEmbedUnimplementedAlertsServer() {} - -// UnsafeAlertsServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AlertsServer will -// result in compilation errors. -type UnsafeAlertsServer interface { - mustEmbedUnimplementedAlertsServer() -} - -func RegisterAlertsServer(s grpc.ServiceRegistrar, srv AlertsServer) { - s.RegisterService(&Alerts_ServiceDesc, srv) -} - -func _Alerts_ListAlerts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListAlertsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AlertsServer).ListAlerts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Alerts_ListAlerts_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AlertsServer).ListAlerts(ctx, req.(*ListAlertsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Alerts_ToggleAlerts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ToggleAlertsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AlertsServer).ToggleAlerts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Alerts_ToggleAlerts_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AlertsServer).ToggleAlerts(ctx, req.(*ToggleAlertsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Alerts_ServiceDesc is the grpc.ServiceDesc for Alerts service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Alerts_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "ia.v1beta1.Alerts", - HandlerType: (*AlertsServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListAlerts", - Handler: _Alerts_ListAlerts_Handler, - }, - { - MethodName: "ToggleAlerts", - Handler: _Alerts_ToggleAlerts_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "managementpb/ia/alerts.proto", -} diff --git a/api/managementpb/ia/channels.pb.go b/api/managementpb/ia/channels.pb.go deleted file mode 100644 index 70636dd1af..0000000000 --- a/api/managementpb/ia/channels.pb.go +++ /dev/null @@ -1,1694 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: managementpb/ia/channels.proto - -package iav1beta1 - -import ( - reflect "reflect" - sync "sync" - - _ "github.com/envoyproxy/protoc-gen-validate/validate" - _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - managementpb "github.com/percona/pmm/api/managementpb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// BasicAuth represents basic HTTP auth configuration. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type BasicAuth struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - PasswordFile string `protobuf:"bytes,3,opt,name=password_file,json=passwordFile,proto3" json:"password_file,omitempty"` -} - -func (x *BasicAuth) Reset() { - *x = BasicAuth{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BasicAuth) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BasicAuth) ProtoMessage() {} - -func (x *BasicAuth) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BasicAuth.ProtoReflect.Descriptor instead. -func (*BasicAuth) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{0} -} - -func (x *BasicAuth) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *BasicAuth) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *BasicAuth) GetPasswordFile() string { - if x != nil { - return x.PasswordFile - } - return "" -} - -// TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type TLSConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFile string `protobuf:"bytes,1,opt,name=ca_file,json=caFile,proto3" json:"ca_file,omitempty"` - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFile string `protobuf:"bytes,2,opt,name=cert_file,json=certFile,proto3" json:"cert_file,omitempty"` - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFile string `protobuf:"bytes,3,opt,name=key_file,json=keyFile,proto3" json:"key_file,omitempty"` - // Name of the server. - ServerName string `protobuf:"bytes,4,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"` - // Disable validation of the server certificate. - InsecureSkipVerify bool `protobuf:"varint,5,opt,name=insecure_skip_verify,json=insecureSkipVerify,proto3" json:"insecure_skip_verify,omitempty"` - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFileContent string `protobuf:"bytes,6,opt,name=ca_file_content,json=caFileContent,proto3" json:"ca_file_content,omitempty"` - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFileContent string `protobuf:"bytes,7,opt,name=cert_file_content,json=certFileContent,proto3" json:"cert_file_content,omitempty"` - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFileContent string `protobuf:"bytes,8,opt,name=key_file_content,json=keyFileContent,proto3" json:"key_file_content,omitempty"` -} - -func (x *TLSConfig) Reset() { - *x = TLSConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TLSConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TLSConfig) ProtoMessage() {} - -func (x *TLSConfig) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TLSConfig.ProtoReflect.Descriptor instead. -func (*TLSConfig) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{1} -} - -func (x *TLSConfig) GetCaFile() string { - if x != nil { - return x.CaFile - } - return "" -} - -func (x *TLSConfig) GetCertFile() string { - if x != nil { - return x.CertFile - } - return "" -} - -func (x *TLSConfig) GetKeyFile() string { - if x != nil { - return x.KeyFile - } - return "" -} - -func (x *TLSConfig) GetServerName() string { - if x != nil { - return x.ServerName - } - return "" -} - -func (x *TLSConfig) GetInsecureSkipVerify() bool { - if x != nil { - return x.InsecureSkipVerify - } - return false -} - -func (x *TLSConfig) GetCaFileContent() string { - if x != nil { - return x.CaFileContent - } - return "" -} - -func (x *TLSConfig) GetCertFileContent() string { - if x != nil { - return x.CertFileContent - } - return "" -} - -func (x *TLSConfig) GetKeyFileContent() string { - if x != nil { - return x.KeyFileContent - } - return "" -} - -// HTTPConfig represents HTTP client configuration. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type HTTPConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Basic HTTP auth configuration. Zero value will remove it. - BasicAuth *BasicAuth `protobuf:"bytes,1,opt,name=basic_auth,json=basicAuth,proto3" json:"basic_auth,omitempty"` - BearerToken string `protobuf:"bytes,2,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` - BearerTokenFile string `protobuf:"bytes,3,opt,name=bearer_token_file,json=bearerTokenFile,proto3" json:"bearer_token_file,omitempty"` - // TLS configuration. Zero value will remove it. - TlsConfig *TLSConfig `protobuf:"bytes,4,opt,name=tls_config,json=tlsConfig,proto3" json:"tls_config,omitempty"` - ProxyUrl string `protobuf:"bytes,5,opt,name=proxy_url,json=proxyUrl,proto3" json:"proxy_url,omitempty"` -} - -func (x *HTTPConfig) Reset() { - *x = HTTPConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HTTPConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HTTPConfig) ProtoMessage() {} - -func (x *HTTPConfig) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HTTPConfig.ProtoReflect.Descriptor instead. -func (*HTTPConfig) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{2} -} - -func (x *HTTPConfig) GetBasicAuth() *BasicAuth { - if x != nil { - return x.BasicAuth - } - return nil -} - -func (x *HTTPConfig) GetBearerToken() string { - if x != nil { - return x.BearerToken - } - return "" -} - -func (x *HTTPConfig) GetBearerTokenFile() string { - if x != nil { - return x.BearerTokenFile - } - return "" -} - -func (x *HTTPConfig) GetTlsConfig() *TLSConfig { - if x != nil { - return x.TlsConfig - } - return nil -} - -func (x *HTTPConfig) GetProxyUrl() string { - if x != nil { - return x.ProxyUrl - } - return "" -} - -// EmailConfig represents email configuration. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type EmailConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SendResolved bool `protobuf:"varint,1,opt,name=send_resolved,json=sendResolved,proto3" json:"send_resolved,omitempty"` - To []string `protobuf:"bytes,2,rep,name=to,proto3" json:"to,omitempty"` -} - -func (x *EmailConfig) Reset() { - *x = EmailConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EmailConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EmailConfig) ProtoMessage() {} - -func (x *EmailConfig) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EmailConfig.ProtoReflect.Descriptor instead. -func (*EmailConfig) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{3} -} - -func (x *EmailConfig) GetSendResolved() bool { - if x != nil { - return x.SendResolved - } - return false -} - -func (x *EmailConfig) GetTo() []string { - if x != nil { - return x.To - } - return nil -} - -// PagerDutyConfig represents PagerDuty configuration. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type PagerDutyConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SendResolved bool `protobuf:"varint,1,opt,name=send_resolved,json=sendResolved,proto3" json:"send_resolved,omitempty"` - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - RoutingKey string `protobuf:"bytes,2,opt,name=routing_key,json=routingKey,proto3" json:"routing_key,omitempty"` - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - ServiceKey string `protobuf:"bytes,3,opt,name=service_key,json=serviceKey,proto3" json:"service_key,omitempty"` -} - -func (x *PagerDutyConfig) Reset() { - *x = PagerDutyConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PagerDutyConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PagerDutyConfig) ProtoMessage() {} - -func (x *PagerDutyConfig) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PagerDutyConfig.ProtoReflect.Descriptor instead. -func (*PagerDutyConfig) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{4} -} - -func (x *PagerDutyConfig) GetSendResolved() bool { - if x != nil { - return x.SendResolved - } - return false -} - -func (x *PagerDutyConfig) GetRoutingKey() string { - if x != nil { - return x.RoutingKey - } - return "" -} - -func (x *PagerDutyConfig) GetServiceKey() string { - if x != nil { - return x.ServiceKey - } - return "" -} - -// SlackConfig represents Slack configuration. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type SlackConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SendResolved bool `protobuf:"varint,1,opt,name=send_resolved,json=sendResolved,proto3" json:"send_resolved,omitempty"` - Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"` -} - -func (x *SlackConfig) Reset() { - *x = SlackConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SlackConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SlackConfig) ProtoMessage() {} - -func (x *SlackConfig) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SlackConfig.ProtoReflect.Descriptor instead. -func (*SlackConfig) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{5} -} - -func (x *SlackConfig) GetSendResolved() bool { - if x != nil { - return x.SendResolved - } - return false -} - -func (x *SlackConfig) GetChannel() string { - if x != nil { - return x.Channel - } - return "" -} - -// WebhookConfig represents webhook configuration. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type WebhookConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SendResolved bool `protobuf:"varint,1,opt,name=send_resolved,json=sendResolved,proto3" json:"send_resolved,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - HttpConfig *HTTPConfig `protobuf:"bytes,3,opt,name=http_config,json=httpConfig,proto3" json:"http_config,omitempty"` - MaxAlerts int32 `protobuf:"varint,4,opt,name=max_alerts,json=maxAlerts,proto3" json:"max_alerts,omitempty"` -} - -func (x *WebhookConfig) Reset() { - *x = WebhookConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebhookConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WebhookConfig) ProtoMessage() {} - -func (x *WebhookConfig) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WebhookConfig.ProtoReflect.Descriptor instead. -func (*WebhookConfig) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{6} -} - -func (x *WebhookConfig) GetSendResolved() bool { - if x != nil { - return x.SendResolved - } - return false -} - -func (x *WebhookConfig) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *WebhookConfig) GetHttpConfig() *HTTPConfig { - if x != nil { - return x.HttpConfig - } - return nil -} - -func (x *WebhookConfig) GetMaxAlerts() int32 { - if x != nil { - return x.MaxAlerts - } - return 0 -} - -// Channel represents a single Notification Channel. -// -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type Channel struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Machine-readable ID. - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // Short human-readable summary. - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - // Types that are assignable to Channel: - // - // *Channel_EmailConfig - // *Channel_PagerdutyConfig - // *Channel_SlackConfig - // *Channel_WebhookConfig - Channel isChannel_Channel `protobuf_oneof:"channel"` - // True if that channel is disabled. - Disabled bool `protobuf:"varint,11,opt,name=disabled,proto3" json:"disabled,omitempty"` -} - -func (x *Channel) Reset() { - *x = Channel{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Channel) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Channel) ProtoMessage() {} - -func (x *Channel) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Channel.ProtoReflect.Descriptor instead. -func (*Channel) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{7} -} - -func (x *Channel) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *Channel) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (m *Channel) GetChannel() isChannel_Channel { - if m != nil { - return m.Channel - } - return nil -} - -func (x *Channel) GetEmailConfig() *EmailConfig { - if x, ok := x.GetChannel().(*Channel_EmailConfig); ok { - return x.EmailConfig - } - return nil -} - -func (x *Channel) GetPagerdutyConfig() *PagerDutyConfig { - if x, ok := x.GetChannel().(*Channel_PagerdutyConfig); ok { - return x.PagerdutyConfig - } - return nil -} - -func (x *Channel) GetSlackConfig() *SlackConfig { - if x, ok := x.GetChannel().(*Channel_SlackConfig); ok { - return x.SlackConfig - } - return nil -} - -func (x *Channel) GetWebhookConfig() *WebhookConfig { - if x, ok := x.GetChannel().(*Channel_WebhookConfig); ok { - return x.WebhookConfig - } - return nil -} - -func (x *Channel) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -type isChannel_Channel interface { - isChannel_Channel() -} - -type Channel_EmailConfig struct { - EmailConfig *EmailConfig `protobuf:"bytes,3,opt,name=email_config,json=emailConfig,proto3,oneof"` -} - -type Channel_PagerdutyConfig struct { - PagerdutyConfig *PagerDutyConfig `protobuf:"bytes,4,opt,name=pagerduty_config,json=pagerdutyConfig,proto3,oneof"` -} - -type Channel_SlackConfig struct { - SlackConfig *SlackConfig `protobuf:"bytes,6,opt,name=slack_config,json=slackConfig,proto3,oneof"` -} - -type Channel_WebhookConfig struct { - WebhookConfig *WebhookConfig `protobuf:"bytes,8,opt,name=webhook_config,json=webhookConfig,proto3,oneof"` -} - -func (*Channel_EmailConfig) isChannel_Channel() {} - -func (*Channel_PagerdutyConfig) isChannel_Channel() {} - -func (*Channel_SlackConfig) isChannel_Channel() {} - -func (*Channel_WebhookConfig) isChannel_Channel() {} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type ListChannelsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Page request. - PageParams *managementpb.PageParams `protobuf:"bytes,1,opt,name=page_params,json=pageParams,proto3" json:"page_params,omitempty"` -} - -func (x *ListChannelsRequest) Reset() { - *x = ListChannelsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListChannelsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListChannelsRequest) ProtoMessage() {} - -func (x *ListChannelsRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListChannelsRequest.ProtoReflect.Descriptor instead. -func (*ListChannelsRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{8} -} - -func (x *ListChannelsRequest) GetPageParams() *managementpb.PageParams { - if x != nil { - return x.PageParams - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type ListChannelsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Channels []*Channel `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty"` - // Total items and pages. - Totals *managementpb.PageTotals `protobuf:"bytes,2,opt,name=totals,proto3" json:"totals,omitempty"` -} - -func (x *ListChannelsResponse) Reset() { - *x = ListChannelsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListChannelsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListChannelsResponse) ProtoMessage() {} - -func (x *ListChannelsResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListChannelsResponse.ProtoReflect.Descriptor instead. -func (*ListChannelsResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{9} -} - -func (x *ListChannelsResponse) GetChannels() []*Channel { - if x != nil { - return x.Channels - } - return nil -} - -func (x *ListChannelsResponse) GetTotals() *managementpb.PageTotals { - if x != nil { - return x.Totals - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type AddChannelRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Short human-readable summary. - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - // Email configuration. Exactly one config should be set. - EmailConfig *EmailConfig `protobuf:"bytes,3,opt,name=email_config,json=emailConfig,proto3" json:"email_config,omitempty"` - // PagerDuty configuration. Exactly one config should be set. - PagerdutyConfig *PagerDutyConfig `protobuf:"bytes,4,opt,name=pagerduty_config,json=pagerdutyConfig,proto3" json:"pagerduty_config,omitempty"` - // Slack configuration. Exactly one config should be set. - SlackConfig *SlackConfig `protobuf:"bytes,6,opt,name=slack_config,json=slackConfig,proto3" json:"slack_config,omitempty"` - // Webhook configuration. Exactly one config should be set. - WebhookConfig *WebhookConfig `protobuf:"bytes,8,opt,name=webhook_config,json=webhookConfig,proto3" json:"webhook_config,omitempty"` - // New channel status. - Disabled bool `protobuf:"varint,11,opt,name=disabled,proto3" json:"disabled,omitempty"` -} - -func (x *AddChannelRequest) Reset() { - *x = AddChannelRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddChannelRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddChannelRequest) ProtoMessage() {} - -func (x *AddChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddChannelRequest.ProtoReflect.Descriptor instead. -func (*AddChannelRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{10} -} - -func (x *AddChannelRequest) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *AddChannelRequest) GetEmailConfig() *EmailConfig { - if x != nil { - return x.EmailConfig - } - return nil -} - -func (x *AddChannelRequest) GetPagerdutyConfig() *PagerDutyConfig { - if x != nil { - return x.PagerdutyConfig - } - return nil -} - -func (x *AddChannelRequest) GetSlackConfig() *SlackConfig { - if x != nil { - return x.SlackConfig - } - return nil -} - -func (x *AddChannelRequest) GetWebhookConfig() *WebhookConfig { - if x != nil { - return x.WebhookConfig - } - return nil -} - -func (x *AddChannelRequest) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type AddChannelResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Machine-readable ID. - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (x *AddChannelResponse) Reset() { - *x = AddChannelResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddChannelResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddChannelResponse) ProtoMessage() {} - -func (x *AddChannelResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddChannelResponse.ProtoReflect.Descriptor instead. -func (*AddChannelResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{11} -} - -func (x *AddChannelResponse) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type ChangeChannelRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Machine-readable ID. - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // Short human-readable summary. Empty value will not change it. - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - // Email configuration. Exactly one config should be set. - EmailConfig *EmailConfig `protobuf:"bytes,3,opt,name=email_config,json=emailConfig,proto3" json:"email_config,omitempty"` - // PagerDuty configuration. Exactly one config should be set. - PagerdutyConfig *PagerDutyConfig `protobuf:"bytes,4,opt,name=pagerduty_config,json=pagerdutyConfig,proto3" json:"pagerduty_config,omitempty"` - // Slack configuration. Exactly one config should be set. - SlackConfig *SlackConfig `protobuf:"bytes,6,opt,name=slack_config,json=slackConfig,proto3" json:"slack_config,omitempty"` - // Webhook configuration. Exactly one config should be set. - WebhookConfig *WebhookConfig `protobuf:"bytes,8,opt,name=webhook_config,json=webhookConfig,proto3" json:"webhook_config,omitempty"` - // Enables or disables that channel. Should be set. - Disabled bool `protobuf:"varint,11,opt,name=disabled,proto3" json:"disabled,omitempty"` -} - -func (x *ChangeChannelRequest) Reset() { - *x = ChangeChannelRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChangeChannelRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChangeChannelRequest) ProtoMessage() {} - -func (x *ChangeChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChangeChannelRequest.ProtoReflect.Descriptor instead. -func (*ChangeChannelRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{12} -} - -func (x *ChangeChannelRequest) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -func (x *ChangeChannelRequest) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *ChangeChannelRequest) GetEmailConfig() *EmailConfig { - if x != nil { - return x.EmailConfig - } - return nil -} - -func (x *ChangeChannelRequest) GetPagerdutyConfig() *PagerDutyConfig { - if x != nil { - return x.PagerdutyConfig - } - return nil -} - -func (x *ChangeChannelRequest) GetSlackConfig() *SlackConfig { - if x != nil { - return x.SlackConfig - } - return nil -} - -func (x *ChangeChannelRequest) GetWebhookConfig() *WebhookConfig { - if x != nil { - return x.WebhookConfig - } - return nil -} - -func (x *ChangeChannelRequest) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type ChangeChannelResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ChangeChannelResponse) Reset() { - *x = ChangeChannelResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChangeChannelResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChangeChannelResponse) ProtoMessage() {} - -func (x *ChangeChannelResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChangeChannelResponse.ProtoReflect.Descriptor instead. -func (*ChangeChannelResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{13} -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type RemoveChannelRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (x *RemoveChannelRequest) Reset() { - *x = RemoveChannelRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveChannelRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveChannelRequest) ProtoMessage() {} - -func (x *RemoveChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveChannelRequest.ProtoReflect.Descriptor instead. -func (*RemoveChannelRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{14} -} - -func (x *RemoveChannelRequest) GetChannelId() string { - if x != nil { - return x.ChannelId - } - return "" -} - -// Deprecated: Marked as deprecated in managementpb/ia/channels.proto. -type RemoveChannelResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RemoveChannelResponse) Reset() { - *x = RemoveChannelResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_channels_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveChannelResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveChannelResponse) ProtoMessage() {} - -func (x *RemoveChannelResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_channels_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveChannelResponse.ProtoReflect.Descriptor instead. -func (*RemoveChannelResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_channels_proto_rawDescGZIP(), []int{15} -} - -var File_managementpb_ia_channels_proto protoreflect.FileDescriptor - -var file_managementpb_ia_channels_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, - 0x61, 0x2f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0a, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x1c, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, - 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x3a, 0x02, 0x18, 0x01, - 0x22, 0xb1, 0x02, 0x0a, 0x09, 0x54, 0x4c, 0x53, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, - 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x63, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x65, 0x72, 0x74, 0x5f, - 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x65, 0x72, 0x74, - 0x46, 0x69, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x30, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6b, 0x69, - 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, - 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, - 0x66, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, 0x46, - 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x65, - 0x72, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x65, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, - 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x6b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x3a, 0x02, 0x18, 0x01, 0x22, 0xe8, 0x01, 0x0a, 0x0a, 0x48, 0x54, 0x54, 0x50, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x34, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x52, 0x09, - 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x65, 0x61, - 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x11, - 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x66, 0x69, 0x6c, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x6c, 0x73, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x69, - 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x4c, 0x53, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x09, 0x74, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, - 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x72, 0x6c, 0x3a, 0x02, 0x18, 0x01, 0x22, - 0x50, 0x0a, 0x0b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, - 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6c, - 0x76, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x02, 0x74, 0x6f, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0x7c, 0x0a, 0x0f, 0x50, 0x61, 0x67, 0x65, 0x72, 0x44, 0x75, 0x74, 0x79, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, - 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x65, 0x6e, - 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x6f, 0x75, - 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4b, 0x65, 0x79, 0x3a, 0x02, 0x18, 0x01, 0x22, - 0x59, 0x0a, 0x0b, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, - 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6c, - 0x76, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xab, 0x01, 0x0a, 0x0d, 0x57, - 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x0a, 0x0d, - 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, - 0x64, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x37, 0x0a, 0x0b, - 0x68, 0x74, 0x74, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x48, - 0x54, 0x54, 0x50, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xf7, 0x02, 0x0a, 0x07, 0x43, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x3c, 0x0a, - 0x0c, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0b, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x48, 0x0a, 0x10, 0x70, - 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x72, 0x44, 0x75, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x48, 0x00, 0x52, 0x0f, 0x70, 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3c, 0x0a, 0x0c, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x5f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x69, 0x61, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x42, 0x0a, 0x0e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0d, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, - 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x22, 0x52, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x70, 0x61, 0x67, - 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x7b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, - 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, - 0x2e, 0x0a, 0x06, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, - 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x52, 0x06, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x3a, - 0x02, 0x18, 0x01, 0x22, 0xd8, 0x02, 0x0a, 0x11, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x73, 0x75, 0x6d, - 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x0c, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x65, 0x6d, 0x61, - 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x67, 0x65, - 0x72, 0x64, 0x75, 0x74, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x50, 0x61, 0x67, 0x65, 0x72, 0x44, 0x75, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, - 0x0f, 0x70, 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, - 0x0b, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x40, 0x0a, 0x0e, - 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, - 0x0d, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, - 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x37, - 0x0a, 0x12, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xfa, 0x02, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x0c, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x52, 0x0b, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x46, - 0x0a, 0x10, 0x70, 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x72, 0x44, 0x75, 0x74, 0x79, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0f, 0x70, 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x69, - 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x40, 0x0a, 0x0e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1b, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0x42, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1b, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x3a, 0x02, - 0x18, 0x01, 0x32, 0xac, 0x04, 0x0a, 0x08, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, - 0x85, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, - 0x12, 0x1f, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x20, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x32, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, - 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x2f, 0x69, 0x61, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2f, - 0x4c, 0x69, 0x73, 0x74, 0x88, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1d, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x69, 0x61, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, - 0x2f, 0x41, 0x64, 0x64, 0x88, 0x02, 0x01, 0x12, 0x8a, 0x01, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x20, 0x2e, 0x69, 0x61, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x69, 0x61, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, - 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x3a, 0x01, 0x2a, 0x22, 0x21, - 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x69, - 0x61, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x88, 0x02, 0x01, 0x12, 0x8a, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x20, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x92, 0x41, 0x02, - 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x3a, 0x01, 0x2a, 0x22, 0x21, 0x2f, 0x76, 0x31, - 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x69, 0x61, 0x2f, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x88, 0x02, - 0x01, 0x42, 0x9e, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, - 0x61, 0x3b, 0x69, 0x61, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x58, - 0x58, 0xaa, 0x02, 0x0a, 0x49, 0x61, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, - 0x0a, 0x49, 0x61, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x16, 0x49, 0x61, - 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x49, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_managementpb_ia_channels_proto_rawDescOnce sync.Once - file_managementpb_ia_channels_proto_rawDescData = file_managementpb_ia_channels_proto_rawDesc -) - -func file_managementpb_ia_channels_proto_rawDescGZIP() []byte { - file_managementpb_ia_channels_proto_rawDescOnce.Do(func() { - file_managementpb_ia_channels_proto_rawDescData = protoimpl.X.CompressGZIP(file_managementpb_ia_channels_proto_rawDescData) - }) - return file_managementpb_ia_channels_proto_rawDescData -} - -var ( - file_managementpb_ia_channels_proto_msgTypes = make([]protoimpl.MessageInfo, 16) - file_managementpb_ia_channels_proto_goTypes = []interface{}{ - (*BasicAuth)(nil), // 0: ia.v1beta1.BasicAuth - (*TLSConfig)(nil), // 1: ia.v1beta1.TLSConfig - (*HTTPConfig)(nil), // 2: ia.v1beta1.HTTPConfig - (*EmailConfig)(nil), // 3: ia.v1beta1.EmailConfig - (*PagerDutyConfig)(nil), // 4: ia.v1beta1.PagerDutyConfig - (*SlackConfig)(nil), // 5: ia.v1beta1.SlackConfig - (*WebhookConfig)(nil), // 6: ia.v1beta1.WebhookConfig - (*Channel)(nil), // 7: ia.v1beta1.Channel - (*ListChannelsRequest)(nil), // 8: ia.v1beta1.ListChannelsRequest - (*ListChannelsResponse)(nil), // 9: ia.v1beta1.ListChannelsResponse - (*AddChannelRequest)(nil), // 10: ia.v1beta1.AddChannelRequest - (*AddChannelResponse)(nil), // 11: ia.v1beta1.AddChannelResponse - (*ChangeChannelRequest)(nil), // 12: ia.v1beta1.ChangeChannelRequest - (*ChangeChannelResponse)(nil), // 13: ia.v1beta1.ChangeChannelResponse - (*RemoveChannelRequest)(nil), // 14: ia.v1beta1.RemoveChannelRequest - (*RemoveChannelResponse)(nil), // 15: ia.v1beta1.RemoveChannelResponse - (*managementpb.PageParams)(nil), // 16: management.PageParams - (*managementpb.PageTotals)(nil), // 17: management.PageTotals - } -) - -var file_managementpb_ia_channels_proto_depIdxs = []int32{ - 0, // 0: ia.v1beta1.HTTPConfig.basic_auth:type_name -> ia.v1beta1.BasicAuth - 1, // 1: ia.v1beta1.HTTPConfig.tls_config:type_name -> ia.v1beta1.TLSConfig - 2, // 2: ia.v1beta1.WebhookConfig.http_config:type_name -> ia.v1beta1.HTTPConfig - 3, // 3: ia.v1beta1.Channel.email_config:type_name -> ia.v1beta1.EmailConfig - 4, // 4: ia.v1beta1.Channel.pagerduty_config:type_name -> ia.v1beta1.PagerDutyConfig - 5, // 5: ia.v1beta1.Channel.slack_config:type_name -> ia.v1beta1.SlackConfig - 6, // 6: ia.v1beta1.Channel.webhook_config:type_name -> ia.v1beta1.WebhookConfig - 16, // 7: ia.v1beta1.ListChannelsRequest.page_params:type_name -> management.PageParams - 7, // 8: ia.v1beta1.ListChannelsResponse.channels:type_name -> ia.v1beta1.Channel - 17, // 9: ia.v1beta1.ListChannelsResponse.totals:type_name -> management.PageTotals - 3, // 10: ia.v1beta1.AddChannelRequest.email_config:type_name -> ia.v1beta1.EmailConfig - 4, // 11: ia.v1beta1.AddChannelRequest.pagerduty_config:type_name -> ia.v1beta1.PagerDutyConfig - 5, // 12: ia.v1beta1.AddChannelRequest.slack_config:type_name -> ia.v1beta1.SlackConfig - 6, // 13: ia.v1beta1.AddChannelRequest.webhook_config:type_name -> ia.v1beta1.WebhookConfig - 3, // 14: ia.v1beta1.ChangeChannelRequest.email_config:type_name -> ia.v1beta1.EmailConfig - 4, // 15: ia.v1beta1.ChangeChannelRequest.pagerduty_config:type_name -> ia.v1beta1.PagerDutyConfig - 5, // 16: ia.v1beta1.ChangeChannelRequest.slack_config:type_name -> ia.v1beta1.SlackConfig - 6, // 17: ia.v1beta1.ChangeChannelRequest.webhook_config:type_name -> ia.v1beta1.WebhookConfig - 8, // 18: ia.v1beta1.Channels.ListChannels:input_type -> ia.v1beta1.ListChannelsRequest - 10, // 19: ia.v1beta1.Channels.AddChannel:input_type -> ia.v1beta1.AddChannelRequest - 12, // 20: ia.v1beta1.Channels.ChangeChannel:input_type -> ia.v1beta1.ChangeChannelRequest - 14, // 21: ia.v1beta1.Channels.RemoveChannel:input_type -> ia.v1beta1.RemoveChannelRequest - 9, // 22: ia.v1beta1.Channels.ListChannels:output_type -> ia.v1beta1.ListChannelsResponse - 11, // 23: ia.v1beta1.Channels.AddChannel:output_type -> ia.v1beta1.AddChannelResponse - 13, // 24: ia.v1beta1.Channels.ChangeChannel:output_type -> ia.v1beta1.ChangeChannelResponse - 15, // 25: ia.v1beta1.Channels.RemoveChannel:output_type -> ia.v1beta1.RemoveChannelResponse - 22, // [22:26] is the sub-list for method output_type - 18, // [18:22] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name -} - -func init() { file_managementpb_ia_channels_proto_init() } -func file_managementpb_ia_channels_proto_init() { - if File_managementpb_ia_channels_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_managementpb_ia_channels_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BasicAuth); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TLSConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HTTPConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmailConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PagerDutyConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SlackConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebhookConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Channel); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListChannelsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListChannelsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddChannelRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddChannelResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChangeChannelRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChangeChannelResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveChannelRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_channels_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveChannelResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_managementpb_ia_channels_proto_msgTypes[7].OneofWrappers = []interface{}{ - (*Channel_EmailConfig)(nil), - (*Channel_PagerdutyConfig)(nil), - (*Channel_SlackConfig)(nil), - (*Channel_WebhookConfig)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_managementpb_ia_channels_proto_rawDesc, - NumEnums: 0, - NumMessages: 16, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_managementpb_ia_channels_proto_goTypes, - DependencyIndexes: file_managementpb_ia_channels_proto_depIdxs, - MessageInfos: file_managementpb_ia_channels_proto_msgTypes, - }.Build() - File_managementpb_ia_channels_proto = out.File - file_managementpb_ia_channels_proto_rawDesc = nil - file_managementpb_ia_channels_proto_goTypes = nil - file_managementpb_ia_channels_proto_depIdxs = nil -} diff --git a/api/managementpb/ia/channels.pb.gw.go b/api/managementpb/ia/channels.pb.gw.go deleted file mode 100644 index f47eb473a1..0000000000 --- a/api/managementpb/ia/channels.pb.gw.go +++ /dev/null @@ -1,410 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: managementpb/ia/channels.proto - -/* -Package iav1beta1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package iav1beta1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = metadata.Join -) - -func request_Channels_ListChannels_0(ctx context.Context, marshaler runtime.Marshaler, client ChannelsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListChannelsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListChannels(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Channels_ListChannels_0(ctx context.Context, marshaler runtime.Marshaler, server ChannelsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListChannelsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListChannels(ctx, &protoReq) - return msg, metadata, err -} - -func request_Channels_AddChannel_0(ctx context.Context, marshaler runtime.Marshaler, client ChannelsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AddChannelRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.AddChannel(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Channels_AddChannel_0(ctx context.Context, marshaler runtime.Marshaler, server ChannelsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AddChannelRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.AddChannel(ctx, &protoReq) - return msg, metadata, err -} - -func request_Channels_ChangeChannel_0(ctx context.Context, marshaler runtime.Marshaler, client ChannelsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ChangeChannelRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ChangeChannel(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Channels_ChangeChannel_0(ctx context.Context, marshaler runtime.Marshaler, server ChannelsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ChangeChannelRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ChangeChannel(ctx, &protoReq) - return msg, metadata, err -} - -func request_Channels_RemoveChannel_0(ctx context.Context, marshaler runtime.Marshaler, client ChannelsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RemoveChannelRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.RemoveChannel(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Channels_RemoveChannel_0(ctx context.Context, marshaler runtime.Marshaler, server ChannelsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RemoveChannelRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.RemoveChannel(ctx, &protoReq) - return msg, metadata, err -} - -// RegisterChannelsHandlerServer registers the http handlers for service Channels to "mux". -// UnaryRPC :call ChannelsServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterChannelsHandlerFromEndpoint instead. -func RegisterChannelsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChannelsServer) error { - mux.Handle("POST", pattern_Channels_ListChannels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Channels/ListChannels", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/List")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Channels_ListChannels_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_ListChannels_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Channels_AddChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Channels/AddChannel", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/Add")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Channels_AddChannel_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_AddChannel_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Channels_ChangeChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Channels/ChangeChannel", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/Change")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Channels_ChangeChannel_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_ChangeChannel_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Channels_RemoveChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Channels/RemoveChannel", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/Remove")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Channels_RemoveChannel_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_RemoveChannel_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -// RegisterChannelsHandlerFromEndpoint is same as RegisterChannelsHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterChannelsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterChannelsHandler(ctx, mux, conn) -} - -// RegisterChannelsHandler registers the http handlers for service Channels to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterChannelsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterChannelsHandlerClient(ctx, mux, NewChannelsClient(conn)) -} - -// RegisterChannelsHandlerClient registers the http handlers for service Channels -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChannelsClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChannelsClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ChannelsClient" to call the correct interceptors. -func RegisterChannelsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChannelsClient) error { - mux.Handle("POST", pattern_Channels_ListChannels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Channels/ListChannels", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/List")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Channels_ListChannels_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_ListChannels_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Channels_AddChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Channels/AddChannel", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/Add")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Channels_AddChannel_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_AddChannel_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Channels_ChangeChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Channels/ChangeChannel", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/Change")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Channels_ChangeChannel_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_ChangeChannel_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Channels_RemoveChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Channels/RemoveChannel", runtime.WithHTTPPathPattern("/v1/management/ia/Channels/Remove")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Channels_RemoveChannel_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Channels_RemoveChannel_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -var ( - pattern_Channels_ListChannels_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Channels", "List"}, "")) - - pattern_Channels_AddChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Channels", "Add"}, "")) - - pattern_Channels_ChangeChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Channels", "Change"}, "")) - - pattern_Channels_RemoveChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Channels", "Remove"}, "")) -) - -var ( - forward_Channels_ListChannels_0 = runtime.ForwardResponseMessage - - forward_Channels_AddChannel_0 = runtime.ForwardResponseMessage - - forward_Channels_ChangeChannel_0 = runtime.ForwardResponseMessage - - forward_Channels_RemoveChannel_0 = runtime.ForwardResponseMessage -) diff --git a/api/managementpb/ia/channels.pb.validate.go b/api/managementpb/ia/channels.pb.validate.go deleted file mode 100644 index cb0ec7d9d1..0000000000 --- a/api/managementpb/ia/channels.pb.validate.go +++ /dev/null @@ -1,2347 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: managementpb/ia/channels.proto - -package iav1beta1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on BasicAuth with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BasicAuth) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BasicAuth with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BasicAuthMultiError, or nil -// if none found. -func (m *BasicAuth) ValidateAll() error { - return m.validate(true) -} - -func (m *BasicAuth) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Username - - // no validation rules for Password - - // no validation rules for PasswordFile - - if len(errors) > 0 { - return BasicAuthMultiError(errors) - } - - return nil -} - -// BasicAuthMultiError is an error wrapping multiple validation errors returned -// by BasicAuth.ValidateAll() if the designated constraints aren't met. -type BasicAuthMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BasicAuthMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BasicAuthMultiError) AllErrors() []error { return m } - -// BasicAuthValidationError is the validation error returned by -// BasicAuth.Validate if the designated constraints aren't met. -type BasicAuthValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BasicAuthValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BasicAuthValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BasicAuthValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BasicAuthValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BasicAuthValidationError) ErrorName() string { return "BasicAuthValidationError" } - -// Error satisfies the builtin error interface -func (e BasicAuthValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBasicAuth.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BasicAuthValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BasicAuthValidationError{} - -// Validate checks the field values on TLSConfig with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TLSConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TLSConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TLSConfigMultiError, or nil -// if none found. -func (m *TLSConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *TLSConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for CaFile - - // no validation rules for CertFile - - // no validation rules for KeyFile - - // no validation rules for ServerName - - // no validation rules for InsecureSkipVerify - - // no validation rules for CaFileContent - - // no validation rules for CertFileContent - - // no validation rules for KeyFileContent - - if len(errors) > 0 { - return TLSConfigMultiError(errors) - } - - return nil -} - -// TLSConfigMultiError is an error wrapping multiple validation errors returned -// by TLSConfig.ValidateAll() if the designated constraints aren't met. -type TLSConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TLSConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TLSConfigMultiError) AllErrors() []error { return m } - -// TLSConfigValidationError is the validation error returned by -// TLSConfig.Validate if the designated constraints aren't met. -type TLSConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TLSConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TLSConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TLSConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TLSConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TLSConfigValidationError) ErrorName() string { return "TLSConfigValidationError" } - -// Error satisfies the builtin error interface -func (e TLSConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTLSConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TLSConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TLSConfigValidationError{} - -// Validate checks the field values on HTTPConfig with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HTTPConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HTTPConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HTTPConfigMultiError, or -// nil if none found. -func (m *HTTPConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *HTTPConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetBasicAuth()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HTTPConfigValidationError{ - field: "BasicAuth", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HTTPConfigValidationError{ - field: "BasicAuth", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HTTPConfigValidationError{ - field: "BasicAuth", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for BearerToken - - // no validation rules for BearerTokenFile - - if all { - switch v := interface{}(m.GetTlsConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HTTPConfigValidationError{ - field: "TlsConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HTTPConfigValidationError{ - field: "TlsConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTlsConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HTTPConfigValidationError{ - field: "TlsConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for ProxyUrl - - if len(errors) > 0 { - return HTTPConfigMultiError(errors) - } - - return nil -} - -// HTTPConfigMultiError is an error wrapping multiple validation errors -// returned by HTTPConfig.ValidateAll() if the designated constraints aren't met. -type HTTPConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HTTPConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HTTPConfigMultiError) AllErrors() []error { return m } - -// HTTPConfigValidationError is the validation error returned by -// HTTPConfig.Validate if the designated constraints aren't met. -type HTTPConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HTTPConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HTTPConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HTTPConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HTTPConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HTTPConfigValidationError) ErrorName() string { return "HTTPConfigValidationError" } - -// Error satisfies the builtin error interface -func (e HTTPConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHTTPConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HTTPConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HTTPConfigValidationError{} - -// Validate checks the field values on EmailConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *EmailConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EmailConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in EmailConfigMultiError, or -// nil if none found. -func (m *EmailConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *EmailConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SendResolved - - if len(m.GetTo()) < 1 { - err := EmailConfigValidationError{ - field: "To", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return EmailConfigMultiError(errors) - } - - return nil -} - -// EmailConfigMultiError is an error wrapping multiple validation errors -// returned by EmailConfig.ValidateAll() if the designated constraints aren't met. -type EmailConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EmailConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EmailConfigMultiError) AllErrors() []error { return m } - -// EmailConfigValidationError is the validation error returned by -// EmailConfig.Validate if the designated constraints aren't met. -type EmailConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EmailConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EmailConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EmailConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EmailConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EmailConfigValidationError) ErrorName() string { return "EmailConfigValidationError" } - -// Error satisfies the builtin error interface -func (e EmailConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEmailConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EmailConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EmailConfigValidationError{} - -// Validate checks the field values on PagerDutyConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *PagerDutyConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PagerDutyConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PagerDutyConfigMultiError, or nil if none found. -func (m *PagerDutyConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *PagerDutyConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SendResolved - - // no validation rules for RoutingKey - - // no validation rules for ServiceKey - - if len(errors) > 0 { - return PagerDutyConfigMultiError(errors) - } - - return nil -} - -// PagerDutyConfigMultiError is an error wrapping multiple validation errors -// returned by PagerDutyConfig.ValidateAll() if the designated constraints -// aren't met. -type PagerDutyConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PagerDutyConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PagerDutyConfigMultiError) AllErrors() []error { return m } - -// PagerDutyConfigValidationError is the validation error returned by -// PagerDutyConfig.Validate if the designated constraints aren't met. -type PagerDutyConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PagerDutyConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PagerDutyConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PagerDutyConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PagerDutyConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PagerDutyConfigValidationError) ErrorName() string { return "PagerDutyConfigValidationError" } - -// Error satisfies the builtin error interface -func (e PagerDutyConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPagerDutyConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PagerDutyConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PagerDutyConfigValidationError{} - -// Validate checks the field values on SlackConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SlackConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SlackConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SlackConfigMultiError, or -// nil if none found. -func (m *SlackConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *SlackConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SendResolved - - if utf8.RuneCountInString(m.GetChannel()) < 1 { - err := SlackConfigValidationError{ - field: "Channel", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SlackConfigMultiError(errors) - } - - return nil -} - -// SlackConfigMultiError is an error wrapping multiple validation errors -// returned by SlackConfig.ValidateAll() if the designated constraints aren't met. -type SlackConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SlackConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SlackConfigMultiError) AllErrors() []error { return m } - -// SlackConfigValidationError is the validation error returned by -// SlackConfig.Validate if the designated constraints aren't met. -type SlackConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SlackConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SlackConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SlackConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SlackConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SlackConfigValidationError) ErrorName() string { return "SlackConfigValidationError" } - -// Error satisfies the builtin error interface -func (e SlackConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSlackConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SlackConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SlackConfigValidationError{} - -// Validate checks the field values on WebhookConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *WebhookConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on WebhookConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in WebhookConfigMultiError, or -// nil if none found. -func (m *WebhookConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *WebhookConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SendResolved - - if utf8.RuneCountInString(m.GetUrl()) < 1 { - err := WebhookConfigValidationError{ - field: "Url", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHttpConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WebhookConfigValidationError{ - field: "HttpConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WebhookConfigValidationError{ - field: "HttpConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WebhookConfigValidationError{ - field: "HttpConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for MaxAlerts - - if len(errors) > 0 { - return WebhookConfigMultiError(errors) - } - - return nil -} - -// WebhookConfigMultiError is an error wrapping multiple validation errors -// returned by WebhookConfig.ValidateAll() if the designated constraints -// aren't met. -type WebhookConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m WebhookConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m WebhookConfigMultiError) AllErrors() []error { return m } - -// WebhookConfigValidationError is the validation error returned by -// WebhookConfig.Validate if the designated constraints aren't met. -type WebhookConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WebhookConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WebhookConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WebhookConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WebhookConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WebhookConfigValidationError) ErrorName() string { return "WebhookConfigValidationError" } - -// Error satisfies the builtin error interface -func (e WebhookConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWebhookConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WebhookConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WebhookConfigValidationError{} - -// Validate checks the field values on Channel with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Channel) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Channel with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in ChannelMultiError, or nil if none found. -func (m *Channel) ValidateAll() error { - return m.validate(true) -} - -func (m *Channel) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ChannelId - - // no validation rules for Summary - - // no validation rules for Disabled - - switch v := m.Channel.(type) { - case *Channel_EmailConfig: - if v == nil { - err := ChannelValidationError{ - field: "Channel", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetEmailConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmailConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChannelValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Channel_PagerdutyConfig: - if v == nil { - err := ChannelValidationError{ - field: "Channel", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetPagerdutyConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPagerdutyConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChannelValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Channel_SlackConfig: - if v == nil { - err := ChannelValidationError{ - field: "Channel", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSlackConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSlackConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChannelValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Channel_WebhookConfig: - if v == nil { - err := ChannelValidationError{ - field: "Channel", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetWebhookConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChannelValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetWebhookConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChannelValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return ChannelMultiError(errors) - } - - return nil -} - -// ChannelMultiError is an error wrapping multiple validation errors returned -// by Channel.ValidateAll() if the designated constraints aren't met. -type ChannelMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ChannelMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ChannelMultiError) AllErrors() []error { return m } - -// ChannelValidationError is the validation error returned by Channel.Validate -// if the designated constraints aren't met. -type ChannelValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ChannelValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ChannelValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ChannelValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ChannelValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ChannelValidationError) ErrorName() string { return "ChannelValidationError" } - -// Error satisfies the builtin error interface -func (e ChannelValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sChannel.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ChannelValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ChannelValidationError{} - -// Validate checks the field values on ListChannelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListChannelsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListChannelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListChannelsRequestMultiError, or nil if none found. -func (m *ListChannelsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListChannelsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetPageParams()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListChannelsRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListChannelsRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPageParams()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListChannelsRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ListChannelsRequestMultiError(errors) - } - - return nil -} - -// ListChannelsRequestMultiError is an error wrapping multiple validation -// errors returned by ListChannelsRequest.ValidateAll() if the designated -// constraints aren't met. -type ListChannelsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListChannelsRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListChannelsRequestMultiError) AllErrors() []error { return m } - -// ListChannelsRequestValidationError is the validation error returned by -// ListChannelsRequest.Validate if the designated constraints aren't met. -type ListChannelsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListChannelsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListChannelsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListChannelsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListChannelsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListChannelsRequestValidationError) ErrorName() string { - return "ListChannelsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ListChannelsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListChannelsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListChannelsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListChannelsRequestValidationError{} - -// Validate checks the field values on ListChannelsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListChannelsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListChannelsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListChannelsResponseMultiError, or nil if none found. -func (m *ListChannelsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListChannelsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetChannels() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListChannelsResponseValidationError{ - field: fmt.Sprintf("Channels[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListChannelsResponseValidationError{ - field: fmt.Sprintf("Channels[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListChannelsResponseValidationError{ - field: fmt.Sprintf("Channels[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetTotals()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListChannelsResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListChannelsResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTotals()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListChannelsResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ListChannelsResponseMultiError(errors) - } - - return nil -} - -// ListChannelsResponseMultiError is an error wrapping multiple validation -// errors returned by ListChannelsResponse.ValidateAll() if the designated -// constraints aren't met. -type ListChannelsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListChannelsResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListChannelsResponseMultiError) AllErrors() []error { return m } - -// ListChannelsResponseValidationError is the validation error returned by -// ListChannelsResponse.Validate if the designated constraints aren't met. -type ListChannelsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListChannelsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListChannelsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListChannelsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListChannelsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListChannelsResponseValidationError) ErrorName() string { - return "ListChannelsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ListChannelsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListChannelsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListChannelsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListChannelsResponseValidationError{} - -// Validate checks the field values on AddChannelRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *AddChannelRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddChannelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddChannelRequestMultiError, or nil if none found. -func (m *AddChannelRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddChannelRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetSummary()) < 1 { - err := AddChannelRequestValidationError{ - field: "Summary", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetEmailConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmailConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddChannelRequestValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPagerdutyConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPagerdutyConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddChannelRequestValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSlackConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSlackConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddChannelRequestValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetWebhookConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddChannelRequestValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetWebhookConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddChannelRequestValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Disabled - - if len(errors) > 0 { - return AddChannelRequestMultiError(errors) - } - - return nil -} - -// AddChannelRequestMultiError is an error wrapping multiple validation errors -// returned by AddChannelRequest.ValidateAll() if the designated constraints -// aren't met. -type AddChannelRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddChannelRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddChannelRequestMultiError) AllErrors() []error { return m } - -// AddChannelRequestValidationError is the validation error returned by -// AddChannelRequest.Validate if the designated constraints aren't met. -type AddChannelRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddChannelRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddChannelRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddChannelRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddChannelRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddChannelRequestValidationError) ErrorName() string { - return "AddChannelRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e AddChannelRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddChannelRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddChannelRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddChannelRequestValidationError{} - -// Validate checks the field values on AddChannelResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddChannelResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddChannelResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddChannelResponseMultiError, or nil if none found. -func (m *AddChannelResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *AddChannelResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ChannelId - - if len(errors) > 0 { - return AddChannelResponseMultiError(errors) - } - - return nil -} - -// AddChannelResponseMultiError is an error wrapping multiple validation errors -// returned by AddChannelResponse.ValidateAll() if the designated constraints -// aren't met. -type AddChannelResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddChannelResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddChannelResponseMultiError) AllErrors() []error { return m } - -// AddChannelResponseValidationError is the validation error returned by -// AddChannelResponse.Validate if the designated constraints aren't met. -type AddChannelResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddChannelResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddChannelResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddChannelResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddChannelResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddChannelResponseValidationError) ErrorName() string { - return "AddChannelResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e AddChannelResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddChannelResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddChannelResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddChannelResponseValidationError{} - -// Validate checks the field values on ChangeChannelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ChangeChannelRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ChangeChannelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ChangeChannelRequestMultiError, or nil if none found. -func (m *ChangeChannelRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ChangeChannelRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetChannelId()) < 1 { - err := ChangeChannelRequestValidationError{ - field: "ChannelId", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Summary - - if all { - switch v := interface{}(m.GetEmailConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmailConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChangeChannelRequestValidationError{ - field: "EmailConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPagerdutyConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPagerdutyConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChangeChannelRequestValidationError{ - field: "PagerdutyConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSlackConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSlackConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChangeChannelRequestValidationError{ - field: "SlackConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetWebhookConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChangeChannelRequestValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetWebhookConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChangeChannelRequestValidationError{ - field: "WebhookConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Disabled - - if len(errors) > 0 { - return ChangeChannelRequestMultiError(errors) - } - - return nil -} - -// ChangeChannelRequestMultiError is an error wrapping multiple validation -// errors returned by ChangeChannelRequest.ValidateAll() if the designated -// constraints aren't met. -type ChangeChannelRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ChangeChannelRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ChangeChannelRequestMultiError) AllErrors() []error { return m } - -// ChangeChannelRequestValidationError is the validation error returned by -// ChangeChannelRequest.Validate if the designated constraints aren't met. -type ChangeChannelRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ChangeChannelRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ChangeChannelRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ChangeChannelRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ChangeChannelRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ChangeChannelRequestValidationError) ErrorName() string { - return "ChangeChannelRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ChangeChannelRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sChangeChannelRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ChangeChannelRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ChangeChannelRequestValidationError{} - -// Validate checks the field values on ChangeChannelResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ChangeChannelResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ChangeChannelResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ChangeChannelResponseMultiError, or nil if none found. -func (m *ChangeChannelResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ChangeChannelResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return ChangeChannelResponseMultiError(errors) - } - - return nil -} - -// ChangeChannelResponseMultiError is an error wrapping multiple validation -// errors returned by ChangeChannelResponse.ValidateAll() if the designated -// constraints aren't met. -type ChangeChannelResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ChangeChannelResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ChangeChannelResponseMultiError) AllErrors() []error { return m } - -// ChangeChannelResponseValidationError is the validation error returned by -// ChangeChannelResponse.Validate if the designated constraints aren't met. -type ChangeChannelResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ChangeChannelResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ChangeChannelResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ChangeChannelResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ChangeChannelResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ChangeChannelResponseValidationError) ErrorName() string { - return "ChangeChannelResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ChangeChannelResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sChangeChannelResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ChangeChannelResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ChangeChannelResponseValidationError{} - -// Validate checks the field values on RemoveChannelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveChannelRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveChannelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveChannelRequestMultiError, or nil if none found. -func (m *RemoveChannelRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveChannelRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetChannelId()) < 1 { - err := RemoveChannelRequestValidationError{ - field: "ChannelId", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RemoveChannelRequestMultiError(errors) - } - - return nil -} - -// RemoveChannelRequestMultiError is an error wrapping multiple validation -// errors returned by RemoveChannelRequest.ValidateAll() if the designated -// constraints aren't met. -type RemoveChannelRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveChannelRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveChannelRequestMultiError) AllErrors() []error { return m } - -// RemoveChannelRequestValidationError is the validation error returned by -// RemoveChannelRequest.Validate if the designated constraints aren't met. -type RemoveChannelRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveChannelRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveChannelRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveChannelRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveChannelRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveChannelRequestValidationError) ErrorName() string { - return "RemoveChannelRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveChannelRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveChannelRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveChannelRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveChannelRequestValidationError{} - -// Validate checks the field values on RemoveChannelResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveChannelResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveChannelResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveChannelResponseMultiError, or nil if none found. -func (m *RemoveChannelResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveChannelResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RemoveChannelResponseMultiError(errors) - } - - return nil -} - -// RemoveChannelResponseMultiError is an error wrapping multiple validation -// errors returned by RemoveChannelResponse.ValidateAll() if the designated -// constraints aren't met. -type RemoveChannelResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveChannelResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveChannelResponseMultiError) AllErrors() []error { return m } - -// RemoveChannelResponseValidationError is the validation error returned by -// RemoveChannelResponse.Validate if the designated constraints aren't met. -type RemoveChannelResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveChannelResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveChannelResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveChannelResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveChannelResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveChannelResponseValidationError) ErrorName() string { - return "RemoveChannelResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveChannelResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveChannelResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveChannelResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveChannelResponseValidationError{} diff --git a/api/managementpb/ia/channels.proto b/api/managementpb/ia/channels.proto deleted file mode 100644 index 8caa5fc0e6..0000000000 --- a/api/managementpb/ia/channels.proto +++ /dev/null @@ -1,233 +0,0 @@ -syntax = "proto3"; - -package ia.v1beta1; - -import "google/api/annotations.proto"; -import "managementpb/pagination.proto"; -import "protoc-gen-openapiv2/options/annotations.proto"; -import "validate/validate.proto"; - -option go_package = "api/managementpb/ia;iav1beta1"; - -// BasicAuth represents basic HTTP auth configuration. -message BasicAuth { - option deprecated = true; - - string username = 1; - string password = 2; - string password_file = 3; -} - -// TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -message TLSConfig { - option deprecated = true; - - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - string ca_file = 1; - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - string cert_file = 2; - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - string key_file = 3; - // Name of the server. - string server_name = 4; - // Disable validation of the server certificate. - bool insecure_skip_verify = 5; - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - string ca_file_content = 6; - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - string cert_file_content = 7; - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - string key_file_content = 8; -} - -// HTTPConfig represents HTTP client configuration. -message HTTPConfig { - option deprecated = true; - - // Basic HTTP auth configuration. Zero value will remove it. - BasicAuth basic_auth = 1; - string bearer_token = 2; - string bearer_token_file = 3; - // TLS configuration. Zero value will remove it. - TLSConfig tls_config = 4; - string proxy_url = 5; -} - -// EmailConfig represents email configuration. -message EmailConfig { - option deprecated = true; - - bool send_resolved = 1; - repeated string to = 2 [(validate.rules).repeated.min_items = 1]; -} - -// PagerDutyConfig represents PagerDuty configuration. -message PagerDutyConfig { - option deprecated = true; - - bool send_resolved = 1; - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - string routing_key = 2; - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - string service_key = 3; -} - -// SlackConfig represents Slack configuration. -message SlackConfig { - option deprecated = true; - - bool send_resolved = 1; - string channel = 2 [(validate.rules).string.min_len = 1]; -} - -// WebhookConfig represents webhook configuration. -message WebhookConfig { - option deprecated = true; - - bool send_resolved = 1; - string url = 2 [(validate.rules).string.min_len = 1]; - HTTPConfig http_config = 3; - int32 max_alerts = 4; -} - -// Channel represents a single Notification Channel. -message Channel { - option deprecated = true; - - // reserved channels - // pushover_config = 5; - // opsgenie_config = 7; - // victorops_config = 9; - // wechat_config = 10; - - // Machine-readable ID. - string channel_id = 1; - // Short human-readable summary. - string summary = 2; - oneof channel { - EmailConfig email_config = 3; - PagerDutyConfig pagerduty_config = 4; - SlackConfig slack_config = 6; - WebhookConfig webhook_config = 8; - } - // True if that channel is disabled. - bool disabled = 11; -} - -message ListChannelsRequest { - option deprecated = true; - - // Page request. - management.PageParams page_params = 1; -} - -message ListChannelsResponse { - option deprecated = true; - - repeated Channel channels = 1; - // Total items and pages. - management.PageTotals totals = 2; -} - -message AddChannelRequest { - option deprecated = true; - - // Short human-readable summary. - string summary = 2 [(validate.rules).string.min_len = 1]; - // Email configuration. Exactly one config should be set. - EmailConfig email_config = 3; - // PagerDuty configuration. Exactly one config should be set. - PagerDutyConfig pagerduty_config = 4; - // Slack configuration. Exactly one config should be set. - SlackConfig slack_config = 6; - // Webhook configuration. Exactly one config should be set. - WebhookConfig webhook_config = 8; - // New channel status. - bool disabled = 11; -} - -message AddChannelResponse { - option deprecated = true; - - // Machine-readable ID. - string channel_id = 1; -} - -message ChangeChannelRequest { - option deprecated = true; - - // Machine-readable ID. - string channel_id = 1 [(validate.rules).string.min_len = 1]; - // Short human-readable summary. Empty value will not change it. - string summary = 2; - // Email configuration. Exactly one config should be set. - EmailConfig email_config = 3; - // PagerDuty configuration. Exactly one config should be set. - PagerDutyConfig pagerduty_config = 4; - // Slack configuration. Exactly one config should be set. - SlackConfig slack_config = 6; - // Webhook configuration. Exactly one config should be set. - WebhookConfig webhook_config = 8; - // Enables or disables that channel. Should be set. - bool disabled = 11; -} - -message ChangeChannelResponse { - option deprecated = true; -} - -message RemoveChannelRequest { - option deprecated = true; - string channel_id = 1 [(validate.rules).string.min_len = 1]; -} - -message RemoveChannelResponse { - option deprecated = true; -} - -// Channels service provides access to Notification Channels. -service Channels { - // ListChannels returns a list of all notifation channels. - rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Channels/List" - body: "*" - }; - } - // AddChannel adds notification channel. - rpc AddChannel(AddChannelRequest) returns (AddChannelResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Channels/Add" - body: "*" - }; - } - // ChangeChannel changes notification channel. - rpc ChangeChannel(ChangeChannelRequest) returns (ChangeChannelResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Channels/Change" - body: "*" - }; - } - // RemoveChannel removes notification channel. - rpc RemoveChannel(RemoveChannelRequest) returns (RemoveChannelResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Channels/Remove" - body: "*" - }; - } -} diff --git a/api/managementpb/ia/channels_grpc.pb.go b/api/managementpb/ia/channels_grpc.pb.go deleted file mode 100644 index 48806962f5..0000000000 --- a/api/managementpb/ia/channels_grpc.pb.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: managementpb/ia/channels.proto - -package iav1beta1 - -import ( - context "context" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Channels_ListChannels_FullMethodName = "/ia.v1beta1.Channels/ListChannels" - Channels_AddChannel_FullMethodName = "/ia.v1beta1.Channels/AddChannel" - Channels_ChangeChannel_FullMethodName = "/ia.v1beta1.Channels/ChangeChannel" - Channels_RemoveChannel_FullMethodName = "/ia.v1beta1.Channels/RemoveChannel" -) - -// ChannelsClient is the client API for Channels service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ChannelsClient interface { - // Deprecated: Do not use. - // ListChannels returns a list of all notifation channels. - ListChannels(ctx context.Context, in *ListChannelsRequest, opts ...grpc.CallOption) (*ListChannelsResponse, error) - // Deprecated: Do not use. - // AddChannel adds notification channel. - AddChannel(ctx context.Context, in *AddChannelRequest, opts ...grpc.CallOption) (*AddChannelResponse, error) - // Deprecated: Do not use. - // ChangeChannel changes notification channel. - ChangeChannel(ctx context.Context, in *ChangeChannelRequest, opts ...grpc.CallOption) (*ChangeChannelResponse, error) - // Deprecated: Do not use. - // RemoveChannel removes notification channel. - RemoveChannel(ctx context.Context, in *RemoveChannelRequest, opts ...grpc.CallOption) (*RemoveChannelResponse, error) -} - -type channelsClient struct { - cc grpc.ClientConnInterface -} - -func NewChannelsClient(cc grpc.ClientConnInterface) ChannelsClient { - return &channelsClient{cc} -} - -// Deprecated: Do not use. -func (c *channelsClient) ListChannels(ctx context.Context, in *ListChannelsRequest, opts ...grpc.CallOption) (*ListChannelsResponse, error) { - out := new(ListChannelsResponse) - err := c.cc.Invoke(ctx, Channels_ListChannels_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *channelsClient) AddChannel(ctx context.Context, in *AddChannelRequest, opts ...grpc.CallOption) (*AddChannelResponse, error) { - out := new(AddChannelResponse) - err := c.cc.Invoke(ctx, Channels_AddChannel_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *channelsClient) ChangeChannel(ctx context.Context, in *ChangeChannelRequest, opts ...grpc.CallOption) (*ChangeChannelResponse, error) { - out := new(ChangeChannelResponse) - err := c.cc.Invoke(ctx, Channels_ChangeChannel_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *channelsClient) RemoveChannel(ctx context.Context, in *RemoveChannelRequest, opts ...grpc.CallOption) (*RemoveChannelResponse, error) { - out := new(RemoveChannelResponse) - err := c.cc.Invoke(ctx, Channels_RemoveChannel_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ChannelsServer is the server API for Channels service. -// All implementations must embed UnimplementedChannelsServer -// for forward compatibility -type ChannelsServer interface { - // Deprecated: Do not use. - // ListChannels returns a list of all notifation channels. - ListChannels(context.Context, *ListChannelsRequest) (*ListChannelsResponse, error) - // Deprecated: Do not use. - // AddChannel adds notification channel. - AddChannel(context.Context, *AddChannelRequest) (*AddChannelResponse, error) - // Deprecated: Do not use. - // ChangeChannel changes notification channel. - ChangeChannel(context.Context, *ChangeChannelRequest) (*ChangeChannelResponse, error) - // Deprecated: Do not use. - // RemoveChannel removes notification channel. - RemoveChannel(context.Context, *RemoveChannelRequest) (*RemoveChannelResponse, error) - mustEmbedUnimplementedChannelsServer() -} - -// UnimplementedChannelsServer must be embedded to have forward compatible implementations. -type UnimplementedChannelsServer struct{} - -func (UnimplementedChannelsServer) ListChannels(context.Context, *ListChannelsRequest) (*ListChannelsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListChannels not implemented") -} - -func (UnimplementedChannelsServer) AddChannel(context.Context, *AddChannelRequest) (*AddChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddChannel not implemented") -} - -func (UnimplementedChannelsServer) ChangeChannel(context.Context, *ChangeChannelRequest) (*ChangeChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChangeChannel not implemented") -} - -func (UnimplementedChannelsServer) RemoveChannel(context.Context, *RemoveChannelRequest) (*RemoveChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveChannel not implemented") -} -func (UnimplementedChannelsServer) mustEmbedUnimplementedChannelsServer() {} - -// UnsafeChannelsServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ChannelsServer will -// result in compilation errors. -type UnsafeChannelsServer interface { - mustEmbedUnimplementedChannelsServer() -} - -func RegisterChannelsServer(s grpc.ServiceRegistrar, srv ChannelsServer) { - s.RegisterService(&Channels_ServiceDesc, srv) -} - -func _Channels_ListChannels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListChannelsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChannelsServer).ListChannels(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Channels_ListChannels_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChannelsServer).ListChannels(ctx, req.(*ListChannelsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Channels_AddChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChannelsServer).AddChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Channels_AddChannel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChannelsServer).AddChannel(ctx, req.(*AddChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Channels_ChangeChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChangeChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChannelsServer).ChangeChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Channels_ChangeChannel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChannelsServer).ChangeChannel(ctx, req.(*ChangeChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Channels_RemoveChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChannelsServer).RemoveChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Channels_RemoveChannel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChannelsServer).RemoveChannel(ctx, req.(*RemoveChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Channels_ServiceDesc is the grpc.ServiceDesc for Channels service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Channels_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "ia.v1beta1.Channels", - HandlerType: (*ChannelsServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListChannels", - Handler: _Channels_ListChannels_Handler, - }, - { - MethodName: "AddChannel", - Handler: _Channels_AddChannel_Handler, - }, - { - MethodName: "ChangeChannel", - Handler: _Channels_ChangeChannel_Handler, - }, - { - MethodName: "RemoveChannel", - Handler: _Channels_RemoveChannel_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "managementpb/ia/channels.proto", -} diff --git a/api/managementpb/ia/json/client/alerts/alerts_client.go b/api/managementpb/ia/json/client/alerts/alerts_client.go deleted file mode 100644 index ddd570bb7a..0000000000 --- a/api/managementpb/ia/json/client/alerts/alerts_client.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package alerts - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new alerts API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for alerts API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - ListAlerts(params *ListAlertsParams, opts ...ClientOption) (*ListAlertsOK, error) - - ToggleAlerts(params *ToggleAlertsParams, opts ...ClientOption) (*ToggleAlertsOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -ListAlerts lists alerts returns a list of all alerts -*/ -func (a *Client) ListAlerts(params *ListAlertsParams, opts ...ClientOption) (*ListAlertsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewListAlertsParams() - } - op := &runtime.ClientOperation{ - ID: "ListAlerts", - Method: "POST", - PathPattern: "/v1/management/ia/Alerts/List", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &ListAlertsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ListAlertsOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ListAlertsDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -ToggleAlerts toggles alerts allows to switch alerts state between silenced and unsilenced - -Pass empty list to apply toggle action to all existing alerts -*/ -func (a *Client) ToggleAlerts(params *ToggleAlertsParams, opts ...ClientOption) (*ToggleAlertsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewToggleAlertsParams() - } - op := &runtime.ClientOperation{ - ID: "ToggleAlerts", - Method: "POST", - PathPattern: "/v1/management/ia/Alerts/Toggle", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &ToggleAlertsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ToggleAlertsOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ToggleAlertsDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/api/managementpb/ia/json/client/alerts/list_alerts_parameters.go b/api/managementpb/ia/json/client/alerts/list_alerts_parameters.go deleted file mode 100644 index b2937ec92e..0000000000 --- a/api/managementpb/ia/json/client/alerts/list_alerts_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package alerts - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewListAlertsParams creates a new ListAlertsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewListAlertsParams() *ListAlertsParams { - return &ListAlertsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewListAlertsParamsWithTimeout creates a new ListAlertsParams object -// with the ability to set a timeout on a request. -func NewListAlertsParamsWithTimeout(timeout time.Duration) *ListAlertsParams { - return &ListAlertsParams{ - timeout: timeout, - } -} - -// NewListAlertsParamsWithContext creates a new ListAlertsParams object -// with the ability to set a context for a request. -func NewListAlertsParamsWithContext(ctx context.Context) *ListAlertsParams { - return &ListAlertsParams{ - Context: ctx, - } -} - -// NewListAlertsParamsWithHTTPClient creates a new ListAlertsParams object -// with the ability to set a custom HTTPClient for a request. -func NewListAlertsParamsWithHTTPClient(client *http.Client) *ListAlertsParams { - return &ListAlertsParams{ - HTTPClient: client, - } -} - -/* -ListAlertsParams contains all the parameters to send to the API endpoint - - for the list alerts operation. - - Typically these are written to a http.Request. -*/ -type ListAlertsParams struct { - // Body. - Body ListAlertsBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the list alerts params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListAlertsParams) WithDefaults() *ListAlertsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the list alerts params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListAlertsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the list alerts params -func (o *ListAlertsParams) WithTimeout(timeout time.Duration) *ListAlertsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the list alerts params -func (o *ListAlertsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the list alerts params -func (o *ListAlertsParams) WithContext(ctx context.Context) *ListAlertsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the list alerts params -func (o *ListAlertsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the list alerts params -func (o *ListAlertsParams) WithHTTPClient(client *http.Client) *ListAlertsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the list alerts params -func (o *ListAlertsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the list alerts params -func (o *ListAlertsParams) WithBody(body ListAlertsBody) *ListAlertsParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the list alerts params -func (o *ListAlertsParams) SetBody(body ListAlertsBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *ListAlertsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/alerts/list_alerts_responses.go b/api/managementpb/ia/json/client/alerts/list_alerts_responses.go deleted file mode 100644 index e1728b1587..0000000000 --- a/api/managementpb/ia/json/client/alerts/list_alerts_responses.go +++ /dev/null @@ -1,2711 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package alerts - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ListAlertsReader is a Reader for the ListAlerts structure. -type ListAlertsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ListAlertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewListAlertsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewListAlertsDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewListAlertsOK creates a ListAlertsOK with default headers values -func NewListAlertsOK() *ListAlertsOK { - return &ListAlertsOK{} -} - -/* -ListAlertsOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ListAlertsOK struct { - Payload *ListAlertsOKBody -} - -func (o *ListAlertsOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Alerts/List][%d] listAlertsOk %+v", 200, o.Payload) -} - -func (o *ListAlertsOK) GetPayload() *ListAlertsOKBody { - return o.Payload -} - -func (o *ListAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ListAlertsOKBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewListAlertsDefault creates a ListAlertsDefault with default headers values -func NewListAlertsDefault(code int) *ListAlertsDefault { - return &ListAlertsDefault{ - _statusCode: code, - } -} - -/* -ListAlertsDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ListAlertsDefault struct { - _statusCode int - - Payload *ListAlertsDefaultBody -} - -// Code gets the status code for the list alerts default response -func (o *ListAlertsDefault) Code() int { - return o._statusCode -} - -func (o *ListAlertsDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Alerts/List][%d] ListAlerts default %+v", o._statusCode, o.Payload) -} - -func (o *ListAlertsDefault) GetPayload() *ListAlertsDefaultBody { - return o.Payload -} - -func (o *ListAlertsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ListAlertsDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -ListAlertsBody list alerts body -swagger:model ListAlertsBody -*/ -type ListAlertsBody struct { - // page params - PageParams *ListAlertsParamsBodyPageParams `json:"page_params,omitempty"` -} - -// Validate validates this list alerts body -func (o *ListAlertsBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validatePageParams(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsBody) validatePageParams(formats strfmt.Registry) error { - if swag.IsZero(o.PageParams) { // not required - return nil - } - - if o.PageParams != nil { - if err := o.PageParams.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "page_params") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "page_params") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts body based on the context it is used -func (o *ListAlertsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidatePageParams(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsBody) contextValidatePageParams(ctx context.Context, formats strfmt.Registry) error { - if o.PageParams != nil { - if err := o.PageParams.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "page_params") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "page_params") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsBody) UnmarshalBinary(b []byte) error { - var res ListAlertsBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsDefaultBody list alerts default body -swagger:model ListAlertsDefaultBody -*/ -type ListAlertsDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*ListAlertsDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this list alerts default body -func (o *ListAlertsDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ListAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ListAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this list alerts default body based on the context it is used -func (o *ListAlertsDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ListAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ListAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsDefaultBody) UnmarshalBinary(b []byte) error { - var res ListAlertsDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsDefaultBodyDetailsItems0 list alerts default body details items0 -swagger:model ListAlertsDefaultBodyDetailsItems0 -*/ -type ListAlertsDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this list alerts default body details items0 -func (o *ListAlertsDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts default body details items0 based on context it is used -func (o *ListAlertsDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertsDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBody list alerts OK body -swagger:model ListAlertsOKBody -*/ -type ListAlertsOKBody struct { - // alerts - Alerts []*ListAlertsOKBodyAlertsItems0 `json:"alerts"` - - // totals - Totals *ListAlertsOKBodyTotals `json:"totals,omitempty"` -} - -// Validate validates this list alerts OK body -func (o *ListAlertsOKBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateAlerts(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTotals(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBody) validateAlerts(formats strfmt.Registry) error { - if swag.IsZero(o.Alerts) { // not required - return nil - } - - for i := 0; i < len(o.Alerts); i++ { - if swag.IsZero(o.Alerts[i]) { // not required - continue - } - - if o.Alerts[i] != nil { - if err := o.Alerts[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertsOk" + "." + "alerts" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertsOk" + "." + "alerts" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertsOKBody) validateTotals(formats strfmt.Registry) error { - if swag.IsZero(o.Totals) { // not required - return nil - } - - if o.Totals != nil { - if err := o.Totals.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertsOk" + "." + "totals") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertsOk" + "." + "totals") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts OK body based on the context it is used -func (o *ListAlertsOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateAlerts(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTotals(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBody) contextValidateAlerts(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Alerts); i++ { - if o.Alerts[i] != nil { - if err := o.Alerts[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertsOk" + "." + "alerts" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertsOk" + "." + "alerts" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertsOKBody) contextValidateTotals(ctx context.Context, formats strfmt.Registry) error { - if o.Totals != nil { - if err := o.Totals.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertsOk" + "." + "totals") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertsOk" + "." + "totals") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBody) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0 Alert represents Alert. -swagger:model ListAlertsOKBodyAlertsItems0 -*/ -type ListAlertsOKBodyAlertsItems0 struct { - // ID. - AlertID string `json:"alert_id,omitempty"` - - // Human-readable summary. - Summary string `json:"summary,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - Severity *string `json:"severity,omitempty"` - - // Status represents Alert Rule's and Alert's combined status. - // - // - CLEAR: No alert. - // - PENDING: Pending, but not triggering alert. - // - TRIGGERING: Triggering (firing) alert. - // - SILENCED: Silenced alert. - // Enum: [STATUS_INVALID CLEAR PENDING TRIGGERING SILENCED] - Status *string `json:"status,omitempty"` - - // Combined labels. - Labels map[string]string `json:"labels,omitempty"` - - // Alert creation time. - // Format: date-time - CreatedAt strfmt.DateTime `json:"created_at,omitempty"` - - // Alert last update time. - // Format: date-time - UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"` - - // rule - Rule *ListAlertsOKBodyAlertsItems0Rule `json:"rule,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 -func (o *ListAlertsOKBodyAlertsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateStatus(formats); err != nil { - res = append(res, err) - } - - if err := o.validateCreatedAt(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUpdatedAt(formats); err != nil { - res = append(res, err) - } - - if err := o.validateRule(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertsOkBodyAlertsItems0TypeSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0TypeSeverityPropEnum = append(listAlertsOkBodyAlertsItems0TypeSeverityPropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYINFO string = "SEVERITY_INFO" - - // ListAlertsOKBodyAlertsItems0SeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - ListAlertsOKBodyAlertsItems0SeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0) validateSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0TypeSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0) validateSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.Severity) { // not required - return nil - } - - // value enum - if err := o.validateSeverityEnum("severity", "body", *o.Severity); err != nil { - return err - } - - return nil -} - -var listAlertsOkBodyAlertsItems0TypeStatusPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["STATUS_INVALID","CLEAR","PENDING","TRIGGERING","SILENCED"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0TypeStatusPropEnum = append(listAlertsOkBodyAlertsItems0TypeStatusPropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0StatusSTATUSINVALID captures enum value "STATUS_INVALID" - ListAlertsOKBodyAlertsItems0StatusSTATUSINVALID string = "STATUS_INVALID" - - // ListAlertsOKBodyAlertsItems0StatusCLEAR captures enum value "CLEAR" - ListAlertsOKBodyAlertsItems0StatusCLEAR string = "CLEAR" - - // ListAlertsOKBodyAlertsItems0StatusPENDING captures enum value "PENDING" - ListAlertsOKBodyAlertsItems0StatusPENDING string = "PENDING" - - // ListAlertsOKBodyAlertsItems0StatusTRIGGERING captures enum value "TRIGGERING" - ListAlertsOKBodyAlertsItems0StatusTRIGGERING string = "TRIGGERING" - - // ListAlertsOKBodyAlertsItems0StatusSILENCED captures enum value "SILENCED" - ListAlertsOKBodyAlertsItems0StatusSILENCED string = "SILENCED" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0) validateStatusEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0TypeStatusPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(o.Status) { // not required - return nil - } - - // value enum - if err := o.validateStatusEnum("status", "body", *o.Status); err != nil { - return err - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0) validateCreatedAt(formats strfmt.Registry) error { - if swag.IsZero(o.CreatedAt) { // not required - return nil - } - - if err := validate.FormatOf("created_at", "body", "date-time", o.CreatedAt.String(), formats); err != nil { - return err - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0) validateUpdatedAt(formats strfmt.Registry) error { - if swag.IsZero(o.UpdatedAt) { // not required - return nil - } - - if err := validate.FormatOf("updated_at", "body", "date-time", o.UpdatedAt.String(), formats); err != nil { - return err - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0) validateRule(formats strfmt.Registry) error { - if swag.IsZero(o.Rule) { // not required - return nil - } - - if o.Rule != nil { - if err := o.Rule.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts OK body alerts items0 based on the context it is used -func (o *ListAlertsOKBodyAlertsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRule(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0) contextValidateRule(ctx context.Context, formats strfmt.Registry) error { - if o.Rule != nil { - if err := o.Rule.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0Rule Rule represents Alert Rule. -swagger:model ListAlertsOKBodyAlertsItems0Rule -*/ -type ListAlertsOKBodyAlertsItems0Rule struct { - // Rule ID. - RuleID string `json:"rule_id,omitempty"` - - // Rule name. - Name string `json:"name,omitempty"` - - // Rule human-readable summary. - Summary string `json:"summary,omitempty"` - - // Template used for this rule. - TemplateName string `json:"template_name,omitempty"` - - // True if that rule is disabled. - Disabled bool `json:"disabled,omitempty"` - - // Expression template. - ExprTemplate string `json:"expr_template,omitempty"` - - // Expression filled with parameters. - Expr string `json:"expr,omitempty"` - - // Expression parameters definitions. - ParamsDefinitions []*ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0 `json:"params_definitions"` - - // Expression parameters values. - ParamsValues []*ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0 `json:"params_values"` - - // Default for duration. - DefaultFor string `json:"default_for,omitempty"` - - // For duration. - For string `json:"for,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - DefaultSeverity *string `json:"default_severity,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - Severity *string `json:"severity,omitempty"` - - // Custom labels. - CustomLabels map[string]string `json:"custom_labels,omitempty"` - - // Labels. - Labels map[string]string `json:"labels,omitempty"` - - // Annotations. - Annotations map[string]string `json:"annotations,omitempty"` - - // Filters. - Filters []*ListAlertsOKBodyAlertsItems0RuleFiltersItems0 `json:"filters"` - - // Channels. - Channels []*ListAlertsOKBodyAlertsItems0RuleChannelsItems0 `json:"channels"` - - // Rule creation time. - // Format: date-time - CreatedAt strfmt.DateTime `json:"created_at,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule -func (o *ListAlertsOKBodyAlertsItems0Rule) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateParamsDefinitions(formats); err != nil { - res = append(res, err) - } - - if err := o.validateParamsValues(formats); err != nil { - res = append(res, err) - } - - if err := o.validateDefaultSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateFilters(formats); err != nil { - res = append(res, err) - } - - if err := o.validateChannels(formats); err != nil { - res = append(res, err) - } - - if err := o.validateCreatedAt(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateParamsDefinitions(formats strfmt.Registry) error { - if swag.IsZero(o.ParamsDefinitions) { // not required - return nil - } - - for i := 0; i < len(o.ParamsDefinitions); i++ { - if swag.IsZero(o.ParamsDefinitions[i]) { // not required - continue - } - - if o.ParamsDefinitions[i] != nil { - if err := o.ParamsDefinitions[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "params_definitions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "params_definitions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateParamsValues(formats strfmt.Registry) error { - if swag.IsZero(o.ParamsValues) { // not required - return nil - } - - for i := 0; i < len(o.ParamsValues); i++ { - if swag.IsZero(o.ParamsValues[i]) { // not required - continue - } - - if o.ParamsValues[i] != nil { - if err := o.ParamsValues[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "params_values" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "params_values" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -var listAlertsOkBodyAlertsItems0RuleTypeDefaultSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleTypeDefaultSeverityPropEnum = append(listAlertsOkBodyAlertsItems0RuleTypeDefaultSeverityPropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYINFO string = "SEVERITY_INFO" - - // ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - ListAlertsOKBodyAlertsItems0RuleDefaultSeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0Rule) validateDefaultSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleTypeDefaultSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateDefaultSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.DefaultSeverity) { // not required - return nil - } - - // value enum - if err := o.validateDefaultSeverityEnum("rule"+"."+"default_severity", "body", *o.DefaultSeverity); err != nil { - return err - } - - return nil -} - -var listAlertsOkBodyAlertsItems0RuleTypeSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleTypeSeverityPropEnum = append(listAlertsOkBodyAlertsItems0RuleTypeSeverityPropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYINFO string = "SEVERITY_INFO" - - // ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - ListAlertsOKBodyAlertsItems0RuleSeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0Rule) validateSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleTypeSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.Severity) { // not required - return nil - } - - // value enum - if err := o.validateSeverityEnum("rule"+"."+"severity", "body", *o.Severity); err != nil { - return err - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateFilters(formats strfmt.Registry) error { - if swag.IsZero(o.Filters) { // not required - return nil - } - - for i := 0; i < len(o.Filters); i++ { - if swag.IsZero(o.Filters[i]) { // not required - continue - } - - if o.Filters[i] != nil { - if err := o.Filters[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "filters" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateChannels(formats strfmt.Registry) error { - if swag.IsZero(o.Channels) { // not required - return nil - } - - for i := 0; i < len(o.Channels); i++ { - if swag.IsZero(o.Channels[i]) { // not required - continue - } - - if o.Channels[i] != nil { - if err := o.Channels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "channels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "channels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) validateCreatedAt(formats strfmt.Registry) error { - if swag.IsZero(o.CreatedAt) { // not required - return nil - } - - if err := validate.FormatOf("rule"+"."+"created_at", "body", "date-time", o.CreatedAt.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this list alerts OK body alerts items0 rule based on the context it is used -func (o *ListAlertsOKBodyAlertsItems0Rule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateParamsDefinitions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateParamsValues(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateFilters(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateChannels(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) contextValidateParamsDefinitions(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.ParamsDefinitions); i++ { - if o.ParamsDefinitions[i] != nil { - if err := o.ParamsDefinitions[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "params_definitions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "params_definitions" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) contextValidateParamsValues(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.ParamsValues); i++ { - if o.ParamsValues[i] != nil { - if err := o.ParamsValues[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "params_values" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "params_values" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) contextValidateFilters(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Filters); i++ { - if o.Filters[i] != nil { - if err := o.Filters[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "filters" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0Rule) contextValidateChannels(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Channels); i++ { - if o.Channels[i] != nil { - if err := o.Channels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("rule" + "." + "channels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("rule" + "." + "channels" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0Rule) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0Rule) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0Rule - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0 Channel represents a single Notification Channel. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0 -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0 struct { - // Machine-readable ID. - ChannelID string `json:"channel_id,omitempty"` - - // Short human-readable summary. - Summary string `json:"summary,omitempty"` - - // True if that channel is disabled. - Disabled bool `json:"disabled,omitempty"` - - // email config - EmailConfig *ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig `json:"email_config,omitempty"` - - // pagerduty config - PagerdutyConfig *ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig `json:"pagerduty_config,omitempty"` - - // slack config - SlackConfig *ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig `json:"slack_config,omitempty"` - - // webhook config - WebhookConfig *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig `json:"webhook_config,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateEmailConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validatePagerdutyConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSlackConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateWebhookConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) validateEmailConfig(formats strfmt.Registry) error { - if swag.IsZero(o.EmailConfig) { // not required - return nil - } - - if o.EmailConfig != nil { - if err := o.EmailConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("email_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) validatePagerdutyConfig(formats strfmt.Registry) error { - if swag.IsZero(o.PagerdutyConfig) { // not required - return nil - } - - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) validateSlackConfig(formats strfmt.Registry) error { - if swag.IsZero(o.SlackConfig) { // not required - return nil - } - - if o.SlackConfig != nil { - if err := o.SlackConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("slack_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) validateWebhookConfig(formats strfmt.Registry) error { - if swag.IsZero(o.WebhookConfig) { // not required - return nil - } - - if o.WebhookConfig != nil { - if err := o.WebhookConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts OK body alerts items0 rule channels items0 based on the context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateEmailConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidatePagerdutyConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateSlackConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateWebhookConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) contextValidateEmailConfig(ctx context.Context, formats strfmt.Registry) error { - if o.EmailConfig != nil { - if err := o.EmailConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("email_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) contextValidatePagerdutyConfig(ctx context.Context, formats strfmt.Registry) error { - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) contextValidateSlackConfig(ctx context.Context, formats strfmt.Registry) error { - if o.SlackConfig != nil { - if err := o.SlackConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("slack_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) contextValidateWebhookConfig(ctx context.Context, formats strfmt.Registry) error { - if o.WebhookConfig != nil { - if err := o.WebhookConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig EmailConfig represents email configuration. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // to - To []string `json:"to"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 email config -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule channels items0 email config based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0EmailConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig PagerDutyConfig represents PagerDuty configuration. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - RoutingKey string `json:"routing_key,omitempty"` - - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - ServiceKey string `json:"service_key,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 pagerduty config -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule channels items0 pagerduty config based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0PagerdutyConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig SlackConfig represents Slack configuration. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // channel - Channel string `json:"channel,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 slack config -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule channels items0 slack config based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0SlackConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig WebhookConfig represents webhook configuration. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // url - URL string `json:"url,omitempty"` - - // max alerts - MaxAlerts int32 `json:"max_alerts,omitempty"` - - // http config - HTTPConfig *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig `json:"http_config,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 webhook config -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateHTTPConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig) validateHTTPConfig(formats strfmt.Registry) error { - if swag.IsZero(o.HTTPConfig) { // not required - return nil - } - - if o.HTTPConfig != nil { - if err := o.HTTPConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts OK body alerts items0 rule channels items0 webhook config based on the context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateHTTPConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig) contextValidateHTTPConfig(ctx context.Context, formats strfmt.Registry) error { - if o.HTTPConfig != nil { - if err := o.HTTPConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig HTTPConfig represents HTTP client configuration. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig struct { - // bearer token - BearerToken string `json:"bearer_token,omitempty"` - - // bearer token file - BearerTokenFile string `json:"bearer_token_file,omitempty"` - - // proxy url - ProxyURL string `json:"proxy_url,omitempty"` - - // basic auth - BasicAuth *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth `json:"basic_auth,omitempty"` - - // tls config - TLSConfig *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig `json:"tls_config,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 webhook config HTTP config -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateBasicAuth(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTLSConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) validateBasicAuth(formats strfmt.Registry) error { - if swag.IsZero(o.BasicAuth) { // not required - return nil - } - - if o.BasicAuth != nil { - if err := o.BasicAuth.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) validateTLSConfig(formats strfmt.Registry) error { - if swag.IsZero(o.TLSConfig) { // not required - return nil - } - - if o.TLSConfig != nil { - if err := o.TLSConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts OK body alerts items0 rule channels items0 webhook config HTTP config based on the context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBasicAuth(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTLSConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) contextValidateBasicAuth(ctx context.Context, formats strfmt.Registry) error { - if o.BasicAuth != nil { - if err := o.BasicAuth.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) contextValidateTLSConfig(ctx context.Context, formats strfmt.Registry) error { - if o.TLSConfig != nil { - if err := o.TLSConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth BasicAuth represents basic HTTP auth configuration. -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth struct { - // username - Username string `json:"username,omitempty"` - - // password - Password string `json:"password,omitempty"` - - // password file - PasswordFile string `json:"password_file,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 webhook config HTTP config basic auth -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule channels items0 webhook config HTTP config basic auth based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigBasicAuth - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -swagger:model ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig -*/ -type ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig struct { - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFile string `json:"ca_file,omitempty"` - - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFile string `json:"cert_file,omitempty"` - - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFile string `json:"key_file,omitempty"` - - // Name of the server. - ServerName string `json:"server_name,omitempty"` - - // Disable validation of the server certificate. - InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` - - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFileContent string `json:"ca_file_content,omitempty"` - - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFileContent string `json:"cert_file_content,omitempty"` - - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFileContent string `json:"key_file_content,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule channels items0 webhook config HTTP config TLS config -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule channels items0 webhook config HTTP config TLS config based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleChannelsItems0WebhookConfigHTTPConfigTLSConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleFiltersItems0 Filter repsents a single filter condition. -swagger:model ListAlertsOKBodyAlertsItems0RuleFiltersItems0 -*/ -type ListAlertsOKBodyAlertsItems0RuleFiltersItems0 struct { - // FilterType represents filter matching type. - // - // - EQUAL: = - // - // != - // NOT_EQUAL = 2; - // - REGEX: =~ - // - // !~ - // NOT_REGEX = 4; - // Enum: [FILTER_TYPE_INVALID EQUAL REGEX] - Type *string `json:"type,omitempty"` - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule filters items0 -func (o *ListAlertsOKBodyAlertsItems0RuleFiltersItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertsOkBodyAlertsItems0RuleFiltersItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["FILTER_TYPE_INVALID","EQUAL","REGEX"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleFiltersItems0TypeTypePropEnum = append(listAlertsOkBodyAlertsItems0RuleFiltersItems0TypeTypePropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleFiltersItems0TypeFILTERTYPEINVALID captures enum value "FILTER_TYPE_INVALID" - ListAlertsOKBodyAlertsItems0RuleFiltersItems0TypeFILTERTYPEINVALID string = "FILTER_TYPE_INVALID" - - // ListAlertsOKBodyAlertsItems0RuleFiltersItems0TypeEQUAL captures enum value "EQUAL" - ListAlertsOKBodyAlertsItems0RuleFiltersItems0TypeEQUAL string = "EQUAL" - - // ListAlertsOKBodyAlertsItems0RuleFiltersItems0TypeREGEX captures enum value "REGEX" - ListAlertsOKBodyAlertsItems0RuleFiltersItems0TypeREGEX string = "REGEX" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0RuleFiltersItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleFiltersItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleFiltersItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule filters items0 based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleFiltersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleFiltersItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleFiltersItems0) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleFiltersItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0 ParamDefinition represents a single query parameter. -swagger:model ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0 -*/ -type ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0 struct { - // Machine-readable name (ID) that is used in expression. - Name string `json:"name,omitempty"` - - // Short human-readable parameter summary. - Summary string `json:"summary,omitempty"` - - // ParamUnit represents template parameter unit. - // - // - PARAM_UNIT_INVALID: Invalid, unknown or absent. - // - PERCENTAGE: % - // - SECONDS: s - // Enum: [PARAM_UNIT_INVALID PERCENTAGE SECONDS] - Unit *string `json:"unit,omitempty"` - - // ParamType represents template parameter type. - // Enum: [PARAM_TYPE_INVALID BOOL FLOAT STRING] - Type *string `json:"type,omitempty"` - - // bool - Bool *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool `json:"bool,omitempty"` - - // float - Float *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float `json:"float,omitempty"` - - // string - String *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String `json:"string,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule params definitions items0 -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateUnit(formats); err != nil { - res = append(res, err) - } - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if err := o.validateBool(formats); err != nil { - res = append(res, err) - } - - if err := o.validateFloat(formats); err != nil { - res = append(res, err) - } - - if err := o.validateString(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeUnitPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_UNIT_INVALID","PERCENTAGE","SECONDS"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeUnitPropEnum = append(listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeUnitPropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0UnitPARAMUNITINVALID captures enum value "PARAM_UNIT_INVALID" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0UnitPARAMUNITINVALID string = "PARAM_UNIT_INVALID" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0UnitPERCENTAGE captures enum value "PERCENTAGE" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0UnitPERCENTAGE string = "PERCENTAGE" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0UnitSECONDS captures enum value "SECONDS" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0UnitSECONDS string = "SECONDS" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateUnitEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeUnitPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateUnit(formats strfmt.Registry) error { - if swag.IsZero(o.Unit) { // not required - return nil - } - - // value enum - if err := o.validateUnitEnum("unit", "body", *o.Unit); err != nil { - return err - } - - return nil -} - -var listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_TYPE_INVALID","BOOL","FLOAT","STRING"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeTypePropEnum = append(listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeTypePropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypePARAMTYPEINVALID captures enum value "PARAM_TYPE_INVALID" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypePARAMTYPEINVALID string = "PARAM_TYPE_INVALID" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypeBOOL captures enum value "BOOL" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypeBOOL string = "BOOL" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypeFLOAT captures enum value "FLOAT" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypeFLOAT string = "FLOAT" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypeSTRING captures enum value "STRING" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0TypeSTRING string = "STRING" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateBool(formats strfmt.Registry) error { - if swag.IsZero(o.Bool) { // not required - return nil - } - - if o.Bool != nil { - if err := o.Bool.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bool") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("bool") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateFloat(formats strfmt.Registry) error { - if swag.IsZero(o.Float) { // not required - return nil - } - - if o.Float != nil { - if err := o.Float.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("float") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("float") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) validateString(formats strfmt.Registry) error { - if swag.IsZero(o.String) { // not required - return nil - } - - if o.String != nil { - if err := o.String.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("string") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("string") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alerts OK body alerts items0 rule params definitions items0 based on the context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBool(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateFloat(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateString(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) contextValidateBool(ctx context.Context, formats strfmt.Registry) error { - if o.Bool != nil { - if err := o.Bool.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bool") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("bool") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) contextValidateFloat(ctx context.Context, formats strfmt.Registry) error { - if o.Float != nil { - if err := o.Float.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("float") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("float") - } - return err - } - } - - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) contextValidateString(ctx context.Context, formats strfmt.Registry) error { - if o.String != nil { - if err := o.String.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("string") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("string") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool BoolParamDefinition represents boolean parameter's default value. -swagger:model ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool -*/ -type ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool struct { - // BooleanFlag represent a command to set some boolean property to true, - // to false, or avoid changing that property. - // - // - DO_NOT_CHANGE: Do not change boolean property. Default value. - // - TRUE: True. - // - FALSE: False. - // Enum: [DO_NOT_CHANGE TRUE FALSE] - Default *string `json:"default,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule params definitions items0 bool -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDefault(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0BoolTypeDefaultPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["DO_NOT_CHANGE","TRUE","FALSE"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0BoolTypeDefaultPropEnum = append(listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0BoolTypeDefaultPropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0BoolDefaultDONOTCHANGE captures enum value "DO_NOT_CHANGE" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0BoolDefaultDONOTCHANGE string = "DO_NOT_CHANGE" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0BoolDefaultTRUE captures enum value "TRUE" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0BoolDefaultTRUE string = "TRUE" - - // ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0BoolDefaultFALSE captures enum value "FALSE" - ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0BoolDefaultFALSE string = "FALSE" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool) validateDefaultEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleParamsDefinitionsItems0BoolTypeDefaultPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool) validateDefault(formats strfmt.Registry) error { - if swag.IsZero(o.Default) { // not required - return nil - } - - // value enum - if err := o.validateDefaultEnum("bool"+"."+"default", "body", *o.Default); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule params definitions items0 bool based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Bool - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float FloatParamDefinition represents float parameter's default value and valid range. -swagger:model ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float -*/ -type ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float struct { - // True if default value is set. - HasDefault bool `json:"has_default,omitempty"` - - // Default value if has_default is true. - Default float64 `json:"default,omitempty"` - - // True if minimal valid value is set. - HasMin bool `json:"has_min,omitempty"` - - // Minimal valid value (inclusive) if has_min is true. - Min float64 `json:"min,omitempty"` - - // True if maximal valid value is set. - HasMax bool `json:"has_max,omitempty"` - - // Maximal valid value (inclusive) if has_max is true. - Max float64 `json:"max,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule params definitions items0 float -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule params definitions items0 float based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0Float - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String StringParamDefinition represents string parameter's default value. -swagger:model ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String -*/ -type ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String struct { - // True if default value is set. - HasDefault bool `json:"has_default,omitempty"` - - // Default value if has_default is true. - Default string `json:"default,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule params definitions items0 string -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule params definitions items0 string based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleParamsDefinitionsItems0String - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0 ParamValue represents a single rule parameter value for List, Change and Update APIs. -swagger:model ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0 -*/ -type ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0 struct { - // Machine-readable name (ID) that is used in expression. - Name string `json:"name,omitempty"` - - // ParamType represents template parameter type. - // Enum: [PARAM_TYPE_INVALID BOOL FLOAT STRING] - Type *string `json:"type,omitempty"` - - // Bool value. - Bool bool `json:"bool,omitempty"` - - // Float value. - Float float64 `json:"float,omitempty"` - - // String value. - String string `json:"string,omitempty"` -} - -// Validate validates this list alerts OK body alerts items0 rule params values items0 -func (o *ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertsOkBodyAlertsItems0RuleParamsValuesItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_TYPE_INVALID","BOOL","FLOAT","STRING"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertsOkBodyAlertsItems0RuleParamsValuesItems0TypeTypePropEnum = append(listAlertsOkBodyAlertsItems0RuleParamsValuesItems0TypeTypePropEnum, v) - } -} - -const ( - - // ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypePARAMTYPEINVALID captures enum value "PARAM_TYPE_INVALID" - ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypePARAMTYPEINVALID string = "PARAM_TYPE_INVALID" - - // ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypeBOOL captures enum value "BOOL" - ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypeBOOL string = "BOOL" - - // ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypeFLOAT captures enum value "FLOAT" - ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypeFLOAT string = "FLOAT" - - // ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypeSTRING captures enum value "STRING" - ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0TypeSTRING string = "STRING" -) - -// prop value enum -func (o *ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertsOkBodyAlertsItems0RuleParamsValuesItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this list alerts OK body alerts items0 rule params values items0 based on context it is used -func (o *ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyAlertsItems0RuleParamsValuesItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsOKBodyTotals PageTotals represents total values for pagination. -swagger:model ListAlertsOKBodyTotals -*/ -type ListAlertsOKBodyTotals struct { - // Total number of results. - TotalItems int32 `json:"total_items,omitempty"` - - // Total number of pages. - TotalPages int32 `json:"total_pages,omitempty"` -} - -// Validate validates this list alerts OK body totals -func (o *ListAlertsOKBodyTotals) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts OK body totals based on context it is used -func (o *ListAlertsOKBodyTotals) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsOKBodyTotals) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsOKBodyTotals) UnmarshalBinary(b []byte) error { - var res ListAlertsOKBodyTotals - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertsParamsBodyPageParams PageParams represents page request parameters for pagination. -swagger:model ListAlertsParamsBodyPageParams -*/ -type ListAlertsParamsBodyPageParams struct { - // Maximum number of results per page. - PageSize int32 `json:"page_size,omitempty"` - - // Index of the requested page, starts from 0. - Index int32 `json:"index,omitempty"` -} - -// Validate validates this list alerts params body page params -func (o *ListAlertsParamsBodyPageParams) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alerts params body page params based on context it is used -func (o *ListAlertsParamsBodyPageParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertsParamsBodyPageParams) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertsParamsBodyPageParams) UnmarshalBinary(b []byte) error { - var res ListAlertsParamsBodyPageParams - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/alerts/toggle_alerts_parameters.go b/api/managementpb/ia/json/client/alerts/toggle_alerts_parameters.go deleted file mode 100644 index 91f845542b..0000000000 --- a/api/managementpb/ia/json/client/alerts/toggle_alerts_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package alerts - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewToggleAlertsParams creates a new ToggleAlertsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewToggleAlertsParams() *ToggleAlertsParams { - return &ToggleAlertsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewToggleAlertsParamsWithTimeout creates a new ToggleAlertsParams object -// with the ability to set a timeout on a request. -func NewToggleAlertsParamsWithTimeout(timeout time.Duration) *ToggleAlertsParams { - return &ToggleAlertsParams{ - timeout: timeout, - } -} - -// NewToggleAlertsParamsWithContext creates a new ToggleAlertsParams object -// with the ability to set a context for a request. -func NewToggleAlertsParamsWithContext(ctx context.Context) *ToggleAlertsParams { - return &ToggleAlertsParams{ - Context: ctx, - } -} - -// NewToggleAlertsParamsWithHTTPClient creates a new ToggleAlertsParams object -// with the ability to set a custom HTTPClient for a request. -func NewToggleAlertsParamsWithHTTPClient(client *http.Client) *ToggleAlertsParams { - return &ToggleAlertsParams{ - HTTPClient: client, - } -} - -/* -ToggleAlertsParams contains all the parameters to send to the API endpoint - - for the toggle alerts operation. - - Typically these are written to a http.Request. -*/ -type ToggleAlertsParams struct { - // Body. - Body ToggleAlertsBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the toggle alerts params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ToggleAlertsParams) WithDefaults() *ToggleAlertsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the toggle alerts params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ToggleAlertsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the toggle alerts params -func (o *ToggleAlertsParams) WithTimeout(timeout time.Duration) *ToggleAlertsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the toggle alerts params -func (o *ToggleAlertsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the toggle alerts params -func (o *ToggleAlertsParams) WithContext(ctx context.Context) *ToggleAlertsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the toggle alerts params -func (o *ToggleAlertsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the toggle alerts params -func (o *ToggleAlertsParams) WithHTTPClient(client *http.Client) *ToggleAlertsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the toggle alerts params -func (o *ToggleAlertsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the toggle alerts params -func (o *ToggleAlertsParams) WithBody(body ToggleAlertsBody) *ToggleAlertsParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the toggle alerts params -func (o *ToggleAlertsParams) SetBody(body ToggleAlertsBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *ToggleAlertsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/alerts/toggle_alerts_responses.go b/api/managementpb/ia/json/client/alerts/toggle_alerts_responses.go deleted file mode 100644 index bba76b097d..0000000000 --- a/api/managementpb/ia/json/client/alerts/toggle_alerts_responses.go +++ /dev/null @@ -1,361 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package alerts - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ToggleAlertsReader is a Reader for the ToggleAlerts structure. -type ToggleAlertsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ToggleAlertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewToggleAlertsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewToggleAlertsDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewToggleAlertsOK creates a ToggleAlertsOK with default headers values -func NewToggleAlertsOK() *ToggleAlertsOK { - return &ToggleAlertsOK{} -} - -/* -ToggleAlertsOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ToggleAlertsOK struct { - Payload interface{} -} - -func (o *ToggleAlertsOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Alerts/Toggle][%d] toggleAlertsOk %+v", 200, o.Payload) -} - -func (o *ToggleAlertsOK) GetPayload() interface{} { - return o.Payload -} - -func (o *ToggleAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewToggleAlertsDefault creates a ToggleAlertsDefault with default headers values -func NewToggleAlertsDefault(code int) *ToggleAlertsDefault { - return &ToggleAlertsDefault{ - _statusCode: code, - } -} - -/* -ToggleAlertsDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ToggleAlertsDefault struct { - _statusCode int - - Payload *ToggleAlertsDefaultBody -} - -// Code gets the status code for the toggle alerts default response -func (o *ToggleAlertsDefault) Code() int { - return o._statusCode -} - -func (o *ToggleAlertsDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Alerts/Toggle][%d] ToggleAlerts default %+v", o._statusCode, o.Payload) -} - -func (o *ToggleAlertsDefault) GetPayload() *ToggleAlertsDefaultBody { - return o.Payload -} - -func (o *ToggleAlertsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ToggleAlertsDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -ToggleAlertsBody toggle alerts body -swagger:model ToggleAlertsBody -*/ -type ToggleAlertsBody struct { - // List of alerts that silence state should be switched. If provided array is empty than all - // existing alerts are switched. - AlertIds []string `json:"alert_ids"` - - // BooleanFlag represent a command to set some boolean property to true, - // to false, or avoid changing that property. - // - // - DO_NOT_CHANGE: Do not change boolean property. Default value. - // - TRUE: True. - // - FALSE: False. - // Enum: [DO_NOT_CHANGE TRUE FALSE] - Silenced *string `json:"silenced,omitempty"` -} - -// Validate validates this toggle alerts body -func (o *ToggleAlertsBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateSilenced(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var toggleAlertsBodyTypeSilencedPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["DO_NOT_CHANGE","TRUE","FALSE"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - toggleAlertsBodyTypeSilencedPropEnum = append(toggleAlertsBodyTypeSilencedPropEnum, v) - } -} - -const ( - - // ToggleAlertsBodySilencedDONOTCHANGE captures enum value "DO_NOT_CHANGE" - ToggleAlertsBodySilencedDONOTCHANGE string = "DO_NOT_CHANGE" - - // ToggleAlertsBodySilencedTRUE captures enum value "TRUE" - ToggleAlertsBodySilencedTRUE string = "TRUE" - - // ToggleAlertsBodySilencedFALSE captures enum value "FALSE" - ToggleAlertsBodySilencedFALSE string = "FALSE" -) - -// prop value enum -func (o *ToggleAlertsBody) validateSilencedEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, toggleAlertsBodyTypeSilencedPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ToggleAlertsBody) validateSilenced(formats strfmt.Registry) error { - if swag.IsZero(o.Silenced) { // not required - return nil - } - - // value enum - if err := o.validateSilencedEnum("body"+"."+"silenced", "body", *o.Silenced); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this toggle alerts body based on context it is used -func (o *ToggleAlertsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ToggleAlertsBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ToggleAlertsBody) UnmarshalBinary(b []byte) error { - var res ToggleAlertsBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ToggleAlertsDefaultBody toggle alerts default body -swagger:model ToggleAlertsDefaultBody -*/ -type ToggleAlertsDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*ToggleAlertsDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this toggle alerts default body -func (o *ToggleAlertsDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ToggleAlertsDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ToggleAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ToggleAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this toggle alerts default body based on the context it is used -func (o *ToggleAlertsDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ToggleAlertsDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ToggleAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ToggleAlerts default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ToggleAlertsDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ToggleAlertsDefaultBody) UnmarshalBinary(b []byte) error { - var res ToggleAlertsDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ToggleAlertsDefaultBodyDetailsItems0 toggle alerts default body details items0 -swagger:model ToggleAlertsDefaultBodyDetailsItems0 -*/ -type ToggleAlertsDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this toggle alerts default body details items0 -func (o *ToggleAlertsDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this toggle alerts default body details items0 based on context it is used -func (o *ToggleAlertsDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ToggleAlertsDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ToggleAlertsDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res ToggleAlertsDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/channels/add_channel_parameters.go b/api/managementpb/ia/json/client/channels/add_channel_parameters.go deleted file mode 100644 index dda611d4a5..0000000000 --- a/api/managementpb/ia/json/client/channels/add_channel_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewAddChannelParams creates a new AddChannelParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewAddChannelParams() *AddChannelParams { - return &AddChannelParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewAddChannelParamsWithTimeout creates a new AddChannelParams object -// with the ability to set a timeout on a request. -func NewAddChannelParamsWithTimeout(timeout time.Duration) *AddChannelParams { - return &AddChannelParams{ - timeout: timeout, - } -} - -// NewAddChannelParamsWithContext creates a new AddChannelParams object -// with the ability to set a context for a request. -func NewAddChannelParamsWithContext(ctx context.Context) *AddChannelParams { - return &AddChannelParams{ - Context: ctx, - } -} - -// NewAddChannelParamsWithHTTPClient creates a new AddChannelParams object -// with the ability to set a custom HTTPClient for a request. -func NewAddChannelParamsWithHTTPClient(client *http.Client) *AddChannelParams { - return &AddChannelParams{ - HTTPClient: client, - } -} - -/* -AddChannelParams contains all the parameters to send to the API endpoint - - for the add channel operation. - - Typically these are written to a http.Request. -*/ -type AddChannelParams struct { - // Body. - Body AddChannelBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the add channel params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *AddChannelParams) WithDefaults() *AddChannelParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the add channel params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *AddChannelParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the add channel params -func (o *AddChannelParams) WithTimeout(timeout time.Duration) *AddChannelParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the add channel params -func (o *AddChannelParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the add channel params -func (o *AddChannelParams) WithContext(ctx context.Context) *AddChannelParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the add channel params -func (o *AddChannelParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the add channel params -func (o *AddChannelParams) WithHTTPClient(client *http.Client) *AddChannelParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the add channel params -func (o *AddChannelParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the add channel params -func (o *AddChannelParams) WithBody(body AddChannelBody) *AddChannelParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the add channel params -func (o *AddChannelParams) SetBody(body AddChannelBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *AddChannelParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/channels/add_channel_responses.go b/api/managementpb/ia/json/client/channels/add_channel_responses.go deleted file mode 100644 index 96a7a1f087..0000000000 --- a/api/managementpb/ia/json/client/channels/add_channel_responses.go +++ /dev/null @@ -1,999 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// AddChannelReader is a Reader for the AddChannel structure. -type AddChannelReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *AddChannelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewAddChannelOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewAddChannelDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewAddChannelOK creates a AddChannelOK with default headers values -func NewAddChannelOK() *AddChannelOK { - return &AddChannelOK{} -} - -/* -AddChannelOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type AddChannelOK struct { - Payload *AddChannelOKBody -} - -func (o *AddChannelOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/Add][%d] addChannelOk %+v", 200, o.Payload) -} - -func (o *AddChannelOK) GetPayload() *AddChannelOKBody { - return o.Payload -} - -func (o *AddChannelOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(AddChannelOKBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewAddChannelDefault creates a AddChannelDefault with default headers values -func NewAddChannelDefault(code int) *AddChannelDefault { - return &AddChannelDefault{ - _statusCode: code, - } -} - -/* -AddChannelDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type AddChannelDefault struct { - _statusCode int - - Payload *AddChannelDefaultBody -} - -// Code gets the status code for the add channel default response -func (o *AddChannelDefault) Code() int { - return o._statusCode -} - -func (o *AddChannelDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/Add][%d] AddChannel default %+v", o._statusCode, o.Payload) -} - -func (o *AddChannelDefault) GetPayload() *AddChannelDefaultBody { - return o.Payload -} - -func (o *AddChannelDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(AddChannelDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -AddChannelBody add channel body -swagger:model AddChannelBody -*/ -type AddChannelBody struct { - // Short human-readable summary. - Summary string `json:"summary,omitempty"` - - // New channel status. - Disabled bool `json:"disabled,omitempty"` - - // email config - EmailConfig *AddChannelParamsBodyEmailConfig `json:"email_config,omitempty"` - - // pagerduty config - PagerdutyConfig *AddChannelParamsBodyPagerdutyConfig `json:"pagerduty_config,omitempty"` - - // slack config - SlackConfig *AddChannelParamsBodySlackConfig `json:"slack_config,omitempty"` - - // webhook config - WebhookConfig *AddChannelParamsBodyWebhookConfig `json:"webhook_config,omitempty"` -} - -// Validate validates this add channel body -func (o *AddChannelBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateEmailConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validatePagerdutyConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSlackConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateWebhookConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelBody) validateEmailConfig(formats strfmt.Registry) error { - if swag.IsZero(o.EmailConfig) { // not required - return nil - } - - if o.EmailConfig != nil { - if err := o.EmailConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_config") - } - return err - } - } - - return nil -} - -func (o *AddChannelBody) validatePagerdutyConfig(formats strfmt.Registry) error { - if swag.IsZero(o.PagerdutyConfig) { // not required - return nil - } - - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *AddChannelBody) validateSlackConfig(formats strfmt.Registry) error { - if swag.IsZero(o.SlackConfig) { // not required - return nil - } - - if o.SlackConfig != nil { - if err := o.SlackConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "slack_config") - } - return err - } - } - - return nil -} - -func (o *AddChannelBody) validateWebhookConfig(formats strfmt.Registry) error { - if swag.IsZero(o.WebhookConfig) { // not required - return nil - } - - if o.WebhookConfig != nil { - if err := o.WebhookConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this add channel body based on the context it is used -func (o *AddChannelBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateEmailConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidatePagerdutyConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateSlackConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateWebhookConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelBody) contextValidateEmailConfig(ctx context.Context, formats strfmt.Registry) error { - if o.EmailConfig != nil { - if err := o.EmailConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_config") - } - return err - } - } - - return nil -} - -func (o *AddChannelBody) contextValidatePagerdutyConfig(ctx context.Context, formats strfmt.Registry) error { - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *AddChannelBody) contextValidateSlackConfig(ctx context.Context, formats strfmt.Registry) error { - if o.SlackConfig != nil { - if err := o.SlackConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "slack_config") - } - return err - } - } - - return nil -} - -func (o *AddChannelBody) contextValidateWebhookConfig(ctx context.Context, formats strfmt.Registry) error { - if o.WebhookConfig != nil { - if err := o.WebhookConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelBody) UnmarshalBinary(b []byte) error { - var res AddChannelBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelDefaultBody add channel default body -swagger:model AddChannelDefaultBody -*/ -type AddChannelDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*AddChannelDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this add channel default body -func (o *AddChannelDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("AddChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("AddChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this add channel default body based on the context it is used -func (o *AddChannelDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("AddChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("AddChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelDefaultBody) UnmarshalBinary(b []byte) error { - var res AddChannelDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelDefaultBodyDetailsItems0 add channel default body details items0 -swagger:model AddChannelDefaultBodyDetailsItems0 -*/ -type AddChannelDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this add channel default body details items0 -func (o *AddChannelDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel default body details items0 based on context it is used -func (o *AddChannelDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res AddChannelDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelOKBody add channel OK body -swagger:model AddChannelOKBody -*/ -type AddChannelOKBody struct { - // Machine-readable ID. - ChannelID string `json:"channel_id,omitempty"` -} - -// Validate validates this add channel OK body -func (o *AddChannelOKBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel OK body based on context it is used -func (o *AddChannelOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelOKBody) UnmarshalBinary(b []byte) error { - var res AddChannelOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodyEmailConfig EmailConfig represents email configuration. -swagger:model AddChannelParamsBodyEmailConfig -*/ -type AddChannelParamsBodyEmailConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // to - To []string `json:"to"` -} - -// Validate validates this add channel params body email config -func (o *AddChannelParamsBodyEmailConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel params body email config based on context it is used -func (o *AddChannelParamsBodyEmailConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodyEmailConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodyEmailConfig) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodyEmailConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodyPagerdutyConfig PagerDutyConfig represents PagerDuty configuration. -swagger:model AddChannelParamsBodyPagerdutyConfig -*/ -type AddChannelParamsBodyPagerdutyConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - RoutingKey string `json:"routing_key,omitempty"` - - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - ServiceKey string `json:"service_key,omitempty"` -} - -// Validate validates this add channel params body pagerduty config -func (o *AddChannelParamsBodyPagerdutyConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel params body pagerduty config based on context it is used -func (o *AddChannelParamsBodyPagerdutyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodyPagerdutyConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodyPagerdutyConfig) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodyPagerdutyConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodySlackConfig SlackConfig represents Slack configuration. -swagger:model AddChannelParamsBodySlackConfig -*/ -type AddChannelParamsBodySlackConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // channel - Channel string `json:"channel,omitempty"` -} - -// Validate validates this add channel params body slack config -func (o *AddChannelParamsBodySlackConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel params body slack config based on context it is used -func (o *AddChannelParamsBodySlackConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodySlackConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodySlackConfig) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodySlackConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodyWebhookConfig WebhookConfig represents webhook configuration. -swagger:model AddChannelParamsBodyWebhookConfig -*/ -type AddChannelParamsBodyWebhookConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // url - URL string `json:"url,omitempty"` - - // max alerts - MaxAlerts int32 `json:"max_alerts,omitempty"` - - // http config - HTTPConfig *AddChannelParamsBodyWebhookConfigHTTPConfig `json:"http_config,omitempty"` -} - -// Validate validates this add channel params body webhook config -func (o *AddChannelParamsBodyWebhookConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateHTTPConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelParamsBodyWebhookConfig) validateHTTPConfig(formats strfmt.Registry) error { - if swag.IsZero(o.HTTPConfig) { // not required - return nil - } - - if o.HTTPConfig != nil { - if err := o.HTTPConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this add channel params body webhook config based on the context it is used -func (o *AddChannelParamsBodyWebhookConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateHTTPConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelParamsBodyWebhookConfig) contextValidateHTTPConfig(ctx context.Context, formats strfmt.Registry) error { - if o.HTTPConfig != nil { - if err := o.HTTPConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfig) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodyWebhookConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodyWebhookConfigHTTPConfig HTTPConfig represents HTTP client configuration. -swagger:model AddChannelParamsBodyWebhookConfigHTTPConfig -*/ -type AddChannelParamsBodyWebhookConfigHTTPConfig struct { - // bearer token - BearerToken string `json:"bearer_token,omitempty"` - - // bearer token file - BearerTokenFile string `json:"bearer_token_file,omitempty"` - - // proxy url - ProxyURL string `json:"proxy_url,omitempty"` - - // basic auth - BasicAuth *AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth `json:"basic_auth,omitempty"` - - // tls config - TLSConfig *AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig `json:"tls_config,omitempty"` -} - -// Validate validates this add channel params body webhook config HTTP config -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateBasicAuth(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTLSConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) validateBasicAuth(formats strfmt.Registry) error { - if swag.IsZero(o.BasicAuth) { // not required - return nil - } - - if o.BasicAuth != nil { - if err := o.BasicAuth.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) validateTLSConfig(formats strfmt.Registry) error { - if swag.IsZero(o.TLSConfig) { // not required - return nil - } - - if o.TLSConfig != nil { - if err := o.TLSConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this add channel params body webhook config HTTP config based on the context it is used -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBasicAuth(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTLSConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) contextValidateBasicAuth(ctx context.Context, formats strfmt.Registry) error { - if o.BasicAuth != nil { - if err := o.BasicAuth.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) contextValidateTLSConfig(ctx context.Context, formats strfmt.Registry) error { - if o.TLSConfig != nil { - if err := o.TLSConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfigHTTPConfig) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodyWebhookConfigHTTPConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth BasicAuth represents basic HTTP auth configuration. -swagger:model AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth -*/ -type AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth struct { - // username - Username string `json:"username,omitempty"` - - // password - Password string `json:"password,omitempty"` - - // password file - PasswordFile string `json:"password_file,omitempty"` -} - -// Validate validates this add channel params body webhook config HTTP config basic auth -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel params body webhook config HTTP config basic auth based on context it is used -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodyWebhookConfigHTTPConfigBasicAuth - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -swagger:model AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig -*/ -type AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig struct { - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFile string `json:"ca_file,omitempty"` - - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFile string `json:"cert_file,omitempty"` - - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFile string `json:"key_file,omitempty"` - - // Name of the server. - ServerName string `json:"server_name,omitempty"` - - // Disable validation of the server certificate. - InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` - - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFileContent string `json:"ca_file_content,omitempty"` - - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFileContent string `json:"cert_file_content,omitempty"` - - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFileContent string `json:"key_file_content,omitempty"` -} - -// Validate validates this add channel params body webhook config HTTP config TLS config -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this add channel params body webhook config HTTP config TLS config based on context it is used -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) UnmarshalBinary(b []byte) error { - var res AddChannelParamsBodyWebhookConfigHTTPConfigTLSConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/channels/change_channel_parameters.go b/api/managementpb/ia/json/client/channels/change_channel_parameters.go deleted file mode 100644 index 569379c6b6..0000000000 --- a/api/managementpb/ia/json/client/channels/change_channel_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewChangeChannelParams creates a new ChangeChannelParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewChangeChannelParams() *ChangeChannelParams { - return &ChangeChannelParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewChangeChannelParamsWithTimeout creates a new ChangeChannelParams object -// with the ability to set a timeout on a request. -func NewChangeChannelParamsWithTimeout(timeout time.Duration) *ChangeChannelParams { - return &ChangeChannelParams{ - timeout: timeout, - } -} - -// NewChangeChannelParamsWithContext creates a new ChangeChannelParams object -// with the ability to set a context for a request. -func NewChangeChannelParamsWithContext(ctx context.Context) *ChangeChannelParams { - return &ChangeChannelParams{ - Context: ctx, - } -} - -// NewChangeChannelParamsWithHTTPClient creates a new ChangeChannelParams object -// with the ability to set a custom HTTPClient for a request. -func NewChangeChannelParamsWithHTTPClient(client *http.Client) *ChangeChannelParams { - return &ChangeChannelParams{ - HTTPClient: client, - } -} - -/* -ChangeChannelParams contains all the parameters to send to the API endpoint - - for the change channel operation. - - Typically these are written to a http.Request. -*/ -type ChangeChannelParams struct { - // Body. - Body ChangeChannelBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the change channel params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ChangeChannelParams) WithDefaults() *ChangeChannelParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the change channel params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ChangeChannelParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the change channel params -func (o *ChangeChannelParams) WithTimeout(timeout time.Duration) *ChangeChannelParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the change channel params -func (o *ChangeChannelParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the change channel params -func (o *ChangeChannelParams) WithContext(ctx context.Context) *ChangeChannelParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the change channel params -func (o *ChangeChannelParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the change channel params -func (o *ChangeChannelParams) WithHTTPClient(client *http.Client) *ChangeChannelParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the change channel params -func (o *ChangeChannelParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the change channel params -func (o *ChangeChannelParams) WithBody(body ChangeChannelBody) *ChangeChannelParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the change channel params -func (o *ChangeChannelParams) SetBody(body ChangeChannelBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *ChangeChannelParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/channels/change_channel_responses.go b/api/managementpb/ia/json/client/channels/change_channel_responses.go deleted file mode 100644 index d4fb8eea19..0000000000 --- a/api/managementpb/ia/json/client/channels/change_channel_responses.go +++ /dev/null @@ -1,963 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ChangeChannelReader is a Reader for the ChangeChannel structure. -type ChangeChannelReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ChangeChannelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewChangeChannelOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewChangeChannelDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewChangeChannelOK creates a ChangeChannelOK with default headers values -func NewChangeChannelOK() *ChangeChannelOK { - return &ChangeChannelOK{} -} - -/* -ChangeChannelOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ChangeChannelOK struct { - Payload interface{} -} - -func (o *ChangeChannelOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/Change][%d] changeChannelOk %+v", 200, o.Payload) -} - -func (o *ChangeChannelOK) GetPayload() interface{} { - return o.Payload -} - -func (o *ChangeChannelOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewChangeChannelDefault creates a ChangeChannelDefault with default headers values -func NewChangeChannelDefault(code int) *ChangeChannelDefault { - return &ChangeChannelDefault{ - _statusCode: code, - } -} - -/* -ChangeChannelDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ChangeChannelDefault struct { - _statusCode int - - Payload *ChangeChannelDefaultBody -} - -// Code gets the status code for the change channel default response -func (o *ChangeChannelDefault) Code() int { - return o._statusCode -} - -func (o *ChangeChannelDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/Change][%d] ChangeChannel default %+v", o._statusCode, o.Payload) -} - -func (o *ChangeChannelDefault) GetPayload() *ChangeChannelDefaultBody { - return o.Payload -} - -func (o *ChangeChannelDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ChangeChannelDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -ChangeChannelBody change channel body -swagger:model ChangeChannelBody -*/ -type ChangeChannelBody struct { - // Machine-readable ID. - ChannelID string `json:"channel_id,omitempty"` - - // Short human-readable summary. Empty value will not change it. - Summary string `json:"summary,omitempty"` - - // Enables or disables that channel. Should be set. - Disabled bool `json:"disabled,omitempty"` - - // email config - EmailConfig *ChangeChannelParamsBodyEmailConfig `json:"email_config,omitempty"` - - // pagerduty config - PagerdutyConfig *ChangeChannelParamsBodyPagerdutyConfig `json:"pagerduty_config,omitempty"` - - // slack config - SlackConfig *ChangeChannelParamsBodySlackConfig `json:"slack_config,omitempty"` - - // webhook config - WebhookConfig *ChangeChannelParamsBodyWebhookConfig `json:"webhook_config,omitempty"` -} - -// Validate validates this change channel body -func (o *ChangeChannelBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateEmailConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validatePagerdutyConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSlackConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateWebhookConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelBody) validateEmailConfig(formats strfmt.Registry) error { - if swag.IsZero(o.EmailConfig) { // not required - return nil - } - - if o.EmailConfig != nil { - if err := o.EmailConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_config") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelBody) validatePagerdutyConfig(formats strfmt.Registry) error { - if swag.IsZero(o.PagerdutyConfig) { // not required - return nil - } - - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelBody) validateSlackConfig(formats strfmt.Registry) error { - if swag.IsZero(o.SlackConfig) { // not required - return nil - } - - if o.SlackConfig != nil { - if err := o.SlackConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "slack_config") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelBody) validateWebhookConfig(formats strfmt.Registry) error { - if swag.IsZero(o.WebhookConfig) { // not required - return nil - } - - if o.WebhookConfig != nil { - if err := o.WebhookConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this change channel body based on the context it is used -func (o *ChangeChannelBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateEmailConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidatePagerdutyConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateSlackConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateWebhookConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelBody) contextValidateEmailConfig(ctx context.Context, formats strfmt.Registry) error { - if o.EmailConfig != nil { - if err := o.EmailConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_config") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelBody) contextValidatePagerdutyConfig(ctx context.Context, formats strfmt.Registry) error { - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelBody) contextValidateSlackConfig(ctx context.Context, formats strfmt.Registry) error { - if o.SlackConfig != nil { - if err := o.SlackConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "slack_config") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelBody) contextValidateWebhookConfig(ctx context.Context, formats strfmt.Registry) error { - if o.WebhookConfig != nil { - if err := o.WebhookConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelBody) UnmarshalBinary(b []byte) error { - var res ChangeChannelBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelDefaultBody change channel default body -swagger:model ChangeChannelDefaultBody -*/ -type ChangeChannelDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*ChangeChannelDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this change channel default body -func (o *ChangeChannelDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ChangeChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ChangeChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this change channel default body based on the context it is used -func (o *ChangeChannelDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ChangeChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ChangeChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelDefaultBody) UnmarshalBinary(b []byte) error { - var res ChangeChannelDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelDefaultBodyDetailsItems0 change channel default body details items0 -swagger:model ChangeChannelDefaultBodyDetailsItems0 -*/ -type ChangeChannelDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this change channel default body details items0 -func (o *ChangeChannelDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change channel default body details items0 based on context it is used -func (o *ChangeChannelDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res ChangeChannelDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodyEmailConfig EmailConfig represents email configuration. -swagger:model ChangeChannelParamsBodyEmailConfig -*/ -type ChangeChannelParamsBodyEmailConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // to - To []string `json:"to"` -} - -// Validate validates this change channel params body email config -func (o *ChangeChannelParamsBodyEmailConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change channel params body email config based on context it is used -func (o *ChangeChannelParamsBodyEmailConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodyEmailConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodyEmailConfig) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodyEmailConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodyPagerdutyConfig PagerDutyConfig represents PagerDuty configuration. -swagger:model ChangeChannelParamsBodyPagerdutyConfig -*/ -type ChangeChannelParamsBodyPagerdutyConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - RoutingKey string `json:"routing_key,omitempty"` - - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - ServiceKey string `json:"service_key,omitempty"` -} - -// Validate validates this change channel params body pagerduty config -func (o *ChangeChannelParamsBodyPagerdutyConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change channel params body pagerduty config based on context it is used -func (o *ChangeChannelParamsBodyPagerdutyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodyPagerdutyConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodyPagerdutyConfig) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodyPagerdutyConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodySlackConfig SlackConfig represents Slack configuration. -swagger:model ChangeChannelParamsBodySlackConfig -*/ -type ChangeChannelParamsBodySlackConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // channel - Channel string `json:"channel,omitempty"` -} - -// Validate validates this change channel params body slack config -func (o *ChangeChannelParamsBodySlackConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change channel params body slack config based on context it is used -func (o *ChangeChannelParamsBodySlackConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodySlackConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodySlackConfig) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodySlackConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodyWebhookConfig WebhookConfig represents webhook configuration. -swagger:model ChangeChannelParamsBodyWebhookConfig -*/ -type ChangeChannelParamsBodyWebhookConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // url - URL string `json:"url,omitempty"` - - // max alerts - MaxAlerts int32 `json:"max_alerts,omitempty"` - - // http config - HTTPConfig *ChangeChannelParamsBodyWebhookConfigHTTPConfig `json:"http_config,omitempty"` -} - -// Validate validates this change channel params body webhook config -func (o *ChangeChannelParamsBodyWebhookConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateHTTPConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelParamsBodyWebhookConfig) validateHTTPConfig(formats strfmt.Registry) error { - if swag.IsZero(o.HTTPConfig) { // not required - return nil - } - - if o.HTTPConfig != nil { - if err := o.HTTPConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this change channel params body webhook config based on the context it is used -func (o *ChangeChannelParamsBodyWebhookConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateHTTPConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelParamsBodyWebhookConfig) contextValidateHTTPConfig(ctx context.Context, formats strfmt.Registry) error { - if o.HTTPConfig != nil { - if err := o.HTTPConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfig) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodyWebhookConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodyWebhookConfigHTTPConfig HTTPConfig represents HTTP client configuration. -swagger:model ChangeChannelParamsBodyWebhookConfigHTTPConfig -*/ -type ChangeChannelParamsBodyWebhookConfigHTTPConfig struct { - // bearer token - BearerToken string `json:"bearer_token,omitempty"` - - // bearer token file - BearerTokenFile string `json:"bearer_token_file,omitempty"` - - // proxy url - ProxyURL string `json:"proxy_url,omitempty"` - - // basic auth - BasicAuth *ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth `json:"basic_auth,omitempty"` - - // tls config - TLSConfig *ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig `json:"tls_config,omitempty"` -} - -// Validate validates this change channel params body webhook config HTTP config -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateBasicAuth(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTLSConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) validateBasicAuth(formats strfmt.Registry) error { - if swag.IsZero(o.BasicAuth) { // not required - return nil - } - - if o.BasicAuth != nil { - if err := o.BasicAuth.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) validateTLSConfig(formats strfmt.Registry) error { - if swag.IsZero(o.TLSConfig) { // not required - return nil - } - - if o.TLSConfig != nil { - if err := o.TLSConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this change channel params body webhook config HTTP config based on the context it is used -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBasicAuth(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTLSConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) contextValidateBasicAuth(ctx context.Context, formats strfmt.Registry) error { - if o.BasicAuth != nil { - if err := o.BasicAuth.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) contextValidateTLSConfig(ctx context.Context, formats strfmt.Registry) error { - if o.TLSConfig != nil { - if err := o.TLSConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfig) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodyWebhookConfigHTTPConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth BasicAuth represents basic HTTP auth configuration. -swagger:model ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth -*/ -type ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth struct { - // username - Username string `json:"username,omitempty"` - - // password - Password string `json:"password,omitempty"` - - // password file - PasswordFile string `json:"password_file,omitempty"` -} - -// Validate validates this change channel params body webhook config HTTP config basic auth -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change channel params body webhook config HTTP config basic auth based on context it is used -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodyWebhookConfigHTTPConfigBasicAuth - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -swagger:model ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig -*/ -type ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig struct { - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFile string `json:"ca_file,omitempty"` - - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFile string `json:"cert_file,omitempty"` - - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFile string `json:"key_file,omitempty"` - - // Name of the server. - ServerName string `json:"server_name,omitempty"` - - // Disable validation of the server certificate. - InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` - - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFileContent string `json:"ca_file_content,omitempty"` - - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFileContent string `json:"cert_file_content,omitempty"` - - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFileContent string `json:"key_file_content,omitempty"` -} - -// Validate validates this change channel params body webhook config HTTP config TLS config -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change channel params body webhook config HTTP config TLS config based on context it is used -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig) UnmarshalBinary(b []byte) error { - var res ChangeChannelParamsBodyWebhookConfigHTTPConfigTLSConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/channels/channels_client.go b/api/managementpb/ia/json/client/channels/channels_client.go deleted file mode 100644 index 801236e6ab..0000000000 --- a/api/managementpb/ia/json/client/channels/channels_client.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new channels API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for channels API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - AddChannel(params *AddChannelParams, opts ...ClientOption) (*AddChannelOK, error) - - ChangeChannel(params *ChangeChannelParams, opts ...ClientOption) (*ChangeChannelOK, error) - - ListChannels(params *ListChannelsParams, opts ...ClientOption) (*ListChannelsOK, error) - - RemoveChannel(params *RemoveChannelParams, opts ...ClientOption) (*RemoveChannelOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -AddChannel adds channel adds notification channel -*/ -func (a *Client) AddChannel(params *AddChannelParams, opts ...ClientOption) (*AddChannelOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewAddChannelParams() - } - op := &runtime.ClientOperation{ - ID: "AddChannel", - Method: "POST", - PathPattern: "/v1/management/ia/Channels/Add", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &AddChannelReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*AddChannelOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*AddChannelDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -ChangeChannel changes channel changes notification channel -*/ -func (a *Client) ChangeChannel(params *ChangeChannelParams, opts ...ClientOption) (*ChangeChannelOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewChangeChannelParams() - } - op := &runtime.ClientOperation{ - ID: "ChangeChannel", - Method: "POST", - PathPattern: "/v1/management/ia/Channels/Change", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &ChangeChannelReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ChangeChannelOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ChangeChannelDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -ListChannels lists channels returns a list of all notifation channels -*/ -func (a *Client) ListChannels(params *ListChannelsParams, opts ...ClientOption) (*ListChannelsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewListChannelsParams() - } - op := &runtime.ClientOperation{ - ID: "ListChannels", - Method: "POST", - PathPattern: "/v1/management/ia/Channels/List", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &ListChannelsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ListChannelsOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ListChannelsDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -RemoveChannel removes channel removes notification channel -*/ -func (a *Client) RemoveChannel(params *RemoveChannelParams, opts ...ClientOption) (*RemoveChannelOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewRemoveChannelParams() - } - op := &runtime.ClientOperation{ - ID: "RemoveChannel", - Method: "POST", - PathPattern: "/v1/management/ia/Channels/Remove", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &RemoveChannelReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*RemoveChannelOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*RemoveChannelDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/api/managementpb/ia/json/client/channels/list_channels_parameters.go b/api/managementpb/ia/json/client/channels/list_channels_parameters.go deleted file mode 100644 index 4f6948c977..0000000000 --- a/api/managementpb/ia/json/client/channels/list_channels_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewListChannelsParams creates a new ListChannelsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewListChannelsParams() *ListChannelsParams { - return &ListChannelsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewListChannelsParamsWithTimeout creates a new ListChannelsParams object -// with the ability to set a timeout on a request. -func NewListChannelsParamsWithTimeout(timeout time.Duration) *ListChannelsParams { - return &ListChannelsParams{ - timeout: timeout, - } -} - -// NewListChannelsParamsWithContext creates a new ListChannelsParams object -// with the ability to set a context for a request. -func NewListChannelsParamsWithContext(ctx context.Context) *ListChannelsParams { - return &ListChannelsParams{ - Context: ctx, - } -} - -// NewListChannelsParamsWithHTTPClient creates a new ListChannelsParams object -// with the ability to set a custom HTTPClient for a request. -func NewListChannelsParamsWithHTTPClient(client *http.Client) *ListChannelsParams { - return &ListChannelsParams{ - HTTPClient: client, - } -} - -/* -ListChannelsParams contains all the parameters to send to the API endpoint - - for the list channels operation. - - Typically these are written to a http.Request. -*/ -type ListChannelsParams struct { - // Body. - Body ListChannelsBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the list channels params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListChannelsParams) WithDefaults() *ListChannelsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the list channels params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListChannelsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the list channels params -func (o *ListChannelsParams) WithTimeout(timeout time.Duration) *ListChannelsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the list channels params -func (o *ListChannelsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the list channels params -func (o *ListChannelsParams) WithContext(ctx context.Context) *ListChannelsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the list channels params -func (o *ListChannelsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the list channels params -func (o *ListChannelsParams) WithHTTPClient(client *http.Client) *ListChannelsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the list channels params -func (o *ListChannelsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the list channels params -func (o *ListChannelsParams) WithBody(body ListChannelsBody) *ListChannelsParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the list channels params -func (o *ListChannelsParams) SetBody(body ListChannelsBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *ListChannelsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/channels/list_channels_responses.go b/api/managementpb/ia/json/client/channels/list_channels_responses.go deleted file mode 100644 index ec672a76db..0000000000 --- a/api/managementpb/ia/json/client/channels/list_channels_responses.go +++ /dev/null @@ -1,1277 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ListChannelsReader is a Reader for the ListChannels structure. -type ListChannelsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ListChannelsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewListChannelsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewListChannelsDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewListChannelsOK creates a ListChannelsOK with default headers values -func NewListChannelsOK() *ListChannelsOK { - return &ListChannelsOK{} -} - -/* -ListChannelsOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ListChannelsOK struct { - Payload *ListChannelsOKBody -} - -func (o *ListChannelsOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/List][%d] listChannelsOk %+v", 200, o.Payload) -} - -func (o *ListChannelsOK) GetPayload() *ListChannelsOKBody { - return o.Payload -} - -func (o *ListChannelsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ListChannelsOKBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewListChannelsDefault creates a ListChannelsDefault with default headers values -func NewListChannelsDefault(code int) *ListChannelsDefault { - return &ListChannelsDefault{ - _statusCode: code, - } -} - -/* -ListChannelsDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ListChannelsDefault struct { - _statusCode int - - Payload *ListChannelsDefaultBody -} - -// Code gets the status code for the list channels default response -func (o *ListChannelsDefault) Code() int { - return o._statusCode -} - -func (o *ListChannelsDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/List][%d] ListChannels default %+v", o._statusCode, o.Payload) -} - -func (o *ListChannelsDefault) GetPayload() *ListChannelsDefaultBody { - return o.Payload -} - -func (o *ListChannelsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ListChannelsDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -ListChannelsBody list channels body -swagger:model ListChannelsBody -*/ -type ListChannelsBody struct { - // page params - PageParams *ListChannelsParamsBodyPageParams `json:"page_params,omitempty"` -} - -// Validate validates this list channels body -func (o *ListChannelsBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validatePageParams(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsBody) validatePageParams(formats strfmt.Registry) error { - if swag.IsZero(o.PageParams) { // not required - return nil - } - - if o.PageParams != nil { - if err := o.PageParams.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "page_params") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "page_params") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list channels body based on the context it is used -func (o *ListChannelsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidatePageParams(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsBody) contextValidatePageParams(ctx context.Context, formats strfmt.Registry) error { - if o.PageParams != nil { - if err := o.PageParams.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "page_params") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "page_params") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsBody) UnmarshalBinary(b []byte) error { - var res ListChannelsBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsDefaultBody list channels default body -swagger:model ListChannelsDefaultBody -*/ -type ListChannelsDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*ListChannelsDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this list channels default body -func (o *ListChannelsDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ListChannels default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ListChannels default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this list channels default body based on the context it is used -func (o *ListChannelsDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ListChannels default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ListChannels default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsDefaultBody) UnmarshalBinary(b []byte) error { - var res ListChannelsDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsDefaultBodyDetailsItems0 list channels default body details items0 -swagger:model ListChannelsDefaultBodyDetailsItems0 -*/ -type ListChannelsDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this list channels default body details items0 -func (o *ListChannelsDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels default body details items0 based on context it is used -func (o *ListChannelsDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res ListChannelsDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBody list channels OK body -swagger:model ListChannelsOKBody -*/ -type ListChannelsOKBody struct { - // channels - Channels []*ListChannelsOKBodyChannelsItems0 `json:"channels"` - - // totals - Totals *ListChannelsOKBodyTotals `json:"totals,omitempty"` -} - -// Validate validates this list channels OK body -func (o *ListChannelsOKBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateChannels(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTotals(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBody) validateChannels(formats strfmt.Registry) error { - if swag.IsZero(o.Channels) { // not required - return nil - } - - for i := 0; i < len(o.Channels); i++ { - if swag.IsZero(o.Channels[i]) { // not required - continue - } - - if o.Channels[i] != nil { - if err := o.Channels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listChannelsOk" + "." + "channels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listChannelsOk" + "." + "channels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListChannelsOKBody) validateTotals(formats strfmt.Registry) error { - if swag.IsZero(o.Totals) { // not required - return nil - } - - if o.Totals != nil { - if err := o.Totals.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listChannelsOk" + "." + "totals") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listChannelsOk" + "." + "totals") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list channels OK body based on the context it is used -func (o *ListChannelsOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateChannels(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTotals(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBody) contextValidateChannels(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Channels); i++ { - if o.Channels[i] != nil { - if err := o.Channels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listChannelsOk" + "." + "channels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listChannelsOk" + "." + "channels" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListChannelsOKBody) contextValidateTotals(ctx context.Context, formats strfmt.Registry) error { - if o.Totals != nil { - if err := o.Totals.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listChannelsOk" + "." + "totals") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listChannelsOk" + "." + "totals") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBody) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0 Channel represents a single Notification Channel. -swagger:model ListChannelsOKBodyChannelsItems0 -*/ -type ListChannelsOKBodyChannelsItems0 struct { - // Machine-readable ID. - ChannelID string `json:"channel_id,omitempty"` - - // Short human-readable summary. - Summary string `json:"summary,omitempty"` - - // True if that channel is disabled. - Disabled bool `json:"disabled,omitempty"` - - // email config - EmailConfig *ListChannelsOKBodyChannelsItems0EmailConfig `json:"email_config,omitempty"` - - // pagerduty config - PagerdutyConfig *ListChannelsOKBodyChannelsItems0PagerdutyConfig `json:"pagerduty_config,omitempty"` - - // slack config - SlackConfig *ListChannelsOKBodyChannelsItems0SlackConfig `json:"slack_config,omitempty"` - - // webhook config - WebhookConfig *ListChannelsOKBodyChannelsItems0WebhookConfig `json:"webhook_config,omitempty"` -} - -// Validate validates this list channels OK body channels items0 -func (o *ListChannelsOKBodyChannelsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateEmailConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validatePagerdutyConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSlackConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateWebhookConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) validateEmailConfig(formats strfmt.Registry) error { - if swag.IsZero(o.EmailConfig) { // not required - return nil - } - - if o.EmailConfig != nil { - if err := o.EmailConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("email_config") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) validatePagerdutyConfig(formats strfmt.Registry) error { - if swag.IsZero(o.PagerdutyConfig) { // not required - return nil - } - - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) validateSlackConfig(formats strfmt.Registry) error { - if swag.IsZero(o.SlackConfig) { // not required - return nil - } - - if o.SlackConfig != nil { - if err := o.SlackConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("slack_config") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) validateWebhookConfig(formats strfmt.Registry) error { - if swag.IsZero(o.WebhookConfig) { // not required - return nil - } - - if o.WebhookConfig != nil { - if err := o.WebhookConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list channels OK body channels items0 based on the context it is used -func (o *ListChannelsOKBodyChannelsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateEmailConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidatePagerdutyConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateSlackConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateWebhookConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) contextValidateEmailConfig(ctx context.Context, formats strfmt.Registry) error { - if o.EmailConfig != nil { - if err := o.EmailConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("email_config") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) contextValidatePagerdutyConfig(ctx context.Context, formats strfmt.Registry) error { - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) contextValidateSlackConfig(ctx context.Context, formats strfmt.Registry) error { - if o.SlackConfig != nil { - if err := o.SlackConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("slack_config") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0) contextValidateWebhookConfig(ctx context.Context, formats strfmt.Registry) error { - if o.WebhookConfig != nil { - if err := o.WebhookConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0EmailConfig EmailConfig represents email configuration. -swagger:model ListChannelsOKBodyChannelsItems0EmailConfig -*/ -type ListChannelsOKBodyChannelsItems0EmailConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // to - To []string `json:"to"` -} - -// Validate validates this list channels OK body channels items0 email config -func (o *ListChannelsOKBodyChannelsItems0EmailConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels OK body channels items0 email config based on context it is used -func (o *ListChannelsOKBodyChannelsItems0EmailConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0EmailConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0EmailConfig) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0EmailConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0PagerdutyConfig PagerDutyConfig represents PagerDuty configuration. -swagger:model ListChannelsOKBodyChannelsItems0PagerdutyConfig -*/ -type ListChannelsOKBodyChannelsItems0PagerdutyConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - RoutingKey string `json:"routing_key,omitempty"` - - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - ServiceKey string `json:"service_key,omitempty"` -} - -// Validate validates this list channels OK body channels items0 pagerduty config -func (o *ListChannelsOKBodyChannelsItems0PagerdutyConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels OK body channels items0 pagerduty config based on context it is used -func (o *ListChannelsOKBodyChannelsItems0PagerdutyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0PagerdutyConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0PagerdutyConfig) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0PagerdutyConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0SlackConfig SlackConfig represents Slack configuration. -swagger:model ListChannelsOKBodyChannelsItems0SlackConfig -*/ -type ListChannelsOKBodyChannelsItems0SlackConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // channel - Channel string `json:"channel,omitempty"` -} - -// Validate validates this list channels OK body channels items0 slack config -func (o *ListChannelsOKBodyChannelsItems0SlackConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels OK body channels items0 slack config based on context it is used -func (o *ListChannelsOKBodyChannelsItems0SlackConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0SlackConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0SlackConfig) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0SlackConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0WebhookConfig WebhookConfig represents webhook configuration. -swagger:model ListChannelsOKBodyChannelsItems0WebhookConfig -*/ -type ListChannelsOKBodyChannelsItems0WebhookConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // url - URL string `json:"url,omitempty"` - - // max alerts - MaxAlerts int32 `json:"max_alerts,omitempty"` - - // http config - HTTPConfig *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig `json:"http_config,omitempty"` -} - -// Validate validates this list channels OK body channels items0 webhook config -func (o *ListChannelsOKBodyChannelsItems0WebhookConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateHTTPConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0WebhookConfig) validateHTTPConfig(formats strfmt.Registry) error { - if swag.IsZero(o.HTTPConfig) { // not required - return nil - } - - if o.HTTPConfig != nil { - if err := o.HTTPConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list channels OK body channels items0 webhook config based on the context it is used -func (o *ListChannelsOKBodyChannelsItems0WebhookConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateHTTPConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0WebhookConfig) contextValidateHTTPConfig(ctx context.Context, formats strfmt.Registry) error { - if o.HTTPConfig != nil { - if err := o.HTTPConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfig) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0WebhookConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig HTTPConfig represents HTTP client configuration. -swagger:model ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig -*/ -type ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig struct { - // bearer token - BearerToken string `json:"bearer_token,omitempty"` - - // bearer token file - BearerTokenFile string `json:"bearer_token_file,omitempty"` - - // proxy url - ProxyURL string `json:"proxy_url,omitempty"` - - // basic auth - BasicAuth *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth `json:"basic_auth,omitempty"` - - // tls config - TLSConfig *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig `json:"tls_config,omitempty"` -} - -// Validate validates this list channels OK body channels items0 webhook config HTTP config -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateBasicAuth(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTLSConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) validateBasicAuth(formats strfmt.Registry) error { - if swag.IsZero(o.BasicAuth) { // not required - return nil - } - - if o.BasicAuth != nil { - if err := o.BasicAuth.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) validateTLSConfig(formats strfmt.Registry) error { - if swag.IsZero(o.TLSConfig) { // not required - return nil - } - - if o.TLSConfig != nil { - if err := o.TLSConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list channels OK body channels items0 webhook config HTTP config based on the context it is used -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBasicAuth(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTLSConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) contextValidateBasicAuth(ctx context.Context, formats strfmt.Registry) error { - if o.BasicAuth != nil { - if err := o.BasicAuth.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) contextValidateTLSConfig(ctx context.Context, formats strfmt.Registry) error { - if o.TLSConfig != nil { - if err := o.TLSConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth BasicAuth represents basic HTTP auth configuration. -swagger:model ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth -*/ -type ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth struct { - // username - Username string `json:"username,omitempty"` - - // password - Password string `json:"password,omitempty"` - - // password file - PasswordFile string `json:"password_file,omitempty"` -} - -// Validate validates this list channels OK body channels items0 webhook config HTTP config basic auth -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels OK body channels items0 webhook config HTTP config basic auth based on context it is used -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigBasicAuth - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -swagger:model ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig -*/ -type ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig struct { - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFile string `json:"ca_file,omitempty"` - - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFile string `json:"cert_file,omitempty"` - - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFile string `json:"key_file,omitempty"` - - // Name of the server. - ServerName string `json:"server_name,omitempty"` - - // Disable validation of the server certificate. - InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` - - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFileContent string `json:"ca_file_content,omitempty"` - - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFileContent string `json:"cert_file_content,omitempty"` - - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFileContent string `json:"key_file_content,omitempty"` -} - -// Validate validates this list channels OK body channels items0 webhook config HTTP config TLS config -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels OK body channels items0 webhook config HTTP config TLS config based on context it is used -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyChannelsItems0WebhookConfigHTTPConfigTLSConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsOKBodyTotals PageTotals represents total values for pagination. -swagger:model ListChannelsOKBodyTotals -*/ -type ListChannelsOKBodyTotals struct { - // Total number of results. - TotalItems int32 `json:"total_items,omitempty"` - - // Total number of pages. - TotalPages int32 `json:"total_pages,omitempty"` -} - -// Validate validates this list channels OK body totals -func (o *ListChannelsOKBodyTotals) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels OK body totals based on context it is used -func (o *ListChannelsOKBodyTotals) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsOKBodyTotals) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsOKBodyTotals) UnmarshalBinary(b []byte) error { - var res ListChannelsOKBodyTotals - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListChannelsParamsBodyPageParams PageParams represents page request parameters for pagination. -swagger:model ListChannelsParamsBodyPageParams -*/ -type ListChannelsParamsBodyPageParams struct { - // Maximum number of results per page. - PageSize int32 `json:"page_size,omitempty"` - - // Index of the requested page, starts from 0. - Index int32 `json:"index,omitempty"` -} - -// Validate validates this list channels params body page params -func (o *ListChannelsParamsBodyPageParams) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list channels params body page params based on context it is used -func (o *ListChannelsParamsBodyPageParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListChannelsParamsBodyPageParams) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListChannelsParamsBodyPageParams) UnmarshalBinary(b []byte) error { - var res ListChannelsParamsBodyPageParams - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/channels/remove_channel_parameters.go b/api/managementpb/ia/json/client/channels/remove_channel_parameters.go deleted file mode 100644 index bc094beef7..0000000000 --- a/api/managementpb/ia/json/client/channels/remove_channel_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewRemoveChannelParams creates a new RemoveChannelParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewRemoveChannelParams() *RemoveChannelParams { - return &RemoveChannelParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewRemoveChannelParamsWithTimeout creates a new RemoveChannelParams object -// with the ability to set a timeout on a request. -func NewRemoveChannelParamsWithTimeout(timeout time.Duration) *RemoveChannelParams { - return &RemoveChannelParams{ - timeout: timeout, - } -} - -// NewRemoveChannelParamsWithContext creates a new RemoveChannelParams object -// with the ability to set a context for a request. -func NewRemoveChannelParamsWithContext(ctx context.Context) *RemoveChannelParams { - return &RemoveChannelParams{ - Context: ctx, - } -} - -// NewRemoveChannelParamsWithHTTPClient creates a new RemoveChannelParams object -// with the ability to set a custom HTTPClient for a request. -func NewRemoveChannelParamsWithHTTPClient(client *http.Client) *RemoveChannelParams { - return &RemoveChannelParams{ - HTTPClient: client, - } -} - -/* -RemoveChannelParams contains all the parameters to send to the API endpoint - - for the remove channel operation. - - Typically these are written to a http.Request. -*/ -type RemoveChannelParams struct { - // Body. - Body RemoveChannelBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the remove channel params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *RemoveChannelParams) WithDefaults() *RemoveChannelParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the remove channel params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *RemoveChannelParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the remove channel params -func (o *RemoveChannelParams) WithTimeout(timeout time.Duration) *RemoveChannelParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the remove channel params -func (o *RemoveChannelParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the remove channel params -func (o *RemoveChannelParams) WithContext(ctx context.Context) *RemoveChannelParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the remove channel params -func (o *RemoveChannelParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the remove channel params -func (o *RemoveChannelParams) WithHTTPClient(client *http.Client) *RemoveChannelParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the remove channel params -func (o *RemoveChannelParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the remove channel params -func (o *RemoveChannelParams) WithBody(body RemoveChannelBody) *RemoveChannelParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the remove channel params -func (o *RemoveChannelParams) SetBody(body RemoveChannelBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *RemoveChannelParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/channels/remove_channel_responses.go b/api/managementpb/ia/json/client/channels/remove_channel_responses.go deleted file mode 100644 index eb6aa49b30..0000000000 --- a/api/managementpb/ia/json/client/channels/remove_channel_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package channels - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// RemoveChannelReader is a Reader for the RemoveChannel structure. -type RemoveChannelReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *RemoveChannelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewRemoveChannelOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewRemoveChannelDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewRemoveChannelOK creates a RemoveChannelOK with default headers values -func NewRemoveChannelOK() *RemoveChannelOK { - return &RemoveChannelOK{} -} - -/* -RemoveChannelOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type RemoveChannelOK struct { - Payload interface{} -} - -func (o *RemoveChannelOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/Remove][%d] removeChannelOk %+v", 200, o.Payload) -} - -func (o *RemoveChannelOK) GetPayload() interface{} { - return o.Payload -} - -func (o *RemoveChannelOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewRemoveChannelDefault creates a RemoveChannelDefault with default headers values -func NewRemoveChannelDefault(code int) *RemoveChannelDefault { - return &RemoveChannelDefault{ - _statusCode: code, - } -} - -/* -RemoveChannelDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type RemoveChannelDefault struct { - _statusCode int - - Payload *RemoveChannelDefaultBody -} - -// Code gets the status code for the remove channel default response -func (o *RemoveChannelDefault) Code() int { - return o._statusCode -} - -func (o *RemoveChannelDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Channels/Remove][%d] RemoveChannel default %+v", o._statusCode, o.Payload) -} - -func (o *RemoveChannelDefault) GetPayload() *RemoveChannelDefaultBody { - return o.Payload -} - -func (o *RemoveChannelDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(RemoveChannelDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -RemoveChannelBody remove channel body -swagger:model RemoveChannelBody -*/ -type RemoveChannelBody struct { - // channel id - ChannelID string `json:"channel_id,omitempty"` -} - -// Validate validates this remove channel body -func (o *RemoveChannelBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this remove channel body based on context it is used -func (o *RemoveChannelBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *RemoveChannelBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *RemoveChannelBody) UnmarshalBinary(b []byte) error { - var res RemoveChannelBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -RemoveChannelDefaultBody remove channel default body -swagger:model RemoveChannelDefaultBody -*/ -type RemoveChannelDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*RemoveChannelDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this remove channel default body -func (o *RemoveChannelDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveChannelDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("RemoveChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("RemoveChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this remove channel default body based on the context it is used -func (o *RemoveChannelDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveChannelDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("RemoveChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("RemoveChannel default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *RemoveChannelDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *RemoveChannelDefaultBody) UnmarshalBinary(b []byte) error { - var res RemoveChannelDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -RemoveChannelDefaultBodyDetailsItems0 remove channel default body details items0 -swagger:model RemoveChannelDefaultBodyDetailsItems0 -*/ -type RemoveChannelDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this remove channel default body details items0 -func (o *RemoveChannelDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this remove channel default body details items0 based on context it is used -func (o *RemoveChannelDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *RemoveChannelDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *RemoveChannelDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res RemoveChannelDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/pmm_integrated_alerting_api_client.go b/api/managementpb/ia/json/client/pmm_integrated_alerting_api_client.go deleted file mode 100644 index f892460af9..0000000000 --- a/api/managementpb/ia/json/client/pmm_integrated_alerting_api_client.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package client - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - httptransport "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/percona/pmm/api/managementpb/ia/json/client/alerts" - "github.com/percona/pmm/api/managementpb/ia/json/client/channels" - "github.com/percona/pmm/api/managementpb/ia/json/client/rules" -) - -// Default PMM integrated alerting API HTTP client. -var Default = NewHTTPClient(nil) - -const ( - // DefaultHost is the default Host - // found in Meta (info) section of spec file - DefaultHost string = "localhost" - // DefaultBasePath is the default BasePath - // found in Meta (info) section of spec file - DefaultBasePath string = "/" -) - -// DefaultSchemes are the default schemes found in Meta (info) section of spec file -var DefaultSchemes = []string{"http", "https"} - -// NewHTTPClient creates a new PMM integrated alerting API HTTP client. -func NewHTTPClient(formats strfmt.Registry) *PMMIntegratedAlertingAPI { - return NewHTTPClientWithConfig(formats, nil) -} - -// NewHTTPClientWithConfig creates a new PMM integrated alerting API HTTP client, -// using a customizable transport config. -func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *PMMIntegratedAlertingAPI { - // ensure nullable parameters have default - if cfg == nil { - cfg = DefaultTransportConfig() - } - - // create transport and client - transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) - return New(transport, formats) -} - -// New creates a new PMM integrated alerting API client -func New(transport runtime.ClientTransport, formats strfmt.Registry) *PMMIntegratedAlertingAPI { - // ensure nullable parameters have default - if formats == nil { - formats = strfmt.Default - } - - cli := new(PMMIntegratedAlertingAPI) - cli.Transport = transport - cli.Alerts = alerts.New(transport, formats) - cli.Channels = channels.New(transport, formats) - cli.Rules = rules.New(transport, formats) - return cli -} - -// DefaultTransportConfig creates a TransportConfig with the -// default settings taken from the meta section of the spec file. -func DefaultTransportConfig() *TransportConfig { - return &TransportConfig{ - Host: DefaultHost, - BasePath: DefaultBasePath, - Schemes: DefaultSchemes, - } -} - -// TransportConfig contains the transport related info, -// found in the meta section of the spec file. -type TransportConfig struct { - Host string - BasePath string - Schemes []string -} - -// WithHost overrides the default host, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithHost(host string) *TransportConfig { - cfg.Host = host - return cfg -} - -// WithBasePath overrides the default basePath, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { - cfg.BasePath = basePath - return cfg -} - -// WithSchemes overrides the default schemes, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { - cfg.Schemes = schemes - return cfg -} - -// PMMIntegratedAlertingAPI is a client for PMM integrated alerting API -type PMMIntegratedAlertingAPI struct { - Alerts alerts.ClientService - - Channels channels.ClientService - - Rules rules.ClientService - - Transport runtime.ClientTransport -} - -// SetTransport changes the transport on the client and all its subresources -func (c *PMMIntegratedAlertingAPI) SetTransport(transport runtime.ClientTransport) { - c.Transport = transport - c.Alerts.SetTransport(transport) - c.Channels.SetTransport(transport) - c.Rules.SetTransport(transport) -} diff --git a/api/managementpb/ia/json/client/rules/create_alert_rule_parameters.go b/api/managementpb/ia/json/client/rules/create_alert_rule_parameters.go deleted file mode 100644 index c361a3c197..0000000000 --- a/api/managementpb/ia/json/client/rules/create_alert_rule_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewCreateAlertRuleParams creates a new CreateAlertRuleParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewCreateAlertRuleParams() *CreateAlertRuleParams { - return &CreateAlertRuleParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewCreateAlertRuleParamsWithTimeout creates a new CreateAlertRuleParams object -// with the ability to set a timeout on a request. -func NewCreateAlertRuleParamsWithTimeout(timeout time.Duration) *CreateAlertRuleParams { - return &CreateAlertRuleParams{ - timeout: timeout, - } -} - -// NewCreateAlertRuleParamsWithContext creates a new CreateAlertRuleParams object -// with the ability to set a context for a request. -func NewCreateAlertRuleParamsWithContext(ctx context.Context) *CreateAlertRuleParams { - return &CreateAlertRuleParams{ - Context: ctx, - } -} - -// NewCreateAlertRuleParamsWithHTTPClient creates a new CreateAlertRuleParams object -// with the ability to set a custom HTTPClient for a request. -func NewCreateAlertRuleParamsWithHTTPClient(client *http.Client) *CreateAlertRuleParams { - return &CreateAlertRuleParams{ - HTTPClient: client, - } -} - -/* -CreateAlertRuleParams contains all the parameters to send to the API endpoint - - for the create alert rule operation. - - Typically these are written to a http.Request. -*/ -type CreateAlertRuleParams struct { - // Body. - Body CreateAlertRuleBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the create alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateAlertRuleParams) WithDefaults() *CreateAlertRuleParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the create alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateAlertRuleParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the create alert rule params -func (o *CreateAlertRuleParams) WithTimeout(timeout time.Duration) *CreateAlertRuleParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the create alert rule params -func (o *CreateAlertRuleParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the create alert rule params -func (o *CreateAlertRuleParams) WithContext(ctx context.Context) *CreateAlertRuleParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the create alert rule params -func (o *CreateAlertRuleParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the create alert rule params -func (o *CreateAlertRuleParams) WithHTTPClient(client *http.Client) *CreateAlertRuleParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the create alert rule params -func (o *CreateAlertRuleParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the create alert rule params -func (o *CreateAlertRuleParams) WithBody(body CreateAlertRuleBody) *CreateAlertRuleParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create alert rule params -func (o *CreateAlertRuleParams) SetBody(body CreateAlertRuleBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *CreateAlertRuleParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/rules/create_alert_rule_responses.go b/api/managementpb/ia/json/client/rules/create_alert_rule_responses.go deleted file mode 100644 index d7102f2eb4..0000000000 --- a/api/managementpb/ia/json/client/rules/create_alert_rule_responses.go +++ /dev/null @@ -1,757 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// CreateAlertRuleReader is a Reader for the CreateAlertRule structure. -type CreateAlertRuleReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *CreateAlertRuleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewCreateAlertRuleOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewCreateAlertRuleDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewCreateAlertRuleOK creates a CreateAlertRuleOK with default headers values -func NewCreateAlertRuleOK() *CreateAlertRuleOK { - return &CreateAlertRuleOK{} -} - -/* -CreateAlertRuleOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type CreateAlertRuleOK struct { - Payload *CreateAlertRuleOKBody -} - -func (o *CreateAlertRuleOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Create][%d] createAlertRuleOk %+v", 200, o.Payload) -} - -func (o *CreateAlertRuleOK) GetPayload() *CreateAlertRuleOKBody { - return o.Payload -} - -func (o *CreateAlertRuleOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(CreateAlertRuleOKBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateAlertRuleDefault creates a CreateAlertRuleDefault with default headers values -func NewCreateAlertRuleDefault(code int) *CreateAlertRuleDefault { - return &CreateAlertRuleDefault{ - _statusCode: code, - } -} - -/* -CreateAlertRuleDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type CreateAlertRuleDefault struct { - _statusCode int - - Payload *CreateAlertRuleDefaultBody -} - -// Code gets the status code for the create alert rule default response -func (o *CreateAlertRuleDefault) Code() int { - return o._statusCode -} - -func (o *CreateAlertRuleDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Create][%d] CreateAlertRule default %+v", o._statusCode, o.Payload) -} - -func (o *CreateAlertRuleDefault) GetPayload() *CreateAlertRuleDefaultBody { - return o.Payload -} - -func (o *CreateAlertRuleDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(CreateAlertRuleDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -CreateAlertRuleBody create alert rule body -swagger:model CreateAlertRuleBody -*/ -type CreateAlertRuleBody struct { - // Template name. Can't be specified simultaneously with source_rule_id. - TemplateName string `json:"template_name,omitempty"` - - // ID of the rule that will be used as source. Can't be specified simultaneously with template_name. - SourceRuleID string `json:"source_rule_id,omitempty"` - - // Rule name. - Name string `json:"name,omitempty"` - - // New rule status. - Disabled bool `json:"disabled,omitempty"` - - // Rule parameters. All template parameters should be set. - Params []*CreateAlertRuleParamsBodyParamsItems0 `json:"params"` - - // Rule duration. Should be set. - For string `json:"for,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - Severity *string `json:"severity,omitempty"` - - // All custom labels to add or remove (with empty values) to default labels from template. - CustomLabels map[string]string `json:"custom_labels,omitempty"` - - // Filters. Should be set. - Filters []*CreateAlertRuleParamsBodyFiltersItems0 `json:"filters"` - - // Channels. Should be set. - ChannelIds []string `json:"channel_ids"` -} - -// Validate validates this create alert rule body -func (o *CreateAlertRuleBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateParams(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateFilters(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateAlertRuleBody) validateParams(formats strfmt.Registry) error { - if swag.IsZero(o.Params) { // not required - return nil - } - - for i := 0; i < len(o.Params); i++ { - if swag.IsZero(o.Params[i]) { // not required - continue - } - - if o.Params[i] != nil { - if err := o.Params[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -var createAlertRuleBodyTypeSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - createAlertRuleBodyTypeSeverityPropEnum = append(createAlertRuleBodyTypeSeverityPropEnum, v) - } -} - -const ( - - // CreateAlertRuleBodySeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - CreateAlertRuleBodySeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // CreateAlertRuleBodySeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - CreateAlertRuleBodySeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // CreateAlertRuleBodySeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - CreateAlertRuleBodySeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // CreateAlertRuleBodySeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - CreateAlertRuleBodySeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // CreateAlertRuleBodySeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - CreateAlertRuleBodySeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // CreateAlertRuleBodySeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - CreateAlertRuleBodySeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // CreateAlertRuleBodySeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - CreateAlertRuleBodySeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // CreateAlertRuleBodySeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - CreateAlertRuleBodySeveritySEVERITYINFO string = "SEVERITY_INFO" - - // CreateAlertRuleBodySeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - CreateAlertRuleBodySeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *CreateAlertRuleBody) validateSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, createAlertRuleBodyTypeSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *CreateAlertRuleBody) validateSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.Severity) { // not required - return nil - } - - // value enum - if err := o.validateSeverityEnum("body"+"."+"severity", "body", *o.Severity); err != nil { - return err - } - - return nil -} - -func (o *CreateAlertRuleBody) validateFilters(formats strfmt.Registry) error { - if swag.IsZero(o.Filters) { // not required - return nil - } - - for i := 0; i < len(o.Filters); i++ { - if swag.IsZero(o.Filters[i]) { // not required - continue - } - - if o.Filters[i] != nil { - if err := o.Filters[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this create alert rule body based on the context it is used -func (o *CreateAlertRuleBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateParams(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateFilters(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateAlertRuleBody) contextValidateParams(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Params); i++ { - if o.Params[i] != nil { - if err := o.Params[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *CreateAlertRuleBody) contextValidateFilters(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Filters); i++ { - if o.Filters[i] != nil { - if err := o.Filters[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *CreateAlertRuleBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateAlertRuleBody) UnmarshalBinary(b []byte) error { - var res CreateAlertRuleBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -CreateAlertRuleDefaultBody create alert rule default body -swagger:model CreateAlertRuleDefaultBody -*/ -type CreateAlertRuleDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*CreateAlertRuleDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this create alert rule default body -func (o *CreateAlertRuleDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateAlertRuleDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("CreateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("CreateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this create alert rule default body based on the context it is used -func (o *CreateAlertRuleDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateAlertRuleDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("CreateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("CreateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *CreateAlertRuleDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateAlertRuleDefaultBody) UnmarshalBinary(b []byte) error { - var res CreateAlertRuleDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -CreateAlertRuleDefaultBodyDetailsItems0 create alert rule default body details items0 -swagger:model CreateAlertRuleDefaultBodyDetailsItems0 -*/ -type CreateAlertRuleDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this create alert rule default body details items0 -func (o *CreateAlertRuleDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this create alert rule default body details items0 based on context it is used -func (o *CreateAlertRuleDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateAlertRuleDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateAlertRuleDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res CreateAlertRuleDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -CreateAlertRuleOKBody create alert rule OK body -swagger:model CreateAlertRuleOKBody -*/ -type CreateAlertRuleOKBody struct { - // Rule ID. - RuleID string `json:"rule_id,omitempty"` -} - -// Validate validates this create alert rule OK body -func (o *CreateAlertRuleOKBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this create alert rule OK body based on context it is used -func (o *CreateAlertRuleOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateAlertRuleOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateAlertRuleOKBody) UnmarshalBinary(b []byte) error { - var res CreateAlertRuleOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -CreateAlertRuleParamsBodyFiltersItems0 Filter repsents a single filter condition. -swagger:model CreateAlertRuleParamsBodyFiltersItems0 -*/ -type CreateAlertRuleParamsBodyFiltersItems0 struct { - // FilterType represents filter matching type. - // - // - EQUAL: = - // - // != - // NOT_EQUAL = 2; - // - REGEX: =~ - // - // !~ - // NOT_REGEX = 4; - // Enum: [FILTER_TYPE_INVALID EQUAL REGEX] - Type *string `json:"type,omitempty"` - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this create alert rule params body filters items0 -func (o *CreateAlertRuleParamsBodyFiltersItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var createAlertRuleParamsBodyFiltersItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["FILTER_TYPE_INVALID","EQUAL","REGEX"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - createAlertRuleParamsBodyFiltersItems0TypeTypePropEnum = append(createAlertRuleParamsBodyFiltersItems0TypeTypePropEnum, v) - } -} - -const ( - - // CreateAlertRuleParamsBodyFiltersItems0TypeFILTERTYPEINVALID captures enum value "FILTER_TYPE_INVALID" - CreateAlertRuleParamsBodyFiltersItems0TypeFILTERTYPEINVALID string = "FILTER_TYPE_INVALID" - - // CreateAlertRuleParamsBodyFiltersItems0TypeEQUAL captures enum value "EQUAL" - CreateAlertRuleParamsBodyFiltersItems0TypeEQUAL string = "EQUAL" - - // CreateAlertRuleParamsBodyFiltersItems0TypeREGEX captures enum value "REGEX" - CreateAlertRuleParamsBodyFiltersItems0TypeREGEX string = "REGEX" -) - -// prop value enum -func (o *CreateAlertRuleParamsBodyFiltersItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, createAlertRuleParamsBodyFiltersItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *CreateAlertRuleParamsBodyFiltersItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this create alert rule params body filters items0 based on context it is used -func (o *CreateAlertRuleParamsBodyFiltersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateAlertRuleParamsBodyFiltersItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateAlertRuleParamsBodyFiltersItems0) UnmarshalBinary(b []byte) error { - var res CreateAlertRuleParamsBodyFiltersItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -CreateAlertRuleParamsBodyParamsItems0 ParamValue represents a single rule parameter value for List, Change and Update APIs. -swagger:model CreateAlertRuleParamsBodyParamsItems0 -*/ -type CreateAlertRuleParamsBodyParamsItems0 struct { - // Machine-readable name (ID) that is used in expression. - Name string `json:"name,omitempty"` - - // ParamType represents template parameter type. - // Enum: [PARAM_TYPE_INVALID BOOL FLOAT STRING] - Type *string `json:"type,omitempty"` - - // Bool value. - Bool bool `json:"bool,omitempty"` - - // Float value. - Float float64 `json:"float,omitempty"` - - // String value. - String string `json:"string,omitempty"` -} - -// Validate validates this create alert rule params body params items0 -func (o *CreateAlertRuleParamsBodyParamsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var createAlertRuleParamsBodyParamsItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_TYPE_INVALID","BOOL","FLOAT","STRING"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - createAlertRuleParamsBodyParamsItems0TypeTypePropEnum = append(createAlertRuleParamsBodyParamsItems0TypeTypePropEnum, v) - } -} - -const ( - - // CreateAlertRuleParamsBodyParamsItems0TypePARAMTYPEINVALID captures enum value "PARAM_TYPE_INVALID" - CreateAlertRuleParamsBodyParamsItems0TypePARAMTYPEINVALID string = "PARAM_TYPE_INVALID" - - // CreateAlertRuleParamsBodyParamsItems0TypeBOOL captures enum value "BOOL" - CreateAlertRuleParamsBodyParamsItems0TypeBOOL string = "BOOL" - - // CreateAlertRuleParamsBodyParamsItems0TypeFLOAT captures enum value "FLOAT" - CreateAlertRuleParamsBodyParamsItems0TypeFLOAT string = "FLOAT" - - // CreateAlertRuleParamsBodyParamsItems0TypeSTRING captures enum value "STRING" - CreateAlertRuleParamsBodyParamsItems0TypeSTRING string = "STRING" -) - -// prop value enum -func (o *CreateAlertRuleParamsBodyParamsItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, createAlertRuleParamsBodyParamsItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *CreateAlertRuleParamsBodyParamsItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this create alert rule params body params items0 based on context it is used -func (o *CreateAlertRuleParamsBodyParamsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateAlertRuleParamsBodyParamsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateAlertRuleParamsBodyParamsItems0) UnmarshalBinary(b []byte) error { - var res CreateAlertRuleParamsBodyParamsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/rules/delete_alert_rule_parameters.go b/api/managementpb/ia/json/client/rules/delete_alert_rule_parameters.go deleted file mode 100644 index 7b24bccb74..0000000000 --- a/api/managementpb/ia/json/client/rules/delete_alert_rule_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewDeleteAlertRuleParams creates a new DeleteAlertRuleParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteAlertRuleParams() *DeleteAlertRuleParams { - return &DeleteAlertRuleParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteAlertRuleParamsWithTimeout creates a new DeleteAlertRuleParams object -// with the ability to set a timeout on a request. -func NewDeleteAlertRuleParamsWithTimeout(timeout time.Duration) *DeleteAlertRuleParams { - return &DeleteAlertRuleParams{ - timeout: timeout, - } -} - -// NewDeleteAlertRuleParamsWithContext creates a new DeleteAlertRuleParams object -// with the ability to set a context for a request. -func NewDeleteAlertRuleParamsWithContext(ctx context.Context) *DeleteAlertRuleParams { - return &DeleteAlertRuleParams{ - Context: ctx, - } -} - -// NewDeleteAlertRuleParamsWithHTTPClient creates a new DeleteAlertRuleParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteAlertRuleParamsWithHTTPClient(client *http.Client) *DeleteAlertRuleParams { - return &DeleteAlertRuleParams{ - HTTPClient: client, - } -} - -/* -DeleteAlertRuleParams contains all the parameters to send to the API endpoint - - for the delete alert rule operation. - - Typically these are written to a http.Request. -*/ -type DeleteAlertRuleParams struct { - // Body. - Body DeleteAlertRuleBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteAlertRuleParams) WithDefaults() *DeleteAlertRuleParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteAlertRuleParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete alert rule params -func (o *DeleteAlertRuleParams) WithTimeout(timeout time.Duration) *DeleteAlertRuleParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete alert rule params -func (o *DeleteAlertRuleParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete alert rule params -func (o *DeleteAlertRuleParams) WithContext(ctx context.Context) *DeleteAlertRuleParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete alert rule params -func (o *DeleteAlertRuleParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete alert rule params -func (o *DeleteAlertRuleParams) WithHTTPClient(client *http.Client) *DeleteAlertRuleParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete alert rule params -func (o *DeleteAlertRuleParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the delete alert rule params -func (o *DeleteAlertRuleParams) WithBody(body DeleteAlertRuleBody) *DeleteAlertRuleParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the delete alert rule params -func (o *DeleteAlertRuleParams) SetBody(body DeleteAlertRuleBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteAlertRuleParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/rules/delete_alert_rule_responses.go b/api/managementpb/ia/json/client/rules/delete_alert_rule_responses.go deleted file mode 100644 index accdebbdc8..0000000000 --- a/api/managementpb/ia/json/client/rules/delete_alert_rule_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// DeleteAlertRuleReader is a Reader for the DeleteAlertRule structure. -type DeleteAlertRuleReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteAlertRuleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteAlertRuleOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewDeleteAlertRuleDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewDeleteAlertRuleOK creates a DeleteAlertRuleOK with default headers values -func NewDeleteAlertRuleOK() *DeleteAlertRuleOK { - return &DeleteAlertRuleOK{} -} - -/* -DeleteAlertRuleOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type DeleteAlertRuleOK struct { - Payload interface{} -} - -func (o *DeleteAlertRuleOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Delete][%d] deleteAlertRuleOk %+v", 200, o.Payload) -} - -func (o *DeleteAlertRuleOK) GetPayload() interface{} { - return o.Payload -} - -func (o *DeleteAlertRuleOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteAlertRuleDefault creates a DeleteAlertRuleDefault with default headers values -func NewDeleteAlertRuleDefault(code int) *DeleteAlertRuleDefault { - return &DeleteAlertRuleDefault{ - _statusCode: code, - } -} - -/* -DeleteAlertRuleDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type DeleteAlertRuleDefault struct { - _statusCode int - - Payload *DeleteAlertRuleDefaultBody -} - -// Code gets the status code for the delete alert rule default response -func (o *DeleteAlertRuleDefault) Code() int { - return o._statusCode -} - -func (o *DeleteAlertRuleDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Delete][%d] DeleteAlertRule default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteAlertRuleDefault) GetPayload() *DeleteAlertRuleDefaultBody { - return o.Payload -} - -func (o *DeleteAlertRuleDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(DeleteAlertRuleDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -DeleteAlertRuleBody delete alert rule body -swagger:model DeleteAlertRuleBody -*/ -type DeleteAlertRuleBody struct { - // Rule ID. - RuleID string `json:"rule_id,omitempty"` -} - -// Validate validates this delete alert rule body -func (o *DeleteAlertRuleBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this delete alert rule body based on context it is used -func (o *DeleteAlertRuleBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *DeleteAlertRuleBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *DeleteAlertRuleBody) UnmarshalBinary(b []byte) error { - var res DeleteAlertRuleBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -DeleteAlertRuleDefaultBody delete alert rule default body -swagger:model DeleteAlertRuleDefaultBody -*/ -type DeleteAlertRuleDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*DeleteAlertRuleDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this delete alert rule default body -func (o *DeleteAlertRuleDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *DeleteAlertRuleDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("DeleteAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("DeleteAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this delete alert rule default body based on the context it is used -func (o *DeleteAlertRuleDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *DeleteAlertRuleDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("DeleteAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("DeleteAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *DeleteAlertRuleDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *DeleteAlertRuleDefaultBody) UnmarshalBinary(b []byte) error { - var res DeleteAlertRuleDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -DeleteAlertRuleDefaultBodyDetailsItems0 delete alert rule default body details items0 -swagger:model DeleteAlertRuleDefaultBodyDetailsItems0 -*/ -type DeleteAlertRuleDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this delete alert rule default body details items0 -func (o *DeleteAlertRuleDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this delete alert rule default body details items0 based on context it is used -func (o *DeleteAlertRuleDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *DeleteAlertRuleDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *DeleteAlertRuleDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res DeleteAlertRuleDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/rules/list_alert_rules_parameters.go b/api/managementpb/ia/json/client/rules/list_alert_rules_parameters.go deleted file mode 100644 index 324b22bb8c..0000000000 --- a/api/managementpb/ia/json/client/rules/list_alert_rules_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewListAlertRulesParams creates a new ListAlertRulesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewListAlertRulesParams() *ListAlertRulesParams { - return &ListAlertRulesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewListAlertRulesParamsWithTimeout creates a new ListAlertRulesParams object -// with the ability to set a timeout on a request. -func NewListAlertRulesParamsWithTimeout(timeout time.Duration) *ListAlertRulesParams { - return &ListAlertRulesParams{ - timeout: timeout, - } -} - -// NewListAlertRulesParamsWithContext creates a new ListAlertRulesParams object -// with the ability to set a context for a request. -func NewListAlertRulesParamsWithContext(ctx context.Context) *ListAlertRulesParams { - return &ListAlertRulesParams{ - Context: ctx, - } -} - -// NewListAlertRulesParamsWithHTTPClient creates a new ListAlertRulesParams object -// with the ability to set a custom HTTPClient for a request. -func NewListAlertRulesParamsWithHTTPClient(client *http.Client) *ListAlertRulesParams { - return &ListAlertRulesParams{ - HTTPClient: client, - } -} - -/* -ListAlertRulesParams contains all the parameters to send to the API endpoint - - for the list alert rules operation. - - Typically these are written to a http.Request. -*/ -type ListAlertRulesParams struct { - // Body. - Body ListAlertRulesBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the list alert rules params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListAlertRulesParams) WithDefaults() *ListAlertRulesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the list alert rules params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListAlertRulesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the list alert rules params -func (o *ListAlertRulesParams) WithTimeout(timeout time.Duration) *ListAlertRulesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the list alert rules params -func (o *ListAlertRulesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the list alert rules params -func (o *ListAlertRulesParams) WithContext(ctx context.Context) *ListAlertRulesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the list alert rules params -func (o *ListAlertRulesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the list alert rules params -func (o *ListAlertRulesParams) WithHTTPClient(client *http.Client) *ListAlertRulesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the list alert rules params -func (o *ListAlertRulesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the list alert rules params -func (o *ListAlertRulesParams) WithBody(body ListAlertRulesBody) *ListAlertRulesParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the list alert rules params -func (o *ListAlertRulesParams) SetBody(body ListAlertRulesBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *ListAlertRulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/rules/list_alert_rules_responses.go b/api/managementpb/ia/json/client/rules/list_alert_rules_responses.go deleted file mode 100644 index 2231679875..0000000000 --- a/api/managementpb/ia/json/client/rules/list_alert_rules_responses.go +++ /dev/null @@ -1,2438 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ListAlertRulesReader is a Reader for the ListAlertRules structure. -type ListAlertRulesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ListAlertRulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewListAlertRulesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewListAlertRulesDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewListAlertRulesOK creates a ListAlertRulesOK with default headers values -func NewListAlertRulesOK() *ListAlertRulesOK { - return &ListAlertRulesOK{} -} - -/* -ListAlertRulesOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ListAlertRulesOK struct { - Payload *ListAlertRulesOKBody -} - -func (o *ListAlertRulesOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/List][%d] listAlertRulesOk %+v", 200, o.Payload) -} - -func (o *ListAlertRulesOK) GetPayload() *ListAlertRulesOKBody { - return o.Payload -} - -func (o *ListAlertRulesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ListAlertRulesOKBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewListAlertRulesDefault creates a ListAlertRulesDefault with default headers values -func NewListAlertRulesDefault(code int) *ListAlertRulesDefault { - return &ListAlertRulesDefault{ - _statusCode: code, - } -} - -/* -ListAlertRulesDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ListAlertRulesDefault struct { - _statusCode int - - Payload *ListAlertRulesDefaultBody -} - -// Code gets the status code for the list alert rules default response -func (o *ListAlertRulesDefault) Code() int { - return o._statusCode -} - -func (o *ListAlertRulesDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/List][%d] ListAlertRules default %+v", o._statusCode, o.Payload) -} - -func (o *ListAlertRulesDefault) GetPayload() *ListAlertRulesDefaultBody { - return o.Payload -} - -func (o *ListAlertRulesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ListAlertRulesDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -ListAlertRulesBody list alert rules body -swagger:model ListAlertRulesBody -*/ -type ListAlertRulesBody struct { - // page params - PageParams *ListAlertRulesParamsBodyPageParams `json:"page_params,omitempty"` -} - -// Validate validates this list alert rules body -func (o *ListAlertRulesBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validatePageParams(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesBody) validatePageParams(formats strfmt.Registry) error { - if swag.IsZero(o.PageParams) { // not required - return nil - } - - if o.PageParams != nil { - if err := o.PageParams.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "page_params") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "page_params") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alert rules body based on the context it is used -func (o *ListAlertRulesBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidatePageParams(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesBody) contextValidatePageParams(ctx context.Context, formats strfmt.Registry) error { - if o.PageParams != nil { - if err := o.PageParams.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "page_params") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "page_params") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesBody) UnmarshalBinary(b []byte) error { - var res ListAlertRulesBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesDefaultBody list alert rules default body -swagger:model ListAlertRulesDefaultBody -*/ -type ListAlertRulesDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*ListAlertRulesDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this list alert rules default body -func (o *ListAlertRulesDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ListAlertRules default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ListAlertRules default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this list alert rules default body based on the context it is used -func (o *ListAlertRulesDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ListAlertRules default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ListAlertRules default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesDefaultBody) UnmarshalBinary(b []byte) error { - var res ListAlertRulesDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesDefaultBodyDetailsItems0 list alert rules default body details items0 -swagger:model ListAlertRulesDefaultBodyDetailsItems0 -*/ -type ListAlertRulesDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this list alert rules default body details items0 -func (o *ListAlertRulesDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules default body details items0 based on context it is used -func (o *ListAlertRulesDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertRulesDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBody list alert rules OK body -swagger:model ListAlertRulesOKBody -*/ -type ListAlertRulesOKBody struct { - // rules - Rules []*ListAlertRulesOKBodyRulesItems0 `json:"rules"` - - // totals - Totals *ListAlertRulesOKBodyTotals `json:"totals,omitempty"` -} - -// Validate validates this list alert rules OK body -func (o *ListAlertRulesOKBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRules(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTotals(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBody) validateRules(formats strfmt.Registry) error { - if swag.IsZero(o.Rules) { // not required - return nil - } - - for i := 0; i < len(o.Rules); i++ { - if swag.IsZero(o.Rules[i]) { // not required - continue - } - - if o.Rules[i] != nil { - if err := o.Rules[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertRulesOk" + "." + "rules" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertRulesOk" + "." + "rules" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertRulesOKBody) validateTotals(formats strfmt.Registry) error { - if swag.IsZero(o.Totals) { // not required - return nil - } - - if o.Totals != nil { - if err := o.Totals.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertRulesOk" + "." + "totals") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertRulesOk" + "." + "totals") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alert rules OK body based on the context it is used -func (o *ListAlertRulesOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRules(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTotals(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBody) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Rules); i++ { - if o.Rules[i] != nil { - if err := o.Rules[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertRulesOk" + "." + "rules" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertRulesOk" + "." + "rules" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertRulesOKBody) contextValidateTotals(ctx context.Context, formats strfmt.Registry) error { - if o.Totals != nil { - if err := o.Totals.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("listAlertRulesOk" + "." + "totals") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("listAlertRulesOk" + "." + "totals") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBody) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0 Rule represents Alert Rule. -swagger:model ListAlertRulesOKBodyRulesItems0 -*/ -type ListAlertRulesOKBodyRulesItems0 struct { - // Rule ID. - RuleID string `json:"rule_id,omitempty"` - - // Rule name. - Name string `json:"name,omitempty"` - - // Rule human-readable summary. - Summary string `json:"summary,omitempty"` - - // Template used for this rule. - TemplateName string `json:"template_name,omitempty"` - - // True if that rule is disabled. - Disabled bool `json:"disabled,omitempty"` - - // Expression template. - ExprTemplate string `json:"expr_template,omitempty"` - - // Expression filled with parameters. - Expr string `json:"expr,omitempty"` - - // Expression parameters definitions. - ParamsDefinitions []*ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0 `json:"params_definitions"` - - // Expression parameters values. - ParamsValues []*ListAlertRulesOKBodyRulesItems0ParamsValuesItems0 `json:"params_values"` - - // Default for duration. - DefaultFor string `json:"default_for,omitempty"` - - // For duration. - For string `json:"for,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - DefaultSeverity *string `json:"default_severity,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - Severity *string `json:"severity,omitempty"` - - // Custom labels. - CustomLabels map[string]string `json:"custom_labels,omitempty"` - - // Labels. - Labels map[string]string `json:"labels,omitempty"` - - // Annotations. - Annotations map[string]string `json:"annotations,omitempty"` - - // Filters. - Filters []*ListAlertRulesOKBodyRulesItems0FiltersItems0 `json:"filters"` - - // Channels. - Channels []*ListAlertRulesOKBodyRulesItems0ChannelsItems0 `json:"channels"` - - // Rule creation time. - // Format: date-time - CreatedAt strfmt.DateTime `json:"created_at,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 -func (o *ListAlertRulesOKBodyRulesItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateParamsDefinitions(formats); err != nil { - res = append(res, err) - } - - if err := o.validateParamsValues(formats); err != nil { - res = append(res, err) - } - - if err := o.validateDefaultSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateFilters(formats); err != nil { - res = append(res, err) - } - - if err := o.validateChannels(formats); err != nil { - res = append(res, err) - } - - if err := o.validateCreatedAt(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateParamsDefinitions(formats strfmt.Registry) error { - if swag.IsZero(o.ParamsDefinitions) { // not required - return nil - } - - for i := 0; i < len(o.ParamsDefinitions); i++ { - if swag.IsZero(o.ParamsDefinitions[i]) { // not required - continue - } - - if o.ParamsDefinitions[i] != nil { - if err := o.ParamsDefinitions[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("params_definitions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("params_definitions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateParamsValues(formats strfmt.Registry) error { - if swag.IsZero(o.ParamsValues) { // not required - return nil - } - - for i := 0; i < len(o.ParamsValues); i++ { - if swag.IsZero(o.ParamsValues[i]) { // not required - continue - } - - if o.ParamsValues[i] != nil { - if err := o.ParamsValues[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("params_values" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("params_values" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -var listAlertRulesOkBodyRulesItems0TypeDefaultSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0TypeDefaultSeverityPropEnum = append(listAlertRulesOkBodyRulesItems0TypeDefaultSeverityPropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYINFO string = "SEVERITY_INFO" - - // ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - ListAlertRulesOKBodyRulesItems0DefaultSeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0) validateDefaultSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0TypeDefaultSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateDefaultSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.DefaultSeverity) { // not required - return nil - } - - // value enum - if err := o.validateDefaultSeverityEnum("default_severity", "body", *o.DefaultSeverity); err != nil { - return err - } - - return nil -} - -var listAlertRulesOkBodyRulesItems0TypeSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0TypeSeverityPropEnum = append(listAlertRulesOkBodyRulesItems0TypeSeverityPropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYINFO string = "SEVERITY_INFO" - - // ListAlertRulesOKBodyRulesItems0SeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - ListAlertRulesOKBodyRulesItems0SeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0) validateSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0TypeSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.Severity) { // not required - return nil - } - - // value enum - if err := o.validateSeverityEnum("severity", "body", *o.Severity); err != nil { - return err - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateFilters(formats strfmt.Registry) error { - if swag.IsZero(o.Filters) { // not required - return nil - } - - for i := 0; i < len(o.Filters); i++ { - if swag.IsZero(o.Filters[i]) { // not required - continue - } - - if o.Filters[i] != nil { - if err := o.Filters[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("filters" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateChannels(formats strfmt.Registry) error { - if swag.IsZero(o.Channels) { // not required - return nil - } - - for i := 0; i < len(o.Channels); i++ { - if swag.IsZero(o.Channels[i]) { // not required - continue - } - - if o.Channels[i] != nil { - if err := o.Channels[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("channels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("channels" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) validateCreatedAt(formats strfmt.Registry) error { - if swag.IsZero(o.CreatedAt) { // not required - return nil - } - - if err := validate.FormatOf("created_at", "body", "date-time", o.CreatedAt.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this list alert rules OK body rules items0 based on the context it is used -func (o *ListAlertRulesOKBodyRulesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateParamsDefinitions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateParamsValues(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateFilters(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateChannels(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) contextValidateParamsDefinitions(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.ParamsDefinitions); i++ { - if o.ParamsDefinitions[i] != nil { - if err := o.ParamsDefinitions[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("params_definitions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("params_definitions" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) contextValidateParamsValues(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.ParamsValues); i++ { - if o.ParamsValues[i] != nil { - if err := o.ParamsValues[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("params_values" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("params_values" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) contextValidateFilters(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Filters); i++ { - if o.Filters[i] != nil { - if err := o.Filters[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("filters" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0) contextValidateChannels(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Channels); i++ { - if o.Channels[i] != nil { - if err := o.Channels[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("channels" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("channels" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0 Channel represents a single Notification Channel. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0 -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0 struct { - // Machine-readable ID. - ChannelID string `json:"channel_id,omitempty"` - - // Short human-readable summary. - Summary string `json:"summary,omitempty"` - - // True if that channel is disabled. - Disabled bool `json:"disabled,omitempty"` - - // email config - EmailConfig *ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig `json:"email_config,omitempty"` - - // pagerduty config - PagerdutyConfig *ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig `json:"pagerduty_config,omitempty"` - - // slack config - SlackConfig *ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig `json:"slack_config,omitempty"` - - // webhook config - WebhookConfig *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig `json:"webhook_config,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateEmailConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validatePagerdutyConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSlackConfig(formats); err != nil { - res = append(res, err) - } - - if err := o.validateWebhookConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) validateEmailConfig(formats strfmt.Registry) error { - if swag.IsZero(o.EmailConfig) { // not required - return nil - } - - if o.EmailConfig != nil { - if err := o.EmailConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("email_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) validatePagerdutyConfig(formats strfmt.Registry) error { - if swag.IsZero(o.PagerdutyConfig) { // not required - return nil - } - - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) validateSlackConfig(formats strfmt.Registry) error { - if swag.IsZero(o.SlackConfig) { // not required - return nil - } - - if o.SlackConfig != nil { - if err := o.SlackConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("slack_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) validateWebhookConfig(formats strfmt.Registry) error { - if swag.IsZero(o.WebhookConfig) { // not required - return nil - } - - if o.WebhookConfig != nil { - if err := o.WebhookConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alert rules OK body rules items0 channels items0 based on the context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateEmailConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidatePagerdutyConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateSlackConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateWebhookConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) contextValidateEmailConfig(ctx context.Context, formats strfmt.Registry) error { - if o.EmailConfig != nil { - if err := o.EmailConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("email_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("email_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) contextValidatePagerdutyConfig(ctx context.Context, formats strfmt.Registry) error { - if o.PagerdutyConfig != nil { - if err := o.PagerdutyConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagerduty_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagerduty_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) contextValidateSlackConfig(ctx context.Context, formats strfmt.Registry) error { - if o.SlackConfig != nil { - if err := o.SlackConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("slack_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("slack_config") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) contextValidateWebhookConfig(ctx context.Context, formats strfmt.Registry) error { - if o.WebhookConfig != nil { - if err := o.WebhookConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig EmailConfig represents email configuration. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // to - To []string `json:"to"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 email config -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 channels items0 email config based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0EmailConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig PagerDutyConfig represents PagerDuty configuration. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // The PagerDuty key for "Events API v2" integration type. Exactly one key should be set. - RoutingKey string `json:"routing_key,omitempty"` - - // The PagerDuty key for "Prometheus" integration type. Exactly one key should be set. - ServiceKey string `json:"service_key,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 pagerduty config -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 channels items0 pagerduty config based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0PagerdutyConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig SlackConfig represents Slack configuration. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // channel - Channel string `json:"channel,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 slack config -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 channels items0 slack config based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0SlackConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig WebhookConfig represents webhook configuration. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig struct { - // send resolved - SendResolved bool `json:"send_resolved,omitempty"` - - // url - URL string `json:"url,omitempty"` - - // max alerts - MaxAlerts int32 `json:"max_alerts,omitempty"` - - // http config - HTTPConfig *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig `json:"http_config,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 webhook config -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateHTTPConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig) validateHTTPConfig(formats strfmt.Registry) error { - if swag.IsZero(o.HTTPConfig) { // not required - return nil - } - - if o.HTTPConfig != nil { - if err := o.HTTPConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alert rules OK body rules items0 channels items0 webhook config based on the context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateHTTPConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig) contextValidateHTTPConfig(ctx context.Context, formats strfmt.Registry) error { - if o.HTTPConfig != nil { - if err := o.HTTPConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig HTTPConfig represents HTTP client configuration. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig struct { - // bearer token - BearerToken string `json:"bearer_token,omitempty"` - - // bearer token file - BearerTokenFile string `json:"bearer_token_file,omitempty"` - - // proxy url - ProxyURL string `json:"proxy_url,omitempty"` - - // basic auth - BasicAuth *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth `json:"basic_auth,omitempty"` - - // tls config - TLSConfig *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig `json:"tls_config,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 webhook config HTTP config -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateBasicAuth(formats); err != nil { - res = append(res, err) - } - - if err := o.validateTLSConfig(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) validateBasicAuth(formats strfmt.Registry) error { - if swag.IsZero(o.BasicAuth) { // not required - return nil - } - - if o.BasicAuth != nil { - if err := o.BasicAuth.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) validateTLSConfig(formats strfmt.Registry) error { - if swag.IsZero(o.TLSConfig) { // not required - return nil - } - - if o.TLSConfig != nil { - if err := o.TLSConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alert rules OK body rules items0 channels items0 webhook config HTTP config based on the context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBasicAuth(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateTLSConfig(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) contextValidateBasicAuth(ctx context.Context, formats strfmt.Registry) error { - if o.BasicAuth != nil { - if err := o.BasicAuth.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "basic_auth") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) contextValidateTLSConfig(ctx context.Context, formats strfmt.Registry) error { - if o.TLSConfig != nil { - if err := o.TLSConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("webhook_config" + "." + "http_config" + "." + "tls_config") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth BasicAuth represents basic HTTP auth configuration. -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth struct { - // username - Username string `json:"username,omitempty"` - - // password - Password string `json:"password,omitempty"` - - // password file - PasswordFile string `json:"password_file,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 webhook config HTTP config basic auth -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 channels items0 webhook config HTTP config basic auth based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigBasicAuth - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig TLSConfig represents TLS configuration for alertmanager -// https://prometheus.io/docs/alerting/latest/configuration/#tls_config -swagger:model ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig -*/ -type ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig struct { - // A path to the CA certificate file to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFile string `json:"ca_file,omitempty"` - - // A path to the certificate file for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFile string `json:"cert_file,omitempty"` - - // A path to the key file for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFile string `json:"key_file,omitempty"` - - // Name of the server. - ServerName string `json:"server_name,omitempty"` - - // Disable validation of the server certificate. - InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` - - // CA certificate to validate the server certificate with. - // ca_file and ca_file_content should not be set at the same time. - CaFileContent string `json:"ca_file_content,omitempty"` - - // A certificate for client cert authentication to the server. - // cert_file and cert_file_content should not be set at the same time. - CertFileContent string `json:"cert_file_content,omitempty"` - - // A key for client cert authentication to the server. - // key_file and key_file_content should not be set at the same time. - KeyFileContent string `json:"key_file_content,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 channels items0 webhook config HTTP config TLS config -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 channels items0 webhook config HTTP config TLS config based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ChannelsItems0WebhookConfigHTTPConfigTLSConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0FiltersItems0 Filter repsents a single filter condition. -swagger:model ListAlertRulesOKBodyRulesItems0FiltersItems0 -*/ -type ListAlertRulesOKBodyRulesItems0FiltersItems0 struct { - // FilterType represents filter matching type. - // - // - EQUAL: = - // - // != - // NOT_EQUAL = 2; - // - REGEX: =~ - // - // !~ - // NOT_REGEX = 4; - // Enum: [FILTER_TYPE_INVALID EQUAL REGEX] - Type *string `json:"type,omitempty"` - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 filters items0 -func (o *ListAlertRulesOKBodyRulesItems0FiltersItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertRulesOkBodyRulesItems0FiltersItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["FILTER_TYPE_INVALID","EQUAL","REGEX"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0FiltersItems0TypeTypePropEnum = append(listAlertRulesOkBodyRulesItems0FiltersItems0TypeTypePropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0FiltersItems0TypeFILTERTYPEINVALID captures enum value "FILTER_TYPE_INVALID" - ListAlertRulesOKBodyRulesItems0FiltersItems0TypeFILTERTYPEINVALID string = "FILTER_TYPE_INVALID" - - // ListAlertRulesOKBodyRulesItems0FiltersItems0TypeEQUAL captures enum value "EQUAL" - ListAlertRulesOKBodyRulesItems0FiltersItems0TypeEQUAL string = "EQUAL" - - // ListAlertRulesOKBodyRulesItems0FiltersItems0TypeREGEX captures enum value "REGEX" - ListAlertRulesOKBodyRulesItems0FiltersItems0TypeREGEX string = "REGEX" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0FiltersItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0FiltersItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0FiltersItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 filters items0 based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0FiltersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0FiltersItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0FiltersItems0) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0FiltersItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0 ParamDefinition represents a single query parameter. -swagger:model ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0 -*/ -type ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0 struct { - // Machine-readable name (ID) that is used in expression. - Name string `json:"name,omitempty"` - - // Short human-readable parameter summary. - Summary string `json:"summary,omitempty"` - - // ParamUnit represents template parameter unit. - // - // - PARAM_UNIT_INVALID: Invalid, unknown or absent. - // - PERCENTAGE: % - // - SECONDS: s - // Enum: [PARAM_UNIT_INVALID PERCENTAGE SECONDS] - Unit *string `json:"unit,omitempty"` - - // ParamType represents template parameter type. - // Enum: [PARAM_TYPE_INVALID BOOL FLOAT STRING] - Type *string `json:"type,omitempty"` - - // bool - Bool *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool `json:"bool,omitempty"` - - // float - Float *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float `json:"float,omitempty"` - - // string - String *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String `json:"string,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 params definitions items0 -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateUnit(formats); err != nil { - res = append(res, err) - } - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if err := o.validateBool(formats); err != nil { - res = append(res, err) - } - - if err := o.validateFloat(formats); err != nil { - res = append(res, err) - } - - if err := o.validateString(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeUnitPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_UNIT_INVALID","PERCENTAGE","SECONDS"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeUnitPropEnum = append(listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeUnitPropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0UnitPARAMUNITINVALID captures enum value "PARAM_UNIT_INVALID" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0UnitPARAMUNITINVALID string = "PARAM_UNIT_INVALID" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0UnitPERCENTAGE captures enum value "PERCENTAGE" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0UnitPERCENTAGE string = "PERCENTAGE" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0UnitSECONDS captures enum value "SECONDS" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0UnitSECONDS string = "SECONDS" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateUnitEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeUnitPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateUnit(formats strfmt.Registry) error { - if swag.IsZero(o.Unit) { // not required - return nil - } - - // value enum - if err := o.validateUnitEnum("unit", "body", *o.Unit); err != nil { - return err - } - - return nil -} - -var listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_TYPE_INVALID","BOOL","FLOAT","STRING"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeTypePropEnum = append(listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeTypePropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypePARAMTYPEINVALID captures enum value "PARAM_TYPE_INVALID" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypePARAMTYPEINVALID string = "PARAM_TYPE_INVALID" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypeBOOL captures enum value "BOOL" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypeBOOL string = "BOOL" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypeFLOAT captures enum value "FLOAT" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypeFLOAT string = "FLOAT" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypeSTRING captures enum value "STRING" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0TypeSTRING string = "STRING" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateBool(formats strfmt.Registry) error { - if swag.IsZero(o.Bool) { // not required - return nil - } - - if o.Bool != nil { - if err := o.Bool.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bool") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("bool") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateFloat(formats strfmt.Registry) error { - if swag.IsZero(o.Float) { // not required - return nil - } - - if o.Float != nil { - if err := o.Float.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("float") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("float") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) validateString(formats strfmt.Registry) error { - if swag.IsZero(o.String) { // not required - return nil - } - - if o.String != nil { - if err := o.String.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("string") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("string") - } - return err - } - } - - return nil -} - -// ContextValidate validate this list alert rules OK body rules items0 params definitions items0 based on the context it is used -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBool(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateFloat(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateString(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) contextValidateBool(ctx context.Context, formats strfmt.Registry) error { - if o.Bool != nil { - if err := o.Bool.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bool") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("bool") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) contextValidateFloat(ctx context.Context, formats strfmt.Registry) error { - if o.Float != nil { - if err := o.Float.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("float") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("float") - } - return err - } - } - - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) contextValidateString(ctx context.Context, formats strfmt.Registry) error { - if o.String != nil { - if err := o.String.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("string") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("string") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool BoolParamDefinition represents boolean parameter's default value. -swagger:model ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool -*/ -type ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool struct { - // BooleanFlag represent a command to set some boolean property to true, - // to false, or avoid changing that property. - // - // - DO_NOT_CHANGE: Do not change boolean property. Default value. - // - TRUE: True. - // - FALSE: False. - // Enum: [DO_NOT_CHANGE TRUE FALSE] - Default *string `json:"default,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 params definitions items0 bool -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDefault(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0BoolTypeDefaultPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["DO_NOT_CHANGE","TRUE","FALSE"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0BoolTypeDefaultPropEnum = append(listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0BoolTypeDefaultPropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0BoolDefaultDONOTCHANGE captures enum value "DO_NOT_CHANGE" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0BoolDefaultDONOTCHANGE string = "DO_NOT_CHANGE" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0BoolDefaultTRUE captures enum value "TRUE" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0BoolDefaultTRUE string = "TRUE" - - // ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0BoolDefaultFALSE captures enum value "FALSE" - ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0BoolDefaultFALSE string = "FALSE" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool) validateDefaultEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0ParamsDefinitionsItems0BoolTypeDefaultPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool) validateDefault(formats strfmt.Registry) error { - if swag.IsZero(o.Default) { // not required - return nil - } - - // value enum - if err := o.validateDefaultEnum("bool"+"."+"default", "body", *o.Default); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 params definitions items0 bool based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Bool - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float FloatParamDefinition represents float parameter's default value and valid range. -swagger:model ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float -*/ -type ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float struct { - // True if default value is set. - HasDefault bool `json:"has_default,omitempty"` - - // Default value if has_default is true. - Default float64 `json:"default,omitempty"` - - // True if minimal valid value is set. - HasMin bool `json:"has_min,omitempty"` - - // Minimal valid value (inclusive) if has_min is true. - Min float64 `json:"min,omitempty"` - - // True if maximal valid value is set. - HasMax bool `json:"has_max,omitempty"` - - // Maximal valid value (inclusive) if has_max is true. - Max float64 `json:"max,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 params definitions items0 float -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 params definitions items0 float based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0Float - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String StringParamDefinition represents string parameter's default value. -swagger:model ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String -*/ -type ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String struct { - // True if default value is set. - HasDefault bool `json:"has_default,omitempty"` - - // Default value if has_default is true. - Default string `json:"default,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 params definitions items0 string -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 params definitions items0 string based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ParamsDefinitionsItems0String - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyRulesItems0ParamsValuesItems0 ParamValue represents a single rule parameter value for List, Change and Update APIs. -swagger:model ListAlertRulesOKBodyRulesItems0ParamsValuesItems0 -*/ -type ListAlertRulesOKBodyRulesItems0ParamsValuesItems0 struct { - // Machine-readable name (ID) that is used in expression. - Name string `json:"name,omitempty"` - - // ParamType represents template parameter type. - // Enum: [PARAM_TYPE_INVALID BOOL FLOAT STRING] - Type *string `json:"type,omitempty"` - - // Bool value. - Bool bool `json:"bool,omitempty"` - - // Float value. - Float float64 `json:"float,omitempty"` - - // String value. - String string `json:"string,omitempty"` -} - -// Validate validates this list alert rules OK body rules items0 params values items0 -func (o *ListAlertRulesOKBodyRulesItems0ParamsValuesItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var listAlertRulesOkBodyRulesItems0ParamsValuesItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_TYPE_INVALID","BOOL","FLOAT","STRING"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - listAlertRulesOkBodyRulesItems0ParamsValuesItems0TypeTypePropEnum = append(listAlertRulesOkBodyRulesItems0ParamsValuesItems0TypeTypePropEnum, v) - } -} - -const ( - - // ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypePARAMTYPEINVALID captures enum value "PARAM_TYPE_INVALID" - ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypePARAMTYPEINVALID string = "PARAM_TYPE_INVALID" - - // ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypeBOOL captures enum value "BOOL" - ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypeBOOL string = "BOOL" - - // ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypeFLOAT captures enum value "FLOAT" - ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypeFLOAT string = "FLOAT" - - // ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypeSTRING captures enum value "STRING" - ListAlertRulesOKBodyRulesItems0ParamsValuesItems0TypeSTRING string = "STRING" -) - -// prop value enum -func (o *ListAlertRulesOKBodyRulesItems0ParamsValuesItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, listAlertRulesOkBodyRulesItems0ParamsValuesItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ListAlertRulesOKBodyRulesItems0ParamsValuesItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this list alert rules OK body rules items0 params values items0 based on context it is used -func (o *ListAlertRulesOKBodyRulesItems0ParamsValuesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsValuesItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyRulesItems0ParamsValuesItems0) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyRulesItems0ParamsValuesItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesOKBodyTotals PageTotals represents total values for pagination. -swagger:model ListAlertRulesOKBodyTotals -*/ -type ListAlertRulesOKBodyTotals struct { - // Total number of results. - TotalItems int32 `json:"total_items,omitempty"` - - // Total number of pages. - TotalPages int32 `json:"total_pages,omitempty"` -} - -// Validate validates this list alert rules OK body totals -func (o *ListAlertRulesOKBodyTotals) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules OK body totals based on context it is used -func (o *ListAlertRulesOKBodyTotals) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesOKBodyTotals) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesOKBodyTotals) UnmarshalBinary(b []byte) error { - var res ListAlertRulesOKBodyTotals - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ListAlertRulesParamsBodyPageParams PageParams represents page request parameters for pagination. -swagger:model ListAlertRulesParamsBodyPageParams -*/ -type ListAlertRulesParamsBodyPageParams struct { - // Maximum number of results per page. - PageSize int32 `json:"page_size,omitempty"` - - // Index of the requested page, starts from 0. - Index int32 `json:"index,omitempty"` -} - -// Validate validates this list alert rules params body page params -func (o *ListAlertRulesParamsBodyPageParams) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this list alert rules params body page params based on context it is used -func (o *ListAlertRulesParamsBodyPageParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ListAlertRulesParamsBodyPageParams) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ListAlertRulesParamsBodyPageParams) UnmarshalBinary(b []byte) error { - var res ListAlertRulesParamsBodyPageParams - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/rules/rules_client.go b/api/managementpb/ia/json/client/rules/rules_client.go deleted file mode 100644 index 5a14a8e792..0000000000 --- a/api/managementpb/ia/json/client/rules/rules_client.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new rules API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for rules API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - CreateAlertRule(params *CreateAlertRuleParams, opts ...ClientOption) (*CreateAlertRuleOK, error) - - DeleteAlertRule(params *DeleteAlertRuleParams, opts ...ClientOption) (*DeleteAlertRuleOK, error) - - ListAlertRules(params *ListAlertRulesParams, opts ...ClientOption) (*ListAlertRulesOK, error) - - ToggleAlertRule(params *ToggleAlertRuleParams, opts ...ClientOption) (*ToggleAlertRuleOK, error) - - UpdateAlertRule(params *UpdateAlertRuleParams, opts ...ClientOption) (*UpdateAlertRuleOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -CreateAlertRule creates alert rule creates alerting rule -*/ -func (a *Client) CreateAlertRule(params *CreateAlertRuleParams, opts ...ClientOption) (*CreateAlertRuleOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewCreateAlertRuleParams() - } - op := &runtime.ClientOperation{ - ID: "CreateAlertRule", - Method: "POST", - PathPattern: "/v1/management/ia/Rules/Create", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &CreateAlertRuleReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*CreateAlertRuleOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*CreateAlertRuleDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -DeleteAlertRule deletes alert rule deletes alerting rule -*/ -func (a *Client) DeleteAlertRule(params *DeleteAlertRuleParams, opts ...ClientOption) (*DeleteAlertRuleOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteAlertRuleParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteAlertRule", - Method: "POST", - PathPattern: "/v1/management/ia/Rules/Delete", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &DeleteAlertRuleReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteAlertRuleOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*DeleteAlertRuleDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -ListAlertRules lists alert rules returns a list of all alerting rules -*/ -func (a *Client) ListAlertRules(params *ListAlertRulesParams, opts ...ClientOption) (*ListAlertRulesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewListAlertRulesParams() - } - op := &runtime.ClientOperation{ - ID: "ListAlertRules", - Method: "POST", - PathPattern: "/v1/management/ia/Rules/List", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &ListAlertRulesReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ListAlertRulesOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ListAlertRulesDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -ToggleAlertRule toggles alert rule allows to switch between disabled and enabled states of an alert rule -*/ -func (a *Client) ToggleAlertRule(params *ToggleAlertRuleParams, opts ...ClientOption) (*ToggleAlertRuleOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewToggleAlertRuleParams() - } - op := &runtime.ClientOperation{ - ID: "ToggleAlertRule", - Method: "POST", - PathPattern: "/v1/management/ia/Rules/Toggle", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &ToggleAlertRuleReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ToggleAlertRuleOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ToggleAlertRuleDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -UpdateAlertRule updates alert rule updates alerting rule -*/ -func (a *Client) UpdateAlertRule(params *UpdateAlertRuleParams, opts ...ClientOption) (*UpdateAlertRuleOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewUpdateAlertRuleParams() - } - op := &runtime.ClientOperation{ - ID: "UpdateAlertRule", - Method: "POST", - PathPattern: "/v1/management/ia/Rules/Update", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &UpdateAlertRuleReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*UpdateAlertRuleOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*UpdateAlertRuleDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/api/managementpb/ia/json/client/rules/toggle_alert_rule_parameters.go b/api/managementpb/ia/json/client/rules/toggle_alert_rule_parameters.go deleted file mode 100644 index 98c9657468..0000000000 --- a/api/managementpb/ia/json/client/rules/toggle_alert_rule_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewToggleAlertRuleParams creates a new ToggleAlertRuleParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewToggleAlertRuleParams() *ToggleAlertRuleParams { - return &ToggleAlertRuleParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewToggleAlertRuleParamsWithTimeout creates a new ToggleAlertRuleParams object -// with the ability to set a timeout on a request. -func NewToggleAlertRuleParamsWithTimeout(timeout time.Duration) *ToggleAlertRuleParams { - return &ToggleAlertRuleParams{ - timeout: timeout, - } -} - -// NewToggleAlertRuleParamsWithContext creates a new ToggleAlertRuleParams object -// with the ability to set a context for a request. -func NewToggleAlertRuleParamsWithContext(ctx context.Context) *ToggleAlertRuleParams { - return &ToggleAlertRuleParams{ - Context: ctx, - } -} - -// NewToggleAlertRuleParamsWithHTTPClient creates a new ToggleAlertRuleParams object -// with the ability to set a custom HTTPClient for a request. -func NewToggleAlertRuleParamsWithHTTPClient(client *http.Client) *ToggleAlertRuleParams { - return &ToggleAlertRuleParams{ - HTTPClient: client, - } -} - -/* -ToggleAlertRuleParams contains all the parameters to send to the API endpoint - - for the toggle alert rule operation. - - Typically these are written to a http.Request. -*/ -type ToggleAlertRuleParams struct { - // Body. - Body ToggleAlertRuleBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the toggle alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ToggleAlertRuleParams) WithDefaults() *ToggleAlertRuleParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the toggle alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ToggleAlertRuleParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the toggle alert rule params -func (o *ToggleAlertRuleParams) WithTimeout(timeout time.Duration) *ToggleAlertRuleParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the toggle alert rule params -func (o *ToggleAlertRuleParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the toggle alert rule params -func (o *ToggleAlertRuleParams) WithContext(ctx context.Context) *ToggleAlertRuleParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the toggle alert rule params -func (o *ToggleAlertRuleParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the toggle alert rule params -func (o *ToggleAlertRuleParams) WithHTTPClient(client *http.Client) *ToggleAlertRuleParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the toggle alert rule params -func (o *ToggleAlertRuleParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the toggle alert rule params -func (o *ToggleAlertRuleParams) WithBody(body ToggleAlertRuleBody) *ToggleAlertRuleParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the toggle alert rule params -func (o *ToggleAlertRuleParams) SetBody(body ToggleAlertRuleBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *ToggleAlertRuleParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/rules/toggle_alert_rule_responses.go b/api/managementpb/ia/json/client/rules/toggle_alert_rule_responses.go deleted file mode 100644 index afbd371436..0000000000 --- a/api/managementpb/ia/json/client/rules/toggle_alert_rule_responses.go +++ /dev/null @@ -1,360 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ToggleAlertRuleReader is a Reader for the ToggleAlertRule structure. -type ToggleAlertRuleReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ToggleAlertRuleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewToggleAlertRuleOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewToggleAlertRuleDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewToggleAlertRuleOK creates a ToggleAlertRuleOK with default headers values -func NewToggleAlertRuleOK() *ToggleAlertRuleOK { - return &ToggleAlertRuleOK{} -} - -/* -ToggleAlertRuleOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ToggleAlertRuleOK struct { - Payload interface{} -} - -func (o *ToggleAlertRuleOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Toggle][%d] toggleAlertRuleOk %+v", 200, o.Payload) -} - -func (o *ToggleAlertRuleOK) GetPayload() interface{} { - return o.Payload -} - -func (o *ToggleAlertRuleOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewToggleAlertRuleDefault creates a ToggleAlertRuleDefault with default headers values -func NewToggleAlertRuleDefault(code int) *ToggleAlertRuleDefault { - return &ToggleAlertRuleDefault{ - _statusCode: code, - } -} - -/* -ToggleAlertRuleDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ToggleAlertRuleDefault struct { - _statusCode int - - Payload *ToggleAlertRuleDefaultBody -} - -// Code gets the status code for the toggle alert rule default response -func (o *ToggleAlertRuleDefault) Code() int { - return o._statusCode -} - -func (o *ToggleAlertRuleDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Toggle][%d] ToggleAlertRule default %+v", o._statusCode, o.Payload) -} - -func (o *ToggleAlertRuleDefault) GetPayload() *ToggleAlertRuleDefaultBody { - return o.Payload -} - -func (o *ToggleAlertRuleDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(ToggleAlertRuleDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -ToggleAlertRuleBody toggle alert rule body -swagger:model ToggleAlertRuleBody -*/ -type ToggleAlertRuleBody struct { - // Rule ID. - RuleID string `json:"rule_id,omitempty"` - - // BooleanFlag represent a command to set some boolean property to true, - // to false, or avoid changing that property. - // - // - DO_NOT_CHANGE: Do not change boolean property. Default value. - // - TRUE: True. - // - FALSE: False. - // Enum: [DO_NOT_CHANGE TRUE FALSE] - Disabled *string `json:"disabled,omitempty"` -} - -// Validate validates this toggle alert rule body -func (o *ToggleAlertRuleBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDisabled(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var toggleAlertRuleBodyTypeDisabledPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["DO_NOT_CHANGE","TRUE","FALSE"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - toggleAlertRuleBodyTypeDisabledPropEnum = append(toggleAlertRuleBodyTypeDisabledPropEnum, v) - } -} - -const ( - - // ToggleAlertRuleBodyDisabledDONOTCHANGE captures enum value "DO_NOT_CHANGE" - ToggleAlertRuleBodyDisabledDONOTCHANGE string = "DO_NOT_CHANGE" - - // ToggleAlertRuleBodyDisabledTRUE captures enum value "TRUE" - ToggleAlertRuleBodyDisabledTRUE string = "TRUE" - - // ToggleAlertRuleBodyDisabledFALSE captures enum value "FALSE" - ToggleAlertRuleBodyDisabledFALSE string = "FALSE" -) - -// prop value enum -func (o *ToggleAlertRuleBody) validateDisabledEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, toggleAlertRuleBodyTypeDisabledPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *ToggleAlertRuleBody) validateDisabled(formats strfmt.Registry) error { - if swag.IsZero(o.Disabled) { // not required - return nil - } - - // value enum - if err := o.validateDisabledEnum("body"+"."+"disabled", "body", *o.Disabled); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this toggle alert rule body based on context it is used -func (o *ToggleAlertRuleBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ToggleAlertRuleBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ToggleAlertRuleBody) UnmarshalBinary(b []byte) error { - var res ToggleAlertRuleBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ToggleAlertRuleDefaultBody toggle alert rule default body -swagger:model ToggleAlertRuleDefaultBody -*/ -type ToggleAlertRuleDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*ToggleAlertRuleDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this toggle alert rule default body -func (o *ToggleAlertRuleDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ToggleAlertRuleDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ToggleAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ToggleAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this toggle alert rule default body based on the context it is used -func (o *ToggleAlertRuleDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ToggleAlertRuleDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ToggleAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ToggleAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *ToggleAlertRuleDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ToggleAlertRuleDefaultBody) UnmarshalBinary(b []byte) error { - var res ToggleAlertRuleDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -ToggleAlertRuleDefaultBodyDetailsItems0 toggle alert rule default body details items0 -swagger:model ToggleAlertRuleDefaultBodyDetailsItems0 -*/ -type ToggleAlertRuleDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this toggle alert rule default body details items0 -func (o *ToggleAlertRuleDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this toggle alert rule default body details items0 based on context it is used -func (o *ToggleAlertRuleDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ToggleAlertRuleDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ToggleAlertRuleDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res ToggleAlertRuleDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/client/rules/update_alert_rule_parameters.go b/api/managementpb/ia/json/client/rules/update_alert_rule_parameters.go deleted file mode 100644 index 0e0b4d7bc6..0000000000 --- a/api/managementpb/ia/json/client/rules/update_alert_rule_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewUpdateAlertRuleParams creates a new UpdateAlertRuleParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewUpdateAlertRuleParams() *UpdateAlertRuleParams { - return &UpdateAlertRuleParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewUpdateAlertRuleParamsWithTimeout creates a new UpdateAlertRuleParams object -// with the ability to set a timeout on a request. -func NewUpdateAlertRuleParamsWithTimeout(timeout time.Duration) *UpdateAlertRuleParams { - return &UpdateAlertRuleParams{ - timeout: timeout, - } -} - -// NewUpdateAlertRuleParamsWithContext creates a new UpdateAlertRuleParams object -// with the ability to set a context for a request. -func NewUpdateAlertRuleParamsWithContext(ctx context.Context) *UpdateAlertRuleParams { - return &UpdateAlertRuleParams{ - Context: ctx, - } -} - -// NewUpdateAlertRuleParamsWithHTTPClient creates a new UpdateAlertRuleParams object -// with the ability to set a custom HTTPClient for a request. -func NewUpdateAlertRuleParamsWithHTTPClient(client *http.Client) *UpdateAlertRuleParams { - return &UpdateAlertRuleParams{ - HTTPClient: client, - } -} - -/* -UpdateAlertRuleParams contains all the parameters to send to the API endpoint - - for the update alert rule operation. - - Typically these are written to a http.Request. -*/ -type UpdateAlertRuleParams struct { - // Body. - Body UpdateAlertRuleBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the update alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *UpdateAlertRuleParams) WithDefaults() *UpdateAlertRuleParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the update alert rule params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *UpdateAlertRuleParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the update alert rule params -func (o *UpdateAlertRuleParams) WithTimeout(timeout time.Duration) *UpdateAlertRuleParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the update alert rule params -func (o *UpdateAlertRuleParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the update alert rule params -func (o *UpdateAlertRuleParams) WithContext(ctx context.Context) *UpdateAlertRuleParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the update alert rule params -func (o *UpdateAlertRuleParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the update alert rule params -func (o *UpdateAlertRuleParams) WithHTTPClient(client *http.Client) *UpdateAlertRuleParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the update alert rule params -func (o *UpdateAlertRuleParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the update alert rule params -func (o *UpdateAlertRuleParams) WithBody(body UpdateAlertRuleBody) *UpdateAlertRuleParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the update alert rule params -func (o *UpdateAlertRuleParams) SetBody(body UpdateAlertRuleBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *UpdateAlertRuleParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/managementpb/ia/json/client/rules/update_alert_rule_responses.go b/api/managementpb/ia/json/client/rules/update_alert_rule_responses.go deleted file mode 100644 index 13854b9415..0000000000 --- a/api/managementpb/ia/json/client/rules/update_alert_rule_responses.go +++ /dev/null @@ -1,715 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rules - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// UpdateAlertRuleReader is a Reader for the UpdateAlertRule structure. -type UpdateAlertRuleReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *UpdateAlertRuleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewUpdateAlertRuleOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewUpdateAlertRuleDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewUpdateAlertRuleOK creates a UpdateAlertRuleOK with default headers values -func NewUpdateAlertRuleOK() *UpdateAlertRuleOK { - return &UpdateAlertRuleOK{} -} - -/* -UpdateAlertRuleOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type UpdateAlertRuleOK struct { - Payload interface{} -} - -func (o *UpdateAlertRuleOK) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Update][%d] updateAlertRuleOk %+v", 200, o.Payload) -} - -func (o *UpdateAlertRuleOK) GetPayload() interface{} { - return o.Payload -} - -func (o *UpdateAlertRuleOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewUpdateAlertRuleDefault creates a UpdateAlertRuleDefault with default headers values -func NewUpdateAlertRuleDefault(code int) *UpdateAlertRuleDefault { - return &UpdateAlertRuleDefault{ - _statusCode: code, - } -} - -/* -UpdateAlertRuleDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type UpdateAlertRuleDefault struct { - _statusCode int - - Payload *UpdateAlertRuleDefaultBody -} - -// Code gets the status code for the update alert rule default response -func (o *UpdateAlertRuleDefault) Code() int { - return o._statusCode -} - -func (o *UpdateAlertRuleDefault) Error() string { - return fmt.Sprintf("[POST /v1/management/ia/Rules/Update][%d] UpdateAlertRule default %+v", o._statusCode, o.Payload) -} - -func (o *UpdateAlertRuleDefault) GetPayload() *UpdateAlertRuleDefaultBody { - return o.Payload -} - -func (o *UpdateAlertRuleDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(UpdateAlertRuleDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -UpdateAlertRuleBody update alert rule body -swagger:model UpdateAlertRuleBody -*/ -type UpdateAlertRuleBody struct { - // Rule ID. - RuleID string `json:"rule_id,omitempty"` - - // Rule name. Should be set. - Name string `json:"name,omitempty"` - - // New rule status. Should be set. - Disabled bool `json:"disabled,omitempty"` - - // Rule parameters. All template parameters should be set. - Params []*UpdateAlertRuleParamsBodyParamsItems0 `json:"params"` - - // Rule duration. Should be set. - For string `json:"for,omitempty"` - - // Severity represents severity level of the check result or alert. - // Enum: [SEVERITY_INVALID SEVERITY_EMERGENCY SEVERITY_ALERT SEVERITY_CRITICAL SEVERITY_ERROR SEVERITY_WARNING SEVERITY_NOTICE SEVERITY_INFO SEVERITY_DEBUG] - Severity *string `json:"severity,omitempty"` - - // All custom labels to add or remove (with empty values) to default labels from template. - CustomLabels map[string]string `json:"custom_labels,omitempty"` - - // Filters. Should be set. - Filters []*UpdateAlertRuleParamsBodyFiltersItems0 `json:"filters"` - - // Channels. Should be set. - ChannelIds []string `json:"channel_ids"` -} - -// Validate validates this update alert rule body -func (o *UpdateAlertRuleBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateParams(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSeverity(formats); err != nil { - res = append(res, err) - } - - if err := o.validateFilters(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *UpdateAlertRuleBody) validateParams(formats strfmt.Registry) error { - if swag.IsZero(o.Params) { // not required - return nil - } - - for i := 0; i < len(o.Params); i++ { - if swag.IsZero(o.Params[i]) { // not required - continue - } - - if o.Params[i] != nil { - if err := o.Params[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -var updateAlertRuleBodyTypeSeverityPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["SEVERITY_INVALID","SEVERITY_EMERGENCY","SEVERITY_ALERT","SEVERITY_CRITICAL","SEVERITY_ERROR","SEVERITY_WARNING","SEVERITY_NOTICE","SEVERITY_INFO","SEVERITY_DEBUG"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - updateAlertRuleBodyTypeSeverityPropEnum = append(updateAlertRuleBodyTypeSeverityPropEnum, v) - } -} - -const ( - - // UpdateAlertRuleBodySeveritySEVERITYINVALID captures enum value "SEVERITY_INVALID" - UpdateAlertRuleBodySeveritySEVERITYINVALID string = "SEVERITY_INVALID" - - // UpdateAlertRuleBodySeveritySEVERITYEMERGENCY captures enum value "SEVERITY_EMERGENCY" - UpdateAlertRuleBodySeveritySEVERITYEMERGENCY string = "SEVERITY_EMERGENCY" - - // UpdateAlertRuleBodySeveritySEVERITYALERT captures enum value "SEVERITY_ALERT" - UpdateAlertRuleBodySeveritySEVERITYALERT string = "SEVERITY_ALERT" - - // UpdateAlertRuleBodySeveritySEVERITYCRITICAL captures enum value "SEVERITY_CRITICAL" - UpdateAlertRuleBodySeveritySEVERITYCRITICAL string = "SEVERITY_CRITICAL" - - // UpdateAlertRuleBodySeveritySEVERITYERROR captures enum value "SEVERITY_ERROR" - UpdateAlertRuleBodySeveritySEVERITYERROR string = "SEVERITY_ERROR" - - // UpdateAlertRuleBodySeveritySEVERITYWARNING captures enum value "SEVERITY_WARNING" - UpdateAlertRuleBodySeveritySEVERITYWARNING string = "SEVERITY_WARNING" - - // UpdateAlertRuleBodySeveritySEVERITYNOTICE captures enum value "SEVERITY_NOTICE" - UpdateAlertRuleBodySeveritySEVERITYNOTICE string = "SEVERITY_NOTICE" - - // UpdateAlertRuleBodySeveritySEVERITYINFO captures enum value "SEVERITY_INFO" - UpdateAlertRuleBodySeveritySEVERITYINFO string = "SEVERITY_INFO" - - // UpdateAlertRuleBodySeveritySEVERITYDEBUG captures enum value "SEVERITY_DEBUG" - UpdateAlertRuleBodySeveritySEVERITYDEBUG string = "SEVERITY_DEBUG" -) - -// prop value enum -func (o *UpdateAlertRuleBody) validateSeverityEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, updateAlertRuleBodyTypeSeverityPropEnum, true); err != nil { - return err - } - return nil -} - -func (o *UpdateAlertRuleBody) validateSeverity(formats strfmt.Registry) error { - if swag.IsZero(o.Severity) { // not required - return nil - } - - // value enum - if err := o.validateSeverityEnum("body"+"."+"severity", "body", *o.Severity); err != nil { - return err - } - - return nil -} - -func (o *UpdateAlertRuleBody) validateFilters(formats strfmt.Registry) error { - if swag.IsZero(o.Filters) { // not required - return nil - } - - for i := 0; i < len(o.Filters); i++ { - if swag.IsZero(o.Filters[i]) { // not required - continue - } - - if o.Filters[i] != nil { - if err := o.Filters[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this update alert rule body based on the context it is used -func (o *UpdateAlertRuleBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateParams(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateFilters(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *UpdateAlertRuleBody) contextValidateParams(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Params); i++ { - if o.Params[i] != nil { - if err := o.Params[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "params" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -func (o *UpdateAlertRuleBody) contextValidateFilters(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Filters); i++ { - if o.Filters[i] != nil { - if err := o.Filters[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "filters" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *UpdateAlertRuleBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *UpdateAlertRuleBody) UnmarshalBinary(b []byte) error { - var res UpdateAlertRuleBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -UpdateAlertRuleDefaultBody update alert rule default body -swagger:model UpdateAlertRuleDefaultBody -*/ -type UpdateAlertRuleDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*UpdateAlertRuleDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this update alert rule default body -func (o *UpdateAlertRuleDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *UpdateAlertRuleDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("UpdateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("UpdateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this update alert rule default body based on the context it is used -func (o *UpdateAlertRuleDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *UpdateAlertRuleDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("UpdateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("UpdateAlertRule default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *UpdateAlertRuleDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *UpdateAlertRuleDefaultBody) UnmarshalBinary(b []byte) error { - var res UpdateAlertRuleDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -UpdateAlertRuleDefaultBodyDetailsItems0 update alert rule default body details items0 -swagger:model UpdateAlertRuleDefaultBodyDetailsItems0 -*/ -type UpdateAlertRuleDefaultBodyDetailsItems0 struct { - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this update alert rule default body details items0 -func (o *UpdateAlertRuleDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this update alert rule default body details items0 based on context it is used -func (o *UpdateAlertRuleDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *UpdateAlertRuleDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *UpdateAlertRuleDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res UpdateAlertRuleDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -UpdateAlertRuleParamsBodyFiltersItems0 Filter repsents a single filter condition. -swagger:model UpdateAlertRuleParamsBodyFiltersItems0 -*/ -type UpdateAlertRuleParamsBodyFiltersItems0 struct { - // FilterType represents filter matching type. - // - // - EQUAL: = - // - // != - // NOT_EQUAL = 2; - // - REGEX: =~ - // - // !~ - // NOT_REGEX = 4; - // Enum: [FILTER_TYPE_INVALID EQUAL REGEX] - Type *string `json:"type,omitempty"` - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this update alert rule params body filters items0 -func (o *UpdateAlertRuleParamsBodyFiltersItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var updateAlertRuleParamsBodyFiltersItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["FILTER_TYPE_INVALID","EQUAL","REGEX"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - updateAlertRuleParamsBodyFiltersItems0TypeTypePropEnum = append(updateAlertRuleParamsBodyFiltersItems0TypeTypePropEnum, v) - } -} - -const ( - - // UpdateAlertRuleParamsBodyFiltersItems0TypeFILTERTYPEINVALID captures enum value "FILTER_TYPE_INVALID" - UpdateAlertRuleParamsBodyFiltersItems0TypeFILTERTYPEINVALID string = "FILTER_TYPE_INVALID" - - // UpdateAlertRuleParamsBodyFiltersItems0TypeEQUAL captures enum value "EQUAL" - UpdateAlertRuleParamsBodyFiltersItems0TypeEQUAL string = "EQUAL" - - // UpdateAlertRuleParamsBodyFiltersItems0TypeREGEX captures enum value "REGEX" - UpdateAlertRuleParamsBodyFiltersItems0TypeREGEX string = "REGEX" -) - -// prop value enum -func (o *UpdateAlertRuleParamsBodyFiltersItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, updateAlertRuleParamsBodyFiltersItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *UpdateAlertRuleParamsBodyFiltersItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this update alert rule params body filters items0 based on context it is used -func (o *UpdateAlertRuleParamsBodyFiltersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *UpdateAlertRuleParamsBodyFiltersItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *UpdateAlertRuleParamsBodyFiltersItems0) UnmarshalBinary(b []byte) error { - var res UpdateAlertRuleParamsBodyFiltersItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -UpdateAlertRuleParamsBodyParamsItems0 ParamValue represents a single rule parameter value for List, Change and Update APIs. -swagger:model UpdateAlertRuleParamsBodyParamsItems0 -*/ -type UpdateAlertRuleParamsBodyParamsItems0 struct { - // Machine-readable name (ID) that is used in expression. - Name string `json:"name,omitempty"` - - // ParamType represents template parameter type. - // Enum: [PARAM_TYPE_INVALID BOOL FLOAT STRING] - Type *string `json:"type,omitempty"` - - // Bool value. - Bool bool `json:"bool,omitempty"` - - // Float value. - Float float64 `json:"float,omitempty"` - - // String value. - String string `json:"string,omitempty"` -} - -// Validate validates this update alert rule params body params items0 -func (o *UpdateAlertRuleParamsBodyParamsItems0) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var updateAlertRuleParamsBodyParamsItems0TypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["PARAM_TYPE_INVALID","BOOL","FLOAT","STRING"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - updateAlertRuleParamsBodyParamsItems0TypeTypePropEnum = append(updateAlertRuleParamsBodyParamsItems0TypeTypePropEnum, v) - } -} - -const ( - - // UpdateAlertRuleParamsBodyParamsItems0TypePARAMTYPEINVALID captures enum value "PARAM_TYPE_INVALID" - UpdateAlertRuleParamsBodyParamsItems0TypePARAMTYPEINVALID string = "PARAM_TYPE_INVALID" - - // UpdateAlertRuleParamsBodyParamsItems0TypeBOOL captures enum value "BOOL" - UpdateAlertRuleParamsBodyParamsItems0TypeBOOL string = "BOOL" - - // UpdateAlertRuleParamsBodyParamsItems0TypeFLOAT captures enum value "FLOAT" - UpdateAlertRuleParamsBodyParamsItems0TypeFLOAT string = "FLOAT" - - // UpdateAlertRuleParamsBodyParamsItems0TypeSTRING captures enum value "STRING" - UpdateAlertRuleParamsBodyParamsItems0TypeSTRING string = "STRING" -) - -// prop value enum -func (o *UpdateAlertRuleParamsBodyParamsItems0) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, updateAlertRuleParamsBodyParamsItems0TypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (o *UpdateAlertRuleParamsBodyParamsItems0) validateType(formats strfmt.Registry) error { - if swag.IsZero(o.Type) { // not required - return nil - } - - // value enum - if err := o.validateTypeEnum("type", "body", *o.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this update alert rule params body params items0 based on context it is used -func (o *UpdateAlertRuleParamsBodyParamsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *UpdateAlertRuleParamsBodyParamsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *UpdateAlertRuleParamsBodyParamsItems0) UnmarshalBinary(b []byte) error { - var res UpdateAlertRuleParamsBodyParamsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/managementpb/ia/json/header.json b/api/managementpb/ia/json/header.json deleted file mode 100644 index 0ace53f924..0000000000 --- a/api/managementpb/ia/json/header.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "PMM Integrated Alerting API", - "version": "v1beta1" - }, - "schemes": [ - "https", - "http" - ] -} diff --git a/api/managementpb/ia/json/ia.json b/api/managementpb/ia/json/ia.json deleted file mode 100644 index 7e941ad93e..0000000000 --- a/api/managementpb/ia/json/ia.json +++ /dev/null @@ -1,2727 +0,0 @@ -{ - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "https", - "http" - ], - "swagger": "2.0", - "info": { - "title": "PMM Integrated Alerting API", - "version": "v1beta1" - }, - "paths": { - "/v1/management/ia/Alerts/List": { - "post": { - "tags": [ - "Alerts" - ], - "summary": "ListAlerts returns a list of all Alerts.", - "operationId": "ListAlerts", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "alerts": { - "type": "array", - "items": { - "description": "Alert represents Alert.", - "type": "object", - "properties": { - "alert_id": { - "description": "ID.", - "type": "string", - "x-order": 0 - }, - "created_at": { - "description": "Alert creation time.", - "type": "string", - "format": "date-time", - "x-order": 6 - }, - "labels": { - "description": "Combined labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 4 - }, - "rule": { - "description": "Rule represents Alert Rule.", - "type": "object", - "properties": { - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 15 - }, - "channels": { - "description": "Channels.", - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "channel": { - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 4 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - }, - "username": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 3 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 5 - } - } - }, - "x-order": 17 - }, - "created_at": { - "description": "Rule creation time.", - "type": "string", - "format": "date-time", - "x-order": 18 - }, - "custom_labels": { - "description": "Custom labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 13 - }, - "default_for": { - "description": "Default for duration.", - "type": "string", - "x-order": 9 - }, - "default_severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 11 - }, - "disabled": { - "description": "True if that rule is disabled.", - "type": "boolean", - "x-order": 4 - }, - "expr": { - "description": "Expression filled with parameters.", - "type": "string", - "x-order": 6 - }, - "expr_template": { - "description": "Expression template.", - "type": "string", - "x-order": 5 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 1 - }, - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 16 - }, - "for": { - "description": "For duration.", - "type": "string", - "x-order": 10 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 14 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "params_definitions": { - "description": "Expression parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - } - }, - "x-order": 5 - }, - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - }, - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 6 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - } - } - }, - "x-order": 7 - }, - "params_values": { - "description": "Expression parameters values.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - } - } - }, - "x-order": 8 - }, - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 12 - }, - "summary": { - "description": "Rule human-readable summary.", - "type": "string", - "x-order": 2 - }, - "template_name": { - "description": "Template used for this rule.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 5 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 2 - }, - "status": { - "description": "Status represents Alert Rule's and Alert's combined status.\n\n - CLEAR: No alert.\n - PENDING: Pending, but not triggering alert.\n - TRIGGERING: Triggering (firing) alert.\n - SILENCED: Silenced alert.", - "type": "string", - "default": "STATUS_INVALID", - "enum": [ - "STATUS_INVALID", - "CLEAR", - "PENDING", - "TRIGGERING", - "SILENCED" - ], - "x-order": 3 - }, - "summary": { - "description": "Human-readable summary.", - "type": "string", - "x-order": 1 - }, - "updated_at": { - "description": "Alert last update time.", - "type": "string", - "format": "date-time", - "x-order": 7 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Alerts/Toggle": { - "post": { - "description": "Pass empty list to apply toggle action to all existing alerts", - "tags": [ - "Alerts" - ], - "summary": "ToggleAlerts allows to switch alerts state between silenced and unsilenced.", - "operationId": "ToggleAlerts", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "alert_ids": { - "description": "List of alerts that silence state should be switched. If provided array is empty than all\nexisting alerts are switched.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 0 - }, - "silenced": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Add": { - "post": { - "tags": [ - "Channels" - ], - "summary": "AddChannel adds notification channel.", - "operationId": "AddChannel", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "disabled": { - "description": "New channel status.", - "type": "boolean", - "x-order": 5 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 1 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 2 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "channel": { - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 3 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 0 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - }, - "username": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 3 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Change": { - "post": { - "tags": [ - "Channels" - ], - "summary": "ChangeChannel changes notification channel.", - "operationId": "ChangeChannel", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "disabled": { - "description": "Enables or disables that channel. Should be set.", - "type": "boolean", - "x-order": 6 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "channel": { - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 4 - }, - "summary": { - "description": "Short human-readable summary. Empty value will not change it.", - "type": "string", - "x-order": 1 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - }, - "username": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 3 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/List": { - "post": { - "tags": [ - "Channels" - ], - "summary": "ListChannels returns a list of all notifation channels.", - "operationId": "ListChannels", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "channels": { - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "channel": { - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 4 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - }, - "username": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 3 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 5 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Remove": { - "post": { - "tags": [ - "Channels" - ], - "summary": "RemoveChannel removes notification channel.", - "operationId": "RemoveChannel", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_id": { - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Create": { - "post": { - "tags": [ - "Rules" - ], - "summary": "CreateAlertRule creates Alerting rule.", - "operationId": "CreateAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_ids": { - "description": "Channels. Should be set.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 9 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 7 - }, - "disabled": { - "description": "New rule status.", - "type": "boolean", - "x-order": 3 - }, - "filters": { - "description": "Filters. Should be set.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 1 - }, - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 8 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 5 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 2 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - } - } - }, - "x-order": 4 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 6 - }, - "source_rule_id": { - "description": "ID of the rule that will be used as source. Can't be specified simultaneously with template_name.", - "type": "string", - "x-order": 1 - }, - "template_name": { - "description": "Template name. Can't be specified simultaneously with source_rule_id.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Delete": { - "post": { - "tags": [ - "Rules" - ], - "summary": "DeleteAlertRule deletes Alerting rule.", - "operationId": "DeleteAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/List": { - "post": { - "tags": [ - "Rules" - ], - "summary": "ListAlertRules returns a list of all Alerting rules.", - "operationId": "ListAlertRules", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "rules": { - "type": "array", - "items": { - "description": "Rule represents Alert Rule.", - "type": "object", - "properties": { - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 15 - }, - "channels": { - "description": "Channels.", - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "channel": { - "type": "string", - "x-order": 1 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 4 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - }, - "username": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 3 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - }, - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 5 - } - } - }, - "x-order": 17 - }, - "created_at": { - "description": "Rule creation time.", - "type": "string", - "format": "date-time", - "x-order": 18 - }, - "custom_labels": { - "description": "Custom labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 13 - }, - "default_for": { - "description": "Default for duration.", - "type": "string", - "x-order": 9 - }, - "default_severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 11 - }, - "disabled": { - "description": "True if that rule is disabled.", - "type": "boolean", - "x-order": 4 - }, - "expr": { - "description": "Expression filled with parameters.", - "type": "string", - "x-order": 6 - }, - "expr_template": { - "description": "Expression template.", - "type": "string", - "x-order": 5 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 1 - }, - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 16 - }, - "for": { - "description": "For duration.", - "type": "string", - "x-order": 10 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 14 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "params_definitions": { - "description": "Expression parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - } - }, - "x-order": 5 - }, - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - }, - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - } - }, - "x-order": 6 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - } - } - }, - "x-order": 7 - }, - "params_values": { - "description": "Expression parameters values.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - } - } - }, - "x-order": 8 - }, - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 12 - }, - "summary": { - "description": "Rule human-readable summary.", - "type": "string", - "x-order": 2 - }, - "template_name": { - "description": "Template used for this rule.", - "type": "string", - "x-order": 3 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Toggle": { - "post": { - "tags": [ - "Rules" - ], - "summary": "ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule.", - "operationId": "ToggleAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "disabled": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 1 - }, - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Update": { - "post": { - "tags": [ - "Rules" - ], - "summary": "UpdateAlertRule updates Alerting rule.", - "operationId": "UpdateAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_ids": { - "description": "Channels. Should be set.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 8 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 6 - }, - "disabled": { - "description": "New rule status. Should be set.", - "type": "boolean", - "x-order": 2 - }, - "filters": { - "description": "Filters. Should be set.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 1 - }, - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 7 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 4 - }, - "name": { - "description": "Rule name. Should be set.", - "type": "string", - "x-order": 1 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - } - } - }, - "x-order": 3 - }, - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - } - }, - "tags": [ - { - "name": "Alerts" - }, - { - "name": "Channels" - }, - { - "name": "Rules" - } - ] -} \ No newline at end of file diff --git a/api/managementpb/ia/rules.pb.go b/api/managementpb/ia/rules.pb.go deleted file mode 100644 index 68a00efa00..0000000000 --- a/api/managementpb/ia/rules.pb.go +++ /dev/null @@ -1,1671 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: managementpb/ia/rules.proto - -package iav1beta1 - -import ( - reflect "reflect" - sync "sync" - - _ "github.com/envoyproxy/protoc-gen-validate/validate" - _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - - managementpb "github.com/percona/pmm/api/managementpb" - alerting "github.com/percona/pmm/api/managementpb/alerting" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// FilterType represents filter matching type. -// -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type FilterType int32 - -const ( - FilterType_FILTER_TYPE_INVALID FilterType = 0 - // = - FilterType_EQUAL FilterType = 1 - // =~ - FilterType_REGEX FilterType = 3 -) - -// Enum value maps for FilterType. -var ( - FilterType_name = map[int32]string{ - 0: "FILTER_TYPE_INVALID", - 1: "EQUAL", - 3: "REGEX", - } - FilterType_value = map[string]int32{ - "FILTER_TYPE_INVALID": 0, - "EQUAL": 1, - "REGEX": 3, - } -) - -func (x FilterType) Enum() *FilterType { - p := new(FilterType) - *p = x - return p -} - -func (x FilterType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FilterType) Descriptor() protoreflect.EnumDescriptor { - return file_managementpb_ia_rules_proto_enumTypes[0].Descriptor() -} - -func (FilterType) Type() protoreflect.EnumType { - return &file_managementpb_ia_rules_proto_enumTypes[0] -} - -func (x FilterType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FilterType.Descriptor instead. -func (FilterType) EnumDescriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{0} -} - -// Filter repsents a single filter condition. -// -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type Filter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type FilterType `protobuf:"varint,1,opt,name=type,proto3,enum=ia.v1beta1.FilterType" json:"type,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Filter) Reset() { - *x = Filter{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Filter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Filter) ProtoMessage() {} - -func (x *Filter) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Filter.ProtoReflect.Descriptor instead. -func (*Filter) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{0} -} - -func (x *Filter) GetType() FilterType { - if x != nil { - return x.Type - } - return FilterType_FILTER_TYPE_INVALID -} - -func (x *Filter) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Filter) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// ParamValue represents a single rule parameter value for List, Change and Update APIs. -// -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type ParamValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Machine-readable name (ID) that is used in expression. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Parameter type. - Type alerting.ParamType `protobuf:"varint,2,opt,name=type,proto3,enum=alerting.v1.ParamType" json:"type,omitempty"` - // Parameter value. - // - // Types that are assignable to Value: - // - // *ParamValue_Bool - // *ParamValue_Float - // *ParamValue_String_ - Value isParamValue_Value `protobuf_oneof:"value"` -} - -func (x *ParamValue) Reset() { - *x = ParamValue{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamValue) ProtoMessage() {} - -func (x *ParamValue) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParamValue.ProtoReflect.Descriptor instead. -func (*ParamValue) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{1} -} - -func (x *ParamValue) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ParamValue) GetType() alerting.ParamType { - if x != nil { - return x.Type - } - return alerting.ParamType(0) -} - -func (m *ParamValue) GetValue() isParamValue_Value { - if m != nil { - return m.Value - } - return nil -} - -func (x *ParamValue) GetBool() bool { - if x, ok := x.GetValue().(*ParamValue_Bool); ok { - return x.Bool - } - return false -} - -func (x *ParamValue) GetFloat() float64 { - if x, ok := x.GetValue().(*ParamValue_Float); ok { - return x.Float - } - return 0 -} - -func (x *ParamValue) GetString_() string { - if x, ok := x.GetValue().(*ParamValue_String_); ok { - return x.String_ - } - return "" -} - -type isParamValue_Value interface { - isParamValue_Value() -} - -type ParamValue_Bool struct { - // Bool value. - Bool bool `protobuf:"varint,3,opt,name=bool,proto3,oneof"` -} - -type ParamValue_Float struct { - // Float value. - Float float64 `protobuf:"fixed64,4,opt,name=float,proto3,oneof"` -} - -type ParamValue_String_ struct { - // String value. - String_ string `protobuf:"bytes,5,opt,name=string,proto3,oneof"` -} - -func (*ParamValue_Bool) isParamValue_Value() {} - -func (*ParamValue_Float) isParamValue_Value() {} - -func (*ParamValue_String_) isParamValue_Value() {} - -// Rule represents Alert Rule. -// -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type Rule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rule ID. - RuleId string `protobuf:"bytes,1,opt,name=rule_id,json=ruleId,proto3" json:"rule_id,omitempty"` - // Rule name. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // Rule human-readable summary. - Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"` - // Template used for this rule. - TemplateName string `protobuf:"bytes,4,opt,name=template_name,json=templateName,proto3" json:"template_name,omitempty"` - // True if that rule is disabled. - Disabled bool `protobuf:"varint,5,opt,name=disabled,proto3" json:"disabled,omitempty"` - // Expression template. - ExprTemplate string `protobuf:"bytes,6,opt,name=expr_template,json=exprTemplate,proto3" json:"expr_template,omitempty"` - // Expression filled with parameters. - Expr string `protobuf:"bytes,7,opt,name=expr,proto3" json:"expr,omitempty"` - // Expression parameters definitions. - ParamsDefinitions []*alerting.ParamDefinition `protobuf:"bytes,8,rep,name=params_definitions,json=paramsDefinitions,proto3" json:"params_definitions,omitempty"` - // Expression parameters values. - ParamsValues []*ParamValue `protobuf:"bytes,9,rep,name=params_values,json=paramsValues,proto3" json:"params_values,omitempty"` - // Default for duration. - DefaultFor *durationpb.Duration `protobuf:"bytes,10,opt,name=default_for,json=defaultFor,proto3" json:"default_for,omitempty"` - // For duration. - For *durationpb.Duration `protobuf:"bytes,11,opt,name=for,proto3" json:"for,omitempty"` - // Default severity. - DefaultSeverity managementpb.Severity `protobuf:"varint,12,opt,name=default_severity,json=defaultSeverity,proto3,enum=management.Severity" json:"default_severity,omitempty"` - // Severity. - Severity managementpb.Severity `protobuf:"varint,13,opt,name=severity,proto3,enum=management.Severity" json:"severity,omitempty"` - // Custom labels. - CustomLabels map[string]string `protobuf:"bytes,14,rep,name=custom_labels,json=customLabels,proto3" json:"custom_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Labels. - Labels map[string]string `protobuf:"bytes,15,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Annotations. - Annotations map[string]string `protobuf:"bytes,16,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Filters. - Filters []*Filter `protobuf:"bytes,17,rep,name=filters,proto3" json:"filters,omitempty"` - // Channels. - Channels []*Channel `protobuf:"bytes,18,rep,name=channels,proto3" json:"channels,omitempty"` - // Rule creation time. - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,19,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` -} - -func (x *Rule) Reset() { - *x = Rule{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Rule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Rule) ProtoMessage() {} - -func (x *Rule) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Rule.ProtoReflect.Descriptor instead. -func (*Rule) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{2} -} - -func (x *Rule) GetRuleId() string { - if x != nil { - return x.RuleId - } - return "" -} - -func (x *Rule) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Rule) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Rule) GetTemplateName() string { - if x != nil { - return x.TemplateName - } - return "" -} - -func (x *Rule) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -func (x *Rule) GetExprTemplate() string { - if x != nil { - return x.ExprTemplate - } - return "" -} - -func (x *Rule) GetExpr() string { - if x != nil { - return x.Expr - } - return "" -} - -func (x *Rule) GetParamsDefinitions() []*alerting.ParamDefinition { - if x != nil { - return x.ParamsDefinitions - } - return nil -} - -func (x *Rule) GetParamsValues() []*ParamValue { - if x != nil { - return x.ParamsValues - } - return nil -} - -func (x *Rule) GetDefaultFor() *durationpb.Duration { - if x != nil { - return x.DefaultFor - } - return nil -} - -func (x *Rule) GetFor() *durationpb.Duration { - if x != nil { - return x.For - } - return nil -} - -func (x *Rule) GetDefaultSeverity() managementpb.Severity { - if x != nil { - return x.DefaultSeverity - } - return managementpb.Severity(0) -} - -func (x *Rule) GetSeverity() managementpb.Severity { - if x != nil { - return x.Severity - } - return managementpb.Severity(0) -} - -func (x *Rule) GetCustomLabels() map[string]string { - if x != nil { - return x.CustomLabels - } - return nil -} - -func (x *Rule) GetLabels() map[string]string { - if x != nil { - return x.Labels - } - return nil -} - -func (x *Rule) GetAnnotations() map[string]string { - if x != nil { - return x.Annotations - } - return nil -} - -func (x *Rule) GetFilters() []*Filter { - if x != nil { - return x.Filters - } - return nil -} - -func (x *Rule) GetChannels() []*Channel { - if x != nil { - return x.Channels - } - return nil -} - -func (x *Rule) GetCreatedAt() *timestamppb.Timestamp { - if x != nil { - return x.CreatedAt - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type ListAlertRulesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Page request. - PageParams *managementpb.PageParams `protobuf:"bytes,1,opt,name=page_params,json=pageParams,proto3" json:"page_params,omitempty"` -} - -func (x *ListAlertRulesRequest) Reset() { - *x = ListAlertRulesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListAlertRulesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAlertRulesRequest) ProtoMessage() {} - -func (x *ListAlertRulesRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAlertRulesRequest.ProtoReflect.Descriptor instead. -func (*ListAlertRulesRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{3} -} - -func (x *ListAlertRulesRequest) GetPageParams() *managementpb.PageParams { - if x != nil { - return x.PageParams - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type ListAlertRulesResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rules []*Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` - // Total items and pages. - Totals *managementpb.PageTotals `protobuf:"bytes,2,opt,name=totals,proto3" json:"totals,omitempty"` -} - -func (x *ListAlertRulesResponse) Reset() { - *x = ListAlertRulesResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListAlertRulesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAlertRulesResponse) ProtoMessage() {} - -func (x *ListAlertRulesResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAlertRulesResponse.ProtoReflect.Descriptor instead. -func (*ListAlertRulesResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{4} -} - -func (x *ListAlertRulesResponse) GetRules() []*Rule { - if x != nil { - return x.Rules - } - return nil -} - -func (x *ListAlertRulesResponse) GetTotals() *managementpb.PageTotals { - if x != nil { - return x.Totals - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type CreateAlertRuleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Template name. Can't be specified simultaneously with source_rule_id. - TemplateName string `protobuf:"bytes,1,opt,name=template_name,json=templateName,proto3" json:"template_name,omitempty"` - // ID of the rule that will be used as source. Can't be specified simultaneously with template_name. - SourceRuleId string `protobuf:"bytes,2,opt,name=source_rule_id,json=sourceRuleId,proto3" json:"source_rule_id,omitempty"` - // Rule name. - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - // New rule status. - Disabled bool `protobuf:"varint,4,opt,name=disabled,proto3" json:"disabled,omitempty"` - // Rule parameters. All template parameters should be set. - Params []*ParamValue `protobuf:"bytes,5,rep,name=params,proto3" json:"params,omitempty"` - // Rule duration. Should be set. - For *durationpb.Duration `protobuf:"bytes,6,opt,name=for,proto3" json:"for,omitempty"` - // Rule severity. Should be set. - Severity managementpb.Severity `protobuf:"varint,7,opt,name=severity,proto3,enum=management.Severity" json:"severity,omitempty"` - // All custom labels to add or remove (with empty values) to default labels from template. - CustomLabels map[string]string `protobuf:"bytes,8,rep,name=custom_labels,json=customLabels,proto3" json:"custom_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Filters. Should be set. - Filters []*Filter `protobuf:"bytes,9,rep,name=filters,proto3" json:"filters,omitempty"` - // Channels. Should be set. - ChannelIds []string `protobuf:"bytes,10,rep,name=channel_ids,json=channelIds,proto3" json:"channel_ids,omitempty"` -} - -func (x *CreateAlertRuleRequest) Reset() { - *x = CreateAlertRuleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateAlertRuleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateAlertRuleRequest) ProtoMessage() {} - -func (x *CreateAlertRuleRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateAlertRuleRequest.ProtoReflect.Descriptor instead. -func (*CreateAlertRuleRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{5} -} - -func (x *CreateAlertRuleRequest) GetTemplateName() string { - if x != nil { - return x.TemplateName - } - return "" -} - -func (x *CreateAlertRuleRequest) GetSourceRuleId() string { - if x != nil { - return x.SourceRuleId - } - return "" -} - -func (x *CreateAlertRuleRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CreateAlertRuleRequest) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -func (x *CreateAlertRuleRequest) GetParams() []*ParamValue { - if x != nil { - return x.Params - } - return nil -} - -func (x *CreateAlertRuleRequest) GetFor() *durationpb.Duration { - if x != nil { - return x.For - } - return nil -} - -func (x *CreateAlertRuleRequest) GetSeverity() managementpb.Severity { - if x != nil { - return x.Severity - } - return managementpb.Severity(0) -} - -func (x *CreateAlertRuleRequest) GetCustomLabels() map[string]string { - if x != nil { - return x.CustomLabels - } - return nil -} - -func (x *CreateAlertRuleRequest) GetFilters() []*Filter { - if x != nil { - return x.Filters - } - return nil -} - -func (x *CreateAlertRuleRequest) GetChannelIds() []string { - if x != nil { - return x.ChannelIds - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type CreateAlertRuleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rule ID. - RuleId string `protobuf:"bytes,1,opt,name=rule_id,json=ruleId,proto3" json:"rule_id,omitempty"` -} - -func (x *CreateAlertRuleResponse) Reset() { - *x = CreateAlertRuleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateAlertRuleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateAlertRuleResponse) ProtoMessage() {} - -func (x *CreateAlertRuleResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateAlertRuleResponse.ProtoReflect.Descriptor instead. -func (*CreateAlertRuleResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{6} -} - -func (x *CreateAlertRuleResponse) GetRuleId() string { - if x != nil { - return x.RuleId - } - return "" -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type UpdateAlertRuleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rule ID. - RuleId string `protobuf:"bytes,1,opt,name=rule_id,json=ruleId,proto3" json:"rule_id,omitempty"` - // Rule name. Should be set. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // New rule status. Should be set. - Disabled bool `protobuf:"varint,3,opt,name=disabled,proto3" json:"disabled,omitempty"` - // Rule parameters. All template parameters should be set. - Params []*ParamValue `protobuf:"bytes,4,rep,name=params,proto3" json:"params,omitempty"` - // Rule duration. Should be set. - For *durationpb.Duration `protobuf:"bytes,5,opt,name=for,proto3" json:"for,omitempty"` - // Rule severity. Should be set. - Severity managementpb.Severity `protobuf:"varint,6,opt,name=severity,proto3,enum=management.Severity" json:"severity,omitempty"` - // All custom labels to add or remove (with empty values) to default labels from template. - CustomLabels map[string]string `protobuf:"bytes,7,rep,name=custom_labels,json=customLabels,proto3" json:"custom_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Filters. Should be set. - Filters []*Filter `protobuf:"bytes,8,rep,name=filters,proto3" json:"filters,omitempty"` - // Channels. Should be set. - ChannelIds []string `protobuf:"bytes,9,rep,name=channel_ids,json=channelIds,proto3" json:"channel_ids,omitempty"` -} - -func (x *UpdateAlertRuleRequest) Reset() { - *x = UpdateAlertRuleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateAlertRuleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateAlertRuleRequest) ProtoMessage() {} - -func (x *UpdateAlertRuleRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateAlertRuleRequest.ProtoReflect.Descriptor instead. -func (*UpdateAlertRuleRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateAlertRuleRequest) GetRuleId() string { - if x != nil { - return x.RuleId - } - return "" -} - -func (x *UpdateAlertRuleRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdateAlertRuleRequest) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -func (x *UpdateAlertRuleRequest) GetParams() []*ParamValue { - if x != nil { - return x.Params - } - return nil -} - -func (x *UpdateAlertRuleRequest) GetFor() *durationpb.Duration { - if x != nil { - return x.For - } - return nil -} - -func (x *UpdateAlertRuleRequest) GetSeverity() managementpb.Severity { - if x != nil { - return x.Severity - } - return managementpb.Severity(0) -} - -func (x *UpdateAlertRuleRequest) GetCustomLabels() map[string]string { - if x != nil { - return x.CustomLabels - } - return nil -} - -func (x *UpdateAlertRuleRequest) GetFilters() []*Filter { - if x != nil { - return x.Filters - } - return nil -} - -func (x *UpdateAlertRuleRequest) GetChannelIds() []string { - if x != nil { - return x.ChannelIds - } - return nil -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type UpdateAlertRuleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *UpdateAlertRuleResponse) Reset() { - *x = UpdateAlertRuleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateAlertRuleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateAlertRuleResponse) ProtoMessage() {} - -func (x *UpdateAlertRuleResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateAlertRuleResponse.ProtoReflect.Descriptor instead. -func (*UpdateAlertRuleResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{8} -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type ToggleAlertRuleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rule ID. - RuleId string `protobuf:"bytes,1,opt,name=rule_id,json=ruleId,proto3" json:"rule_id,omitempty"` - // New rule status, if set. - Disabled managementpb.BooleanFlag `protobuf:"varint,2,opt,name=disabled,proto3,enum=managementpb.BooleanFlag" json:"disabled,omitempty"` -} - -func (x *ToggleAlertRuleRequest) Reset() { - *x = ToggleAlertRuleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToggleAlertRuleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToggleAlertRuleRequest) ProtoMessage() {} - -func (x *ToggleAlertRuleRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToggleAlertRuleRequest.ProtoReflect.Descriptor instead. -func (*ToggleAlertRuleRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{9} -} - -func (x *ToggleAlertRuleRequest) GetRuleId() string { - if x != nil { - return x.RuleId - } - return "" -} - -func (x *ToggleAlertRuleRequest) GetDisabled() managementpb.BooleanFlag { - if x != nil { - return x.Disabled - } - return managementpb.BooleanFlag(0) -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type ToggleAlertRuleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ToggleAlertRuleResponse) Reset() { - *x = ToggleAlertRuleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToggleAlertRuleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToggleAlertRuleResponse) ProtoMessage() {} - -func (x *ToggleAlertRuleResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToggleAlertRuleResponse.ProtoReflect.Descriptor instead. -func (*ToggleAlertRuleResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{10} -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type DeleteAlertRuleRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rule ID. - RuleId string `protobuf:"bytes,1,opt,name=rule_id,json=ruleId,proto3" json:"rule_id,omitempty"` -} - -func (x *DeleteAlertRuleRequest) Reset() { - *x = DeleteAlertRuleRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteAlertRuleRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteAlertRuleRequest) ProtoMessage() {} - -func (x *DeleteAlertRuleRequest) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteAlertRuleRequest.ProtoReflect.Descriptor instead. -func (*DeleteAlertRuleRequest) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{11} -} - -func (x *DeleteAlertRuleRequest) GetRuleId() string { - if x != nil { - return x.RuleId - } - return "" -} - -// Deprecated: Marked as deprecated in managementpb/ia/rules.proto. -type DeleteAlertRuleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DeleteAlertRuleResponse) Reset() { - *x = DeleteAlertRuleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_managementpb_ia_rules_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteAlertRuleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteAlertRuleResponse) ProtoMessage() {} - -func (x *DeleteAlertRuleResponse) ProtoReflect() protoreflect.Message { - mi := &file_managementpb_ia_rules_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteAlertRuleResponse.ProtoReflect.Descriptor instead. -func (*DeleteAlertRuleResponse) Descriptor() ([]byte, []int) { - return file_managementpb_ia_rules_proto_rawDescGZIP(), []int{12} -} - -var File_managementpb_ia_rules_proto protoreflect.FileDescriptor - -var file_managementpb_ia_rules_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, - 0x61, 0x2f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x69, - 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2f, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, - 0x2f, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, - 0x62, 0x2f, 0x69, 0x61, 0x2f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, - 0x62, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, - 0x2f, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x16, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xaa, 0x01, 0x0a, 0x0a, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, - 0x12, 0x18, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x07, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcb, 0x08, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, - 0x12, 0x17, 0x0a, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, - 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x72, - 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x65, 0x78, 0x70, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x65, 0x78, 0x70, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x78, 0x70, - 0x72, 0x12, 0x4b, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x64, 0x65, 0x66, 0x69, - 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3b, - 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0b, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x46, 0x6f, 0x72, 0x12, 0x2b, 0x0a, 0x03, 0x66, 0x6f, 0x72, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x03, 0x66, 0x6f, 0x72, 0x12, 0x3f, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, - 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x76, 0x65, - 0x72, 0x69, 0x74, 0x79, 0x52, 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x65, 0x76, - 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, - 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, - 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x47, 0x0a, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6c, 0x65, - 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x12, 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x75, - 0x6c, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, - 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x69, 0x61, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x41, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x07, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x69, - 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x69, 0x61, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x41, 0x74, 0x1a, 0x3f, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x54, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, - 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x50, 0x61, 0x67, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x67, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x74, 0x0a, 0x16, 0x4c, - 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x2e, 0x0a, - 0x06, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x54, - 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x52, 0x06, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0x91, 0x04, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, - 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x72, 0x75, 0x6c, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x52, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, - 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, - 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x03, 0x66, 0x6f, 0x72, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x03, 0x66, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, - 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x59, 0x0a, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, - 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x73, 0x12, 0x2c, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x1f, 0x0a, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x73, - 0x1a, 0x3f, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x36, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, - 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x17, 0x0a, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xe8, 0x03, - 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x72, 0x75, 0x6c, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x06, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x03, 0x66, 0x6f, - 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x03, 0x66, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, - 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, - 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x59, 0x0a, 0x0d, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x34, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x12, 0x2c, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, - 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x49, 0x64, 0x73, 0x1a, 0x3f, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x61, 0x62, - 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1d, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x75, 0x0a, 0x16, 0x54, 0x6f, 0x67, 0x67, 0x6c, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x20, 0x0a, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x72, 0x75, 0x6c, - 0x65, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x6c, 0x61, 0x67, - 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1d, - 0x0a, 0x17, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x3e, 0x0a, - 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x06, 0x72, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1d, 0x0a, - 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x2a, 0x3f, 0x0a, 0x0a, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x49, - 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, - 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x09, - 0x0a, 0x05, 0x52, 0x45, 0x47, 0x45, 0x58, 0x10, 0x03, 0x1a, 0x02, 0x18, 0x01, 0x32, 0xd2, 0x05, - 0x0a, 0x05, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x88, 0x01, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, - 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, - 0x6c, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2f, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, - 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x2f, 0x69, 0x61, 0x2f, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x88, - 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, - 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x31, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, - 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x69, 0x61, 0x2f, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x2f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x88, - 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, - 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x31, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, - 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x69, 0x61, 0x2f, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x2f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x88, - 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, - 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x31, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, - 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x69, 0x61, 0x2f, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x2f, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x88, - 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x22, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, - 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x61, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x31, 0x92, 0x41, 0x02, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, - 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x69, 0x61, 0x2f, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x2f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x88, - 0x02, 0x01, 0x42, 0x9b, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, 0x61, 0x3b, - 0x69, 0x61, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x58, 0x58, 0xaa, - 0x02, 0x0a, 0x49, 0x61, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x0a, 0x49, - 0x61, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x16, 0x49, 0x61, 0x5c, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0b, 0x49, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_managementpb_ia_rules_proto_rawDescOnce sync.Once - file_managementpb_ia_rules_proto_rawDescData = file_managementpb_ia_rules_proto_rawDesc -) - -func file_managementpb_ia_rules_proto_rawDescGZIP() []byte { - file_managementpb_ia_rules_proto_rawDescOnce.Do(func() { - file_managementpb_ia_rules_proto_rawDescData = protoimpl.X.CompressGZIP(file_managementpb_ia_rules_proto_rawDescData) - }) - return file_managementpb_ia_rules_proto_rawDescData -} - -var ( - file_managementpb_ia_rules_proto_enumTypes = make([]protoimpl.EnumInfo, 1) - file_managementpb_ia_rules_proto_msgTypes = make([]protoimpl.MessageInfo, 18) - file_managementpb_ia_rules_proto_goTypes = []interface{}{ - (FilterType)(0), // 0: ia.v1beta1.FilterType - (*Filter)(nil), // 1: ia.v1beta1.Filter - (*ParamValue)(nil), // 2: ia.v1beta1.ParamValue - (*Rule)(nil), // 3: ia.v1beta1.Rule - (*ListAlertRulesRequest)(nil), // 4: ia.v1beta1.ListAlertRulesRequest - (*ListAlertRulesResponse)(nil), // 5: ia.v1beta1.ListAlertRulesResponse - (*CreateAlertRuleRequest)(nil), // 6: ia.v1beta1.CreateAlertRuleRequest - (*CreateAlertRuleResponse)(nil), // 7: ia.v1beta1.CreateAlertRuleResponse - (*UpdateAlertRuleRequest)(nil), // 8: ia.v1beta1.UpdateAlertRuleRequest - (*UpdateAlertRuleResponse)(nil), // 9: ia.v1beta1.UpdateAlertRuleResponse - (*ToggleAlertRuleRequest)(nil), // 10: ia.v1beta1.ToggleAlertRuleRequest - (*ToggleAlertRuleResponse)(nil), // 11: ia.v1beta1.ToggleAlertRuleResponse - (*DeleteAlertRuleRequest)(nil), // 12: ia.v1beta1.DeleteAlertRuleRequest - (*DeleteAlertRuleResponse)(nil), // 13: ia.v1beta1.DeleteAlertRuleResponse - nil, // 14: ia.v1beta1.Rule.CustomLabelsEntry - nil, // 15: ia.v1beta1.Rule.LabelsEntry - nil, // 16: ia.v1beta1.Rule.AnnotationsEntry - nil, // 17: ia.v1beta1.CreateAlertRuleRequest.CustomLabelsEntry - nil, // 18: ia.v1beta1.UpdateAlertRuleRequest.CustomLabelsEntry - (alerting.ParamType)(0), // 19: alerting.v1.ParamType - (*alerting.ParamDefinition)(nil), // 20: alerting.v1.ParamDefinition - (*durationpb.Duration)(nil), // 21: google.protobuf.Duration - (managementpb.Severity)(0), // 22: management.Severity - (*Channel)(nil), // 23: ia.v1beta1.Channel - (*timestamppb.Timestamp)(nil), // 24: google.protobuf.Timestamp - (*managementpb.PageParams)(nil), // 25: management.PageParams - (*managementpb.PageTotals)(nil), // 26: management.PageTotals - (managementpb.BooleanFlag)(0), // 27: managementpb.BooleanFlag - } -) - -var file_managementpb_ia_rules_proto_depIdxs = []int32{ - 0, // 0: ia.v1beta1.Filter.type:type_name -> ia.v1beta1.FilterType - 19, // 1: ia.v1beta1.ParamValue.type:type_name -> alerting.v1.ParamType - 20, // 2: ia.v1beta1.Rule.params_definitions:type_name -> alerting.v1.ParamDefinition - 2, // 3: ia.v1beta1.Rule.params_values:type_name -> ia.v1beta1.ParamValue - 21, // 4: ia.v1beta1.Rule.default_for:type_name -> google.protobuf.Duration - 21, // 5: ia.v1beta1.Rule.for:type_name -> google.protobuf.Duration - 22, // 6: ia.v1beta1.Rule.default_severity:type_name -> management.Severity - 22, // 7: ia.v1beta1.Rule.severity:type_name -> management.Severity - 14, // 8: ia.v1beta1.Rule.custom_labels:type_name -> ia.v1beta1.Rule.CustomLabelsEntry - 15, // 9: ia.v1beta1.Rule.labels:type_name -> ia.v1beta1.Rule.LabelsEntry - 16, // 10: ia.v1beta1.Rule.annotations:type_name -> ia.v1beta1.Rule.AnnotationsEntry - 1, // 11: ia.v1beta1.Rule.filters:type_name -> ia.v1beta1.Filter - 23, // 12: ia.v1beta1.Rule.channels:type_name -> ia.v1beta1.Channel - 24, // 13: ia.v1beta1.Rule.created_at:type_name -> google.protobuf.Timestamp - 25, // 14: ia.v1beta1.ListAlertRulesRequest.page_params:type_name -> management.PageParams - 3, // 15: ia.v1beta1.ListAlertRulesResponse.rules:type_name -> ia.v1beta1.Rule - 26, // 16: ia.v1beta1.ListAlertRulesResponse.totals:type_name -> management.PageTotals - 2, // 17: ia.v1beta1.CreateAlertRuleRequest.params:type_name -> ia.v1beta1.ParamValue - 21, // 18: ia.v1beta1.CreateAlertRuleRequest.for:type_name -> google.protobuf.Duration - 22, // 19: ia.v1beta1.CreateAlertRuleRequest.severity:type_name -> management.Severity - 17, // 20: ia.v1beta1.CreateAlertRuleRequest.custom_labels:type_name -> ia.v1beta1.CreateAlertRuleRequest.CustomLabelsEntry - 1, // 21: ia.v1beta1.CreateAlertRuleRequest.filters:type_name -> ia.v1beta1.Filter - 2, // 22: ia.v1beta1.UpdateAlertRuleRequest.params:type_name -> ia.v1beta1.ParamValue - 21, // 23: ia.v1beta1.UpdateAlertRuleRequest.for:type_name -> google.protobuf.Duration - 22, // 24: ia.v1beta1.UpdateAlertRuleRequest.severity:type_name -> management.Severity - 18, // 25: ia.v1beta1.UpdateAlertRuleRequest.custom_labels:type_name -> ia.v1beta1.UpdateAlertRuleRequest.CustomLabelsEntry - 1, // 26: ia.v1beta1.UpdateAlertRuleRequest.filters:type_name -> ia.v1beta1.Filter - 27, // 27: ia.v1beta1.ToggleAlertRuleRequest.disabled:type_name -> managementpb.BooleanFlag - 4, // 28: ia.v1beta1.Rules.ListAlertRules:input_type -> ia.v1beta1.ListAlertRulesRequest - 6, // 29: ia.v1beta1.Rules.CreateAlertRule:input_type -> ia.v1beta1.CreateAlertRuleRequest - 8, // 30: ia.v1beta1.Rules.UpdateAlertRule:input_type -> ia.v1beta1.UpdateAlertRuleRequest - 10, // 31: ia.v1beta1.Rules.ToggleAlertRule:input_type -> ia.v1beta1.ToggleAlertRuleRequest - 12, // 32: ia.v1beta1.Rules.DeleteAlertRule:input_type -> ia.v1beta1.DeleteAlertRuleRequest - 5, // 33: ia.v1beta1.Rules.ListAlertRules:output_type -> ia.v1beta1.ListAlertRulesResponse - 7, // 34: ia.v1beta1.Rules.CreateAlertRule:output_type -> ia.v1beta1.CreateAlertRuleResponse - 9, // 35: ia.v1beta1.Rules.UpdateAlertRule:output_type -> ia.v1beta1.UpdateAlertRuleResponse - 11, // 36: ia.v1beta1.Rules.ToggleAlertRule:output_type -> ia.v1beta1.ToggleAlertRuleResponse - 13, // 37: ia.v1beta1.Rules.DeleteAlertRule:output_type -> ia.v1beta1.DeleteAlertRuleResponse - 33, // [33:38] is the sub-list for method output_type - 28, // [28:33] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name -} - -func init() { file_managementpb_ia_rules_proto_init() } -func file_managementpb_ia_rules_proto_init() { - if File_managementpb_ia_rules_proto != nil { - return - } - file_managementpb_ia_channels_proto_init() - if !protoimpl.UnsafeEnabled { - file_managementpb_ia_rules_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Filter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Rule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListAlertRulesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListAlertRulesResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateAlertRuleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateAlertRuleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateAlertRuleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateAlertRuleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToggleAlertRuleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToggleAlertRuleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteAlertRuleRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_managementpb_ia_rules_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteAlertRuleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_managementpb_ia_rules_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*ParamValue_Bool)(nil), - (*ParamValue_Float)(nil), - (*ParamValue_String_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_managementpb_ia_rules_proto_rawDesc, - NumEnums: 1, - NumMessages: 18, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_managementpb_ia_rules_proto_goTypes, - DependencyIndexes: file_managementpb_ia_rules_proto_depIdxs, - EnumInfos: file_managementpb_ia_rules_proto_enumTypes, - MessageInfos: file_managementpb_ia_rules_proto_msgTypes, - }.Build() - File_managementpb_ia_rules_proto = out.File - file_managementpb_ia_rules_proto_rawDesc = nil - file_managementpb_ia_rules_proto_goTypes = nil - file_managementpb_ia_rules_proto_depIdxs = nil -} diff --git a/api/managementpb/ia/rules.pb.gw.go b/api/managementpb/ia/rules.pb.gw.go deleted file mode 100644 index 8458714bcb..0000000000 --- a/api/managementpb/ia/rules.pb.gw.go +++ /dev/null @@ -1,491 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: managementpb/ia/rules.proto - -/* -Package iav1beta1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package iav1beta1 - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = metadata.Join -) - -func request_Rules_ListAlertRules_0(ctx context.Context, marshaler runtime.Marshaler, client RulesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListAlertRulesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListAlertRules(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Rules_ListAlertRules_0(ctx context.Context, marshaler runtime.Marshaler, server RulesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListAlertRulesRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListAlertRules(ctx, &protoReq) - return msg, metadata, err -} - -func request_Rules_CreateAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, client RulesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.CreateAlertRule(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Rules_CreateAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, server RulesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.CreateAlertRule(ctx, &protoReq) - return msg, metadata, err -} - -func request_Rules_UpdateAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, client RulesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.UpdateAlertRule(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Rules_UpdateAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, server RulesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UpdateAlertRule(ctx, &protoReq) - return msg, metadata, err -} - -func request_Rules_ToggleAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, client RulesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ToggleAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ToggleAlertRule(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Rules_ToggleAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, server RulesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ToggleAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ToggleAlertRule(ctx, &protoReq) - return msg, metadata, err -} - -func request_Rules_DeleteAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, client RulesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.DeleteAlertRule(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Rules_DeleteAlertRule_0(ctx context.Context, marshaler runtime.Marshaler, server RulesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteAlertRuleRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.DeleteAlertRule(ctx, &protoReq) - return msg, metadata, err -} - -// RegisterRulesHandlerServer registers the http handlers for service Rules to "mux". -// UnaryRPC :call RulesServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRulesHandlerFromEndpoint instead. -func RegisterRulesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RulesServer) error { - mux.Handle("POST", pattern_Rules_ListAlertRules_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Rules/ListAlertRules", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/List")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Rules_ListAlertRules_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_ListAlertRules_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_CreateAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Rules/CreateAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Create")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Rules_CreateAlertRule_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_CreateAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_UpdateAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Rules/UpdateAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Update")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Rules_UpdateAlertRule_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_UpdateAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_ToggleAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Rules/ToggleAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Toggle")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Rules_ToggleAlertRule_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_ToggleAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_DeleteAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ia.v1beta1.Rules/DeleteAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Delete")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Rules_DeleteAlertRule_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_DeleteAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -// RegisterRulesHandlerFromEndpoint is same as RegisterRulesHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterRulesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterRulesHandler(ctx, mux, conn) -} - -// RegisterRulesHandler registers the http handlers for service Rules to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterRulesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterRulesHandlerClient(ctx, mux, NewRulesClient(conn)) -} - -// RegisterRulesHandlerClient registers the http handlers for service Rules -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RulesClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RulesClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "RulesClient" to call the correct interceptors. -func RegisterRulesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RulesClient) error { - mux.Handle("POST", pattern_Rules_ListAlertRules_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Rules/ListAlertRules", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/List")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Rules_ListAlertRules_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_ListAlertRules_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_CreateAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Rules/CreateAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Create")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Rules_CreateAlertRule_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_CreateAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_UpdateAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Rules/UpdateAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Update")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Rules_UpdateAlertRule_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_UpdateAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_ToggleAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Rules/ToggleAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Toggle")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Rules_ToggleAlertRule_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_ToggleAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_Rules_DeleteAlertRule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ia.v1beta1.Rules/DeleteAlertRule", runtime.WithHTTPPathPattern("/v1/management/ia/Rules/Delete")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Rules_DeleteAlertRule_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Rules_DeleteAlertRule_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -var ( - pattern_Rules_ListAlertRules_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Rules", "List"}, "")) - - pattern_Rules_CreateAlertRule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Rules", "Create"}, "")) - - pattern_Rules_UpdateAlertRule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Rules", "Update"}, "")) - - pattern_Rules_ToggleAlertRule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Rules", "Toggle"}, "")) - - pattern_Rules_DeleteAlertRule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "management", "ia", "Rules", "Delete"}, "")) -) - -var ( - forward_Rules_ListAlertRules_0 = runtime.ForwardResponseMessage - - forward_Rules_CreateAlertRule_0 = runtime.ForwardResponseMessage - - forward_Rules_UpdateAlertRule_0 = runtime.ForwardResponseMessage - - forward_Rules_ToggleAlertRule_0 = runtime.ForwardResponseMessage - - forward_Rules_DeleteAlertRule_0 = runtime.ForwardResponseMessage -) diff --git a/api/managementpb/ia/rules.pb.validate.go b/api/managementpb/ia/rules.pb.validate.go deleted file mode 100644 index 03d92e46f4..0000000000 --- a/api/managementpb/ia/rules.pb.validate.go +++ /dev/null @@ -1,2008 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: managementpb/ia/rules.proto - -package iav1beta1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - managementpb "github.com/percona/pmm/api/managementpb" - alertingv1 "github.com/percona/pmm/api/managementpb/alerting" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = alertingv1.ParamType(0) - - _ = managementpb.Severity(0) -) - -// Validate checks the field values on Filter with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Filter) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Filter with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in FilterMultiError, or nil if none found. -func (m *Filter) ValidateAll() error { - return m.validate(true) -} - -func (m *Filter) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Type - - // no validation rules for Key - - // no validation rules for Value - - if len(errors) > 0 { - return FilterMultiError(errors) - } - - return nil -} - -// FilterMultiError is an error wrapping multiple validation errors returned by -// Filter.ValidateAll() if the designated constraints aren't met. -type FilterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FilterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FilterMultiError) AllErrors() []error { return m } - -// FilterValidationError is the validation error returned by Filter.Validate if -// the designated constraints aren't met. -type FilterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FilterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FilterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FilterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FilterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FilterValidationError) ErrorName() string { return "FilterValidationError" } - -// Error satisfies the builtin error interface -func (e FilterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFilter.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FilterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FilterValidationError{} - -// Validate checks the field values on ParamValue with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ParamValue) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ParamValue with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ParamValueMultiError, or -// nil if none found. -func (m *ParamValue) ValidateAll() error { - return m.validate(true) -} - -func (m *ParamValue) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := ParamValueValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Type - - switch v := m.Value.(type) { - case *ParamValue_Bool: - if v == nil { - err := ParamValueValidationError{ - field: "Value", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for Bool - case *ParamValue_Float: - if v == nil { - err := ParamValueValidationError{ - field: "Value", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for Float - case *ParamValue_String_: - if v == nil { - err := ParamValueValidationError{ - field: "Value", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for String_ - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return ParamValueMultiError(errors) - } - - return nil -} - -// ParamValueMultiError is an error wrapping multiple validation errors -// returned by ParamValue.ValidateAll() if the designated constraints aren't met. -type ParamValueMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ParamValueMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ParamValueMultiError) AllErrors() []error { return m } - -// ParamValueValidationError is the validation error returned by -// ParamValue.Validate if the designated constraints aren't met. -type ParamValueValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ParamValueValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ParamValueValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ParamValueValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ParamValueValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ParamValueValidationError) ErrorName() string { return "ParamValueValidationError" } - -// Error satisfies the builtin error interface -func (e ParamValueValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sParamValue.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ParamValueValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ParamValueValidationError{} - -// Validate checks the field values on Rule with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *Rule) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Rule with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in RuleMultiError, or nil if none found. -func (m *Rule) ValidateAll() error { - return m.validate(true) -} - -func (m *Rule) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for RuleId - - // no validation rules for Name - - // no validation rules for Summary - - // no validation rules for TemplateName - - // no validation rules for Disabled - - // no validation rules for ExprTemplate - - // no validation rules for Expr - - for idx, item := range m.GetParamsDefinitions() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("ParamsDefinitions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("ParamsDefinitions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: fmt.Sprintf("ParamsDefinitions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetParamsValues() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("ParamsValues[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("ParamsValues[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: fmt.Sprintf("ParamsValues[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetDefaultFor()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: "DefaultFor", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: "DefaultFor", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDefaultFor()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: "DefaultFor", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetFor()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFor()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for DefaultSeverity - - // no validation rules for Severity - - // no validation rules for CustomLabels - - // no validation rules for Labels - - // no validation rules for Annotations - - for idx, item := range m.GetFilters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetChannels() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("Channels[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: fmt.Sprintf("Channels[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: fmt.Sprintf("Channels[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetCreatedAt()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuleValidationError{ - field: "CreatedAt", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuleValidationError{ - field: "CreatedAt", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuleValidationError{ - field: "CreatedAt", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RuleMultiError(errors) - } - - return nil -} - -// RuleMultiError is an error wrapping multiple validation errors returned by -// Rule.ValidateAll() if the designated constraints aren't met. -type RuleMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuleMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuleMultiError) AllErrors() []error { return m } - -// RuleValidationError is the validation error returned by Rule.Validate if the -// designated constraints aren't met. -type RuleValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuleValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuleValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuleValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuleValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuleValidationError) ErrorName() string { return "RuleValidationError" } - -// Error satisfies the builtin error interface -func (e RuleValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRule.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuleValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuleValidationError{} - -// Validate checks the field values on ListAlertRulesRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListAlertRulesRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListAlertRulesRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListAlertRulesRequestMultiError, or nil if none found. -func (m *ListAlertRulesRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListAlertRulesRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetPageParams()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAlertRulesRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAlertRulesRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPageParams()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAlertRulesRequestValidationError{ - field: "PageParams", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ListAlertRulesRequestMultiError(errors) - } - - return nil -} - -// ListAlertRulesRequestMultiError is an error wrapping multiple validation -// errors returned by ListAlertRulesRequest.ValidateAll() if the designated -// constraints aren't met. -type ListAlertRulesRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListAlertRulesRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListAlertRulesRequestMultiError) AllErrors() []error { return m } - -// ListAlertRulesRequestValidationError is the validation error returned by -// ListAlertRulesRequest.Validate if the designated constraints aren't met. -type ListAlertRulesRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListAlertRulesRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListAlertRulesRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListAlertRulesRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListAlertRulesRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListAlertRulesRequestValidationError) ErrorName() string { - return "ListAlertRulesRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ListAlertRulesRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListAlertRulesRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListAlertRulesRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListAlertRulesRequestValidationError{} - -// Validate checks the field values on ListAlertRulesResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListAlertRulesResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListAlertRulesResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListAlertRulesResponseMultiError, or nil if none found. -func (m *ListAlertRulesResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListAlertRulesResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetRules() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAlertRulesResponseValidationError{ - field: fmt.Sprintf("Rules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAlertRulesResponseValidationError{ - field: fmt.Sprintf("Rules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAlertRulesResponseValidationError{ - field: fmt.Sprintf("Rules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetTotals()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAlertRulesResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAlertRulesResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTotals()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAlertRulesResponseValidationError{ - field: "Totals", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ListAlertRulesResponseMultiError(errors) - } - - return nil -} - -// ListAlertRulesResponseMultiError is an error wrapping multiple validation -// errors returned by ListAlertRulesResponse.ValidateAll() if the designated -// constraints aren't met. -type ListAlertRulesResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListAlertRulesResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListAlertRulesResponseMultiError) AllErrors() []error { return m } - -// ListAlertRulesResponseValidationError is the validation error returned by -// ListAlertRulesResponse.Validate if the designated constraints aren't met. -type ListAlertRulesResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListAlertRulesResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListAlertRulesResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListAlertRulesResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListAlertRulesResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListAlertRulesResponseValidationError) ErrorName() string { - return "ListAlertRulesResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ListAlertRulesResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListAlertRulesResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListAlertRulesResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListAlertRulesResponseValidationError{} - -// Validate checks the field values on CreateAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CreateAlertRuleRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CreateAlertRuleRequestMultiError, or nil if none found. -func (m *CreateAlertRuleRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateAlertRuleRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TemplateName - - // no validation rules for SourceRuleId - - // no validation rules for Name - - // no validation rules for Disabled - - for idx, item := range m.GetParams() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Params[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Params[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Params[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetFor()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateAlertRuleRequestValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateAlertRuleRequestValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFor()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateAlertRuleRequestValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Severity - - // no validation rules for CustomLabels - - for idx, item := range m.GetFilters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return CreateAlertRuleRequestMultiError(errors) - } - - return nil -} - -// CreateAlertRuleRequestMultiError is an error wrapping multiple validation -// errors returned by CreateAlertRuleRequest.ValidateAll() if the designated -// constraints aren't met. -type CreateAlertRuleRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateAlertRuleRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CreateAlertRuleRequestMultiError) AllErrors() []error { return m } - -// CreateAlertRuleRequestValidationError is the validation error returned by -// CreateAlertRuleRequest.Validate if the designated constraints aren't met. -type CreateAlertRuleRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateAlertRuleRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateAlertRuleRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateAlertRuleRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateAlertRuleRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateAlertRuleRequestValidationError) ErrorName() string { - return "CreateAlertRuleRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e CreateAlertRuleRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCreateAlertRuleRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateAlertRuleRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateAlertRuleRequestValidationError{} - -// Validate checks the field values on CreateAlertRuleResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CreateAlertRuleResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateAlertRuleResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CreateAlertRuleResponseMultiError, or nil if none found. -func (m *CreateAlertRuleResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateAlertRuleResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for RuleId - - if len(errors) > 0 { - return CreateAlertRuleResponseMultiError(errors) - } - - return nil -} - -// CreateAlertRuleResponseMultiError is an error wrapping multiple validation -// errors returned by CreateAlertRuleResponse.ValidateAll() if the designated -// constraints aren't met. -type CreateAlertRuleResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateAlertRuleResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CreateAlertRuleResponseMultiError) AllErrors() []error { return m } - -// CreateAlertRuleResponseValidationError is the validation error returned by -// CreateAlertRuleResponse.Validate if the designated constraints aren't met. -type CreateAlertRuleResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateAlertRuleResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateAlertRuleResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateAlertRuleResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateAlertRuleResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateAlertRuleResponseValidationError) ErrorName() string { - return "CreateAlertRuleResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e CreateAlertRuleResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCreateAlertRuleResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateAlertRuleResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateAlertRuleResponseValidationError{} - -// Validate checks the field values on UpdateAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateAlertRuleRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpdateAlertRuleRequestMultiError, or nil if none found. -func (m *UpdateAlertRuleRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateAlertRuleRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetRuleId()) < 1 { - err := UpdateAlertRuleRequestValidationError{ - field: "RuleId", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Name - - // no validation rules for Disabled - - for idx, item := range m.GetParams() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UpdateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Params[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UpdateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Params[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UpdateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Params[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetFor()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UpdateAlertRuleRequestValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UpdateAlertRuleRequestValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFor()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UpdateAlertRuleRequestValidationError{ - field: "For", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Severity - - // no validation rules for CustomLabels - - for idx, item := range m.GetFilters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UpdateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UpdateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UpdateAlertRuleRequestValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return UpdateAlertRuleRequestMultiError(errors) - } - - return nil -} - -// UpdateAlertRuleRequestMultiError is an error wrapping multiple validation -// errors returned by UpdateAlertRuleRequest.ValidateAll() if the designated -// constraints aren't met. -type UpdateAlertRuleRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateAlertRuleRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateAlertRuleRequestMultiError) AllErrors() []error { return m } - -// UpdateAlertRuleRequestValidationError is the validation error returned by -// UpdateAlertRuleRequest.Validate if the designated constraints aren't met. -type UpdateAlertRuleRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateAlertRuleRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateAlertRuleRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateAlertRuleRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateAlertRuleRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateAlertRuleRequestValidationError) ErrorName() string { - return "UpdateAlertRuleRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateAlertRuleRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateAlertRuleRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateAlertRuleRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateAlertRuleRequestValidationError{} - -// Validate checks the field values on UpdateAlertRuleResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateAlertRuleResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateAlertRuleResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpdateAlertRuleResponseMultiError, or nil if none found. -func (m *UpdateAlertRuleResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateAlertRuleResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return UpdateAlertRuleResponseMultiError(errors) - } - - return nil -} - -// UpdateAlertRuleResponseMultiError is an error wrapping multiple validation -// errors returned by UpdateAlertRuleResponse.ValidateAll() if the designated -// constraints aren't met. -type UpdateAlertRuleResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateAlertRuleResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateAlertRuleResponseMultiError) AllErrors() []error { return m } - -// UpdateAlertRuleResponseValidationError is the validation error returned by -// UpdateAlertRuleResponse.Validate if the designated constraints aren't met. -type UpdateAlertRuleResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateAlertRuleResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateAlertRuleResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateAlertRuleResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateAlertRuleResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateAlertRuleResponseValidationError) ErrorName() string { - return "UpdateAlertRuleResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateAlertRuleResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateAlertRuleResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateAlertRuleResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateAlertRuleResponseValidationError{} - -// Validate checks the field values on ToggleAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ToggleAlertRuleRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ToggleAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ToggleAlertRuleRequestMultiError, or nil if none found. -func (m *ToggleAlertRuleRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ToggleAlertRuleRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetRuleId()) < 1 { - err := ToggleAlertRuleRequestValidationError{ - field: "RuleId", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Disabled - - if len(errors) > 0 { - return ToggleAlertRuleRequestMultiError(errors) - } - - return nil -} - -// ToggleAlertRuleRequestMultiError is an error wrapping multiple validation -// errors returned by ToggleAlertRuleRequest.ValidateAll() if the designated -// constraints aren't met. -type ToggleAlertRuleRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ToggleAlertRuleRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ToggleAlertRuleRequestMultiError) AllErrors() []error { return m } - -// ToggleAlertRuleRequestValidationError is the validation error returned by -// ToggleAlertRuleRequest.Validate if the designated constraints aren't met. -type ToggleAlertRuleRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ToggleAlertRuleRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ToggleAlertRuleRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ToggleAlertRuleRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ToggleAlertRuleRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ToggleAlertRuleRequestValidationError) ErrorName() string { - return "ToggleAlertRuleRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ToggleAlertRuleRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sToggleAlertRuleRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ToggleAlertRuleRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ToggleAlertRuleRequestValidationError{} - -// Validate checks the field values on ToggleAlertRuleResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ToggleAlertRuleResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ToggleAlertRuleResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ToggleAlertRuleResponseMultiError, or nil if none found. -func (m *ToggleAlertRuleResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ToggleAlertRuleResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return ToggleAlertRuleResponseMultiError(errors) - } - - return nil -} - -// ToggleAlertRuleResponseMultiError is an error wrapping multiple validation -// errors returned by ToggleAlertRuleResponse.ValidateAll() if the designated -// constraints aren't met. -type ToggleAlertRuleResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ToggleAlertRuleResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ToggleAlertRuleResponseMultiError) AllErrors() []error { return m } - -// ToggleAlertRuleResponseValidationError is the validation error returned by -// ToggleAlertRuleResponse.Validate if the designated constraints aren't met. -type ToggleAlertRuleResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ToggleAlertRuleResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ToggleAlertRuleResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ToggleAlertRuleResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ToggleAlertRuleResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ToggleAlertRuleResponseValidationError) ErrorName() string { - return "ToggleAlertRuleResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ToggleAlertRuleResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sToggleAlertRuleResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ToggleAlertRuleResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ToggleAlertRuleResponseValidationError{} - -// Validate checks the field values on DeleteAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteAlertRuleRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteAlertRuleRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteAlertRuleRequestMultiError, or nil if none found. -func (m *DeleteAlertRuleRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteAlertRuleRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetRuleId()) < 1 { - err := DeleteAlertRuleRequestValidationError{ - field: "RuleId", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return DeleteAlertRuleRequestMultiError(errors) - } - - return nil -} - -// DeleteAlertRuleRequestMultiError is an error wrapping multiple validation -// errors returned by DeleteAlertRuleRequest.ValidateAll() if the designated -// constraints aren't met. -type DeleteAlertRuleRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteAlertRuleRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteAlertRuleRequestMultiError) AllErrors() []error { return m } - -// DeleteAlertRuleRequestValidationError is the validation error returned by -// DeleteAlertRuleRequest.Validate if the designated constraints aren't met. -type DeleteAlertRuleRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteAlertRuleRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteAlertRuleRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteAlertRuleRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteAlertRuleRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteAlertRuleRequestValidationError) ErrorName() string { - return "DeleteAlertRuleRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteAlertRuleRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteAlertRuleRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteAlertRuleRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteAlertRuleRequestValidationError{} - -// Validate checks the field values on DeleteAlertRuleResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteAlertRuleResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteAlertRuleResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteAlertRuleResponseMultiError, or nil if none found. -func (m *DeleteAlertRuleResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteAlertRuleResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DeleteAlertRuleResponseMultiError(errors) - } - - return nil -} - -// DeleteAlertRuleResponseMultiError is an error wrapping multiple validation -// errors returned by DeleteAlertRuleResponse.ValidateAll() if the designated -// constraints aren't met. -type DeleteAlertRuleResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteAlertRuleResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteAlertRuleResponseMultiError) AllErrors() []error { return m } - -// DeleteAlertRuleResponseValidationError is the validation error returned by -// DeleteAlertRuleResponse.Validate if the designated constraints aren't met. -type DeleteAlertRuleResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteAlertRuleResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteAlertRuleResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteAlertRuleResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteAlertRuleResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteAlertRuleResponseValidationError) ErrorName() string { - return "DeleteAlertRuleResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteAlertRuleResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteAlertRuleResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteAlertRuleResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteAlertRuleResponseValidationError{} diff --git a/api/managementpb/ia/rules.proto b/api/managementpb/ia/rules.proto deleted file mode 100644 index a0f18dafbd..0000000000 --- a/api/managementpb/ia/rules.proto +++ /dev/null @@ -1,243 +0,0 @@ -syntax = "proto3"; - -package ia.v1beta1; - -import "google/api/annotations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "managementpb/alerting/alerting.proto"; -import "managementpb/alerting/params.proto"; -import "managementpb/boolean_flag.proto"; -import "managementpb/ia/channels.proto"; -import "managementpb/pagination.proto"; -import "managementpb/severity.proto"; -import "protoc-gen-openapiv2/options/annotations.proto"; -import "validate/validate.proto"; - -option go_package = "api/managementpb/ia;iav1beta1"; - -// FilterType represents filter matching type. -enum FilterType { - option deprecated = true; - FILTER_TYPE_INVALID = 0; - // = - EQUAL = 1; - // != - // NOT_EQUAL = 2; - - // =~ - REGEX = 3; - // !~ - // NOT_REGEX = 4; -} - -// Filter repsents a single filter condition. -message Filter { - option deprecated = true; - FilterType type = 1; - string key = 2; - string value = 3; -} - -// ParamValue represents a single rule parameter value for List, Change and Update APIs. -message ParamValue { - option deprecated = true; - // Machine-readable name (ID) that is used in expression. - string name = 1 [(validate.rules).string.min_len = 1]; - // Parameter type. - alerting.v1.ParamType type = 2; - // Parameter value. - oneof value { - // Bool value. - bool bool = 3; - // Float value. - double float = 4; - // String value. - string string = 5; - } -} - -// Rule represents Alert Rule. -message Rule { - option deprecated = true; - // Rule ID. - string rule_id = 1; - // Rule name. - string name = 2; - // Rule human-readable summary. - string summary = 3; - // Template used for this rule. - string template_name = 4; - // True if that rule is disabled. - bool disabled = 5; - // Expression template. - string expr_template = 6; - // Expression filled with parameters. - string expr = 7; - // Expression parameters definitions. - repeated alerting.v1.ParamDefinition params_definitions = 8; - // Expression parameters values. - repeated ParamValue params_values = 9; - // Default for duration. - google.protobuf.Duration default_for = 10; - // For duration. - google.protobuf.Duration for = 11; - // Default severity. - management.Severity default_severity = 12; - // Severity. - management.Severity severity = 13; - // Custom labels. - map custom_labels = 14; - // Labels. - map labels = 15; - // Annotations. - map annotations = 16; - // Filters. - repeated Filter filters = 17; - // Channels. - repeated Channel channels = 18; - // Rule creation time. - google.protobuf.Timestamp created_at = 19; -} - -message ListAlertRulesRequest { - option deprecated = true; - // Page request. - management.PageParams page_params = 1; -} - -message ListAlertRulesResponse { - option deprecated = true; - repeated Rule rules = 1; - // Total items and pages. - management.PageTotals totals = 2; -} - -message CreateAlertRuleRequest { - option deprecated = true; - // Template name. Can't be specified simultaneously with source_rule_id. - string template_name = 1; - // ID of the rule that will be used as source. Can't be specified simultaneously with template_name. - string source_rule_id = 2; - // Rule name. - string name = 3; - // New rule status. - bool disabled = 4; - // Rule parameters. All template parameters should be set. - repeated ParamValue params = 5; - // Rule duration. Should be set. - google.protobuf.Duration for = 6; - // Rule severity. Should be set. - management.Severity severity = 7; - // All custom labels to add or remove (with empty values) to default labels from template. - map custom_labels = 8; - // Filters. Should be set. - repeated Filter filters = 9; - // Channels. Should be set. - repeated string channel_ids = 10; -} - -message CreateAlertRuleResponse { - option deprecated = true; - // Rule ID. - string rule_id = 1; -} - -message UpdateAlertRuleRequest { - option deprecated = true; - // Rule ID. - string rule_id = 1 [(validate.rules).string.min_len = 1]; - // Rule name. Should be set. - string name = 2; - // New rule status. Should be set. - bool disabled = 3; - // Rule parameters. All template parameters should be set. - repeated ParamValue params = 4; - // Rule duration. Should be set. - google.protobuf.Duration for = 5; - // Rule severity. Should be set. - management.Severity severity = 6; - // All custom labels to add or remove (with empty values) to default labels from template. - map custom_labels = 7; - // Filters. Should be set. - repeated Filter filters = 8; - // Channels. Should be set. - repeated string channel_ids = 9; -} - -message UpdateAlertRuleResponse { - option deprecated = true; -} - -message ToggleAlertRuleRequest { - option deprecated = true; - - // Rule ID. - string rule_id = 1 [(validate.rules).string.min_len = 1]; - // New rule status, if set. - managementpb.BooleanFlag disabled = 2; -} - -message ToggleAlertRuleResponse { - option deprecated = true; -} - -message DeleteAlertRuleRequest { - option deprecated = true; - - // Rule ID. - string rule_id = 1 [(validate.rules).string.min_len = 1]; -} - -message DeleteAlertRuleResponse { - option deprecated = true; -} - -// Rules service provides public methods for managing Alerting rules. -service Rules { - // ListAlertRules returns a list of all Alerting rules. - rpc ListAlertRules(ListAlertRulesRequest) returns (ListAlertRulesResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Rules/List" - body: "*" - }; - } - // CreateAlertRule creates Alerting rule. - rpc CreateAlertRule(CreateAlertRuleRequest) returns (CreateAlertRuleResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Rules/Create" - body: "*" - }; - } - // UpdateAlertRule updates Alerting rule. - rpc UpdateAlertRule(UpdateAlertRuleRequest) returns (UpdateAlertRuleResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Rules/Update" - body: "*" - }; - } - // ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule. - rpc ToggleAlertRule(ToggleAlertRuleRequest) returns (ToggleAlertRuleResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Rules/Toggle" - body: "*" - }; - } - // DeleteAlertRule deletes Alerting rule. - rpc DeleteAlertRule(DeleteAlertRuleRequest) returns (DeleteAlertRuleResponse) { - option deprecated = true; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {deprecated: true}; - option (google.api.http) = { - post: "/v1/management/ia/Rules/Delete" - body: "*" - }; - } -} diff --git a/api/managementpb/ia/rules_grpc.pb.go b/api/managementpb/ia/rules_grpc.pb.go deleted file mode 100644 index 786492a856..0000000000 --- a/api/managementpb/ia/rules_grpc.pb.go +++ /dev/null @@ -1,286 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: managementpb/ia/rules.proto - -package iav1beta1 - -import ( - context "context" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Rules_ListAlertRules_FullMethodName = "/ia.v1beta1.Rules/ListAlertRules" - Rules_CreateAlertRule_FullMethodName = "/ia.v1beta1.Rules/CreateAlertRule" - Rules_UpdateAlertRule_FullMethodName = "/ia.v1beta1.Rules/UpdateAlertRule" - Rules_ToggleAlertRule_FullMethodName = "/ia.v1beta1.Rules/ToggleAlertRule" - Rules_DeleteAlertRule_FullMethodName = "/ia.v1beta1.Rules/DeleteAlertRule" -) - -// RulesClient is the client API for Rules service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type RulesClient interface { - // Deprecated: Do not use. - // ListAlertRules returns a list of all Alerting rules. - ListAlertRules(ctx context.Context, in *ListAlertRulesRequest, opts ...grpc.CallOption) (*ListAlertRulesResponse, error) - // Deprecated: Do not use. - // CreateAlertRule creates Alerting rule. - CreateAlertRule(ctx context.Context, in *CreateAlertRuleRequest, opts ...grpc.CallOption) (*CreateAlertRuleResponse, error) - // Deprecated: Do not use. - // UpdateAlertRule updates Alerting rule. - UpdateAlertRule(ctx context.Context, in *UpdateAlertRuleRequest, opts ...grpc.CallOption) (*UpdateAlertRuleResponse, error) - // Deprecated: Do not use. - // ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule. - ToggleAlertRule(ctx context.Context, in *ToggleAlertRuleRequest, opts ...grpc.CallOption) (*ToggleAlertRuleResponse, error) - // Deprecated: Do not use. - // DeleteAlertRule deletes Alerting rule. - DeleteAlertRule(ctx context.Context, in *DeleteAlertRuleRequest, opts ...grpc.CallOption) (*DeleteAlertRuleResponse, error) -} - -type rulesClient struct { - cc grpc.ClientConnInterface -} - -func NewRulesClient(cc grpc.ClientConnInterface) RulesClient { - return &rulesClient{cc} -} - -// Deprecated: Do not use. -func (c *rulesClient) ListAlertRules(ctx context.Context, in *ListAlertRulesRequest, opts ...grpc.CallOption) (*ListAlertRulesResponse, error) { - out := new(ListAlertRulesResponse) - err := c.cc.Invoke(ctx, Rules_ListAlertRules_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *rulesClient) CreateAlertRule(ctx context.Context, in *CreateAlertRuleRequest, opts ...grpc.CallOption) (*CreateAlertRuleResponse, error) { - out := new(CreateAlertRuleResponse) - err := c.cc.Invoke(ctx, Rules_CreateAlertRule_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *rulesClient) UpdateAlertRule(ctx context.Context, in *UpdateAlertRuleRequest, opts ...grpc.CallOption) (*UpdateAlertRuleResponse, error) { - out := new(UpdateAlertRuleResponse) - err := c.cc.Invoke(ctx, Rules_UpdateAlertRule_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *rulesClient) ToggleAlertRule(ctx context.Context, in *ToggleAlertRuleRequest, opts ...grpc.CallOption) (*ToggleAlertRuleResponse, error) { - out := new(ToggleAlertRuleResponse) - err := c.cc.Invoke(ctx, Rules_ToggleAlertRule_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *rulesClient) DeleteAlertRule(ctx context.Context, in *DeleteAlertRuleRequest, opts ...grpc.CallOption) (*DeleteAlertRuleResponse, error) { - out := new(DeleteAlertRuleResponse) - err := c.cc.Invoke(ctx, Rules_DeleteAlertRule_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RulesServer is the server API for Rules service. -// All implementations must embed UnimplementedRulesServer -// for forward compatibility -type RulesServer interface { - // Deprecated: Do not use. - // ListAlertRules returns a list of all Alerting rules. - ListAlertRules(context.Context, *ListAlertRulesRequest) (*ListAlertRulesResponse, error) - // Deprecated: Do not use. - // CreateAlertRule creates Alerting rule. - CreateAlertRule(context.Context, *CreateAlertRuleRequest) (*CreateAlertRuleResponse, error) - // Deprecated: Do not use. - // UpdateAlertRule updates Alerting rule. - UpdateAlertRule(context.Context, *UpdateAlertRuleRequest) (*UpdateAlertRuleResponse, error) - // Deprecated: Do not use. - // ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule. - ToggleAlertRule(context.Context, *ToggleAlertRuleRequest) (*ToggleAlertRuleResponse, error) - // Deprecated: Do not use. - // DeleteAlertRule deletes Alerting rule. - DeleteAlertRule(context.Context, *DeleteAlertRuleRequest) (*DeleteAlertRuleResponse, error) - mustEmbedUnimplementedRulesServer() -} - -// UnimplementedRulesServer must be embedded to have forward compatible implementations. -type UnimplementedRulesServer struct{} - -func (UnimplementedRulesServer) ListAlertRules(context.Context, *ListAlertRulesRequest) (*ListAlertRulesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAlertRules not implemented") -} - -func (UnimplementedRulesServer) CreateAlertRule(context.Context, *CreateAlertRuleRequest) (*CreateAlertRuleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateAlertRule not implemented") -} - -func (UnimplementedRulesServer) UpdateAlertRule(context.Context, *UpdateAlertRuleRequest) (*UpdateAlertRuleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateAlertRule not implemented") -} - -func (UnimplementedRulesServer) ToggleAlertRule(context.Context, *ToggleAlertRuleRequest) (*ToggleAlertRuleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ToggleAlertRule not implemented") -} - -func (UnimplementedRulesServer) DeleteAlertRule(context.Context, *DeleteAlertRuleRequest) (*DeleteAlertRuleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteAlertRule not implemented") -} -func (UnimplementedRulesServer) mustEmbedUnimplementedRulesServer() {} - -// UnsafeRulesServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to RulesServer will -// result in compilation errors. -type UnsafeRulesServer interface { - mustEmbedUnimplementedRulesServer() -} - -func RegisterRulesServer(s grpc.ServiceRegistrar, srv RulesServer) { - s.RegisterService(&Rules_ServiceDesc, srv) -} - -func _Rules_ListAlertRules_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListAlertRulesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RulesServer).ListAlertRules(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Rules_ListAlertRules_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RulesServer).ListAlertRules(ctx, req.(*ListAlertRulesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Rules_CreateAlertRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateAlertRuleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RulesServer).CreateAlertRule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Rules_CreateAlertRule_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RulesServer).CreateAlertRule(ctx, req.(*CreateAlertRuleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Rules_UpdateAlertRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateAlertRuleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RulesServer).UpdateAlertRule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Rules_UpdateAlertRule_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RulesServer).UpdateAlertRule(ctx, req.(*UpdateAlertRuleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Rules_ToggleAlertRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ToggleAlertRuleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RulesServer).ToggleAlertRule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Rules_ToggleAlertRule_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RulesServer).ToggleAlertRule(ctx, req.(*ToggleAlertRuleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Rules_DeleteAlertRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteAlertRuleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RulesServer).DeleteAlertRule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Rules_DeleteAlertRule_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RulesServer).DeleteAlertRule(ctx, req.(*DeleteAlertRuleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Rules_ServiceDesc is the grpc.ServiceDesc for Rules service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Rules_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "ia.v1beta1.Rules", - HandlerType: (*RulesServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListAlertRules", - Handler: _Rules_ListAlertRules_Handler, - }, - { - MethodName: "CreateAlertRule", - Handler: _Rules_CreateAlertRule_Handler, - }, - { - MethodName: "UpdateAlertRule", - Handler: _Rules_UpdateAlertRule_Handler, - }, - { - MethodName: "ToggleAlertRule", - Handler: _Rules_ToggleAlertRule_Handler, - }, - { - MethodName: "DeleteAlertRule", - Handler: _Rules_DeleteAlertRule_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "managementpb/ia/rules.proto", -} diff --git a/api/managementpb/ia/status.dot b/api/managementpb/ia/status.dot deleted file mode 100644 index 158875869e..0000000000 --- a/api/managementpb/ia/status.dot +++ /dev/null @@ -1,20 +0,0 @@ -digraph { - node [style=filled]; - - CLEAR [fillcolor=green]; - PENDING; - TRIGGERING; - SILENCED; - - CLEAR -> PENDING; - PENDING -> TRIGGERING; - TRIGGERING -> SILENCED; - - # not typical and not exposed in the UI, but still possible - CLEAR -> SILENCED [style=dashed]; - PENDING -> SILENCED [style=dashed]; - - PENDING -> CLEAR [style=dotted]; - TRIGGERING -> CLEAR [style=dotted]; - SILENCED -> CLEAR [style=dotted]; -} diff --git a/api/managementpb/ia/status.pb.go b/api/managementpb/ia/status.pb.go deleted file mode 100644 index 681fef5a4e..0000000000 --- a/api/managementpb/ia/status.pb.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: managementpb/ia/status.proto - -package iav1beta1 - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Status represents Alert Rule's and Alert's combined status. -// -// Deprecated: Marked as deprecated in managementpb/ia/status.proto. -type Status int32 - -const ( - Status_STATUS_INVALID Status = 0 - // No alert. - Status_CLEAR Status = 1 - // Pending, but not triggering alert. - Status_PENDING Status = 2 - // Triggering (firing) alert. - Status_TRIGGERING Status = 3 - // Silenced alert. - Status_SILENCED Status = 4 -) - -// Enum value maps for Status. -var ( - Status_name = map[int32]string{ - 0: "STATUS_INVALID", - 1: "CLEAR", - 2: "PENDING", - 3: "TRIGGERING", - 4: "SILENCED", - } - Status_value = map[string]int32{ - "STATUS_INVALID": 0, - "CLEAR": 1, - "PENDING": 2, - "TRIGGERING": 3, - "SILENCED": 4, - } -) - -func (x Status) Enum() *Status { - p := new(Status) - *p = x - return p -} - -func (x Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Status) Descriptor() protoreflect.EnumDescriptor { - return file_managementpb_ia_status_proto_enumTypes[0].Descriptor() -} - -func (Status) Type() protoreflect.EnumType { - return &file_managementpb_ia_status_proto_enumTypes[0] -} - -func (x Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Status.Descriptor instead. -func (Status) EnumDescriptor() ([]byte, []int) { - return file_managementpb_ia_status_proto_rawDescGZIP(), []int{0} -} - -var File_managementpb_ia_status_proto protoreflect.FileDescriptor - -var file_managementpb_ia_status_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, - 0x61, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, - 0x69, 0x61, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2a, 0x56, 0x0a, 0x06, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x49, - 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4c, 0x45, 0x41, - 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, - 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x03, - 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x49, 0x4c, 0x45, 0x4e, 0x43, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x02, - 0x18, 0x01, 0x42, 0x9c, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x61, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0x2f, 0x69, 0x61, - 0x3b, 0x69, 0x61, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x58, 0x58, - 0xaa, 0x02, 0x0a, 0x49, 0x61, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x0a, - 0x49, 0x61, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x16, 0x49, 0x61, 0x5c, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x49, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_managementpb_ia_status_proto_rawDescOnce sync.Once - file_managementpb_ia_status_proto_rawDescData = file_managementpb_ia_status_proto_rawDesc -) - -func file_managementpb_ia_status_proto_rawDescGZIP() []byte { - file_managementpb_ia_status_proto_rawDescOnce.Do(func() { - file_managementpb_ia_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_managementpb_ia_status_proto_rawDescData) - }) - return file_managementpb_ia_status_proto_rawDescData -} - -var ( - file_managementpb_ia_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) - file_managementpb_ia_status_proto_goTypes = []interface{}{ - (Status)(0), // 0: ia.v1beta1.Status - } -) - -var file_managementpb_ia_status_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_managementpb_ia_status_proto_init() } -func file_managementpb_ia_status_proto_init() { - if File_managementpb_ia_status_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_managementpb_ia_status_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_managementpb_ia_status_proto_goTypes, - DependencyIndexes: file_managementpb_ia_status_proto_depIdxs, - EnumInfos: file_managementpb_ia_status_proto_enumTypes, - }.Build() - File_managementpb_ia_status_proto = out.File - file_managementpb_ia_status_proto_rawDesc = nil - file_managementpb_ia_status_proto_goTypes = nil - file_managementpb_ia_status_proto_depIdxs = nil -} diff --git a/api/managementpb/ia/status.pb.validate.go b/api/managementpb/ia/status.pb.validate.go deleted file mode 100644 index 88d02ccf6b..0000000000 --- a/api/managementpb/ia/status.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: managementpb/ia/status.proto - -package iav1beta1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/api/managementpb/ia/status.proto b/api/managementpb/ia/status.proto deleted file mode 100644 index 9592c9c541..0000000000 --- a/api/managementpb/ia/status.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; - -package ia.v1beta1; - -option go_package = "api/managementpb/ia;iav1beta1"; - -// Status represents Alert Rule's and Alert's combined status. -enum Status { - option deprecated = true; - STATUS_INVALID = 0; - // No alert. - CLEAR = 1; - // Pending, but not triggering alert. - PENDING = 2; - // Triggering (firing) alert. - TRIGGERING = 3; - // Silenced alert. - SILENCED = 4; -} diff --git a/api/serverpb/json/client/server/change_settings_responses.go b/api/serverpb/json/client/server/change_settings_responses.go index 2b8002e621..b3dd26880c 100644 --- a/api/serverpb/json/client/server/change_settings_responses.go +++ b/api/serverpb/json/client/server/change_settings_responses.go @@ -171,12 +171,6 @@ type ChangeSettingsBody struct { // Disable Alerting. DisableAlerting bool `json:"disable_alerting,omitempty"` - // If true, removes Alerting email (SMTP) settings. - RemoveEmailAlertingSettings bool `json:"remove_email_alerting_settings,omitempty"` - - // If true, removes Alerting Slack settings. - RemoveSlackAlertingSettings bool `json:"remove_slack_alerting_settings,omitempty"` - // PMM Server public address. PMMPublicAddress string `json:"pmm_public_address,omitempty"` @@ -201,15 +195,9 @@ type ChangeSettingsBody struct { // Disable Access Control DisableAccessControl bool `json:"disable_access_control,omitempty"` - // email alerting settings - EmailAlertingSettings *ChangeSettingsParamsBodyEmailAlertingSettings `json:"email_alerting_settings,omitempty"` - // metrics resolutions MetricsResolutions *ChangeSettingsParamsBodyMetricsResolutions `json:"metrics_resolutions,omitempty"` - // slack alerting settings - SlackAlertingSettings *ChangeSettingsParamsBodySlackAlertingSettings `json:"slack_alerting_settings,omitempty"` - // stt check intervals SttCheckIntervals *ChangeSettingsParamsBodySttCheckIntervals `json:"stt_check_intervals,omitempty"` } @@ -218,18 +206,10 @@ type ChangeSettingsBody struct { func (o *ChangeSettingsBody) Validate(formats strfmt.Registry) error { var res []error - if err := o.validateEmailAlertingSettings(formats); err != nil { - res = append(res, err) - } - if err := o.validateMetricsResolutions(formats); err != nil { res = append(res, err) } - if err := o.validateSlackAlertingSettings(formats); err != nil { - res = append(res, err) - } - if err := o.validateSttCheckIntervals(formats); err != nil { res = append(res, err) } @@ -240,25 +220,6 @@ func (o *ChangeSettingsBody) Validate(formats strfmt.Registry) error { return nil } -func (o *ChangeSettingsBody) validateEmailAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.EmailAlertingSettings) { // not required - return nil - } - - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsBody) validateMetricsResolutions(formats strfmt.Registry) error { if swag.IsZero(o.MetricsResolutions) { // not required return nil @@ -278,25 +239,6 @@ func (o *ChangeSettingsBody) validateMetricsResolutions(formats strfmt.Registry) return nil } -func (o *ChangeSettingsBody) validateSlackAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.SlackAlertingSettings) { // not required - return nil - } - - if o.SlackAlertingSettings != nil { - if err := o.SlackAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "slack_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "slack_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsBody) validateSttCheckIntervals(formats strfmt.Registry) error { if swag.IsZero(o.SttCheckIntervals) { // not required return nil @@ -320,18 +262,10 @@ func (o *ChangeSettingsBody) validateSttCheckIntervals(formats strfmt.Registry) func (o *ChangeSettingsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error - if err := o.contextValidateEmailAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - if err := o.contextValidateMetricsResolutions(ctx, formats); err != nil { res = append(res, err) } - if err := o.contextValidateSlackAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - if err := o.contextValidateSttCheckIntervals(ctx, formats); err != nil { res = append(res, err) } @@ -342,21 +276,6 @@ func (o *ChangeSettingsBody) ContextValidate(ctx context.Context, formats strfmt return nil } -func (o *ChangeSettingsBody) contextValidateEmailAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsBody) contextValidateMetricsResolutions(ctx context.Context, formats strfmt.Registry) error { if o.MetricsResolutions != nil { if err := o.MetricsResolutions.ContextValidate(ctx, formats); err != nil { @@ -372,21 +291,6 @@ func (o *ChangeSettingsBody) contextValidateMetricsResolutions(ctx context.Conte return nil } -func (o *ChangeSettingsBody) contextValidateSlackAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.SlackAlertingSettings != nil { - if err := o.SlackAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "slack_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "slack_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsBody) contextValidateSttCheckIntervals(ctx context.Context, formats strfmt.Registry) error { if o.SttCheckIntervals != nil { if err := o.SttCheckIntervals.ContextValidate(ctx, formats); err != nil { @@ -819,15 +723,9 @@ type ChangeSettingsOKBodySettings struct { // Default Access Control role ID for new users. DefaultRoleID int64 `json:"default_role_id,omitempty"` - // email alerting settings - EmailAlertingSettings *ChangeSettingsOKBodySettingsEmailAlertingSettings `json:"email_alerting_settings,omitempty"` - // metrics resolutions MetricsResolutions *ChangeSettingsOKBodySettingsMetricsResolutions `json:"metrics_resolutions,omitempty"` - // slack alerting settings - SlackAlertingSettings *ChangeSettingsOKBodySettingsSlackAlertingSettings `json:"slack_alerting_settings,omitempty"` - // stt check intervals SttCheckIntervals *ChangeSettingsOKBodySettingsSttCheckIntervals `json:"stt_check_intervals,omitempty"` } @@ -836,18 +734,10 @@ type ChangeSettingsOKBodySettings struct { func (o *ChangeSettingsOKBodySettings) Validate(formats strfmt.Registry) error { var res []error - if err := o.validateEmailAlertingSettings(formats); err != nil { - res = append(res, err) - } - if err := o.validateMetricsResolutions(formats); err != nil { res = append(res, err) } - if err := o.validateSlackAlertingSettings(formats); err != nil { - res = append(res, err) - } - if err := o.validateSttCheckIntervals(formats); err != nil { res = append(res, err) } @@ -858,25 +748,6 @@ func (o *ChangeSettingsOKBodySettings) Validate(formats strfmt.Registry) error { return nil } -func (o *ChangeSettingsOKBodySettings) validateEmailAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.EmailAlertingSettings) { // not required - return nil - } - - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("changeSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("changeSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsOKBodySettings) validateMetricsResolutions(formats strfmt.Registry) error { if swag.IsZero(o.MetricsResolutions) { // not required return nil @@ -896,25 +767,6 @@ func (o *ChangeSettingsOKBodySettings) validateMetricsResolutions(formats strfmt return nil } -func (o *ChangeSettingsOKBodySettings) validateSlackAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.SlackAlertingSettings) { // not required - return nil - } - - if o.SlackAlertingSettings != nil { - if err := o.SlackAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("changeSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("changeSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsOKBodySettings) validateSttCheckIntervals(formats strfmt.Registry) error { if swag.IsZero(o.SttCheckIntervals) { // not required return nil @@ -938,18 +790,10 @@ func (o *ChangeSettingsOKBodySettings) validateSttCheckIntervals(formats strfmt. func (o *ChangeSettingsOKBodySettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error - if err := o.contextValidateEmailAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - if err := o.contextValidateMetricsResolutions(ctx, formats); err != nil { res = append(res, err) } - if err := o.contextValidateSlackAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - if err := o.contextValidateSttCheckIntervals(ctx, formats); err != nil { res = append(res, err) } @@ -960,21 +804,6 @@ func (o *ChangeSettingsOKBodySettings) ContextValidate(ctx context.Context, form return nil } -func (o *ChangeSettingsOKBodySettings) contextValidateEmailAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("changeSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("changeSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsOKBodySettings) contextValidateMetricsResolutions(ctx context.Context, formats strfmt.Registry) error { if o.MetricsResolutions != nil { if err := o.MetricsResolutions.ContextValidate(ctx, formats); err != nil { @@ -990,21 +819,6 @@ func (o *ChangeSettingsOKBodySettings) contextValidateMetricsResolutions(ctx con return nil } -func (o *ChangeSettingsOKBodySettings) contextValidateSlackAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.SlackAlertingSettings != nil { - if err := o.SlackAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("changeSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("changeSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } - return err - } - } - - return nil -} - func (o *ChangeSettingsOKBodySettings) contextValidateSttCheckIntervals(ctx context.Context, formats strfmt.Registry) error { if o.SttCheckIntervals != nil { if err := o.SttCheckIntervals.ContextValidate(ctx, formats); err != nil { @@ -1038,64 +852,6 @@ func (o *ChangeSettingsOKBodySettings) UnmarshalBinary(b []byte) error { return nil } -/* -ChangeSettingsOKBodySettingsEmailAlertingSettings EmailAlertingSettings represents email (SMTP) configuration for Alerting. -swagger:model ChangeSettingsOKBodySettingsEmailAlertingSettings -*/ -type ChangeSettingsOKBodySettingsEmailAlertingSettings struct { - // SMTP From header field. - From string `json:"from,omitempty"` - - // SMTP host and port. - Smarthost string `json:"smarthost,omitempty"` - - // Hostname to identify to the SMTP server. - Hello string `json:"hello,omitempty"` - - // Auth using CRAM-MD5, LOGIN and PLAIN. - Username string `json:"username,omitempty"` - - // Auth using LOGIN and PLAIN. - Password string `json:"password,omitempty"` - - // Auth using PLAIN. - Identity string `json:"identity,omitempty"` - - // Auth using CRAM-MD5. - Secret string `json:"secret,omitempty"` - - // Require TLS. - RequireTLS bool `json:"require_tls,omitempty"` -} - -// Validate validates this change settings OK body settings email alerting settings -func (o *ChangeSettingsOKBodySettingsEmailAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change settings OK body settings email alerting settings based on context it is used -func (o *ChangeSettingsOKBodySettingsEmailAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeSettingsOKBodySettingsEmailAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeSettingsOKBodySettingsEmailAlertingSettings) UnmarshalBinary(b []byte) error { - var res ChangeSettingsOKBodySettingsEmailAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - /* ChangeSettingsOKBodySettingsMetricsResolutions MetricsResolutions represents Prometheus exporters metrics resolutions. swagger:model ChangeSettingsOKBodySettingsMetricsResolutions @@ -1139,43 +895,6 @@ func (o *ChangeSettingsOKBodySettingsMetricsResolutions) UnmarshalBinary(b []byt return nil } -/* -ChangeSettingsOKBodySettingsSlackAlertingSettings SlackAlertingSettings represents Slack configuration for Alerting. -swagger:model ChangeSettingsOKBodySettingsSlackAlertingSettings -*/ -type ChangeSettingsOKBodySettingsSlackAlertingSettings struct { - // Slack API (webhook) URL. - URL string `json:"url,omitempty"` -} - -// Validate validates this change settings OK body settings slack alerting settings -func (o *ChangeSettingsOKBodySettingsSlackAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change settings OK body settings slack alerting settings based on context it is used -func (o *ChangeSettingsOKBodySettingsSlackAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeSettingsOKBodySettingsSlackAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeSettingsOKBodySettingsSlackAlertingSettings) UnmarshalBinary(b []byte) error { - var res ChangeSettingsOKBodySettingsSlackAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - /* ChangeSettingsOKBodySettingsSttCheckIntervals STTCheckIntervals represents intervals between STT checks. swagger:model ChangeSettingsOKBodySettingsSttCheckIntervals @@ -1219,64 +938,6 @@ func (o *ChangeSettingsOKBodySettingsSttCheckIntervals) UnmarshalBinary(b []byte return nil } -/* -ChangeSettingsParamsBodyEmailAlertingSettings EmailAlertingSettings represents email (SMTP) configuration for Alerting. -swagger:model ChangeSettingsParamsBodyEmailAlertingSettings -*/ -type ChangeSettingsParamsBodyEmailAlertingSettings struct { - // SMTP From header field. - From string `json:"from,omitempty"` - - // SMTP host and port. - Smarthost string `json:"smarthost,omitempty"` - - // Hostname to identify to the SMTP server. - Hello string `json:"hello,omitempty"` - - // Auth using CRAM-MD5, LOGIN and PLAIN. - Username string `json:"username,omitempty"` - - // Auth using LOGIN and PLAIN. - Password string `json:"password,omitempty"` - - // Auth using PLAIN. - Identity string `json:"identity,omitempty"` - - // Auth using CRAM-MD5. - Secret string `json:"secret,omitempty"` - - // Require TLS. - RequireTLS bool `json:"require_tls,omitempty"` -} - -// Validate validates this change settings params body email alerting settings -func (o *ChangeSettingsParamsBodyEmailAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change settings params body email alerting settings based on context it is used -func (o *ChangeSettingsParamsBodyEmailAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeSettingsParamsBodyEmailAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeSettingsParamsBodyEmailAlertingSettings) UnmarshalBinary(b []byte) error { - var res ChangeSettingsParamsBodyEmailAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - /* ChangeSettingsParamsBodyMetricsResolutions MetricsResolutions represents Prometheus exporters metrics resolutions. swagger:model ChangeSettingsParamsBodyMetricsResolutions @@ -1320,43 +981,6 @@ func (o *ChangeSettingsParamsBodyMetricsResolutions) UnmarshalBinary(b []byte) e return nil } -/* -ChangeSettingsParamsBodySlackAlertingSettings SlackAlertingSettings represents Slack configuration for Alerting. -swagger:model ChangeSettingsParamsBodySlackAlertingSettings -*/ -type ChangeSettingsParamsBodySlackAlertingSettings struct { - // Slack API (webhook) URL. - URL string `json:"url,omitempty"` -} - -// Validate validates this change settings params body slack alerting settings -func (o *ChangeSettingsParamsBodySlackAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this change settings params body slack alerting settings based on context it is used -func (o *ChangeSettingsParamsBodySlackAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ChangeSettingsParamsBodySlackAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ChangeSettingsParamsBodySlackAlertingSettings) UnmarshalBinary(b []byte) error { - var res ChangeSettingsParamsBodySlackAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - /* ChangeSettingsParamsBodySttCheckIntervals STTCheckIntervals represents intervals between STT checks. swagger:model ChangeSettingsParamsBodySttCheckIntervals diff --git a/api/serverpb/json/client/server/get_settings_responses.go b/api/serverpb/json/client/server/get_settings_responses.go index 3d40aa6583..29d80dad1c 100644 --- a/api/serverpb/json/client/server/get_settings_responses.go +++ b/api/serverpb/json/client/server/get_settings_responses.go @@ -517,15 +517,9 @@ type GetSettingsOKBodySettings struct { // Default Access Control role ID for new users. DefaultRoleID int64 `json:"default_role_id,omitempty"` - // email alerting settings - EmailAlertingSettings *GetSettingsOKBodySettingsEmailAlertingSettings `json:"email_alerting_settings,omitempty"` - // metrics resolutions MetricsResolutions *GetSettingsOKBodySettingsMetricsResolutions `json:"metrics_resolutions,omitempty"` - // slack alerting settings - SlackAlertingSettings *GetSettingsOKBodySettingsSlackAlertingSettings `json:"slack_alerting_settings,omitempty"` - // stt check intervals SttCheckIntervals *GetSettingsOKBodySettingsSttCheckIntervals `json:"stt_check_intervals,omitempty"` } @@ -534,18 +528,10 @@ type GetSettingsOKBodySettings struct { func (o *GetSettingsOKBodySettings) Validate(formats strfmt.Registry) error { var res []error - if err := o.validateEmailAlertingSettings(formats); err != nil { - res = append(res, err) - } - if err := o.validateMetricsResolutions(formats); err != nil { res = append(res, err) } - if err := o.validateSlackAlertingSettings(formats); err != nil { - res = append(res, err) - } - if err := o.validateSttCheckIntervals(formats); err != nil { res = append(res, err) } @@ -556,25 +542,6 @@ func (o *GetSettingsOKBodySettings) Validate(formats strfmt.Registry) error { return nil } -func (o *GetSettingsOKBodySettings) validateEmailAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.EmailAlertingSettings) { // not required - return nil - } - - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("getSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("getSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - func (o *GetSettingsOKBodySettings) validateMetricsResolutions(formats strfmt.Registry) error { if swag.IsZero(o.MetricsResolutions) { // not required return nil @@ -594,25 +561,6 @@ func (o *GetSettingsOKBodySettings) validateMetricsResolutions(formats strfmt.Re return nil } -func (o *GetSettingsOKBodySettings) validateSlackAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.SlackAlertingSettings) { // not required - return nil - } - - if o.SlackAlertingSettings != nil { - if err := o.SlackAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("getSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("getSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } - return err - } - } - - return nil -} - func (o *GetSettingsOKBodySettings) validateSttCheckIntervals(formats strfmt.Registry) error { if swag.IsZero(o.SttCheckIntervals) { // not required return nil @@ -636,18 +584,10 @@ func (o *GetSettingsOKBodySettings) validateSttCheckIntervals(formats strfmt.Reg func (o *GetSettingsOKBodySettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error - if err := o.contextValidateEmailAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - if err := o.contextValidateMetricsResolutions(ctx, formats); err != nil { res = append(res, err) } - if err := o.contextValidateSlackAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - if err := o.contextValidateSttCheckIntervals(ctx, formats); err != nil { res = append(res, err) } @@ -658,21 +598,6 @@ func (o *GetSettingsOKBodySettings) ContextValidate(ctx context.Context, formats return nil } -func (o *GetSettingsOKBodySettings) contextValidateEmailAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("getSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("getSettingsOk" + "." + "settings" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - func (o *GetSettingsOKBodySettings) contextValidateMetricsResolutions(ctx context.Context, formats strfmt.Registry) error { if o.MetricsResolutions != nil { if err := o.MetricsResolutions.ContextValidate(ctx, formats); err != nil { @@ -688,21 +613,6 @@ func (o *GetSettingsOKBodySettings) contextValidateMetricsResolutions(ctx contex return nil } -func (o *GetSettingsOKBodySettings) contextValidateSlackAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.SlackAlertingSettings != nil { - if err := o.SlackAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("getSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("getSettingsOk" + "." + "settings" + "." + "slack_alerting_settings") - } - return err - } - } - - return nil -} - func (o *GetSettingsOKBodySettings) contextValidateSttCheckIntervals(ctx context.Context, formats strfmt.Registry) error { if o.SttCheckIntervals != nil { if err := o.SttCheckIntervals.ContextValidate(ctx, formats); err != nil { @@ -736,64 +646,6 @@ func (o *GetSettingsOKBodySettings) UnmarshalBinary(b []byte) error { return nil } -/* -GetSettingsOKBodySettingsEmailAlertingSettings EmailAlertingSettings represents email (SMTP) configuration for Alerting. -swagger:model GetSettingsOKBodySettingsEmailAlertingSettings -*/ -type GetSettingsOKBodySettingsEmailAlertingSettings struct { - // SMTP From header field. - From string `json:"from,omitempty"` - - // SMTP host and port. - Smarthost string `json:"smarthost,omitempty"` - - // Hostname to identify to the SMTP server. - Hello string `json:"hello,omitempty"` - - // Auth using CRAM-MD5, LOGIN and PLAIN. - Username string `json:"username,omitempty"` - - // Auth using LOGIN and PLAIN. - Password string `json:"password,omitempty"` - - // Auth using PLAIN. - Identity string `json:"identity,omitempty"` - - // Auth using CRAM-MD5. - Secret string `json:"secret,omitempty"` - - // Require TLS. - RequireTLS bool `json:"require_tls,omitempty"` -} - -// Validate validates this get settings OK body settings email alerting settings -func (o *GetSettingsOKBodySettingsEmailAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this get settings OK body settings email alerting settings based on context it is used -func (o *GetSettingsOKBodySettingsEmailAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *GetSettingsOKBodySettingsEmailAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *GetSettingsOKBodySettingsEmailAlertingSettings) UnmarshalBinary(b []byte) error { - var res GetSettingsOKBodySettingsEmailAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - /* GetSettingsOKBodySettingsMetricsResolutions MetricsResolutions represents Prometheus exporters metrics resolutions. swagger:model GetSettingsOKBodySettingsMetricsResolutions @@ -837,43 +689,6 @@ func (o *GetSettingsOKBodySettingsMetricsResolutions) UnmarshalBinary(b []byte) return nil } -/* -GetSettingsOKBodySettingsSlackAlertingSettings SlackAlertingSettings represents Slack configuration for Alerting. -swagger:model GetSettingsOKBodySettingsSlackAlertingSettings -*/ -type GetSettingsOKBodySettingsSlackAlertingSettings struct { - // Slack API (webhook) URL. - URL string `json:"url,omitempty"` -} - -// Validate validates this get settings OK body settings slack alerting settings -func (o *GetSettingsOKBodySettingsSlackAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this get settings OK body settings slack alerting settings based on context it is used -func (o *GetSettingsOKBodySettingsSlackAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *GetSettingsOKBodySettingsSlackAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *GetSettingsOKBodySettingsSlackAlertingSettings) UnmarshalBinary(b []byte) error { - var res GetSettingsOKBodySettingsSlackAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - /* GetSettingsOKBodySettingsSttCheckIntervals STTCheckIntervals represents intervals between STT checks. swagger:model GetSettingsOKBodySettingsSttCheckIntervals diff --git a/api/serverpb/json/client/server/server_client.go b/api/serverpb/json/client/server/server_client.go index fffdea9044..4ea4103a70 100644 --- a/api/serverpb/json/client/server/server_client.go +++ b/api/serverpb/json/client/server/server_client.go @@ -44,8 +44,6 @@ type ClientService interface { StartUpdate(params *StartUpdateParams, opts ...ClientOption) (*StartUpdateOK, error) - TestEmailAlertingSettings(params *TestEmailAlertingSettingsParams, opts ...ClientOption) (*TestEmailAlertingSettingsOK, error) - UpdateStatus(params *UpdateStatusParams, opts ...ClientOption) (*UpdateStatusOK, error) Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error) @@ -326,45 +324,6 @@ func (a *Client) StartUpdate(params *StartUpdateParams, opts ...ClientOption) (* return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -TestEmailAlertingSettings tests email alerting - -Sends test email to check current SMTP settings for email alerting. -*/ -func (a *Client) TestEmailAlertingSettings(params *TestEmailAlertingSettingsParams, opts ...ClientOption) (*TestEmailAlertingSettingsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewTestEmailAlertingSettingsParams() - } - op := &runtime.ClientOperation{ - ID: "TestEmailAlertingSettings", - Method: "POST", - PathPattern: "/v1/Settings/TestEmailAlertingSettings", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - Reader: &TestEmailAlertingSettingsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*TestEmailAlertingSettingsOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*TestEmailAlertingSettingsDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* UpdateStatus updates status diff --git a/api/serverpb/json/client/server/test_email_alerting_settings_parameters.go b/api/serverpb/json/client/server/test_email_alerting_settings_parameters.go deleted file mode 100644 index df14058507..0000000000 --- a/api/serverpb/json/client/server/test_email_alerting_settings_parameters.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewTestEmailAlertingSettingsParams creates a new TestEmailAlertingSettingsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewTestEmailAlertingSettingsParams() *TestEmailAlertingSettingsParams { - return &TestEmailAlertingSettingsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewTestEmailAlertingSettingsParamsWithTimeout creates a new TestEmailAlertingSettingsParams object -// with the ability to set a timeout on a request. -func NewTestEmailAlertingSettingsParamsWithTimeout(timeout time.Duration) *TestEmailAlertingSettingsParams { - return &TestEmailAlertingSettingsParams{ - timeout: timeout, - } -} - -// NewTestEmailAlertingSettingsParamsWithContext creates a new TestEmailAlertingSettingsParams object -// with the ability to set a context for a request. -func NewTestEmailAlertingSettingsParamsWithContext(ctx context.Context) *TestEmailAlertingSettingsParams { - return &TestEmailAlertingSettingsParams{ - Context: ctx, - } -} - -// NewTestEmailAlertingSettingsParamsWithHTTPClient creates a new TestEmailAlertingSettingsParams object -// with the ability to set a custom HTTPClient for a request. -func NewTestEmailAlertingSettingsParamsWithHTTPClient(client *http.Client) *TestEmailAlertingSettingsParams { - return &TestEmailAlertingSettingsParams{ - HTTPClient: client, - } -} - -/* -TestEmailAlertingSettingsParams contains all the parameters to send to the API endpoint - - for the test email alerting settings operation. - - Typically these are written to a http.Request. -*/ -type TestEmailAlertingSettingsParams struct { - // Body. - Body TestEmailAlertingSettingsBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the test email alerting settings params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *TestEmailAlertingSettingsParams) WithDefaults() *TestEmailAlertingSettingsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the test email alerting settings params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *TestEmailAlertingSettingsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) WithTimeout(timeout time.Duration) *TestEmailAlertingSettingsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) WithContext(ctx context.Context) *TestEmailAlertingSettingsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) WithHTTPClient(client *http.Client) *TestEmailAlertingSettingsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) WithBody(body TestEmailAlertingSettingsBody) *TestEmailAlertingSettingsParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the test email alerting settings params -func (o *TestEmailAlertingSettingsParams) SetBody(body TestEmailAlertingSettingsBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *TestEmailAlertingSettingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/serverpb/json/client/server/test_email_alerting_settings_responses.go b/api/serverpb/json/client/server/test_email_alerting_settings_responses.go deleted file mode 100644 index d244764a80..0000000000 --- a/api/serverpb/json/client/server/test_email_alerting_settings_responses.go +++ /dev/null @@ -1,518 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TestEmailAlertingSettingsReader is a Reader for the TestEmailAlertingSettings structure. -type TestEmailAlertingSettingsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *TestEmailAlertingSettingsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewTestEmailAlertingSettingsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewTestEmailAlertingSettingsDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewTestEmailAlertingSettingsOK creates a TestEmailAlertingSettingsOK with default headers values -func NewTestEmailAlertingSettingsOK() *TestEmailAlertingSettingsOK { - return &TestEmailAlertingSettingsOK{} -} - -/* -TestEmailAlertingSettingsOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type TestEmailAlertingSettingsOK struct { - Payload interface{} -} - -func (o *TestEmailAlertingSettingsOK) Error() string { - return fmt.Sprintf("[POST /v1/Settings/TestEmailAlertingSettings][%d] testEmailAlertingSettingsOk %+v", 200, o.Payload) -} - -func (o *TestEmailAlertingSettingsOK) GetPayload() interface{} { - return o.Payload -} - -func (o *TestEmailAlertingSettingsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewTestEmailAlertingSettingsDefault creates a TestEmailAlertingSettingsDefault with default headers values -func NewTestEmailAlertingSettingsDefault(code int) *TestEmailAlertingSettingsDefault { - return &TestEmailAlertingSettingsDefault{ - _statusCode: code, - } -} - -/* -TestEmailAlertingSettingsDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type TestEmailAlertingSettingsDefault struct { - _statusCode int - - Payload *TestEmailAlertingSettingsDefaultBody -} - -// Code gets the status code for the test email alerting settings default response -func (o *TestEmailAlertingSettingsDefault) Code() int { - return o._statusCode -} - -func (o *TestEmailAlertingSettingsDefault) Error() string { - return fmt.Sprintf("[POST /v1/Settings/TestEmailAlertingSettings][%d] TestEmailAlertingSettings default %+v", o._statusCode, o.Payload) -} - -func (o *TestEmailAlertingSettingsDefault) GetPayload() *TestEmailAlertingSettingsDefaultBody { - return o.Payload -} - -func (o *TestEmailAlertingSettingsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(TestEmailAlertingSettingsDefaultBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -TestEmailAlertingSettingsBody test email alerting settings body -swagger:model TestEmailAlertingSettingsBody -*/ -type TestEmailAlertingSettingsBody struct { - // Target email address to send the email to. - EmailTo string `json:"email_to,omitempty"` - - // email alerting settings - EmailAlertingSettings *TestEmailAlertingSettingsParamsBodyEmailAlertingSettings `json:"email_alerting_settings,omitempty"` -} - -// Validate validates this test email alerting settings body -func (o *TestEmailAlertingSettingsBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateEmailAlertingSettings(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *TestEmailAlertingSettingsBody) validateEmailAlertingSettings(formats strfmt.Registry) error { - if swag.IsZero(o.EmailAlertingSettings) { // not required - return nil - } - - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - -// ContextValidate validate this test email alerting settings body based on the context it is used -func (o *TestEmailAlertingSettingsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateEmailAlertingSettings(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *TestEmailAlertingSettingsBody) contextValidateEmailAlertingSettings(ctx context.Context, formats strfmt.Registry) error { - if o.EmailAlertingSettings != nil { - if err := o.EmailAlertingSettings.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "email_alerting_settings") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "email_alerting_settings") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *TestEmailAlertingSettingsBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *TestEmailAlertingSettingsBody) UnmarshalBinary(b []byte) error { - var res TestEmailAlertingSettingsBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -TestEmailAlertingSettingsDefaultBody test email alerting settings default body -swagger:model TestEmailAlertingSettingsDefaultBody -*/ -type TestEmailAlertingSettingsDefaultBody struct { - // code - Code int32 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` - - // details - Details []*TestEmailAlertingSettingsDefaultBodyDetailsItems0 `json:"details"` -} - -// Validate validates this test email alerting settings default body -func (o *TestEmailAlertingSettingsDefaultBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *TestEmailAlertingSettingsDefaultBody) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(o.Details) { // not required - return nil - } - - for i := 0; i < len(o.Details); i++ { - if swag.IsZero(o.Details[i]) { // not required - continue - } - - if o.Details[i] != nil { - if err := o.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("TestEmailAlertingSettings default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("TestEmailAlertingSettings default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this test email alerting settings default body based on the context it is used -func (o *TestEmailAlertingSettingsDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *TestEmailAlertingSettingsDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - for i := 0; i < len(o.Details); i++ { - if o.Details[i] != nil { - if err := o.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("TestEmailAlertingSettings default" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("TestEmailAlertingSettings default" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *TestEmailAlertingSettingsDefaultBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *TestEmailAlertingSettingsDefaultBody) UnmarshalBinary(b []byte) error { - var res TestEmailAlertingSettingsDefaultBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -TestEmailAlertingSettingsDefaultBodyDetailsItems0 `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// // or ... -// if (any.isSameTypeAs(Foo.getDefaultInstance())) { -// foo = any.unpack(Foo.getDefaultInstance()); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := anypb.New(foo) -// if err != nil { -// ... -// } -// ... -// foo := &pb.Foo{} -// if err := any.UnmarshalTo(foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// JSON -// -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -swagger:model TestEmailAlertingSettingsDefaultBodyDetailsItems0 -*/ -type TestEmailAlertingSettingsDefaultBodyDetailsItems0 struct { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - AtType string `json:"@type,omitempty"` -} - -// Validate validates this test email alerting settings default body details items0 -func (o *TestEmailAlertingSettingsDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this test email alerting settings default body details items0 based on context it is used -func (o *TestEmailAlertingSettingsDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *TestEmailAlertingSettingsDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *TestEmailAlertingSettingsDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error { - var res TestEmailAlertingSettingsDefaultBodyDetailsItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -TestEmailAlertingSettingsParamsBodyEmailAlertingSettings EmailAlertingSettings represents email (SMTP) configuration for Alerting. -swagger:model TestEmailAlertingSettingsParamsBodyEmailAlertingSettings -*/ -type TestEmailAlertingSettingsParamsBodyEmailAlertingSettings struct { - // SMTP From header field. - From string `json:"from,omitempty"` - - // SMTP host and port. - Smarthost string `json:"smarthost,omitempty"` - - // Hostname to identify to the SMTP server. - Hello string `json:"hello,omitempty"` - - // Auth using CRAM-MD5, LOGIN and PLAIN. - Username string `json:"username,omitempty"` - - // Auth using LOGIN and PLAIN. - Password string `json:"password,omitempty"` - - // Auth using PLAIN. - Identity string `json:"identity,omitempty"` - - // Auth using CRAM-MD5. - Secret string `json:"secret,omitempty"` - - // Require TLS. - RequireTLS bool `json:"require_tls,omitempty"` -} - -// Validate validates this test email alerting settings params body email alerting settings -func (o *TestEmailAlertingSettingsParamsBodyEmailAlertingSettings) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this test email alerting settings params body email alerting settings based on context it is used -func (o *TestEmailAlertingSettingsParamsBodyEmailAlertingSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *TestEmailAlertingSettingsParamsBodyEmailAlertingSettings) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *TestEmailAlertingSettingsParamsBodyEmailAlertingSettings) UnmarshalBinary(b []byte) error { - var res TestEmailAlertingSettingsParamsBodyEmailAlertingSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/api/serverpb/json/serverpb.json b/api/serverpb/json/serverpb.json index 3e58eb1247..f68bd650cb 100644 --- a/api/serverpb/json/serverpb.json +++ b/api/serverpb/json/serverpb.json @@ -172,7 +172,7 @@ "disable_access_control": { "type": "boolean", "title": "Disable Access Control", - "x-order": 28 + "x-order": 24 }, "disable_alerting": { "description": "Disable Alerting.", @@ -182,12 +182,12 @@ "disable_azurediscover": { "description": "Disable Azure Discover.", "type": "boolean", - "x-order": 24 + "x-order": 20 }, "disable_backup_management": { "description": "Disable Backup Management.", "type": "boolean", - "x-order": 26 + "x-order": 22 }, "disable_stt": { "description": "Disable Security Threat Tool.", @@ -202,57 +202,10 @@ "type": "boolean", "x-order": 1 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 16 - }, "enable_access_control": { "type": "boolean", "title": "Enable Access Control", - "x-order": 27 + "x-order": 23 }, "enable_alerting": { "description": "Enable Alerting.", @@ -262,12 +215,12 @@ "enable_azurediscover": { "description": "Enable Azure Discover.", "type": "boolean", - "x-order": 23 + "x-order": 19 }, "enable_backup_management": { "description": "Enable Backup Management.", "type": "boolean", - "x-order": 25 + "x-order": 21 }, "enable_stt": { "description": "Enable Security Threat Tool.", @@ -307,7 +260,7 @@ "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 20 + "x-order": 16 }, "remove_alert_manager_rules": { "description": "Remove custom alerting or recording rules.", @@ -319,31 +272,9 @@ "type": "boolean", "x-order": 9 }, - "remove_email_alerting_settings": { - "description": "If true, removes Alerting email (SMTP) settings.", - "type": "boolean", - "x-order": 17 - }, "remove_pmm_public_address": { "type": "boolean", - "x-order": 21 - }, - "remove_slack_alerting_settings": { - "description": "If true, removes Alerting Slack settings.", - "type": "boolean", - "x-order": 19 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 18 + "x-order": 17 }, "ssh_key": { "type": "string", @@ -369,7 +300,7 @@ "x-order": 0 } }, - "x-order": 22 + "x-order": 18 } } } @@ -410,17 +341,17 @@ "azurediscover_enabled": { "description": "True if Azure Discover is enabled.", "type": "boolean", - "x-order": 16 + "x-order": 14 }, "backup_management_enabled": { "description": "True if Backup Management is enabled.", "type": "boolean", - "x-order": 15 + "x-order": 13 }, "connected_to_platform": { "type": "boolean", "title": "True if the PMM instance is connected to Platform", - "x-order": 17 + "x-order": 15 }, "data_retention": { "type": "string", @@ -430,59 +361,12 @@ "description": "Default Access Control role ID for new users.", "type": "integer", "format": "int64", - "x-order": 20 - }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 11 + "x-order": 18 }, "enable_access_control": { "description": "True if Access Control is enabled.", "type": "boolean", - "x-order": 19 + "x-order": 17 }, "metrics_resolutions": { "description": "MetricsResolutions represents Prometheus exporters metrics resolutions.", @@ -514,19 +398,7 @@ "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 13 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 12 + "x-order": 11 }, "ssh_key": { "type": "string", @@ -552,7 +424,7 @@ "x-order": 0 } }, - "x-order": 14 + "x-order": 12 }, "stt_enabled": { "description": "True if Security Threat Tool is enabled.", @@ -570,7 +442,7 @@ "items": { "type": "string" }, - "x-order": 18 + "x-order": 16 }, "updates_disabled": { "description": "True if updates are disabled.", @@ -672,17 +544,17 @@ "azurediscover_enabled": { "description": "True if Azure Discover is enabled.", "type": "boolean", - "x-order": 16 + "x-order": 14 }, "backup_management_enabled": { "description": "True if Backup Management is enabled.", "type": "boolean", - "x-order": 15 + "x-order": 13 }, "connected_to_platform": { "type": "boolean", "title": "True if the PMM instance is connected to Platform", - "x-order": 17 + "x-order": 15 }, "data_retention": { "type": "string", @@ -692,59 +564,12 @@ "description": "Default Access Control role ID for new users.", "type": "integer", "format": "int64", - "x-order": 20 - }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 11 + "x-order": 18 }, "enable_access_control": { "description": "True if Access Control is enabled.", "type": "boolean", - "x-order": 19 + "x-order": 17 }, "metrics_resolutions": { "description": "MetricsResolutions represents Prometheus exporters metrics resolutions.", @@ -776,19 +601,7 @@ "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 13 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 12 + "x-order": 11 }, "ssh_key": { "type": "string", @@ -814,7 +627,7 @@ "x-order": 0 } }, - "x-order": 14 + "x-order": 12 }, "stt_enabled": { "description": "True if Security Threat Tool is enabled.", @@ -832,7 +645,7 @@ "items": { "type": "string" }, - "x-order": 18 + "x-order": 16 }, "updates_disabled": { "description": "True if updates are disabled.", @@ -881,121 +694,6 @@ } } }, - "/v1/Settings/TestEmailAlertingSettings": { - "post": { - "description": "Sends test email to check current SMTP settings for email alerting.", - "tags": [ - "Server" - ], - "summary": "Test email alerting", - "operationId": "TestEmailAlertingSettings", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 0 - }, - "email_to": { - "description": "Target email address to send the email to.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "details": { - "type": "array", - "items": { - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }", - "type": "object", - "properties": { - "@type": { - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics.", - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - }, - "message": { - "type": "string", - "x-order": 1 - } - } - } - } - } - } - }, "/v1/Updates/Check": { "post": { "description": "Checks for available PMM Server updates.", diff --git a/api/serverpb/server.pb.go b/api/serverpb/server.pb.go index 996fda1cab..5aba4c87dd 100644 --- a/api/serverpb/server.pb.go +++ b/api/serverpb/server.pb.go @@ -777,167 +777,6 @@ func (x *MetricsResolutions) GetLr() *durationpb.Duration { return nil } -// EmailAlertingSettings represents email (SMTP) configuration for Alerting. -type EmailAlertingSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // SMTP From header field. - From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` - // SMTP host and port. - Smarthost string `protobuf:"bytes,2,opt,name=smarthost,proto3" json:"smarthost,omitempty"` - // Hostname to identify to the SMTP server. - Hello string `protobuf:"bytes,3,opt,name=hello,proto3" json:"hello,omitempty"` - // Auth using CRAM-MD5, LOGIN and PLAIN. - Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` - // Auth using LOGIN and PLAIN. - Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` - // Auth using PLAIN. - Identity string `protobuf:"bytes,6,opt,name=identity,proto3" json:"identity,omitempty"` - // Auth using CRAM-MD5. - Secret string `protobuf:"bytes,7,opt,name=secret,proto3" json:"secret,omitempty"` - // Require TLS. - RequireTls bool `protobuf:"varint,8,opt,name=require_tls,json=requireTls,proto3" json:"require_tls,omitempty"` -} - -func (x *EmailAlertingSettings) Reset() { - *x = EmailAlertingSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EmailAlertingSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EmailAlertingSettings) ProtoMessage() {} - -func (x *EmailAlertingSettings) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EmailAlertingSettings.ProtoReflect.Descriptor instead. -func (*EmailAlertingSettings) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{12} -} - -func (x *EmailAlertingSettings) GetFrom() string { - if x != nil { - return x.From - } - return "" -} - -func (x *EmailAlertingSettings) GetSmarthost() string { - if x != nil { - return x.Smarthost - } - return "" -} - -func (x *EmailAlertingSettings) GetHello() string { - if x != nil { - return x.Hello - } - return "" -} - -func (x *EmailAlertingSettings) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *EmailAlertingSettings) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *EmailAlertingSettings) GetIdentity() string { - if x != nil { - return x.Identity - } - return "" -} - -func (x *EmailAlertingSettings) GetSecret() string { - if x != nil { - return x.Secret - } - return "" -} - -func (x *EmailAlertingSettings) GetRequireTls() bool { - if x != nil { - return x.RequireTls - } - return false -} - -// SlackAlertingSettings represents Slack configuration for Alerting. -type SlackAlertingSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Slack API (webhook) URL. - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` -} - -func (x *SlackAlertingSettings) Reset() { - *x = SlackAlertingSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SlackAlertingSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SlackAlertingSettings) ProtoMessage() {} - -func (x *SlackAlertingSettings) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SlackAlertingSettings.ProtoReflect.Descriptor instead. -func (*SlackAlertingSettings) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{13} -} - -func (x *SlackAlertingSettings) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - // STTCheckIntervals represents intervals between STT checks. type STTCheckIntervals struct { state protoimpl.MessageState @@ -955,7 +794,7 @@ type STTCheckIntervals struct { func (x *STTCheckIntervals) Reset() { *x = STTCheckIntervals{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[14] + mi := &file_serverpb_server_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -968,7 +807,7 @@ func (x *STTCheckIntervals) String() string { func (*STTCheckIntervals) ProtoMessage() {} func (x *STTCheckIntervals) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[14] + mi := &file_serverpb_server_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -981,7 +820,7 @@ func (x *STTCheckIntervals) ProtoReflect() protoreflect.Message { // Deprecated: Use STTCheckIntervals.ProtoReflect.Descriptor instead. func (*STTCheckIntervals) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{14} + return file_serverpb_server_proto_rawDescGZIP(), []int{12} } func (x *STTCheckIntervals) GetStandardInterval() *durationpb.Duration { @@ -1029,10 +868,6 @@ type Settings struct { PlatformEmail string `protobuf:"bytes,10,opt,name=platform_email,json=platformEmail,proto3" json:"platform_email,omitempty"` // True if Alerting is enabled. AlertingEnabled bool `protobuf:"varint,12,opt,name=alerting_enabled,json=alertingEnabled,proto3" json:"alerting_enabled,omitempty"` - // Alerting email (SMTP) settings. - EmailAlertingSettings *EmailAlertingSettings `protobuf:"bytes,13,opt,name=email_alerting_settings,json=emailAlertingSettings,proto3" json:"email_alerting_settings,omitempty"` - // Alerting Slack settings. - SlackAlertingSettings *SlackAlertingSettings `protobuf:"bytes,14,opt,name=slack_alerting_settings,json=slackAlertingSettings,proto3" json:"slack_alerting_settings,omitempty"` // PMM Server public address. PmmPublicAddress string `protobuf:"bytes,15,opt,name=pmm_public_address,json=pmmPublicAddress,proto3" json:"pmm_public_address,omitempty"` // Intervals between STT check runs. @@ -1054,7 +889,7 @@ type Settings struct { func (x *Settings) Reset() { *x = Settings{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[15] + mi := &file_serverpb_server_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1067,7 +902,7 @@ func (x *Settings) String() string { func (*Settings) ProtoMessage() {} func (x *Settings) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[15] + mi := &file_serverpb_server_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1080,7 +915,7 @@ func (x *Settings) ProtoReflect() protoreflect.Message { // Deprecated: Use Settings.ProtoReflect.Descriptor instead. func (*Settings) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{15} + return file_serverpb_server_proto_rawDescGZIP(), []int{13} } func (x *Settings) GetUpdatesDisabled() bool { @@ -1160,20 +995,6 @@ func (x *Settings) GetAlertingEnabled() bool { return false } -func (x *Settings) GetEmailAlertingSettings() *EmailAlertingSettings { - if x != nil { - return x.EmailAlertingSettings - } - return nil -} - -func (x *Settings) GetSlackAlertingSettings() *SlackAlertingSettings { - if x != nil { - return x.SlackAlertingSettings - } - return nil -} - func (x *Settings) GetPmmPublicAddress() string { if x != nil { return x.PmmPublicAddress @@ -1239,7 +1060,7 @@ type GetSettingsRequest struct { func (x *GetSettingsRequest) Reset() { *x = GetSettingsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[16] + mi := &file_serverpb_server_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1252,7 +1073,7 @@ func (x *GetSettingsRequest) String() string { func (*GetSettingsRequest) ProtoMessage() {} func (x *GetSettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[16] + mi := &file_serverpb_server_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1265,7 +1086,7 @@ func (x *GetSettingsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSettingsRequest.ProtoReflect.Descriptor instead. func (*GetSettingsRequest) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{16} + return file_serverpb_server_proto_rawDescGZIP(), []int{14} } type GetSettingsResponse struct { @@ -1279,7 +1100,7 @@ type GetSettingsResponse struct { func (x *GetSettingsResponse) Reset() { *x = GetSettingsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[17] + mi := &file_serverpb_server_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1292,7 +1113,7 @@ func (x *GetSettingsResponse) String() string { func (*GetSettingsResponse) ProtoMessage() {} func (x *GetSettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[17] + mi := &file_serverpb_server_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1305,7 +1126,7 @@ func (x *GetSettingsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSettingsResponse.ProtoReflect.Descriptor instead. func (*GetSettingsResponse) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{17} + return file_serverpb_server_proto_rawDescGZIP(), []int{15} } func (x *GetSettingsResponse) GetSettings() *Settings { @@ -1345,14 +1166,6 @@ type ChangeSettingsRequest struct { EnableAlerting bool `protobuf:"varint,13,opt,name=enable_alerting,json=enableAlerting,proto3" json:"enable_alerting,omitempty"` // Disable Alerting. DisableAlerting bool `protobuf:"varint,14,opt,name=disable_alerting,json=disableAlerting,proto3" json:"disable_alerting,omitempty"` - // Change Alerting email (SMTP) settings, if set. - EmailAlertingSettings *EmailAlertingSettings `protobuf:"bytes,15,opt,name=email_alerting_settings,json=emailAlertingSettings,proto3" json:"email_alerting_settings,omitempty"` - // If true, removes Alerting email (SMTP) settings. - RemoveEmailAlertingSettings bool `protobuf:"varint,16,opt,name=remove_email_alerting_settings,json=removeEmailAlertingSettings,proto3" json:"remove_email_alerting_settings,omitempty"` - // Change Alerting Slack settings, if set. - SlackAlertingSettings *SlackAlertingSettings `protobuf:"bytes,17,opt,name=slack_alerting_settings,json=slackAlertingSettings,proto3" json:"slack_alerting_settings,omitempty"` - // If true, removes Alerting Slack settings. - RemoveSlackAlertingSettings bool `protobuf:"varint,18,opt,name=remove_slack_alerting_settings,json=removeSlackAlertingSettings,proto3" json:"remove_slack_alerting_settings,omitempty"` // PMM Server public address. PmmPublicAddress string `protobuf:"bytes,19,opt,name=pmm_public_address,json=pmmPublicAddress,proto3" json:"pmm_public_address,omitempty"` RemovePmmPublicAddress bool `protobuf:"varint,20,opt,name=remove_pmm_public_address,json=removePmmPublicAddress,proto3" json:"remove_pmm_public_address,omitempty"` @@ -1375,7 +1188,7 @@ type ChangeSettingsRequest struct { func (x *ChangeSettingsRequest) Reset() { *x = ChangeSettingsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[18] + mi := &file_serverpb_server_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1388,7 +1201,7 @@ func (x *ChangeSettingsRequest) String() string { func (*ChangeSettingsRequest) ProtoMessage() {} func (x *ChangeSettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[18] + mi := &file_serverpb_server_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1401,7 +1214,7 @@ func (x *ChangeSettingsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ChangeSettingsRequest.ProtoReflect.Descriptor instead. func (*ChangeSettingsRequest) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{18} + return file_serverpb_server_proto_rawDescGZIP(), []int{16} } func (x *ChangeSettingsRequest) GetEnableUpdates() bool { @@ -1516,34 +1329,6 @@ func (x *ChangeSettingsRequest) GetDisableAlerting() bool { return false } -func (x *ChangeSettingsRequest) GetEmailAlertingSettings() *EmailAlertingSettings { - if x != nil { - return x.EmailAlertingSettings - } - return nil -} - -func (x *ChangeSettingsRequest) GetRemoveEmailAlertingSettings() bool { - if x != nil { - return x.RemoveEmailAlertingSettings - } - return false -} - -func (x *ChangeSettingsRequest) GetSlackAlertingSettings() *SlackAlertingSettings { - if x != nil { - return x.SlackAlertingSettings - } - return nil -} - -func (x *ChangeSettingsRequest) GetRemoveSlackAlertingSettings() bool { - if x != nil { - return x.RemoveSlackAlertingSettings - } - return false -} - func (x *ChangeSettingsRequest) GetPmmPublicAddress() string { if x != nil { return x.PmmPublicAddress @@ -1618,7 +1403,7 @@ type ChangeSettingsResponse struct { func (x *ChangeSettingsResponse) Reset() { *x = ChangeSettingsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[19] + mi := &file_serverpb_server_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1631,7 +1416,7 @@ func (x *ChangeSettingsResponse) String() string { func (*ChangeSettingsResponse) ProtoMessage() {} func (x *ChangeSettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[19] + mi := &file_serverpb_server_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1644,7 +1429,7 @@ func (x *ChangeSettingsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ChangeSettingsResponse.ProtoReflect.Descriptor instead. func (*ChangeSettingsResponse) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{19} + return file_serverpb_server_proto_rawDescGZIP(), []int{17} } func (x *ChangeSettingsResponse) GetSettings() *Settings { @@ -1654,101 +1439,6 @@ func (x *ChangeSettingsResponse) GetSettings() *Settings { return nil } -type TestEmailAlertingSettingsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Alerting email (SMTP) settings. - EmailAlertingSettings *EmailAlertingSettings `protobuf:"bytes,1,opt,name=email_alerting_settings,json=emailAlertingSettings,proto3" json:"email_alerting_settings,omitempty"` - // Target email address to send the email to. - EmailTo string `protobuf:"bytes,2,opt,name=email_to,json=emailTo,proto3" json:"email_to,omitempty"` -} - -func (x *TestEmailAlertingSettingsRequest) Reset() { - *x = TestEmailAlertingSettingsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestEmailAlertingSettingsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestEmailAlertingSettingsRequest) ProtoMessage() {} - -func (x *TestEmailAlertingSettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestEmailAlertingSettingsRequest.ProtoReflect.Descriptor instead. -func (*TestEmailAlertingSettingsRequest) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{20} -} - -func (x *TestEmailAlertingSettingsRequest) GetEmailAlertingSettings() *EmailAlertingSettings { - if x != nil { - return x.EmailAlertingSettings - } - return nil -} - -func (x *TestEmailAlertingSettingsRequest) GetEmailTo() string { - if x != nil { - return x.EmailTo - } - return "" -} - -type TestEmailAlertingSettingsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *TestEmailAlertingSettingsResponse) Reset() { - *x = TestEmailAlertingSettingsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestEmailAlertingSettingsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestEmailAlertingSettingsResponse) ProtoMessage() {} - -func (x *TestEmailAlertingSettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestEmailAlertingSettingsResponse.ProtoReflect.Descriptor instead. -func (*TestEmailAlertingSettingsResponse) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{21} -} - type AWSInstanceCheckRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1761,7 +1451,7 @@ type AWSInstanceCheckRequest struct { func (x *AWSInstanceCheckRequest) Reset() { *x = AWSInstanceCheckRequest{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[22] + mi := &file_serverpb_server_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1774,7 +1464,7 @@ func (x *AWSInstanceCheckRequest) String() string { func (*AWSInstanceCheckRequest) ProtoMessage() {} func (x *AWSInstanceCheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[22] + mi := &file_serverpb_server_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1787,7 +1477,7 @@ func (x *AWSInstanceCheckRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AWSInstanceCheckRequest.ProtoReflect.Descriptor instead. func (*AWSInstanceCheckRequest) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{22} + return file_serverpb_server_proto_rawDescGZIP(), []int{18} } func (x *AWSInstanceCheckRequest) GetInstanceId() string { @@ -1806,7 +1496,7 @@ type AWSInstanceCheckResponse struct { func (x *AWSInstanceCheckResponse) Reset() { *x = AWSInstanceCheckResponse{} if protoimpl.UnsafeEnabled { - mi := &file_serverpb_server_proto_msgTypes[23] + mi := &file_serverpb_server_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1819,7 +1509,7 @@ func (x *AWSInstanceCheckResponse) String() string { func (*AWSInstanceCheckResponse) ProtoMessage() {} func (x *AWSInstanceCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_serverpb_server_proto_msgTypes[23] + mi := &file_serverpb_server_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1832,7 +1522,7 @@ func (x *AWSInstanceCheckResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AWSInstanceCheckResponse.ProtoReflect.Descriptor instead. func (*AWSInstanceCheckResponse) Descriptor() ([]byte, []int) { - return file_serverpb_server_proto_rawDescGZIP(), []int{23} + return file_serverpb_server_proto_rawDescGZIP(), []int{19} } var File_serverpb_server_proto protoreflect.FileDescriptor @@ -1928,354 +1618,279 @@ var file_serverpb_server_proto_rawDesc = []byte{ 0x6e, 0x52, 0x02, 0x6d, 0x72, 0x12, 0x29, 0x0a, 0x02, 0x6c, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6c, 0x72, - 0x22, 0xfe, 0x01, 0x0a, 0x15, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, - 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x66, 0x72, - 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x25, 0x0a, 0x09, 0x73, 0x6d, 0x61, 0x72, 0x74, - 0x68, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x09, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x68, - 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x54, 0x6c, - 0x73, 0x22, 0x32, 0x0a, 0x15, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, - 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, - 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0xe3, 0x01, 0x0a, 0x11, 0x53, 0x54, 0x54, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x46, 0x0a, 0x11, 0x73, - 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x10, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x76, 0x61, 0x6c, 0x12, 0x3e, 0x0a, 0x0d, 0x72, 0x61, 0x72, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x72, 0x61, 0x72, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x76, 0x61, 0x6c, 0x12, 0x46, 0x0a, 0x11, 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x5f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x66, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0xd9, 0x08, 0x0a, 0x08, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x44, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, - 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, - 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x12, 0x4b, 0x0a, 0x13, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x6f, - 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, - 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x12, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, 0x0a, - 0x0e, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x22, 0xe3, 0x01, 0x0a, 0x11, 0x53, 0x54, 0x54, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x46, 0x0a, 0x11, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, + 0x72, 0x64, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x73, 0x74, + 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x3e, + 0x0a, 0x0d, 0x72, 0x61, 0x72, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0d, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x17, 0x0a, 0x07, 0x73, 0x73, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x73, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x77, 0x73, 0x5f, - 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0d, 0x61, 0x77, 0x73, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x2e, 0x0a, 0x13, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6c, - 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x74, 0x74, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x73, 0x74, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x0e, - 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x6d, - 0x61, 0x69, 0x6c, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x55, - 0x0a, 0x17, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, - 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x15, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x55, 0x0a, 0x17, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x5f, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x15, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x12, - 0x70, 0x6d, 0x6d, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x6d, 0x6d, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x13, 0x73, 0x74, - 0x74, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, - 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x53, 0x54, 0x54, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x73, 0x52, 0x11, 0x73, 0x74, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, - 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x12, 0x33, 0x0a, 0x15, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x14, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x45, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, - 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, - 0x54, 0x6f, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x2f, 0x0a, 0x13, 0x74, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x69, 0x65, - 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, - 0x72, 0x79, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, - 0x26, 0x0a, 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x43, 0x0a, - 0x13, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x22, 0xa8, 0x0c, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x1c, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, - 0x73, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x10, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x6d, - 0x65, 0x74, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x13, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, - 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x12, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x40, 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x52, 0x0c, 0x72, 0x61, 0x72, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x46, + 0x0a, 0x11, 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x73, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, - 0x61, 0x77, 0x73, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x77, 0x73, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, - 0x37, 0x0a, 0x18, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x15, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x2e, 0x0a, 0x13, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x73, 0x74, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x53, 0x74, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x73, 0x74, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x53, 0x74, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x29, - 0x0a, 0x10, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, - 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, - 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x55, 0x0a, 0x17, 0x65, 0x6d, 0x61, - 0x69, 0x6c, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, - 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x15, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x12, 0x43, 0x0a, 0x1e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1b, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x55, 0x0a, 0x17, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x5f, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x15, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x43, 0x0a, 0x1e, - 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x5f, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x1b, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x63, - 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6d, 0x6d, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, - 0x6d, 0x6d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x39, 0x0a, 0x19, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x14, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x16, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x6d, 0x6d, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x13, 0x73, 0x74, - 0x74, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, - 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x53, 0x54, 0x54, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x73, 0x52, 0x11, 0x73, 0x74, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x18, 0x16, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x7a, 0x75, 0x72, 0x65, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x15, 0x64, 0x69, 0x73, 0x61, - 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x41, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x38, 0x0a, - 0x18, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x18, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x16, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x19, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x19, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x64, 0x69, 0x73, 0x61, - 0x62, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x18, 0x1e, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x69, 0x73, 0x61, 0x62, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0xb7, 0x07, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x64, + 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x2b, + 0x0a, 0x11, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x74, 0x65, 0x6c, 0x65, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x4b, 0x0a, 0x13, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x12, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, + 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, + 0x5f, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x64, 0x61, 0x74, + 0x61, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x73, + 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x73, 0x68, + 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x77, 0x73, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x77, 0x73, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, + 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x2e, 0x0a, 0x13, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x11, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x74, 0x5f, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x74, 0x74, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x29, + 0x0a, 0x10, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, + 0x6e, 0x67, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6d, 0x6d, + 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x6d, 0x6d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x13, 0x73, 0x74, 0x74, 0x5f, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x10, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x54, + 0x54, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x73, 0x52, + 0x11, 0x73, 0x74, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, + 0x6c, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, + 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x33, + 0x0a, 0x15, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x5f, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x61, + 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x45, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, + 0x5f, 0x74, 0x6f, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x13, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x54, 0x6f, 0x50, + 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x2f, 0x0a, 0x13, 0x74, 0x65, 0x6c, 0x65, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x14, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x53, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x22, 0x46, 0x0a, - 0x16, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x54, 0x65, 0x73, 0x74, 0x45, 0x6d, - 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x55, 0x0a, 0x17, 0x65, 0x6d, - 0x61, 0x69, 0x6c, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, - 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x15, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x74, 0x6f, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x54, 0x6f, 0x22, 0x23, 0x0a, 0x21, - 0x54, 0x65, 0x73, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, - 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x43, 0x0a, 0x17, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0b, - 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2a, 0x66, 0x0a, 0x12, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x49, 0x53, 0x54, - 0x52, 0x49, 0x42, 0x55, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, - 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x4f, 0x43, - 0x4b, 0x45, 0x52, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x56, 0x46, 0x10, 0x02, 0x12, 0x07, - 0x0a, 0x03, 0x41, 0x4d, 0x49, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x5a, 0x55, 0x52, 0x45, - 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x44, 0x4f, 0x10, 0x05, 0x32, 0xef, 0x0c, 0x0a, 0x06, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x79, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x3d, 0x92, 0x41, 0x27, 0x12, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x1a, - 0x1c, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x9e, 0x02, 0x0a, 0x09, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x18, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0xdb, 0x01, 0x92, 0x41, 0xc5, 0x01, 0x12, 0x16, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, - 0x73, 0x73, 0x1a, 0xaa, 0x01, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x20, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x62, 0x65, 0x69, - 0x6e, 0x67, 0x20, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x20, 0x61, 0x72, 0x65, - 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x79, 0x65, 0x74, 0x2e, 0x20, - 0x55, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x41, 0x50, 0x49, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x70, 0x72, 0x6f, 0x62, 0x69, 0x6e, 0x67, 0x20, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x65, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x61, 0x64, 0x79, - 0x7a, 0x12, 0xa3, 0x01, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x58, 0x92, - 0x41, 0x39, 0x12, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x73, 0x1a, 0x28, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x6c, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x26, 0x0a, 0x0f, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x16, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x6f, + 0x6c, 0x65, 0x49, 0x64, 0x4a, 0x04, 0x08, 0x0d, 0x10, 0x0e, 0x4a, 0x04, 0x08, 0x0e, 0x10, 0x0f, + 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x43, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, + 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x88, 0x0a, 0x0a, 0x15, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, + 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, + 0x1d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, + 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6c, 0x65, + 0x6d, 0x65, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x12, 0x4b, 0x0a, + 0x13, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x12, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, + 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, 0x0a, 0x0e, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, + 0x73, 0x73, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x77, 0x73, 0x5f, 0x70, 0x61, 0x72, + 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x61, + 0x77, 0x73, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x11, + 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x37, 0x0a, 0x18, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x55, 0x72, + 0x6c, 0x12, 0x2e, 0x0a, 0x13, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x61, 0x6c, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, + 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, + 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x6c, 0x65, + 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x74, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x74, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x74, 0x12, 0x27, + 0x0a, 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, + 0x67, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, + 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x69, 0x73, 0x61, 0x62, + 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, + 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6d, 0x6d, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x70, 0x6d, 0x6d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x39, 0x0a, 0x19, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x14, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x16, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x6d, 0x6d, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x13, 0x73, + 0x74, 0x74, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, + 0x6c, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x53, 0x54, 0x54, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x73, 0x52, 0x11, 0x73, 0x74, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x18, 0x16, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x7a, 0x75, 0x72, + 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x15, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x38, + 0x0a, 0x18, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x18, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x16, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x19, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x19, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x18, 0x1e, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4a, 0x04, + 0x08, 0x0f, 0x10, 0x10, 0x4a, 0x04, 0x08, 0x10, 0x10, 0x11, 0x4a, 0x04, 0x08, 0x11, 0x10, 0x12, + 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x22, 0x46, 0x0a, 0x16, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x43, + 0x0a, 0x17, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0b, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x49, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, + 0x66, 0x0a, 0x12, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x49, 0x53, 0x54, 0x52, 0x49, 0x42, + 0x55, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x49, 0x4e, 0x56, + 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x4f, 0x43, 0x4b, 0x45, 0x52, + 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x56, 0x46, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x41, + 0x4d, 0x49, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x10, 0x04, 0x12, + 0x06, 0x0a, 0x02, 0x44, 0x4f, 0x10, 0x05, 0x32, 0xeb, 0x0a, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x12, 0x79, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, + 0x92, 0x41, 0x27, 0x12, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x1c, 0x52, 0x65, + 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, + 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x9e, 0x02, + 0x0a, 0x09, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x18, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, + 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xdb, 0x01, 0x92, 0x41, 0xc5, 0x01, 0x12, 0x16, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x1a, + 0xaa, 0x01, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x20, + 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6e, 0x6f, + 0x74, 0x20, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x79, 0x65, 0x74, 0x2e, 0x20, 0x55, 0x73, 0x65, + 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x41, 0x50, 0x49, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x20, 0x6f, 0x66, 0x20, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, + 0x72, 0x6f, 0x62, 0x69, 0x6e, 0x67, 0x20, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, + 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x61, 0x64, 0x79, 0x7a, 0x12, 0xa3, + 0x01, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, + 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x58, 0x92, 0x41, 0x39, 0x12, + 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x28, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, + 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x12, 0x90, 0x01, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0x92, + 0x41, 0x29, 0x12, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x1a, 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x73, 0x2f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x90, 0x01, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x48, 0x92, 0x41, 0x29, 0x12, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x20, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x1a, 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x73, 0x2f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x9d, 0x01, 0x0a, 0x0c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x73, 0x2f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x9d, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x52, 0x92, 0x41, 0x32, 0x12, 0x0d, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x21, 0x52, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x2f, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x9a, 0x01, 0x0a, 0x0b, 0x47, - 0x65, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1a, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x52, 0x92, 0x41, 0x34, 0x12, 0x0c, 0x47, 0x65, 0x74, 0x20, 0x73, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x1a, 0x24, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x2f, 0x47, 0x65, 0x74, 0x12, 0xa1, 0x01, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1d, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x50, 0x92, 0x41, 0x2f, 0x12, 0x0f, - 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x1a, - 0x1c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x18, 0x3a, 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x81, 0x02, 0x0a, 0x19, - 0x54, 0x65, 0x73, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, - 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x28, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8e, - 0x01, 0x92, 0x41, 0x5a, 0x12, 0x13, 0x54, 0x65, 0x73, 0x74, 0x20, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x20, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x1a, 0x43, 0x53, 0x65, 0x6e, 0x64, 0x73, - 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x53, 0x4d, 0x54, - 0x50, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, - 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x01, 0x2a, 0x22, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x54, 0x65, 0x73, 0x74, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, - 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, - 0xaa, 0x01, 0x0a, 0x10, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x57, - 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, - 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x53, 0x92, 0x41, 0x31, 0x12, 0x12, 0x41, 0x57, - 0x53, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x1a, 0x1b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x41, 0x57, 0x53, 0x20, 0x45, 0x43, 0x32, - 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x49, 0x44, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x41, 0x57, 0x53, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x76, 0x0a, 0x0a, - 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x0b, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, - 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x70, 0x62, 0xa2, 0x02, - 0x03, 0x53, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0xca, 0x02, 0x06, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0xe2, 0x02, 0x12, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x52, 0x92, 0x41, 0x32, 0x12, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x21, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, + 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, + 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, + 0x2f, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x9a, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x52, 0x92, 0x41, 0x34, 0x12, 0x0c, 0x47, 0x65, 0x74, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x1a, 0x24, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, + 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x2f, 0x47, 0x65, 0x74, 0x12, 0xa1, 0x01, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x50, 0x92, 0x41, 0x2f, 0x12, 0x0f, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x1a, 0x1c, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, + 0x3a, 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0xaa, 0x01, 0x0a, 0x10, 0x41, 0x57, 0x53, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1f, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x53, 0x92, 0x41, 0x31, 0x12, 0x12, 0x41, 0x57, 0x53, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x1a, 0x1b, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x73, 0x20, 0x41, 0x57, 0x53, 0x20, 0x45, 0x43, 0x32, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x20, 0x49, 0x44, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, + 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x41, 0x57, 0x53, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x76, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x42, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x53, 0x58, 0x58, 0xaa, 0x02, 0x06, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0xca, 0x02, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0xe2, + 0x02, 0x12, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2292,88 +1907,77 @@ func file_serverpb_server_proto_rawDescGZIP() []byte { var ( file_serverpb_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1) - file_serverpb_server_proto_msgTypes = make([]protoimpl.MessageInfo, 24) + file_serverpb_server_proto_msgTypes = make([]protoimpl.MessageInfo, 20) file_serverpb_server_proto_goTypes = []interface{}{ - (DistributionMethod)(0), // 0: server.DistributionMethod - (*VersionInfo)(nil), // 1: server.VersionInfo - (*VersionRequest)(nil), // 2: server.VersionRequest - (*VersionResponse)(nil), // 3: server.VersionResponse - (*ReadinessRequest)(nil), // 4: server.ReadinessRequest - (*ReadinessResponse)(nil), // 5: server.ReadinessResponse - (*CheckUpdatesRequest)(nil), // 6: server.CheckUpdatesRequest - (*CheckUpdatesResponse)(nil), // 7: server.CheckUpdatesResponse - (*StartUpdateRequest)(nil), // 8: server.StartUpdateRequest - (*StartUpdateResponse)(nil), // 9: server.StartUpdateResponse - (*UpdateStatusRequest)(nil), // 10: server.UpdateStatusRequest - (*UpdateStatusResponse)(nil), // 11: server.UpdateStatusResponse - (*MetricsResolutions)(nil), // 12: server.MetricsResolutions - (*EmailAlertingSettings)(nil), // 13: server.EmailAlertingSettings - (*SlackAlertingSettings)(nil), // 14: server.SlackAlertingSettings - (*STTCheckIntervals)(nil), // 15: server.STTCheckIntervals - (*Settings)(nil), // 16: server.Settings - (*GetSettingsRequest)(nil), // 17: server.GetSettingsRequest - (*GetSettingsResponse)(nil), // 18: server.GetSettingsResponse - (*ChangeSettingsRequest)(nil), // 19: server.ChangeSettingsRequest - (*ChangeSettingsResponse)(nil), // 20: server.ChangeSettingsResponse - (*TestEmailAlertingSettingsRequest)(nil), // 21: server.TestEmailAlertingSettingsRequest - (*TestEmailAlertingSettingsResponse)(nil), // 22: server.TestEmailAlertingSettingsResponse - (*AWSInstanceCheckRequest)(nil), // 23: server.AWSInstanceCheckRequest - (*AWSInstanceCheckResponse)(nil), // 24: server.AWSInstanceCheckResponse - (*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 26: google.protobuf.Duration + (DistributionMethod)(0), // 0: server.DistributionMethod + (*VersionInfo)(nil), // 1: server.VersionInfo + (*VersionRequest)(nil), // 2: server.VersionRequest + (*VersionResponse)(nil), // 3: server.VersionResponse + (*ReadinessRequest)(nil), // 4: server.ReadinessRequest + (*ReadinessResponse)(nil), // 5: server.ReadinessResponse + (*CheckUpdatesRequest)(nil), // 6: server.CheckUpdatesRequest + (*CheckUpdatesResponse)(nil), // 7: server.CheckUpdatesResponse + (*StartUpdateRequest)(nil), // 8: server.StartUpdateRequest + (*StartUpdateResponse)(nil), // 9: server.StartUpdateResponse + (*UpdateStatusRequest)(nil), // 10: server.UpdateStatusRequest + (*UpdateStatusResponse)(nil), // 11: server.UpdateStatusResponse + (*MetricsResolutions)(nil), // 12: server.MetricsResolutions + (*STTCheckIntervals)(nil), // 13: server.STTCheckIntervals + (*Settings)(nil), // 14: server.Settings + (*GetSettingsRequest)(nil), // 15: server.GetSettingsRequest + (*GetSettingsResponse)(nil), // 16: server.GetSettingsResponse + (*ChangeSettingsRequest)(nil), // 17: server.ChangeSettingsRequest + (*ChangeSettingsResponse)(nil), // 18: server.ChangeSettingsResponse + (*AWSInstanceCheckRequest)(nil), // 19: server.AWSInstanceCheckRequest + (*AWSInstanceCheckResponse)(nil), // 20: server.AWSInstanceCheckResponse + (*timestamppb.Timestamp)(nil), // 21: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 22: google.protobuf.Duration } ) var file_serverpb_server_proto_depIdxs = []int32{ - 25, // 0: server.VersionInfo.timestamp:type_name -> google.protobuf.Timestamp + 21, // 0: server.VersionInfo.timestamp:type_name -> google.protobuf.Timestamp 1, // 1: server.VersionResponse.server:type_name -> server.VersionInfo 1, // 2: server.VersionResponse.managed:type_name -> server.VersionInfo 0, // 3: server.VersionResponse.distribution_method:type_name -> server.DistributionMethod 1, // 4: server.CheckUpdatesResponse.installed:type_name -> server.VersionInfo 1, // 5: server.CheckUpdatesResponse.latest:type_name -> server.VersionInfo - 25, // 6: server.CheckUpdatesResponse.last_check:type_name -> google.protobuf.Timestamp - 26, // 7: server.MetricsResolutions.hr:type_name -> google.protobuf.Duration - 26, // 8: server.MetricsResolutions.mr:type_name -> google.protobuf.Duration - 26, // 9: server.MetricsResolutions.lr:type_name -> google.protobuf.Duration - 26, // 10: server.STTCheckIntervals.standard_interval:type_name -> google.protobuf.Duration - 26, // 11: server.STTCheckIntervals.rare_interval:type_name -> google.protobuf.Duration - 26, // 12: server.STTCheckIntervals.frequent_interval:type_name -> google.protobuf.Duration + 21, // 6: server.CheckUpdatesResponse.last_check:type_name -> google.protobuf.Timestamp + 22, // 7: server.MetricsResolutions.hr:type_name -> google.protobuf.Duration + 22, // 8: server.MetricsResolutions.mr:type_name -> google.protobuf.Duration + 22, // 9: server.MetricsResolutions.lr:type_name -> google.protobuf.Duration + 22, // 10: server.STTCheckIntervals.standard_interval:type_name -> google.protobuf.Duration + 22, // 11: server.STTCheckIntervals.rare_interval:type_name -> google.protobuf.Duration + 22, // 12: server.STTCheckIntervals.frequent_interval:type_name -> google.protobuf.Duration 12, // 13: server.Settings.metrics_resolutions:type_name -> server.MetricsResolutions - 26, // 14: server.Settings.data_retention:type_name -> google.protobuf.Duration - 13, // 15: server.Settings.email_alerting_settings:type_name -> server.EmailAlertingSettings - 14, // 16: server.Settings.slack_alerting_settings:type_name -> server.SlackAlertingSettings - 15, // 17: server.Settings.stt_check_intervals:type_name -> server.STTCheckIntervals - 16, // 18: server.GetSettingsResponse.settings:type_name -> server.Settings - 12, // 19: server.ChangeSettingsRequest.metrics_resolutions:type_name -> server.MetricsResolutions - 26, // 20: server.ChangeSettingsRequest.data_retention:type_name -> google.protobuf.Duration - 13, // 21: server.ChangeSettingsRequest.email_alerting_settings:type_name -> server.EmailAlertingSettings - 14, // 22: server.ChangeSettingsRequest.slack_alerting_settings:type_name -> server.SlackAlertingSettings - 15, // 23: server.ChangeSettingsRequest.stt_check_intervals:type_name -> server.STTCheckIntervals - 16, // 24: server.ChangeSettingsResponse.settings:type_name -> server.Settings - 13, // 25: server.TestEmailAlertingSettingsRequest.email_alerting_settings:type_name -> server.EmailAlertingSettings - 2, // 26: server.Server.Version:input_type -> server.VersionRequest - 4, // 27: server.Server.Readiness:input_type -> server.ReadinessRequest - 6, // 28: server.Server.CheckUpdates:input_type -> server.CheckUpdatesRequest - 8, // 29: server.Server.StartUpdate:input_type -> server.StartUpdateRequest - 10, // 30: server.Server.UpdateStatus:input_type -> server.UpdateStatusRequest - 17, // 31: server.Server.GetSettings:input_type -> server.GetSettingsRequest - 19, // 32: server.Server.ChangeSettings:input_type -> server.ChangeSettingsRequest - 21, // 33: server.Server.TestEmailAlertingSettings:input_type -> server.TestEmailAlertingSettingsRequest - 23, // 34: server.Server.AWSInstanceCheck:input_type -> server.AWSInstanceCheckRequest - 3, // 35: server.Server.Version:output_type -> server.VersionResponse - 5, // 36: server.Server.Readiness:output_type -> server.ReadinessResponse - 7, // 37: server.Server.CheckUpdates:output_type -> server.CheckUpdatesResponse - 9, // 38: server.Server.StartUpdate:output_type -> server.StartUpdateResponse - 11, // 39: server.Server.UpdateStatus:output_type -> server.UpdateStatusResponse - 18, // 40: server.Server.GetSettings:output_type -> server.GetSettingsResponse - 20, // 41: server.Server.ChangeSettings:output_type -> server.ChangeSettingsResponse - 22, // 42: server.Server.TestEmailAlertingSettings:output_type -> server.TestEmailAlertingSettingsResponse - 24, // 43: server.Server.AWSInstanceCheck:output_type -> server.AWSInstanceCheckResponse - 35, // [35:44] is the sub-list for method output_type - 26, // [26:35] is the sub-list for method input_type - 26, // [26:26] is the sub-list for extension type_name - 26, // [26:26] is the sub-list for extension extendee - 0, // [0:26] is the sub-list for field type_name + 22, // 14: server.Settings.data_retention:type_name -> google.protobuf.Duration + 13, // 15: server.Settings.stt_check_intervals:type_name -> server.STTCheckIntervals + 14, // 16: server.GetSettingsResponse.settings:type_name -> server.Settings + 12, // 17: server.ChangeSettingsRequest.metrics_resolutions:type_name -> server.MetricsResolutions + 22, // 18: server.ChangeSettingsRequest.data_retention:type_name -> google.protobuf.Duration + 13, // 19: server.ChangeSettingsRequest.stt_check_intervals:type_name -> server.STTCheckIntervals + 14, // 20: server.ChangeSettingsResponse.settings:type_name -> server.Settings + 2, // 21: server.Server.Version:input_type -> server.VersionRequest + 4, // 22: server.Server.Readiness:input_type -> server.ReadinessRequest + 6, // 23: server.Server.CheckUpdates:input_type -> server.CheckUpdatesRequest + 8, // 24: server.Server.StartUpdate:input_type -> server.StartUpdateRequest + 10, // 25: server.Server.UpdateStatus:input_type -> server.UpdateStatusRequest + 15, // 26: server.Server.GetSettings:input_type -> server.GetSettingsRequest + 17, // 27: server.Server.ChangeSettings:input_type -> server.ChangeSettingsRequest + 19, // 28: server.Server.AWSInstanceCheck:input_type -> server.AWSInstanceCheckRequest + 3, // 29: server.Server.Version:output_type -> server.VersionResponse + 5, // 30: server.Server.Readiness:output_type -> server.ReadinessResponse + 7, // 31: server.Server.CheckUpdates:output_type -> server.CheckUpdatesResponse + 9, // 32: server.Server.StartUpdate:output_type -> server.StartUpdateResponse + 11, // 33: server.Server.UpdateStatus:output_type -> server.UpdateStatusResponse + 16, // 34: server.Server.GetSettings:output_type -> server.GetSettingsResponse + 18, // 35: server.Server.ChangeSettings:output_type -> server.ChangeSettingsResponse + 20, // 36: server.Server.AWSInstanceCheck:output_type -> server.AWSInstanceCheckResponse + 29, // [29:37] is the sub-list for method output_type + 21, // [21:29] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name } func init() { file_serverpb_server_proto_init() } @@ -2527,30 +2131,6 @@ func file_serverpb_server_proto_init() { } } file_serverpb_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmailAlertingSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_serverpb_server_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SlackAlertingSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_serverpb_server_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*STTCheckIntervals); i { case 0: return &v.state @@ -2562,7 +2142,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Settings); i { case 0: return &v.state @@ -2574,7 +2154,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetSettingsRequest); i { case 0: return &v.state @@ -2586,7 +2166,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetSettingsResponse); i { case 0: return &v.state @@ -2598,7 +2178,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChangeSettingsRequest); i { case 0: return &v.state @@ -2610,7 +2190,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChangeSettingsResponse); i { case 0: return &v.state @@ -2622,31 +2202,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestEmailAlertingSettingsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_serverpb_server_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestEmailAlertingSettingsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_serverpb_server_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AWSInstanceCheckRequest); i { case 0: return &v.state @@ -2658,7 +2214,7 @@ func file_serverpb_server_proto_init() { return nil } } - file_serverpb_server_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_serverpb_server_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AWSInstanceCheckResponse); i { case 0: return &v.state @@ -2677,7 +2233,7 @@ func file_serverpb_server_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_serverpb_server_proto_rawDesc, NumEnums: 1, - NumMessages: 24, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/api/serverpb/server.pb.gw.go b/api/serverpb/server.pb.gw.go index 6b7c5f0f11..3fa3295641 100644 --- a/api/serverpb/server.pb.gw.go +++ b/api/serverpb/server.pb.gw.go @@ -241,38 +241,6 @@ func local_request_Server_ChangeSettings_0(ctx context.Context, marshaler runtim return msg, metadata, err } -func request_Server_TestEmailAlertingSettings_0(ctx context.Context, marshaler runtime.Marshaler, client ServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TestEmailAlertingSettingsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.TestEmailAlertingSettings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_Server_TestEmailAlertingSettings_0(ctx context.Context, marshaler runtime.Marshaler, server ServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TestEmailAlertingSettingsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.TestEmailAlertingSettings(ctx, &protoReq) - return msg, metadata, err -} - func request_Server_AWSInstanceCheck_0(ctx context.Context, marshaler runtime.Marshaler, client ServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq AWSInstanceCheckRequest var metadata runtime.ServerMetadata @@ -478,30 +446,6 @@ func RegisterServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser forward_Server_ChangeSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Server_TestEmailAlertingSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/server.Server/TestEmailAlertingSettings", runtime.WithHTTPPathPattern("/v1/Settings/TestEmailAlertingSettings")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Server_TestEmailAlertingSettings_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Server_TestEmailAlertingSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle("POST", pattern_Server_AWSInstanceCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -713,27 +657,6 @@ func RegisterServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli forward_Server_ChangeSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Server_TestEmailAlertingSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/server.Server/TestEmailAlertingSettings", runtime.WithHTTPPathPattern("/v1/Settings/TestEmailAlertingSettings")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Server_TestEmailAlertingSettings_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_Server_TestEmailAlertingSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle("POST", pattern_Server_AWSInstanceCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -773,8 +696,6 @@ var ( pattern_Server_ChangeSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "Settings", "Change"}, "")) - pattern_Server_TestEmailAlertingSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "Settings", "TestEmailAlertingSettings"}, "")) - pattern_Server_AWSInstanceCheck_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "AWSInstanceCheck"}, "")) ) @@ -793,7 +714,5 @@ var ( forward_Server_ChangeSettings_0 = runtime.ForwardResponseMessage - forward_Server_TestEmailAlertingSettings_0 = runtime.ForwardResponseMessage - forward_Server_AWSInstanceCheck_0 = runtime.ForwardResponseMessage ) diff --git a/api/serverpb/server.pb.validate.go b/api/serverpb/server.pb.validate.go index 2f6cca9075..155ee65797 100644 --- a/api/serverpb/server.pb.validate.go +++ b/api/serverpb/server.pb.validate.go @@ -1541,255 +1541,6 @@ var _ interface { ErrorName() string } = MetricsResolutionsValidationError{} -// Validate checks the field values on EmailAlertingSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *EmailAlertingSettings) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EmailAlertingSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// EmailAlertingSettingsMultiError, or nil if none found. -func (m *EmailAlertingSettings) ValidateAll() error { - return m.validate(true) -} - -func (m *EmailAlertingSettings) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetFrom()) < 1 { - err := EmailAlertingSettingsValidationError{ - field: "From", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetSmarthost()) < 1 { - err := EmailAlertingSettingsValidationError{ - field: "Smarthost", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Hello - - // no validation rules for Username - - // no validation rules for Password - - // no validation rules for Identity - - // no validation rules for Secret - - // no validation rules for RequireTls - - if len(errors) > 0 { - return EmailAlertingSettingsMultiError(errors) - } - - return nil -} - -// EmailAlertingSettingsMultiError is an error wrapping multiple validation -// errors returned by EmailAlertingSettings.ValidateAll() if the designated -// constraints aren't met. -type EmailAlertingSettingsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EmailAlertingSettingsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EmailAlertingSettingsMultiError) AllErrors() []error { return m } - -// EmailAlertingSettingsValidationError is the validation error returned by -// EmailAlertingSettings.Validate if the designated constraints aren't met. -type EmailAlertingSettingsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EmailAlertingSettingsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EmailAlertingSettingsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EmailAlertingSettingsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EmailAlertingSettingsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EmailAlertingSettingsValidationError) ErrorName() string { - return "EmailAlertingSettingsValidationError" -} - -// Error satisfies the builtin error interface -func (e EmailAlertingSettingsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEmailAlertingSettings.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EmailAlertingSettingsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EmailAlertingSettingsValidationError{} - -// Validate checks the field values on SlackAlertingSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SlackAlertingSettings) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SlackAlertingSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SlackAlertingSettingsMultiError, or nil if none found. -func (m *SlackAlertingSettings) ValidateAll() error { - return m.validate(true) -} - -func (m *SlackAlertingSettings) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetUrl()) < 1 { - err := SlackAlertingSettingsValidationError{ - field: "Url", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SlackAlertingSettingsMultiError(errors) - } - - return nil -} - -// SlackAlertingSettingsMultiError is an error wrapping multiple validation -// errors returned by SlackAlertingSettings.ValidateAll() if the designated -// constraints aren't met. -type SlackAlertingSettingsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SlackAlertingSettingsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SlackAlertingSettingsMultiError) AllErrors() []error { return m } - -// SlackAlertingSettingsValidationError is the validation error returned by -// SlackAlertingSettings.Validate if the designated constraints aren't met. -type SlackAlertingSettingsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SlackAlertingSettingsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SlackAlertingSettingsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SlackAlertingSettingsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SlackAlertingSettingsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SlackAlertingSettingsValidationError) ErrorName() string { - return "SlackAlertingSettingsValidationError" -} - -// Error satisfies the builtin error interface -func (e SlackAlertingSettingsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSlackAlertingSettings.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SlackAlertingSettingsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SlackAlertingSettingsValidationError{} - // Validate checks the field values on STTCheckIntervals with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. @@ -2075,64 +1826,6 @@ func (m *Settings) validate(all bool) error { // no validation rules for AlertingEnabled - if all { - switch v := interface{}(m.GetEmailAlertingSettings()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SettingsValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SettingsValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmailAlertingSettings()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SettingsValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSlackAlertingSettings()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SettingsValidationError{ - field: "SlackAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SettingsValidationError{ - field: "SlackAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSlackAlertingSettings()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SettingsValidationError{ - field: "SlackAlertingSettings", - reason: "embedded message failed validation", - cause: err, - } - } - } - // no validation rules for PmmPublicAddress if all { @@ -2590,68 +2283,6 @@ func (m *ChangeSettingsRequest) validate(all bool) error { // no validation rules for DisableAlerting - if all { - switch v := interface{}(m.GetEmailAlertingSettings()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChangeSettingsRequestValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChangeSettingsRequestValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmailAlertingSettings()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChangeSettingsRequestValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for RemoveEmailAlertingSettings - - if all { - switch v := interface{}(m.GetSlackAlertingSettings()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ChangeSettingsRequestValidationError{ - field: "SlackAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ChangeSettingsRequestValidationError{ - field: "SlackAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSlackAlertingSettings()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ChangeSettingsRequestValidationError{ - field: "SlackAlertingSettings", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for RemoveSlackAlertingSettings - // no validation rules for PmmPublicAddress // no validation rules for RemovePmmPublicAddress @@ -2908,247 +2539,6 @@ var _ interface { ErrorName() string } = ChangeSettingsResponseValidationError{} -// Validate checks the field values on TestEmailAlertingSettingsRequest with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *TestEmailAlertingSettingsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TestEmailAlertingSettingsRequest with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// TestEmailAlertingSettingsRequestMultiError, or nil if none found. -func (m *TestEmailAlertingSettingsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *TestEmailAlertingSettingsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetEmailAlertingSettings()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TestEmailAlertingSettingsRequestValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TestEmailAlertingSettingsRequestValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmailAlertingSettings()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TestEmailAlertingSettingsRequestValidationError{ - field: "EmailAlertingSettings", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for EmailTo - - if len(errors) > 0 { - return TestEmailAlertingSettingsRequestMultiError(errors) - } - - return nil -} - -// TestEmailAlertingSettingsRequestMultiError is an error wrapping multiple -// validation errors returned by -// TestEmailAlertingSettingsRequest.ValidateAll() if the designated -// constraints aren't met. -type TestEmailAlertingSettingsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TestEmailAlertingSettingsRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TestEmailAlertingSettingsRequestMultiError) AllErrors() []error { return m } - -// TestEmailAlertingSettingsRequestValidationError is the validation error -// returned by TestEmailAlertingSettingsRequest.Validate if the designated -// constraints aren't met. -type TestEmailAlertingSettingsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TestEmailAlertingSettingsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TestEmailAlertingSettingsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TestEmailAlertingSettingsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TestEmailAlertingSettingsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TestEmailAlertingSettingsRequestValidationError) ErrorName() string { - return "TestEmailAlertingSettingsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e TestEmailAlertingSettingsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTestEmailAlertingSettingsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TestEmailAlertingSettingsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TestEmailAlertingSettingsRequestValidationError{} - -// Validate checks the field values on TestEmailAlertingSettingsResponse with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *TestEmailAlertingSettingsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TestEmailAlertingSettingsResponse -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// TestEmailAlertingSettingsResponseMultiError, or nil if none found. -func (m *TestEmailAlertingSettingsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *TestEmailAlertingSettingsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return TestEmailAlertingSettingsResponseMultiError(errors) - } - - return nil -} - -// TestEmailAlertingSettingsResponseMultiError is an error wrapping multiple -// validation errors returned by -// TestEmailAlertingSettingsResponse.ValidateAll() if the designated -// constraints aren't met. -type TestEmailAlertingSettingsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TestEmailAlertingSettingsResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TestEmailAlertingSettingsResponseMultiError) AllErrors() []error { return m } - -// TestEmailAlertingSettingsResponseValidationError is the validation error -// returned by TestEmailAlertingSettingsResponse.Validate if the designated -// constraints aren't met. -type TestEmailAlertingSettingsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TestEmailAlertingSettingsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TestEmailAlertingSettingsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TestEmailAlertingSettingsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TestEmailAlertingSettingsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TestEmailAlertingSettingsResponseValidationError) ErrorName() string { - return "TestEmailAlertingSettingsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e TestEmailAlertingSettingsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTestEmailAlertingSettingsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TestEmailAlertingSettingsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TestEmailAlertingSettingsResponseValidationError{} - // Validate checks the field values on AWSInstanceCheckRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. diff --git a/api/serverpb/server.proto b/api/serverpb/server.proto index 445b62b500..a8e5a694ff 100644 --- a/api/serverpb/server.proto +++ b/api/serverpb/server.proto @@ -108,32 +108,6 @@ message MetricsResolutions { google.protobuf.Duration lr = 3; } -// EmailAlertingSettings represents email (SMTP) configuration for Alerting. -message EmailAlertingSettings { - // SMTP From header field. - string from = 1 [(validate.rules).string.min_len = 1]; - // SMTP host and port. - string smarthost = 2 [(validate.rules).string.min_len = 1]; - // Hostname to identify to the SMTP server. - string hello = 3; - // Auth using CRAM-MD5, LOGIN and PLAIN. - string username = 4; - // Auth using LOGIN and PLAIN. - string password = 5; - // Auth using PLAIN. - string identity = 6; - // Auth using CRAM-MD5. - string secret = 7; - // Require TLS. - bool require_tls = 8; -} - -// SlackAlertingSettings represents Slack configuration for Alerting. -message SlackAlertingSettings { - // Slack API (webhook) URL. - string url = 1 [(validate.rules).string.min_len = 1]; -} - // STTCheckIntervals represents intervals between STT checks. message STTCheckIntervals { // Standard check interval. @@ -146,6 +120,8 @@ message STTCheckIntervals { // Settings represents PMM Server settings. message Settings { + reserved 13, 14; // Removed fields + // True if updates are disabled. bool updates_disabled = 1; // True if telemetry is enabled. @@ -167,10 +143,6 @@ message Settings { string platform_email = 10; // True if Alerting is enabled. bool alerting_enabled = 12; - // Alerting email (SMTP) settings. - EmailAlertingSettings email_alerting_settings = 13; - // Alerting Slack settings. - SlackAlertingSettings slack_alerting_settings = 14; // PMM Server public address. string pmm_public_address = 15; // Intervals between STT check runs. @@ -196,6 +168,8 @@ message GetSettingsResponse { } message ChangeSettingsRequest { + reserved 15, 16, 17, 18; //Removed fields + bool enable_updates = 28; bool disable_updates = 29; bool enable_telemetry = 1; @@ -224,14 +198,6 @@ message ChangeSettingsRequest { bool enable_alerting = 13; // Disable Alerting. bool disable_alerting = 14; - // Change Alerting email (SMTP) settings, if set. - EmailAlertingSettings email_alerting_settings = 15; - // If true, removes Alerting email (SMTP) settings. - bool remove_email_alerting_settings = 16; - // Change Alerting Slack settings, if set. - SlackAlertingSettings slack_alerting_settings = 17; - // If true, removes Alerting Slack settings. - bool remove_slack_alerting_settings = 18; // PMM Server public address. string pmm_public_address = 19; bool remove_pmm_public_address = 20; @@ -255,15 +221,6 @@ message ChangeSettingsResponse { Settings settings = 1; } -message TestEmailAlertingSettingsRequest { - // Alerting email (SMTP) settings. - EmailAlertingSettings email_alerting_settings = 1; - // Target email address to send the email to. - string email_to = 2; -} - -message TestEmailAlertingSettingsResponse {} - message AWSInstanceCheckRequest { // AWS EC2 instance ID (i-1234567890abcdef0). string instance_id = 1 [(validate.rules).string.min_len = 1]; @@ -345,17 +302,6 @@ service Server { description: "Changes PMM Server settings." }; } - // TestEmailAlertingSettings sends test email to check current SMTP settings for email alerting. - rpc TestEmailAlertingSettings(TestEmailAlertingSettingsRequest) returns (TestEmailAlertingSettingsResponse) { - option (google.api.http) = { - post: "/v1/Settings/TestEmailAlertingSettings" - body: "*" - }; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { - summary: "Test email alerting" - description: "Sends test email to check current SMTP settings for email alerting." - }; - } // AWSInstanceCheck checks AWS EC2 instance ID. rpc AWSInstanceCheck(AWSInstanceCheckRequest) returns (AWSInstanceCheckResponse) { option (google.api.http) = { diff --git a/api/serverpb/server_grpc.pb.go b/api/serverpb/server_grpc.pb.go index 63197e8537..70b49195fd 100644 --- a/api/serverpb/server_grpc.pb.go +++ b/api/serverpb/server_grpc.pb.go @@ -20,15 +20,14 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Server_Version_FullMethodName = "/server.Server/Version" - Server_Readiness_FullMethodName = "/server.Server/Readiness" - Server_CheckUpdates_FullMethodName = "/server.Server/CheckUpdates" - Server_StartUpdate_FullMethodName = "/server.Server/StartUpdate" - Server_UpdateStatus_FullMethodName = "/server.Server/UpdateStatus" - Server_GetSettings_FullMethodName = "/server.Server/GetSettings" - Server_ChangeSettings_FullMethodName = "/server.Server/ChangeSettings" - Server_TestEmailAlertingSettings_FullMethodName = "/server.Server/TestEmailAlertingSettings" - Server_AWSInstanceCheck_FullMethodName = "/server.Server/AWSInstanceCheck" + Server_Version_FullMethodName = "/server.Server/Version" + Server_Readiness_FullMethodName = "/server.Server/Readiness" + Server_CheckUpdates_FullMethodName = "/server.Server/CheckUpdates" + Server_StartUpdate_FullMethodName = "/server.Server/StartUpdate" + Server_UpdateStatus_FullMethodName = "/server.Server/UpdateStatus" + Server_GetSettings_FullMethodName = "/server.Server/GetSettings" + Server_ChangeSettings_FullMethodName = "/server.Server/ChangeSettings" + Server_AWSInstanceCheck_FullMethodName = "/server.Server/AWSInstanceCheck" ) // ServerClient is the client API for Server service. @@ -50,8 +49,6 @@ type ServerClient interface { GetSettings(ctx context.Context, in *GetSettingsRequest, opts ...grpc.CallOption) (*GetSettingsResponse, error) // ChangeSettings changes PMM Server settings. ChangeSettings(ctx context.Context, in *ChangeSettingsRequest, opts ...grpc.CallOption) (*ChangeSettingsResponse, error) - // TestEmailAlertingSettings sends test email to check current SMTP settings for email alerting. - TestEmailAlertingSettings(ctx context.Context, in *TestEmailAlertingSettingsRequest, opts ...grpc.CallOption) (*TestEmailAlertingSettingsResponse, error) // AWSInstanceCheck checks AWS EC2 instance ID. AWSInstanceCheck(ctx context.Context, in *AWSInstanceCheckRequest, opts ...grpc.CallOption) (*AWSInstanceCheckResponse, error) } @@ -127,15 +124,6 @@ func (c *serverClient) ChangeSettings(ctx context.Context, in *ChangeSettingsReq return out, nil } -func (c *serverClient) TestEmailAlertingSettings(ctx context.Context, in *TestEmailAlertingSettingsRequest, opts ...grpc.CallOption) (*TestEmailAlertingSettingsResponse, error) { - out := new(TestEmailAlertingSettingsResponse) - err := c.cc.Invoke(ctx, Server_TestEmailAlertingSettings_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *serverClient) AWSInstanceCheck(ctx context.Context, in *AWSInstanceCheckRequest, opts ...grpc.CallOption) (*AWSInstanceCheckResponse, error) { out := new(AWSInstanceCheckResponse) err := c.cc.Invoke(ctx, Server_AWSInstanceCheck_FullMethodName, in, out, opts...) @@ -164,8 +152,6 @@ type ServerServer interface { GetSettings(context.Context, *GetSettingsRequest) (*GetSettingsResponse, error) // ChangeSettings changes PMM Server settings. ChangeSettings(context.Context, *ChangeSettingsRequest) (*ChangeSettingsResponse, error) - // TestEmailAlertingSettings sends test email to check current SMTP settings for email alerting. - TestEmailAlertingSettings(context.Context, *TestEmailAlertingSettingsRequest) (*TestEmailAlertingSettingsResponse, error) // AWSInstanceCheck checks AWS EC2 instance ID. AWSInstanceCheck(context.Context, *AWSInstanceCheckRequest) (*AWSInstanceCheckResponse, error) mustEmbedUnimplementedServerServer() @@ -202,10 +188,6 @@ func (UnimplementedServerServer) ChangeSettings(context.Context, *ChangeSettings return nil, status.Errorf(codes.Unimplemented, "method ChangeSettings not implemented") } -func (UnimplementedServerServer) TestEmailAlertingSettings(context.Context, *TestEmailAlertingSettingsRequest) (*TestEmailAlertingSettingsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TestEmailAlertingSettings not implemented") -} - func (UnimplementedServerServer) AWSInstanceCheck(context.Context, *AWSInstanceCheckRequest) (*AWSInstanceCheckResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AWSInstanceCheck not implemented") } @@ -348,24 +330,6 @@ func _Server_ChangeSettings_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Server_TestEmailAlertingSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TestEmailAlertingSettingsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServerServer).TestEmailAlertingSettings(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Server_TestEmailAlertingSettings_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServerServer).TestEmailAlertingSettings(ctx, req.(*TestEmailAlertingSettingsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Server_AWSInstanceCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AWSInstanceCheckRequest) if err := dec(in); err != nil { @@ -419,10 +383,6 @@ var Server_ServiceDesc = grpc.ServiceDesc{ MethodName: "ChangeSettings", Handler: _Server_ChangeSettings_Handler, }, - { - MethodName: "TestEmailAlertingSettings", - Handler: _Server_TestEmailAlertingSettings_Handler, - }, { MethodName: "AWSInstanceCheck", Handler: _Server_AWSInstanceCheck_Handler, diff --git a/api/swagger/swagger-dev-only.json b/api/swagger/swagger-dev-only.json deleted file mode 100644 index bda80314e4..0000000000 --- a/api/swagger/swagger-dev-only.json +++ /dev/null @@ -1,13341 +0,0 @@ -{ - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "https", - "http" - ], - "swagger": "2.0", - "info": { - "description": "This API is for development and testing purposes.", - "title": "PMM API", - "version": "develop" - }, - "paths": { - "/v0/qan/Filters/Get": { - "post": { - "tags": [ - "Filters" - ], - "summary": "Get gets map of metrics names.", - "operationId": "Get", - "parameters": [ - { - "description": "FiltersRequest contains period for which we need filters.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "FiltersRequest contains period for which we need filters.", - "type": "object", - "properties": { - "period_start_from": { - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "period_start_to": { - "type": "string", - "format": "date-time", - "x-order": 1 - }, - "main_metric_name": { - "type": "string", - "x-order": 2 - }, - "labels": { - "type": "array", - "items": { - "description": "MapFieldEntry allows to pass labels/dimensions in form like {\"server\": [\"db1\", \"db2\"...]}.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - } - }, - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "FiltersReply is map of labels for given period by key.\nKey is label's name and value is label's value and how many times it occur.", - "type": "object", - "properties": { - "labels": { - "type": "object", - "additionalProperties": { - "description": "ListLabels is list of label's values: duplicates are impossible.", - "type": "object", - "properties": { - "name": { - "type": "array", - "items": { - "description": "Values is label values and main metric percent and per second.", - "type": "object", - "properties": { - "value": { - "type": "string", - "x-order": 0 - }, - "main_metric_percent": { - "type": "number", - "format": "float", - "x-order": 1 - }, - "main_metric_per_sec": { - "type": "number", - "format": "float", - "x-order": 2 - } - } - }, - "x-order": 0 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/GetMetricsNames": { - "post": { - "tags": [ - "MetricsNames" - ], - "summary": "GetMetricsNames gets map of metrics names.", - "operationId": "GetMetricsNames", - "parameters": [ - { - "description": "MetricsNamesRequest is emty.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "MetricsNamesRequest is emty.", - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "MetricsNamesReply is map of stored metrics:\nkey is root of metric name in db (Ex:. [m_]query_time[_sum]);\nvalue - Human readable name of metrics.", - "type": "object", - "properties": { - "data": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/GetReport": { - "post": { - "tags": [ - "Profile" - ], - "summary": "GetReport returns list of metrics group by queryid or other dimentions.", - "operationId": "GetReport", - "parameters": [ - { - "description": "ReportRequest defines filtering of metrics report for db server or other dimentions.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "ReportRequest defines filtering of metrics report for db server or other dimentions.", - "type": "object", - "properties": { - "period_start_from": { - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "period_start_to": { - "type": "string", - "format": "date-time", - "x-order": 1 - }, - "group_by": { - "type": "string", - "x-order": 2 - }, - "labels": { - "type": "array", - "items": { - "description": "ReportMapFieldEntry allows to pass labels/dimentions in form like {\"server\": [\"db1\", \"db2\"...]}.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - } - }, - "x-order": 3 - }, - "columns": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 4 - }, - "order_by": { - "type": "string", - "x-order": 5 - }, - "offset": { - "type": "integer", - "format": "int64", - "x-order": 6 - }, - "limit": { - "type": "integer", - "format": "int64", - "x-order": 7 - }, - "main_metric": { - "type": "string", - "x-order": 8 - }, - "search": { - "type": "string", - "x-order": 9 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "ReportReply is list of reports per quieryids, hosts etc.", - "type": "object", - "properties": { - "total_rows": { - "type": "integer", - "format": "int64", - "x-order": 0 - }, - "offset": { - "type": "integer", - "format": "int64", - "x-order": 1 - }, - "limit": { - "type": "integer", - "format": "int64", - "x-order": 2 - }, - "rows": { - "type": "array", - "items": { - "description": "Row define metrics for selected dimention.", - "type": "object", - "properties": { - "rank": { - "type": "integer", - "format": "int64", - "x-order": 0 - }, - "dimension": { - "type": "string", - "x-order": 1 - }, - "database": { - "type": "string", - "x-order": 2 - }, - "metrics": { - "type": "object", - "additionalProperties": { - "description": "Metric cell.", - "type": "object", - "properties": { - "stats": { - "description": "Stat is statistics of specific metric.", - "type": "object", - "properties": { - "rate": { - "type": "number", - "format": "float", - "x-order": 0 - }, - "cnt": { - "type": "number", - "format": "float", - "x-order": 1 - }, - "sum": { - "type": "number", - "format": "float", - "x-order": 2 - }, - "min": { - "type": "number", - "format": "float", - "x-order": 3 - }, - "max": { - "type": "number", - "format": "float", - "x-order": 4 - }, - "p99": { - "type": "number", - "format": "float", - "x-order": 5 - }, - "avg": { - "type": "number", - "format": "float", - "x-order": 6 - }, - "sum_per_sec": { - "type": "number", - "format": "float", - "x-order": 7 - } - }, - "x-order": 0 - } - } - }, - "x-order": 3 - }, - "sparkline": { - "type": "array", - "items": { - "description": "Point contains values that represents abscissa (time) and ordinate (volume etc.)\nof every point in a coordinate system of Sparklines.", - "type": "object", - "properties": { - "point": { - "description": "The serial number of the chart point from the largest time in the time interval to the lowest time in the time range.", - "type": "integer", - "format": "int64", - "x-order": 0 - }, - "time_frame": { - "description": "Duration beetween two points.", - "type": "integer", - "format": "int64", - "x-order": 1 - }, - "timestamp": { - "description": "Time of point in format RFC3339.", - "type": "string", - "x-order": 2 - }, - "load": { - "description": "load is query_time / time_range.", - "type": "number", - "format": "float", - "x-order": 3 - }, - "num_queries_per_sec": { - "description": "number of queries in bucket.", - "type": "number", - "format": "float", - "x-order": 4 - }, - "num_queries_with_errors_per_sec": { - "description": "number of queries with errors.", - "type": "number", - "format": "float", - "x-order": 5 - }, - "num_queries_with_warnings_per_sec": { - "description": "number of queries with warnings.", - "type": "number", - "format": "float", - "x-order": 6 - }, - "m_query_time_sum_per_sec": { - "description": "The statement execution time in seconds.", - "type": "number", - "format": "float", - "x-order": 7 - }, - "m_lock_time_sum_per_sec": { - "description": "The time to acquire locks in seconds.", - "type": "number", - "format": "float", - "x-order": 8 - }, - "m_rows_sent_sum_per_sec": { - "description": "The number of rows sent to the client.", - "type": "number", - "format": "float", - "x-order": 9 - }, - "m_rows_examined_sum_per_sec": { - "description": "Number of rows scanned - SELECT.", - "type": "number", - "format": "float", - "x-order": 10 - }, - "m_rows_affected_sum_per_sec": { - "description": "Number of rows changed - UPDATE, DELETE, INSERT.", - "type": "number", - "format": "float", - "x-order": 11 - }, - "m_rows_read_sum_per_sec": { - "description": "The number of rows read from tables.", - "type": "number", - "format": "float", - "x-order": 12 - }, - "m_merge_passes_sum_per_sec": { - "description": "The number of merge passes that the sort algorithm has had to do.", - "type": "number", - "format": "float", - "x-order": 13 - }, - "m_innodb_io_r_ops_sum_per_sec": { - "description": "Counts the number of page read operations scheduled.", - "type": "number", - "format": "float", - "x-order": 14 - }, - "m_innodb_io_r_bytes_sum_per_sec": { - "description": "Similar to innodb_IO_r_ops, but the unit is bytes.", - "type": "number", - "format": "float", - "x-order": 15 - }, - "m_innodb_io_r_wait_sum_per_sec": { - "description": "Shows how long (in seconds) it took InnoDB to actually read the data from storage.", - "type": "number", - "format": "float", - "x-order": 16 - }, - "m_innodb_rec_lock_wait_sum_per_sec": { - "description": "Shows how long (in seconds) the query waited for row locks.", - "type": "number", - "format": "float", - "x-order": 17 - }, - "m_innodb_queue_wait_sum_per_sec": { - "description": "Shows how long (in seconds) the query spent either waiting to enter the InnoDB queue or inside that queue waiting for execution.", - "type": "number", - "format": "float", - "x-order": 18 - }, - "m_innodb_pages_distinct_sum_per_sec": { - "description": "Counts approximately the number of unique pages the query accessed.", - "type": "number", - "format": "float", - "x-order": 19 - }, - "m_query_length_sum_per_sec": { - "description": "Shows how long the query is.", - "type": "number", - "format": "float", - "x-order": 20 - }, - "m_bytes_sent_sum_per_sec": { - "description": "The number of bytes sent to all clients.", - "type": "number", - "format": "float", - "x-order": 21 - }, - "m_tmp_tables_sum_per_sec": { - "description": "Number of temporary tables created on memory for the query.", - "type": "number", - "format": "float", - "x-order": 22 - }, - "m_tmp_disk_tables_sum_per_sec": { - "description": "Number of temporary tables created on disk for the query.", - "type": "number", - "format": "float", - "x-order": 23 - }, - "m_tmp_table_sizes_sum_per_sec": { - "description": "Total Size in bytes for all temporary tables used in the query.", - "type": "number", - "format": "float", - "x-order": 24 - }, - "m_qc_hit_sum_per_sec": { - "description": "Boolean metrics:\n- *_sum_per_sec - how many times this matric was true.\n\nQuery Cache hits.", - "type": "number", - "format": "float", - "x-order": 25 - }, - "m_full_scan_sum_per_sec": { - "description": "The query performed a full table scan.", - "type": "number", - "format": "float", - "x-order": 26 - }, - "m_full_join_sum_per_sec": { - "description": "The query performed a full join (a join without indexes).", - "type": "number", - "format": "float", - "x-order": 27 - }, - "m_tmp_table_sum_per_sec": { - "description": "The query created an implicit internal temporary table.", - "type": "number", - "format": "float", - "x-order": 28 - }, - "m_tmp_table_on_disk_sum_per_sec": { - "description": "The querys temporary table was stored on disk.", - "type": "number", - "format": "float", - "x-order": 29 - }, - "m_filesort_sum_per_sec": { - "description": "The query used a filesort.", - "type": "number", - "format": "float", - "x-order": 30 - }, - "m_filesort_on_disk_sum_per_sec": { - "description": "The filesort was performed on disk.", - "type": "number", - "format": "float", - "x-order": 31 - }, - "m_select_full_range_join_sum_per_sec": { - "description": "The number of joins that used a range search on a reference table.", - "type": "number", - "format": "float", - "x-order": 32 - }, - "m_select_range_sum_per_sec": { - "description": "The number of joins that used ranges on the first table.", - "type": "number", - "format": "float", - "x-order": 33 - }, - "m_select_range_check_sum_per_sec": { - "description": "The number of joins without keys that check for key usage after each row.", - "type": "number", - "format": "float", - "x-order": 34 - }, - "m_sort_range_sum_per_sec": { - "description": "The number of sorts that were done using ranges.", - "type": "number", - "format": "float", - "x-order": 35 - }, - "m_sort_rows_sum_per_sec": { - "description": "The number of sorted rows.", - "type": "number", - "format": "float", - "x-order": 36 - }, - "m_sort_scan_sum_per_sec": { - "description": "The number of sorts that were done by scanning the table.", - "type": "number", - "format": "float", - "x-order": 37 - }, - "m_no_index_used_sum_per_sec": { - "description": "The number of queries without index.", - "type": "number", - "format": "float", - "x-order": 38 - }, - "m_no_good_index_used_sum_per_sec": { - "description": "The number of queries without good index.", - "type": "number", - "format": "float", - "x-order": 39 - }, - "m_docs_returned_sum_per_sec": { - "description": "MongoDB metrics.\n\nThe number of returned documents.", - "type": "number", - "format": "float", - "x-order": 40 - }, - "m_response_length_sum_per_sec": { - "description": "The response length of the query result in bytes.", - "type": "number", - "format": "float", - "x-order": 41 - }, - "m_docs_scanned_sum_per_sec": { - "description": "The number of scanned documents.", - "type": "number", - "format": "float", - "x-order": 42 - }, - "m_shared_blks_hit_sum_per_sec": { - "description": "PostgreSQL metrics.\n\nTotal number of shared block cache hits by the statement.", - "type": "number", - "format": "float", - "x-order": 43 - }, - "m_shared_blks_read_sum_per_sec": { - "description": "Total number of shared blocks read by the statement.", - "type": "number", - "format": "float", - "x-order": 44 - }, - "m_shared_blks_dirtied_sum_per_sec": { - "description": "Total number of shared blocks dirtied by the statement.", - "type": "number", - "format": "float", - "x-order": 45 - }, - "m_shared_blks_written_sum_per_sec": { - "description": "Total number of shared blocks written by the statement.", - "type": "number", - "format": "float", - "x-order": 46 - }, - "m_local_blks_hit_sum_per_sec": { - "description": "Total number of local block cache hits by the statement.", - "type": "number", - "format": "float", - "x-order": 47 - }, - "m_local_blks_read_sum_per_sec": { - "description": "Total number of local blocks read by the statement.", - "type": "number", - "format": "float", - "x-order": 48 - }, - "m_local_blks_dirtied_sum_per_sec": { - "description": "Total number of local blocks dirtied by the statement.", - "type": "number", - "format": "float", - "x-order": 49 - }, - "m_local_blks_written_sum_per_sec": { - "description": "Total number of local blocks written by the statement.", - "type": "number", - "format": "float", - "x-order": 50 - }, - "m_temp_blks_read_sum_per_sec": { - "description": "Total number of temp blocks read by the statement.", - "type": "number", - "format": "float", - "x-order": 51 - }, - "m_temp_blks_written_sum_per_sec": { - "description": "Total number of temp blocks written by the statement.", - "type": "number", - "format": "float", - "x-order": 52 - }, - "m_blk_read_time_sum_per_sec": { - "description": "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero).", - "type": "number", - "format": "float", - "x-order": 53 - }, - "m_blk_write_time_sum_per_sec": { - "description": "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero).", - "type": "number", - "format": "float", - "x-order": 54 - }, - "m_cpu_user_time_sum_per_sec": { - "description": "Total time user spent in query.", - "type": "number", - "format": "float", - "x-order": 55 - }, - "m_cpu_sys_time_sum_per_sec": { - "description": "Total time system spent in query.", - "type": "number", - "format": "float", - "x-order": 56 - }, - "m_plans_calls_sum_per_sec": { - "description": "Total number of planned calls.", - "type": "number", - "format": "float", - "title": "pg_stat_monitor 0.9 metrics", - "x-order": 57 - }, - "m_wal_records_sum_per_sec": { - "description": "Total number of WAL (Write-ahead logging) records.", - "type": "number", - "format": "float", - "x-order": 58 - }, - "m_wal_fpi_sum_per_sec": { - "description": "Total number of FPI (full page images) in WAL (Write-ahead logging) records.", - "type": "number", - "format": "float", - "x-order": 59 - }, - "m_wal_bytes_sum_per_sec": { - "description": "Total bytes of WAL (Write-ahead logging) records.", - "type": "number", - "format": "float", - "x-order": 60 - }, - "m_plan_time_sum_per_sec": { - "description": "Plan time in per seconds.", - "type": "number", - "format": "float", - "x-order": 61 - } - } - }, - "x-order": 4 - }, - "fingerprint": { - "type": "string", - "x-order": 5 - }, - "num_queries": { - "type": "integer", - "format": "int64", - "x-order": 6 - }, - "qps": { - "type": "number", - "format": "float", - "x-order": 7 - }, - "load": { - "type": "number", - "format": "float", - "x-order": 8 - } - } - }, - "x-order": 3 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/ExplainFingerprintByQueryID": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "ExplainFingerprintByQueryID get explain fingerprint for given query ID.", - "operationId": "ExplainFingerprintByQueryID", - "parameters": [ - { - "description": "ExplainFingerprintByQueryIDRequest get explain fingerprint for given query ID.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "ExplainFingerprintByQueryIDRequest get explain fingerprint for given query ID.", - "type": "object", - "properties": { - "serviceid": { - "type": "string", - "x-order": 0 - }, - "query_id": { - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "ExplainFingerprintByQueryIDReply is explain fingerprint and placeholders count for given query ID.", - "type": "object", - "properties": { - "explain_fingerprint": { - "type": "string", - "x-order": 0 - }, - "placeholders_count": { - "type": "integer", - "format": "int64", - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/GetHistogram": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "GetHistogram gets histogram items for specific filtering.", - "operationId": "GetHistogram", - "parameters": [ - { - "description": "HistogramRequest defines filtering by time range, labels and queryid.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "HistogramRequest defines filtering by time range, labels and queryid.", - "type": "object", - "properties": { - "period_start_from": { - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "period_start_to": { - "type": "string", - "format": "date-time", - "x-order": 1 - }, - "labels": { - "type": "array", - "items": { - "description": "MapFieldEntry allows to pass labels/dimensions in form like {\"server\": [\"db1\", \"db2\"...]}.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - } - }, - "x-order": 2 - }, - "queryid": { - "type": "string", - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "HistogramReply is histogram items as a list.", - "type": "object", - "properties": { - "histogram_items": { - "type": "array", - "items": { - "description": "HistogramItem represents one item in histogram.", - "type": "object", - "properties": { - "range": { - "type": "string", - "x-order": 0 - }, - "frequency": { - "type": "integer", - "format": "int64", - "x-order": 1 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/GetLabels": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "GetLabels gets list of labels for object details.", - "operationId": "GetLabels", - "parameters": [ - { - "description": "ObjectDetailsLabelsRequest defines filtering of object detail's labels for specific value of\ndimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "ObjectDetailsLabelsRequest defines filtering of object detail's labels for specific value of\ndimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "type": "object", - "properties": { - "period_start_from": { - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "period_start_to": { - "type": "string", - "format": "date-time", - "x-order": 1 - }, - "filter_by": { - "description": "dimension value: ex: queryid - 1D410B4BE5060972.", - "type": "string", - "x-order": 2 - }, - "group_by": { - "description": "one of dimension: queryid | host ...", - "type": "string", - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "ObjectDetailsLabelsReply is a map of labels names as keys and labels values as a list.", - "type": "object", - "properties": { - "labels": { - "type": "object", - "additionalProperties": { - "description": "ListLabelValues is list of label's values.", - "type": "object", - "properties": { - "values": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 0 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/GetMetrics": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "GetMetrics gets map of metrics for specific filtering.", - "operationId": "GetMetrics", - "parameters": [ - { - "description": "MetricsRequest defines filtering of metrics for specific value of dimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "MetricsRequest defines filtering of metrics for specific value of dimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "type": "object", - "properties": { - "period_start_from": { - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "period_start_to": { - "type": "string", - "format": "date-time", - "x-order": 1 - }, - "filter_by": { - "description": "dimension value: ex: queryid - 1D410B4BE5060972.", - "type": "string", - "x-order": 2 - }, - "group_by": { - "description": "one of dimension: queryid | host ...", - "type": "string", - "x-order": 3 - }, - "labels": { - "type": "array", - "items": { - "description": "MapFieldEntry allows to pass labels/dimensions in form like {\"server\": [\"db1\", \"db2\"...]}.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - } - }, - "x-order": 4 - }, - "include_only_fields": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 5 - }, - "totals": { - "type": "boolean", - "title": "retrieve only values for totals, excluding N/A values", - "x-order": 6 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "MetricsReply defines metrics for specific value of dimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "type": "object", - "properties": { - "metrics": { - "type": "object", - "additionalProperties": { - "description": "MetricValues is statistics of specific metric.", - "type": "object", - "properties": { - "rate": { - "type": "number", - "format": "float", - "x-order": 0 - }, - "cnt": { - "type": "number", - "format": "float", - "x-order": 1 - }, - "sum": { - "type": "number", - "format": "float", - "x-order": 2 - }, - "min": { - "type": "number", - "format": "float", - "x-order": 3 - }, - "max": { - "type": "number", - "format": "float", - "x-order": 4 - }, - "avg": { - "type": "number", - "format": "float", - "x-order": 5 - }, - "p99": { - "type": "number", - "format": "float", - "x-order": 6 - }, - "percent_of_total": { - "type": "number", - "format": "float", - "x-order": 7 - } - } - }, - "x-order": 0 - }, - "text_metrics": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 1 - }, - "sparkline": { - "type": "array", - "items": { - "description": "Point contains values that represents abscissa (time) and ordinate (volume etc.)\nof every point in a coordinate system of Sparklines.", - "type": "object", - "properties": { - "point": { - "description": "The serial number of the chart point from the largest time in the time interval to the lowest time in the time range.", - "type": "integer", - "format": "int64", - "x-order": 0 - }, - "time_frame": { - "description": "Duration beetween two points.", - "type": "integer", - "format": "int64", - "x-order": 1 - }, - "timestamp": { - "description": "Time of point in format RFC3339.", - "type": "string", - "x-order": 2 - }, - "load": { - "description": "load is query_time / time_range.", - "type": "number", - "format": "float", - "x-order": 3 - }, - "num_queries_per_sec": { - "description": "number of queries in bucket.", - "type": "number", - "format": "float", - "x-order": 4 - }, - "num_queries_with_errors_per_sec": { - "description": "number of queries with errors.", - "type": "number", - "format": "float", - "x-order": 5 - }, - "num_queries_with_warnings_per_sec": { - "description": "number of queries with warnings.", - "type": "number", - "format": "float", - "x-order": 6 - }, - "m_query_time_sum_per_sec": { - "description": "The statement execution time in seconds.", - "type": "number", - "format": "float", - "x-order": 7 - }, - "m_lock_time_sum_per_sec": { - "description": "The time to acquire locks in seconds.", - "type": "number", - "format": "float", - "x-order": 8 - }, - "m_rows_sent_sum_per_sec": { - "description": "The number of rows sent to the client.", - "type": "number", - "format": "float", - "x-order": 9 - }, - "m_rows_examined_sum_per_sec": { - "description": "Number of rows scanned - SELECT.", - "type": "number", - "format": "float", - "x-order": 10 - }, - "m_rows_affected_sum_per_sec": { - "description": "Number of rows changed - UPDATE, DELETE, INSERT.", - "type": "number", - "format": "float", - "x-order": 11 - }, - "m_rows_read_sum_per_sec": { - "description": "The number of rows read from tables.", - "type": "number", - "format": "float", - "x-order": 12 - }, - "m_merge_passes_sum_per_sec": { - "description": "The number of merge passes that the sort algorithm has had to do.", - "type": "number", - "format": "float", - "x-order": 13 - }, - "m_innodb_io_r_ops_sum_per_sec": { - "description": "Counts the number of page read operations scheduled.", - "type": "number", - "format": "float", - "x-order": 14 - }, - "m_innodb_io_r_bytes_sum_per_sec": { - "description": "Similar to innodb_IO_r_ops, but the unit is bytes.", - "type": "number", - "format": "float", - "x-order": 15 - }, - "m_innodb_io_r_wait_sum_per_sec": { - "description": "Shows how long (in seconds) it took InnoDB to actually read the data from storage.", - "type": "number", - "format": "float", - "x-order": 16 - }, - "m_innodb_rec_lock_wait_sum_per_sec": { - "description": "Shows how long (in seconds) the query waited for row locks.", - "type": "number", - "format": "float", - "x-order": 17 - }, - "m_innodb_queue_wait_sum_per_sec": { - "description": "Shows how long (in seconds) the query spent either waiting to enter the InnoDB queue or inside that queue waiting for execution.", - "type": "number", - "format": "float", - "x-order": 18 - }, - "m_innodb_pages_distinct_sum_per_sec": { - "description": "Counts approximately the number of unique pages the query accessed.", - "type": "number", - "format": "float", - "x-order": 19 - }, - "m_query_length_sum_per_sec": { - "description": "Shows how long the query is.", - "type": "number", - "format": "float", - "x-order": 20 - }, - "m_bytes_sent_sum_per_sec": { - "description": "The number of bytes sent to all clients.", - "type": "number", - "format": "float", - "x-order": 21 - }, - "m_tmp_tables_sum_per_sec": { - "description": "Number of temporary tables created on memory for the query.", - "type": "number", - "format": "float", - "x-order": 22 - }, - "m_tmp_disk_tables_sum_per_sec": { - "description": "Number of temporary tables created on disk for the query.", - "type": "number", - "format": "float", - "x-order": 23 - }, - "m_tmp_table_sizes_sum_per_sec": { - "description": "Total Size in bytes for all temporary tables used in the query.", - "type": "number", - "format": "float", - "x-order": 24 - }, - "m_qc_hit_sum_per_sec": { - "description": "Boolean metrics:\n- *_sum_per_sec - how many times this matric was true.\n\nQuery Cache hits.", - "type": "number", - "format": "float", - "x-order": 25 - }, - "m_full_scan_sum_per_sec": { - "description": "The query performed a full table scan.", - "type": "number", - "format": "float", - "x-order": 26 - }, - "m_full_join_sum_per_sec": { - "description": "The query performed a full join (a join without indexes).", - "type": "number", - "format": "float", - "x-order": 27 - }, - "m_tmp_table_sum_per_sec": { - "description": "The query created an implicit internal temporary table.", - "type": "number", - "format": "float", - "x-order": 28 - }, - "m_tmp_table_on_disk_sum_per_sec": { - "description": "The querys temporary table was stored on disk.", - "type": "number", - "format": "float", - "x-order": 29 - }, - "m_filesort_sum_per_sec": { - "description": "The query used a filesort.", - "type": "number", - "format": "float", - "x-order": 30 - }, - "m_filesort_on_disk_sum_per_sec": { - "description": "The filesort was performed on disk.", - "type": "number", - "format": "float", - "x-order": 31 - }, - "m_select_full_range_join_sum_per_sec": { - "description": "The number of joins that used a range search on a reference table.", - "type": "number", - "format": "float", - "x-order": 32 - }, - "m_select_range_sum_per_sec": { - "description": "The number of joins that used ranges on the first table.", - "type": "number", - "format": "float", - "x-order": 33 - }, - "m_select_range_check_sum_per_sec": { - "description": "The number of joins without keys that check for key usage after each row.", - "type": "number", - "format": "float", - "x-order": 34 - }, - "m_sort_range_sum_per_sec": { - "description": "The number of sorts that were done using ranges.", - "type": "number", - "format": "float", - "x-order": 35 - }, - "m_sort_rows_sum_per_sec": { - "description": "The number of sorted rows.", - "type": "number", - "format": "float", - "x-order": 36 - }, - "m_sort_scan_sum_per_sec": { - "description": "The number of sorts that were done by scanning the table.", - "type": "number", - "format": "float", - "x-order": 37 - }, - "m_no_index_used_sum_per_sec": { - "description": "The number of queries without index.", - "type": "number", - "format": "float", - "x-order": 38 - }, - "m_no_good_index_used_sum_per_sec": { - "description": "The number of queries without good index.", - "type": "number", - "format": "float", - "x-order": 39 - }, - "m_docs_returned_sum_per_sec": { - "description": "MongoDB metrics.\n\nThe number of returned documents.", - "type": "number", - "format": "float", - "x-order": 40 - }, - "m_response_length_sum_per_sec": { - "description": "The response length of the query result in bytes.", - "type": "number", - "format": "float", - "x-order": 41 - }, - "m_docs_scanned_sum_per_sec": { - "description": "The number of scanned documents.", - "type": "number", - "format": "float", - "x-order": 42 - }, - "m_shared_blks_hit_sum_per_sec": { - "description": "PostgreSQL metrics.\n\nTotal number of shared block cache hits by the statement.", - "type": "number", - "format": "float", - "x-order": 43 - }, - "m_shared_blks_read_sum_per_sec": { - "description": "Total number of shared blocks read by the statement.", - "type": "number", - "format": "float", - "x-order": 44 - }, - "m_shared_blks_dirtied_sum_per_sec": { - "description": "Total number of shared blocks dirtied by the statement.", - "type": "number", - "format": "float", - "x-order": 45 - }, - "m_shared_blks_written_sum_per_sec": { - "description": "Total number of shared blocks written by the statement.", - "type": "number", - "format": "float", - "x-order": 46 - }, - "m_local_blks_hit_sum_per_sec": { - "description": "Total number of local block cache hits by the statement.", - "type": "number", - "format": "float", - "x-order": 47 - }, - "m_local_blks_read_sum_per_sec": { - "description": "Total number of local blocks read by the statement.", - "type": "number", - "format": "float", - "x-order": 48 - }, - "m_local_blks_dirtied_sum_per_sec": { - "description": "Total number of local blocks dirtied by the statement.", - "type": "number", - "format": "float", - "x-order": 49 - }, - "m_local_blks_written_sum_per_sec": { - "description": "Total number of local blocks written by the statement.", - "type": "number", - "format": "float", - "x-order": 50 - }, - "m_temp_blks_read_sum_per_sec": { - "description": "Total number of temp blocks read by the statement.", - "type": "number", - "format": "float", - "x-order": 51 - }, - "m_temp_blks_written_sum_per_sec": { - "description": "Total number of temp blocks written by the statement.", - "type": "number", - "format": "float", - "x-order": 52 - }, - "m_blk_read_time_sum_per_sec": { - "description": "Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero).", - "type": "number", - "format": "float", - "x-order": 53 - }, - "m_blk_write_time_sum_per_sec": { - "description": "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero).", - "type": "number", - "format": "float", - "x-order": 54 - }, - "m_cpu_user_time_sum_per_sec": { - "description": "Total time user spent in query.", - "type": "number", - "format": "float", - "x-order": 55 - }, - "m_cpu_sys_time_sum_per_sec": { - "description": "Total time system spent in query.", - "type": "number", - "format": "float", - "x-order": 56 - }, - "m_plans_calls_sum_per_sec": { - "description": "Total number of planned calls.", - "type": "number", - "format": "float", - "title": "pg_stat_monitor 0.9 metrics", - "x-order": 57 - }, - "m_wal_records_sum_per_sec": { - "description": "Total number of WAL (Write-ahead logging) records.", - "type": "number", - "format": "float", - "x-order": 58 - }, - "m_wal_fpi_sum_per_sec": { - "description": "Total number of FPI (full page images) in WAL (Write-ahead logging) records.", - "type": "number", - "format": "float", - "x-order": 59 - }, - "m_wal_bytes_sum_per_sec": { - "description": "Total bytes of WAL (Write-ahead logging) records.", - "type": "number", - "format": "float", - "x-order": 60 - }, - "m_plan_time_sum_per_sec": { - "description": "Plan time in per seconds.", - "type": "number", - "format": "float", - "x-order": 61 - } - } - }, - "x-order": 2 - }, - "totals": { - "type": "object", - "additionalProperties": { - "description": "MetricValues is statistics of specific metric.", - "type": "object", - "properties": { - "rate": { - "type": "number", - "format": "float", - "x-order": 0 - }, - "cnt": { - "type": "number", - "format": "float", - "x-order": 1 - }, - "sum": { - "type": "number", - "format": "float", - "x-order": 2 - }, - "min": { - "type": "number", - "format": "float", - "x-order": 3 - }, - "max": { - "type": "number", - "format": "float", - "x-order": 4 - }, - "avg": { - "type": "number", - "format": "float", - "x-order": 5 - }, - "p99": { - "type": "number", - "format": "float", - "x-order": 6 - }, - "percent_of_total": { - "type": "number", - "format": "float", - "x-order": 7 - } - } - }, - "x-order": 3 - }, - "fingerprint": { - "type": "string", - "x-order": 4 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/GetQueryExample": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "GetQueryExample gets list of query examples.", - "operationId": "GetQueryExample", - "parameters": [ - { - "description": "QueryExampleRequest defines filtering of query examples for specific value of\ndimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "QueryExampleRequest defines filtering of query examples for specific value of\ndimension (ex.: host=hostname1 or queryid=1D410B4BE5060972.", - "type": "object", - "properties": { - "period_start_from": { - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "period_start_to": { - "type": "string", - "format": "date-time", - "x-order": 1 - }, - "filter_by": { - "description": "dimension value: ex: queryid - 1D410B4BE5060972.", - "type": "string", - "x-order": 2 - }, - "group_by": { - "description": "one of dimension: queryid | host ...", - "type": "string", - "x-order": 3 - }, - "labels": { - "type": "array", - "items": { - "description": "MapFieldEntry allows to pass labels/dimensions in form like {\"server\": [\"db1\", \"db2\"...]}.", - "type": "object", - "properties": { - "key": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - } - }, - "x-order": 4 - }, - "limit": { - "type": "integer", - "format": "int64", - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "QueryExampleReply list of query examples.", - "type": "object", - "properties": { - "query_examples": { - "type": "array", - "items": { - "description": "QueryExample shows query examples and their metrics.", - "type": "object", - "properties": { - "example": { - "type": "string", - "x-order": 0 - }, - "example_format": { - "description": "ExampleFormat is format of query example: real or query without values.\n\nDeprecated: is not used, should not be used, should be removed.", - "type": "string", - "default": "EXAMPLE_FORMAT_INVALID", - "enum": [ - "EXAMPLE_FORMAT_INVALID", - "EXAMPLE", - "FINGERPRINT" - ], - "x-order": 1 - }, - "example_type": { - "description": "ExampleType is a type of query example selected for this query class in given period of time.", - "type": "string", - "default": "EXAMPLE_TYPE_INVALID", - "enum": [ - "EXAMPLE_TYPE_INVALID", - "RANDOM", - "SLOWEST", - "FASTEST", - "WITH_ERROR" - ], - "x-order": 2 - }, - "is_truncated": { - "type": "integer", - "format": "int64", - "x-order": 3 - }, - "placeholders_count": { - "type": "integer", - "format": "int64", - "x-order": 4 - }, - "explain_fingerprint": { - "type": "string", - "x-order": 5 - }, - "query_id": { - "type": "string", - "x-order": 6 - }, - "example_metrics": { - "type": "string", - "x-order": 7 - }, - "service_id": { - "type": "string", - "x-order": 8 - }, - "service_type": { - "type": "string", - "x-order": 9 - }, - "schema": { - "type": "string", - "x-order": 10 - }, - "tables": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 11 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/GetQueryPlan": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "GetQueryPlan gets query plan and plan id for specific filtering.", - "operationId": "GetQueryPlan", - "parameters": [ - { - "description": "QueryPlanRequest defines filtering by queryid.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "QueryPlanRequest defines filtering by queryid.", - "type": "object", - "properties": { - "queryid": { - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "QueryPlanReply contains planid and query_plan.", - "type": "object", - "properties": { - "planid": { - "type": "string", - "x-order": 0 - }, - "query_plan": { - "type": "string", - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v0/qan/ObjectDetails/QueryExists": { - "post": { - "tags": [ - "ObjectDetails" - ], - "summary": "QueryExists check if query exists in clickhouse.", - "operationId": "QueryExists", - "parameters": [ - { - "description": "QueryExistsRequest check if provided query exists or not.", - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "QueryExistsRequest check if provided query exists or not.", - "type": "object", - "properties": { - "serviceid": { - "type": "string", - "x-order": 0 - }, - "query": { - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/Connect": { - "post": { - "description": "Connect a PMM server to the organization created on Percona Portal. That allows the user to sign in to the PMM server with their Percona Account.", - "tags": [ - "Platform" - ], - "summary": "Connect", - "operationId": "Connect", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "server_name": { - "description": "User defined human readable PMM Server Name.", - "type": "string", - "x-order": 0 - }, - "email": { - "description": "Existing Percona Platform user's email.", - "type": "string", - "x-order": 1 - }, - "password": { - "description": "Existing Percona Platform user's password.", - "type": "string", - "x-order": 2 - }, - "personal_access_token": { - "description": "Personal Access Token that the user obtains from Percona Portal.", - "type": "string", - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/Disconnect": { - "post": { - "description": "Disconnect a PMM server from the organization created on Percona Portal.", - "tags": [ - "Platform" - ], - "summary": "Disconnect", - "operationId": "Disconnect", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "force": { - "type": "boolean", - "title": "Forces the cleanup process for connected PMM instances regardless of the Portal API response", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/GetContactInformation": { - "post": { - "description": "GetContactInformation fetches the contact details of the customer success employee handling the Percona customer account from Percona Platform.", - "tags": [ - "Platform" - ], - "summary": "GetContactInformation", - "operationId": "GetContactInformation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "customer_success": { - "description": "CustomerSuccess contains the contanct details of the customer success employee assigned to a customer's account.", - "type": "object", - "properties": { - "name": { - "type": "string", - "x-order": 0 - }, - "email": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 0 - }, - "new_ticket_url": { - "description": "URL to open a new support ticket.", - "type": "string", - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/SearchOrganizationEntitlements": { - "post": { - "description": "SearchOrganizationEntitlements fetches details of the entitlement's available to the Portal organization that the PMM server is connected to.", - "tags": [ - "Platform" - ], - "summary": "SearchOrganizationEntitlements", - "operationId": "SearchOrganizationEntitlements", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "entitlements": { - "type": "array", - "items": { - "description": "OrganizationEntitlement contains information about Organization entitlement.", - "type": "object", - "properties": { - "number": { - "description": "Entitlement number.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Entitlement name.", - "type": "string", - "x-order": 1 - }, - "summary": { - "description": "Entitlement short summary.", - "type": "string", - "x-order": 2 - }, - "tier": { - "description": "Entitlement tier.", - "type": "string", - "x-order": 3 - }, - "total_units": { - "description": "Total units covered by this entitlement.", - "type": "string", - "x-order": 4 - }, - "unlimited_units": { - "description": "Flag indicates that unlimited units are covered.", - "type": "boolean", - "x-order": 5 - }, - "support_level": { - "description": "Support level covered by this entitlement.", - "type": "string", - "x-order": 6 - }, - "software_families": { - "description": "Percona product families covered by this entitlement.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 7 - }, - "start_date": { - "description": "Entitlement start data.\nNote: only date is used here but not time.", - "type": "string", - "format": "date-time", - "x-order": 8 - }, - "end_date": { - "description": "Entitlement end date.\nNote: only date is used here but not time.", - "type": "string", - "format": "date-time", - "x-order": 9 - }, - "platform": { - "description": "Platform indicates platform specific entitlements.", - "type": "object", - "properties": { - "security_advisor": { - "description": "Flag indicates that security advisors are covered by this entitlement.", - "type": "string", - "x-order": 0 - }, - "config_advisor": { - "description": "Flag indicates that config advisors are covered by this entitlement.", - "type": "string", - "x-order": 1 - } - }, - "x-order": 10 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/SearchOrganizationTickets": { - "post": { - "description": "SearchOrganizationTickets searches support tickets belonging to the Percona Portal Organization that the PMM server is connected to.", - "tags": [ - "Platform" - ], - "summary": "SearchOrganizationTickets", - "operationId": "SearchOrganizationTickets", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "tickets": { - "description": "Support tickets belonging to the Percona Portal Organization.", - "type": "array", - "items": { - "description": "OrganizationTicket contains information about the support ticket.", - "type": "object", - "properties": { - "number": { - "description": "Ticket number.", - "type": "string", - "x-order": 0 - }, - "short_description": { - "description": "Ticket short description.", - "type": "string", - "x-order": 1 - }, - "priority": { - "description": "Ticket priority.", - "type": "string", - "x-order": 2 - }, - "state": { - "description": "Ticket state.", - "type": "string", - "x-order": 3 - }, - "create_time": { - "description": "Ticket creation time.", - "type": "string", - "format": "date-time", - "x-order": 4 - }, - "department": { - "description": "Department.", - "type": "string", - "x-order": 5 - }, - "requester": { - "description": "Ticket requester.", - "type": "string", - "x-order": 6 - }, - "task_type": { - "description": "Task type.", - "type": "string", - "x-order": 7 - }, - "url": { - "description": "Ticket url.", - "type": "string", - "x-order": 8 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/ServerInfo": { - "post": { - "description": "ServerInfo returns PMM server ID and name.", - "tags": [ - "Platform" - ], - "summary": "ServerInfo", - "operationId": "ServerInfo", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "pmm_server_name": { - "type": "string", - "x-order": 0 - }, - "pmm_server_id": { - "type": "string", - "x-order": 1 - }, - "pmm_server_telemetry_id": { - "type": "string", - "x-order": 2 - }, - "connected_to_portal": { - "type": "boolean", - "x-order": 3 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Platform/UserStatus": { - "post": { - "description": "UserStatus returns a boolean indicating whether the current user is logged in with their Percona Account or not.", - "tags": [ - "Platform" - ], - "summary": "UserStatus", - "operationId": "UserStatus", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "is_platform_user": { - "type": "boolean", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Components/ChangePSMDB": { - "post": { - "tags": [ - "Components" - ], - "summary": "ChangePSMDBComponents manages PSMDB related components.", - "operationId": "ChangePSMDBComponents", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "mongod": { - "description": "ChangeComponent contains fields to manage components.", - "type": "object", - "properties": { - "default_version": { - "type": "string", - "x-order": 0 - }, - "versions": { - "type": "array", - "items": { - "description": "ComponentVersion contains operations which should be done with component version.", - "type": "object", - "properties": { - "version": { - "type": "string", - "x-order": 0 - }, - "disable": { - "type": "boolean", - "x-order": 1 - }, - "enable": { - "type": "boolean", - "x-order": 2 - } - } - }, - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Components/ChangePXC": { - "post": { - "tags": [ - "Components" - ], - "summary": "ChangePXCComponents manages PXC related components.", - "operationId": "ChangePXCComponents", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "pxc": { - "description": "ChangeComponent contains fields to manage components.", - "type": "object", - "properties": { - "default_version": { - "type": "string", - "x-order": 0 - }, - "versions": { - "type": "array", - "items": { - "description": "ComponentVersion contains operations which should be done with component version.", - "type": "object", - "properties": { - "version": { - "type": "string", - "x-order": 0 - }, - "disable": { - "type": "boolean", - "x-order": 1 - }, - "enable": { - "type": "boolean", - "x-order": 2 - } - } - }, - "x-order": 1 - } - }, - "x-order": 1 - }, - "proxysql": { - "description": "ChangeComponent contains fields to manage components.", - "type": "object", - "properties": { - "default_version": { - "type": "string", - "x-order": 0 - }, - "versions": { - "type": "array", - "items": { - "description": "ComponentVersion contains operations which should be done with component version.", - "type": "object", - "properties": { - "version": { - "type": "string", - "x-order": 0 - }, - "disable": { - "type": "boolean", - "x-order": 1 - }, - "enable": { - "type": "boolean", - "x-order": 2 - } - } - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "haproxy": { - "description": "ChangeComponent contains fields to manage components.", - "type": "object", - "properties": { - "default_version": { - "type": "string", - "x-order": 0 - }, - "versions": { - "type": "array", - "items": { - "description": "ComponentVersion contains operations which should be done with component version.", - "type": "object", - "properties": { - "version": { - "type": "string", - "x-order": 0 - }, - "disable": { - "type": "boolean", - "x-order": 1 - }, - "enable": { - "type": "boolean", - "x-order": 2 - } - } - }, - "x-order": 1 - } - }, - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Components/CheckForOperatorUpdate": { - "post": { - "tags": [ - "Components" - ], - "summary": "CheckForOperatorUpdate checks if a new version of an operator is available.", - "operationId": "CheckForOperatorUpdate", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "cluster_to_components": { - "description": "The cluster name is used as a key for this map, value contains components and their inforamtion about update.", - "type": "object", - "additionalProperties": { - "description": "ComponentsUpdateInformation contains info about components and their available latest versions.", - "type": "object", - "properties": { - "component_to_update_information": { - "description": "component_to_update_information stores, under the name of the component, information about the update.\n\"pxc-operator\", \"psmdb-operator\" are names used by backend for our operators.", - "type": "object", - "additionalProperties": { - "description": "ComponentUpdateInformation contains version we can update to for certain component.", - "type": "object", - "properties": { - "available_version": { - "type": "string", - "x-order": 0 - } - } - }, - "x-order": 0 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Components/GetPSMDB": { - "post": { - "tags": [ - "Components" - ], - "summary": "GetPSMDBComponents returns list of available components for PSMDB Clusters.", - "operationId": "GetPSMDBComponents", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "db_version": { - "description": "Version of DB.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "versions": { - "type": "array", - "items": { - "description": "OperatorVersion contains information about operator and components matrix.", - "type": "object", - "properties": { - "product": { - "type": "string", - "x-order": 0 - }, - "operator": { - "type": "string", - "x-order": 1 - }, - "matrix": { - "description": "Matrix contains all available components.", - "type": "object", - "properties": { - "mongod": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 0 - }, - "pxc": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 1 - }, - "pmm": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 2 - }, - "proxysql": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 3 - }, - "haproxy": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 4 - }, - "backup": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 5 - }, - "operator": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 6 - }, - "log_collector": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 7 - } - }, - "x-order": 2 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Components/GetPXC": { - "post": { - "tags": [ - "Components" - ], - "summary": "GetPXCComponents returns list of available components for PXC Clusters.", - "operationId": "GetPXCComponents", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "db_version": { - "description": "Version of DB.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "versions": { - "type": "array", - "items": { - "description": "OperatorVersion contains information about operator and components matrix.", - "type": "object", - "properties": { - "product": { - "type": "string", - "x-order": 0 - }, - "operator": { - "type": "string", - "x-order": 1 - }, - "matrix": { - "description": "Matrix contains all available components.", - "type": "object", - "properties": { - "mongod": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 0 - }, - "pxc": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 1 - }, - "pmm": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 2 - }, - "proxysql": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 3 - }, - "haproxy": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 4 - }, - "backup": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 5 - }, - "operator": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 6 - }, - "log_collector": { - "type": "object", - "additionalProperties": { - "description": "Component contains information about component.", - "type": "object", - "properties": { - "image_path": { - "type": "string", - "x-order": 0 - }, - "image_hash": { - "type": "string", - "x-order": 1 - }, - "status": { - "type": "string", - "x-order": 2 - }, - "critical": { - "type": "boolean", - "x-order": 3 - }, - "default": { - "type": "boolean", - "x-order": 4 - }, - "disabled": { - "type": "boolean", - "x-order": 5 - } - } - }, - "x-order": 7 - } - }, - "x-order": 2 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Components/InstallOperator": { - "post": { - "tags": [ - "Components" - ], - "summary": "InstallOperator installs given operator in given version.", - "operationId": "InstallOperator", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "operator_type": { - "description": "operator_type tells what operator we are interested in updating.", - "type": "string", - "x-order": 1 - }, - "version": { - "description": "version tells what version of the operator we should update to.", - "type": "string", - "x-order": 2 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "status": { - "description": "OperatorsStatus defines status of operators installed in Kubernetes cluster.\n\n - OPERATORS_STATUS_INVALID: OPERATORS_STATUS_INVALID represents unknown state.\n - OPERATORS_STATUS_OK: OPERATORS_STATUS_OK represents that operators are installed and have supported API version.\n - OPERATORS_STATUS_UNSUPPORTED: OPERATORS_STATUS_UNSUPPORTED represents that operators are installed, but doesn't have supported API version.\n - OPERATORS_STATUS_NOT_INSTALLED: OPERATORS_STATUS_NOT_INSTALLED represents that operators are not installed.", - "type": "string", - "default": "OPERATORS_STATUS_INVALID", - "enum": [ - "OPERATORS_STATUS_INVALID", - "OPERATORS_STATUS_OK", - "OPERATORS_STATUS_UNSUPPORTED", - "OPERATORS_STATUS_NOT_INSTALLED" - ], - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/DBClusters/Delete": { - "post": { - "tags": [ - "DBClusters" - ], - "summary": "DeleteDBCluster deletes DB cluster.", - "operationId": "DeleteDBCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "DB cluster name.", - "type": "string", - "x-order": 1 - }, - "cluster_type": { - "description": "DBClusterType represents database cluster type.\n\n - DB_CLUSTER_TYPE_INVALID: DB_CLUSTER_TYPE_INVALID represents unknown cluster type.\n - DB_CLUSTER_TYPE_PXC: DB_CLUSTER_TYPE_PXC represents pxc cluster type.\n - DB_CLUSTER_TYPE_PSMDB: DB_CLUSTER_TYPE_PSMDB represents psmdb cluster type.", - "type": "string", - "default": "DB_CLUSTER_TYPE_INVALID", - "enum": [ - "DB_CLUSTER_TYPE_INVALID", - "DB_CLUSTER_TYPE_PXC", - "DB_CLUSTER_TYPE_PSMDB" - ], - "x-order": 2 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/DBClusters/Get": { - "post": { - "tags": [ - "DBClusters" - ], - "summary": "GetDBCluster returns parameters used to create a database cluster", - "operationId": "GetDBCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "DB cluster name.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "pxc_cluster": { - "description": "PXCCluster represents PXC cluster information.", - "type": "object", - "properties": { - "name": { - "description": "Cluster name.", - "type": "string", - "x-order": 0 - }, - "state": { - "description": "DBClusterState represents DB cluster CR state.\n\n - DB_CLUSTER_STATE_INVALID: DB_CLUSTER_STATE_INVALID represents unknown state.\n - DB_CLUSTER_STATE_CHANGING: DB_CLUSTER_STATE_CHANGING represents a cluster being changed.\n - DB_CLUSTER_STATE_READY: DB_CLUSTER_STATE_READY represents a cluster without pending changes.\n - DB_CLUSTER_STATE_FAILED: DB_CLUSTER_STATE_FAILED represents a failed cluster.\n - DB_CLUSTER_STATE_DELETING: DB_CLUSTER_STATE_DELETING represents a cluster being deleting.\n - DB_CLUSTER_STATE_PAUSED: DB_CLUSTER_STATE_PAUSED represents a cluster is paused.\n - DB_CLUSTER_STATE_UPGRADING: DB_CLUSTER_STATE_UPGRADING is a special case of DB_CLUSTER_STATE_CHANGING.\nIt indicates database cluster upgrade is ongoing.", - "type": "string", - "default": "DB_CLUSTER_STATE_INVALID", - "enum": [ - "DB_CLUSTER_STATE_INVALID", - "DB_CLUSTER_STATE_CHANGING", - "DB_CLUSTER_STATE_READY", - "DB_CLUSTER_STATE_FAILED", - "DB_CLUSTER_STATE_DELETING", - "DB_CLUSTER_STATE_PAUSED", - "DB_CLUSTER_STATE_UPGRADING" - ], - "x-order": 1 - }, - "operation": { - "description": "RunningOperation respresents a long-running operation.", - "type": "object", - "properties": { - "finished_steps": { - "description": "Finished steps of the operaion; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "description": "Text describing the current operation progress step.", - "type": "string", - "x-order": 1 - }, - "total_steps": { - "description": "Total steps needed to finish the operation; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 2 - } - }, - "x-order": 2 - }, - "params": { - "description": "PXCClusterParams represents PXC cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "pxc": { - "description": "PXC container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for PXC.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - }, - "configuration": { - "type": "string", - "title": "Configuration for PXC cluster", - "x-order": 3 - }, - "storage_class": { - "description": "Storage Class for PXC cluster.", - "type": "string", - "x-order": 4 - } - }, - "x-order": 1 - }, - "proxysql": { - "description": "ProxySQL container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for ProxySQL.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - } - }, - "x-order": 2 - }, - "haproxy": { - "description": "HAProxy container parameters.\nNOTE: HAProxy does not need disk size as ProxySQL does because the container does not require it.", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for HAProxy.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - } - }, - "x-order": 3 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 4 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 5 - } - }, - "x-order": 3 - }, - "exposed": { - "description": "DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 4 - }, - "installed_image": { - "description": "Installed XtraDB image.", - "type": "string", - "x-order": 5 - }, - "available_image": { - "description": "Available database version user can upgrade cluster to, returned as an image. Image tag contains the version.\nIf it's empty, no upgrade is available.", - "type": "string", - "x-order": 6 - }, - "internet_facing": { - "description": "Is DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 7 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 8 - } - }, - "x-order": 0 - }, - "psmdb_cluster": { - "description": "PSMDBCluster represents PSMDB cluster information.", - "type": "object", - "properties": { - "name": { - "description": "Cluster name.", - "type": "string", - "x-order": 0 - }, - "state": { - "description": "DBClusterState represents DB cluster CR state.\n\n - DB_CLUSTER_STATE_INVALID: DB_CLUSTER_STATE_INVALID represents unknown state.\n - DB_CLUSTER_STATE_CHANGING: DB_CLUSTER_STATE_CHANGING represents a cluster being changed.\n - DB_CLUSTER_STATE_READY: DB_CLUSTER_STATE_READY represents a cluster without pending changes.\n - DB_CLUSTER_STATE_FAILED: DB_CLUSTER_STATE_FAILED represents a failed cluster.\n - DB_CLUSTER_STATE_DELETING: DB_CLUSTER_STATE_DELETING represents a cluster being deleting.\n - DB_CLUSTER_STATE_PAUSED: DB_CLUSTER_STATE_PAUSED represents a cluster is paused.\n - DB_CLUSTER_STATE_UPGRADING: DB_CLUSTER_STATE_UPGRADING is a special case of DB_CLUSTER_STATE_CHANGING.\nIt indicates database cluster upgrade is ongoing.", - "type": "string", - "default": "DB_CLUSTER_STATE_INVALID", - "enum": [ - "DB_CLUSTER_STATE_INVALID", - "DB_CLUSTER_STATE_CHANGING", - "DB_CLUSTER_STATE_READY", - "DB_CLUSTER_STATE_FAILED", - "DB_CLUSTER_STATE_DELETING", - "DB_CLUSTER_STATE_PAUSED", - "DB_CLUSTER_STATE_UPGRADING" - ], - "x-order": 1 - }, - "operation": { - "description": "RunningOperation respresents a long-running operation.", - "type": "object", - "properties": { - "finished_steps": { - "description": "Finished steps of the operaion; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "description": "Text describing the current operation progress step.", - "type": "string", - "x-order": 1 - }, - "total_steps": { - "description": "Total steps needed to finish the operation; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 2 - } - }, - "x-order": 2 - }, - "params": { - "description": "PSMDBClusterParams represents PSMDB cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "replicaset": { - "description": "ReplicaSet container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - }, - "configuration": { - "type": "string", - "title": "Configuration for PSMDB cluster", - "x-order": 2 - }, - "storage_class": { - "description": "Storage Class for PSMDB cluster.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 1 - }, - "image": { - "description": "Docker image used for PSMDB.", - "type": "string", - "x-order": 2 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 3 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 4 - } - }, - "x-order": 3 - }, - "exposed": { - "description": "DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 4 - }, - "installed_image": { - "description": "Installed PSMDB image.", - "type": "string", - "x-order": 5 - }, - "available_image": { - "description": "Available database version user can upgrade cluster to, returned as an image. Image tag contains the version.\nIf it's empty, no upgrade is available.", - "type": "string", - "x-order": 6 - }, - "internet_facing": { - "description": "Is DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 7 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 8 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/DBClusters/List": { - "post": { - "tags": [ - "DBClusters" - ], - "summary": "ListDBClusters returns a list of DB clusters.", - "operationId": "ListDBClusters", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "pxc_clusters": { - "description": "PXC clusters information.", - "type": "array", - "items": { - "description": "PXCCluster represents PXC cluster information.", - "type": "object", - "properties": { - "name": { - "description": "Cluster name.", - "type": "string", - "x-order": 0 - }, - "state": { - "description": "DBClusterState represents DB cluster CR state.\n\n - DB_CLUSTER_STATE_INVALID: DB_CLUSTER_STATE_INVALID represents unknown state.\n - DB_CLUSTER_STATE_CHANGING: DB_CLUSTER_STATE_CHANGING represents a cluster being changed.\n - DB_CLUSTER_STATE_READY: DB_CLUSTER_STATE_READY represents a cluster without pending changes.\n - DB_CLUSTER_STATE_FAILED: DB_CLUSTER_STATE_FAILED represents a failed cluster.\n - DB_CLUSTER_STATE_DELETING: DB_CLUSTER_STATE_DELETING represents a cluster being deleting.\n - DB_CLUSTER_STATE_PAUSED: DB_CLUSTER_STATE_PAUSED represents a cluster is paused.\n - DB_CLUSTER_STATE_UPGRADING: DB_CLUSTER_STATE_UPGRADING is a special case of DB_CLUSTER_STATE_CHANGING.\nIt indicates database cluster upgrade is ongoing.", - "type": "string", - "default": "DB_CLUSTER_STATE_INVALID", - "enum": [ - "DB_CLUSTER_STATE_INVALID", - "DB_CLUSTER_STATE_CHANGING", - "DB_CLUSTER_STATE_READY", - "DB_CLUSTER_STATE_FAILED", - "DB_CLUSTER_STATE_DELETING", - "DB_CLUSTER_STATE_PAUSED", - "DB_CLUSTER_STATE_UPGRADING" - ], - "x-order": 1 - }, - "operation": { - "description": "RunningOperation respresents a long-running operation.", - "type": "object", - "properties": { - "finished_steps": { - "description": "Finished steps of the operaion; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "description": "Text describing the current operation progress step.", - "type": "string", - "x-order": 1 - }, - "total_steps": { - "description": "Total steps needed to finish the operation; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 2 - } - }, - "x-order": 2 - }, - "params": { - "description": "PXCClusterParams represents PXC cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "pxc": { - "description": "PXC container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for PXC.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - }, - "configuration": { - "type": "string", - "title": "Configuration for PXC cluster", - "x-order": 3 - }, - "storage_class": { - "description": "Storage Class for PXC cluster.", - "type": "string", - "x-order": 4 - } - }, - "x-order": 1 - }, - "proxysql": { - "description": "ProxySQL container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for ProxySQL.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - } - }, - "x-order": 2 - }, - "haproxy": { - "description": "HAProxy container parameters.\nNOTE: HAProxy does not need disk size as ProxySQL does because the container does not require it.", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for HAProxy.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - } - }, - "x-order": 3 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 4 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 5 - } - }, - "x-order": 3 - }, - "exposed": { - "description": "DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 4 - }, - "installed_image": { - "description": "Installed XtraDB image.", - "type": "string", - "x-order": 5 - }, - "available_image": { - "description": "Available database version user can upgrade cluster to, returned as an image. Image tag contains the version.\nIf it's empty, no upgrade is available.", - "type": "string", - "x-order": 6 - }, - "internet_facing": { - "description": "Is DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 7 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 8 - } - } - }, - "x-order": 0 - }, - "psmdb_clusters": { - "description": "PSMDB clusters information.", - "type": "array", - "items": { - "description": "PSMDBCluster represents PSMDB cluster information.", - "type": "object", - "properties": { - "name": { - "description": "Cluster name.", - "type": "string", - "x-order": 0 - }, - "state": { - "description": "DBClusterState represents DB cluster CR state.\n\n - DB_CLUSTER_STATE_INVALID: DB_CLUSTER_STATE_INVALID represents unknown state.\n - DB_CLUSTER_STATE_CHANGING: DB_CLUSTER_STATE_CHANGING represents a cluster being changed.\n - DB_CLUSTER_STATE_READY: DB_CLUSTER_STATE_READY represents a cluster without pending changes.\n - DB_CLUSTER_STATE_FAILED: DB_CLUSTER_STATE_FAILED represents a failed cluster.\n - DB_CLUSTER_STATE_DELETING: DB_CLUSTER_STATE_DELETING represents a cluster being deleting.\n - DB_CLUSTER_STATE_PAUSED: DB_CLUSTER_STATE_PAUSED represents a cluster is paused.\n - DB_CLUSTER_STATE_UPGRADING: DB_CLUSTER_STATE_UPGRADING is a special case of DB_CLUSTER_STATE_CHANGING.\nIt indicates database cluster upgrade is ongoing.", - "type": "string", - "default": "DB_CLUSTER_STATE_INVALID", - "enum": [ - "DB_CLUSTER_STATE_INVALID", - "DB_CLUSTER_STATE_CHANGING", - "DB_CLUSTER_STATE_READY", - "DB_CLUSTER_STATE_FAILED", - "DB_CLUSTER_STATE_DELETING", - "DB_CLUSTER_STATE_PAUSED", - "DB_CLUSTER_STATE_UPGRADING" - ], - "x-order": 1 - }, - "operation": { - "description": "RunningOperation respresents a long-running operation.", - "type": "object", - "properties": { - "finished_steps": { - "description": "Finished steps of the operaion; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "description": "Text describing the current operation progress step.", - "type": "string", - "x-order": 1 - }, - "total_steps": { - "description": "Total steps needed to finish the operation; can decrease or increase compared to the previous value.", - "type": "integer", - "format": "int32", - "x-order": 2 - } - }, - "x-order": 2 - }, - "params": { - "description": "PSMDBClusterParams represents PSMDB cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "replicaset": { - "description": "ReplicaSet container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - }, - "configuration": { - "type": "string", - "title": "Configuration for PSMDB cluster", - "x-order": 2 - }, - "storage_class": { - "description": "Storage Class for PSMDB cluster.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 1 - }, - "image": { - "description": "Docker image used for PSMDB.", - "type": "string", - "x-order": 2 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 3 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 4 - } - }, - "x-order": 3 - }, - "exposed": { - "description": "DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 4 - }, - "installed_image": { - "description": "Installed PSMDB image.", - "type": "string", - "x-order": 5 - }, - "available_image": { - "description": "Available database version user can upgrade cluster to, returned as an image. Image tag contains the version.\nIf it's empty, no upgrade is available.", - "type": "string", - "x-order": 6 - }, - "internet_facing": { - "description": "Is DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 7 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 8 - } - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/DBClusters/Restart": { - "post": { - "tags": [ - "DBClusters" - ], - "summary": "RestartDBCluster restarts DB cluster.", - "operationId": "RestartDBCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "PXC cluster name.", - "type": "string", - "x-order": 1 - }, - "cluster_type": { - "description": "DBClusterType represents database cluster type.\n\n - DB_CLUSTER_TYPE_INVALID: DB_CLUSTER_TYPE_INVALID represents unknown cluster type.\n - DB_CLUSTER_TYPE_PXC: DB_CLUSTER_TYPE_PXC represents pxc cluster type.\n - DB_CLUSTER_TYPE_PSMDB: DB_CLUSTER_TYPE_PSMDB represents psmdb cluster type.", - "type": "string", - "default": "DB_CLUSTER_TYPE_INVALID", - "enum": [ - "DB_CLUSTER_TYPE_INVALID", - "DB_CLUSTER_TYPE_PXC", - "DB_CLUSTER_TYPE_PSMDB" - ], - "x-order": 2 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/GetLogs": { - "post": { - "tags": [ - "LogsAPI" - ], - "summary": "GetLogs gets all logs from db cluster.", - "operationId": "GetLogs", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "cluster_name": { - "description": "DB cluster name.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "logs": { - "description": "Log represents list of logs. Each entry contains either container's logs or,\nwhen container field is empty, pod's events.", - "type": "array", - "items": { - "description": "Logs contain logs for certain pod's container. If container is an empty\nstring, logs contain pod's events.", - "type": "object", - "properties": { - "pod": { - "description": "Pod name.", - "type": "string", - "x-order": 0 - }, - "container": { - "description": "Container name.", - "type": "string", - "x-order": 1 - }, - "logs": { - "description": "Content of container's log or pod's events.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 2 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Kubernetes/Get": { - "post": { - "tags": [ - "Kubernetes" - ], - "summary": "GetKubernetesCluster return KubeAuth with Kubernetes config.", - "operationId": "GetKubernetesCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "kube_auth": { - "description": "KubeAuth represents Kubernetes / kubectl authentication and authorization information.", - "type": "object", - "properties": { - "kubeconfig": { - "description": "Kubeconfig file content.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Kubernetes/List": { - "post": { - "tags": [ - "Kubernetes" - ], - "summary": "ListKubernetesClusters returns a list of all registered Kubernetes clusters.", - "operationId": "ListKubernetesClusters", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "kubernetes_clusters": { - "description": "Kubernetes clusters.", - "type": "array", - "items": { - "description": "Cluster contains public info about Kubernetes cluster.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "operators": { - "description": "Operators contains list of operators installed in Kubernetes cluster.", - "type": "object", - "properties": { - "pxc": { - "description": "Operator contains all information about operator installed in Kubernetes cluster.", - "type": "object", - "properties": { - "status": { - "description": "OperatorsStatus defines status of operators installed in Kubernetes cluster.\n\n - OPERATORS_STATUS_INVALID: OPERATORS_STATUS_INVALID represents unknown state.\n - OPERATORS_STATUS_OK: OPERATORS_STATUS_OK represents that operators are installed and have supported API version.\n - OPERATORS_STATUS_UNSUPPORTED: OPERATORS_STATUS_UNSUPPORTED represents that operators are installed, but doesn't have supported API version.\n - OPERATORS_STATUS_NOT_INSTALLED: OPERATORS_STATUS_NOT_INSTALLED represents that operators are not installed.", - "type": "string", - "default": "OPERATORS_STATUS_INVALID", - "enum": [ - "OPERATORS_STATUS_INVALID", - "OPERATORS_STATUS_OK", - "OPERATORS_STATUS_UNSUPPORTED", - "OPERATORS_STATUS_NOT_INSTALLED" - ], - "x-order": 0 - }, - "version": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 0 - }, - "psmdb": { - "description": "Operator contains all information about operator installed in Kubernetes cluster.", - "type": "object", - "properties": { - "status": { - "description": "OperatorsStatus defines status of operators installed in Kubernetes cluster.\n\n - OPERATORS_STATUS_INVALID: OPERATORS_STATUS_INVALID represents unknown state.\n - OPERATORS_STATUS_OK: OPERATORS_STATUS_OK represents that operators are installed and have supported API version.\n - OPERATORS_STATUS_UNSUPPORTED: OPERATORS_STATUS_UNSUPPORTED represents that operators are installed, but doesn't have supported API version.\n - OPERATORS_STATUS_NOT_INSTALLED: OPERATORS_STATUS_NOT_INSTALLED represents that operators are not installed.", - "type": "string", - "default": "OPERATORS_STATUS_INVALID", - "enum": [ - "OPERATORS_STATUS_INVALID", - "OPERATORS_STATUS_OK", - "OPERATORS_STATUS_UNSUPPORTED", - "OPERATORS_STATUS_NOT_INSTALLED" - ], - "x-order": 0 - }, - "version": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 1 - }, - "dbaas": { - "description": "Operator contains all information about operator installed in Kubernetes cluster.", - "type": "object", - "properties": { - "status": { - "description": "OperatorsStatus defines status of operators installed in Kubernetes cluster.\n\n - OPERATORS_STATUS_INVALID: OPERATORS_STATUS_INVALID represents unknown state.\n - OPERATORS_STATUS_OK: OPERATORS_STATUS_OK represents that operators are installed and have supported API version.\n - OPERATORS_STATUS_UNSUPPORTED: OPERATORS_STATUS_UNSUPPORTED represents that operators are installed, but doesn't have supported API version.\n - OPERATORS_STATUS_NOT_INSTALLED: OPERATORS_STATUS_NOT_INSTALLED represents that operators are not installed.", - "type": "string", - "default": "OPERATORS_STATUS_INVALID", - "enum": [ - "OPERATORS_STATUS_INVALID", - "OPERATORS_STATUS_OK", - "OPERATORS_STATUS_UNSUPPORTED", - "OPERATORS_STATUS_NOT_INSTALLED" - ], - "x-order": 0 - }, - "version": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 2 - } - }, - "x-order": 1 - }, - "status": { - "description": "KubernetesClusterStatus defines status of Kubernetes cluster.\n\n - KUBERNETES_CLUSTER_STATUS_INVALID: KUBERNETES_CLUSTER_STATUS_INVALID represents unknown state.\n - KUBERNETES_CLUSTER_STATUS_OK: KUBERNETES_CLUSTER_STATUS_OK represents that Kubernetes cluster is accessible.\n - KUBERNETES_CLUSTER_STATUS_UNAVAILABLE: KUBERNETES_CLUSTER_STATUS_UNAVAILABLE represents that Kubernetes cluster is not accessible.\n - KUBERNETES_CLUSTER_STATUS_PROVISIONING: KUBERNETES_CLUSTER_STATUS_PROVISIONING represents that Kubernetes cluster is privisioning.", - "type": "string", - "default": "KUBERNETES_CLUSTER_STATUS_INVALID", - "enum": [ - "KUBERNETES_CLUSTER_STATUS_INVALID", - "KUBERNETES_CLUSTER_STATUS_OK", - "KUBERNETES_CLUSTER_STATUS_UNAVAILABLE", - "KUBERNETES_CLUSTER_STATUS_PROVISIONING" - ], - "x-order": 2 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Kubernetes/Register": { - "post": { - "tags": [ - "Kubernetes" - ], - "summary": "RegisterKubernetesCluster registers an existing Kubernetes cluster in PMM.", - "operationId": "RegisterKubernetesCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "kube_auth": { - "description": "KubeAuth represents Kubernetes / kubectl authentication and authorization information.", - "type": "object", - "properties": { - "kubeconfig": { - "description": "Kubeconfig file content.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 1 - }, - "aws_access_key_id": { - "description": "AWS access key id, only needed when registering EKS cluster and kubeconfig does not contain it.", - "type": "string", - "x-order": 2 - }, - "aws_secret_access_key": { - "description": "AWS secret access key, only needed when registering EKS cluster and kubeconfig does not contain it.", - "type": "string", - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Kubernetes/Resources/Get": { - "post": { - "tags": [ - "Kubernetes" - ], - "summary": "GetResources returns all and available resources of a Kubernetes cluster.\nNOTE: The user defined in kubeconfig for the cluster has to have rights to\n list and get Pods from all Namespaces. Also getting and listing Nodes\n has to be allowed.", - "operationId": "GetResources", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "all": { - "description": "Resources contains Kubernetes cluster resources.", - "type": "object", - "properties": { - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "uint64", - "x-order": 0 - }, - "cpu_m": { - "description": "CPU in millicpus. For example 0.1 of CPU is equivalent to 100 millicpus.\nSee https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu.", - "type": "string", - "format": "uint64", - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "uint64", - "x-order": 2 - } - }, - "x-order": 0 - }, - "available": { - "description": "Resources contains Kubernetes cluster resources.", - "type": "object", - "properties": { - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "uint64", - "x-order": 0 - }, - "cpu_m": { - "description": "CPU in millicpus. For example 0.1 of CPU is equivalent to 100 millicpus.\nSee https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu.", - "type": "string", - "format": "uint64", - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "uint64", - "x-order": 2 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Kubernetes/StorageClasses/List": { - "post": { - "tags": [ - "Kubernetes" - ], - "summary": "ListStorageClasses returns the names of all storage classes available in a Kubernetes cluster.", - "operationId": "ListStorageClasses", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "storage_classes": { - "description": "Kubernetes storage classes names.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/Kubernetes/Unregister": { - "post": { - "tags": [ - "Kubernetes" - ], - "summary": "UnregisterKubernetesCluster removes a registered Kubernetes cluster from PMM.", - "operationId": "UnregisterKubernetesCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "force": { - "description": "If true then Kubernetes cluster will be deleted\neven if it contains database clusters.", - "type": "boolean", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PSMDBCluster/Create": { - "post": { - "tags": [ - "PSMDBClusters" - ], - "summary": "CreatePSMDBCluster creates a new PSMDB cluster.", - "operationId": "CreatePSMDBCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "type": "string", - "title": "PSMDB cluster name.\na DNS-1035 label must consist of lower case alphanumeric characters or '-',\nstart with an alphabetic character, and end with an alphanumeric character\n(e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')", - "x-order": 1 - }, - "params": { - "description": "PSMDBClusterParams represents PSMDB cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "replicaset": { - "description": "ReplicaSet container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - }, - "configuration": { - "type": "string", - "title": "Configuration for PSMDB cluster", - "x-order": 2 - }, - "storage_class": { - "description": "Storage Class for PSMDB cluster.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 1 - }, - "image": { - "description": "Docker image used for PSMDB.", - "type": "string", - "x-order": 2 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 3 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 4 - } - }, - "x-order": 2 - }, - "expose": { - "description": "Make DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 3 - }, - "internet_facing": { - "description": "Make DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 4 - }, - "source_ranges": { - "description": "Apply IP source ranges against the cluster.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PSMDBCluster/Resources/Get": { - "post": { - "tags": [ - "PSMDBClusters" - ], - "summary": "GetPSMDBClusterResources returns expected resources to be consumed by the cluster.", - "operationId": "GetPSMDBClusterResources", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "params": { - "description": "PSMDBClusterParams represents PSMDB cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "replicaset": { - "description": "ReplicaSet container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - }, - "configuration": { - "type": "string", - "title": "Configuration for PSMDB cluster", - "x-order": 2 - }, - "storage_class": { - "description": "Storage Class for PSMDB cluster.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 1 - }, - "image": { - "description": "Docker image used for PSMDB.", - "type": "string", - "x-order": 2 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 3 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 4 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "expected": { - "description": "Resources contains Kubernetes cluster resources.", - "type": "object", - "properties": { - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "uint64", - "x-order": 0 - }, - "cpu_m": { - "description": "CPU in millicpus. For example 0.1 of CPU is equivalent to 100 millicpus.\nSee https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu.", - "type": "string", - "format": "uint64", - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "uint64", - "x-order": 2 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PSMDBCluster/Update": { - "post": { - "tags": [ - "PSMDBClusters" - ], - "summary": "UpdatePSMDBCluster updates existing PSMDB cluster.", - "operationId": "UpdatePSMDBCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "PSMDB cluster name.", - "type": "string", - "x-order": 1 - }, - "params": { - "description": "UpdatePSMDBClusterParams represents PSMDB cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "replicaset": { - "description": "ReplicaSet container parameters.", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - }, - "configuration": { - "type": "string", - "title": "Configuration for PSMDB cluster", - "x-order": 1 - }, - "storage_class": { - "description": "Storage Class for PSMDB cluster.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 1 - }, - "suspend": { - "description": "Suspend cluster `pause: true`.", - "type": "boolean", - "x-order": 2 - }, - "resume": { - "description": "Resume cluster `pause: false`.", - "type": "boolean", - "x-order": 3 - }, - "image": { - "description": "PSMDB image to use. If it's the same image but with different version tag, upgrade of database cluster to version\nin given tag is triggered. If entirely different image is given, error is returned.", - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PSMDBClusters/GetCredentials": { - "post": { - "tags": [ - "PSMDBClusters" - ], - "summary": "GetPSMDBClusterCredentials returns a PSMDB cluster credentials by cluster name.", - "operationId": "GetPSMDBClusterCredentials", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "PSMDB cluster name.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "connection_credentials": { - "description": "PSMDBCredentials is a credentials to connect to PSMDB.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "username": { - "description": "MongoDB username.", - "type": "string", - "x-order": 0 - }, - "password": { - "description": "MongoDB password.", - "type": "string", - "x-order": 1 - }, - "host": { - "description": "MongoDB host.", - "type": "string", - "x-order": 2 - }, - "port": { - "description": "MongoDB port.", - "type": "integer", - "format": "int32", - "x-order": 3 - }, - "replicaset": { - "description": "Replicaset name.", - "type": "string", - "x-order": 4 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PXCCluster/Create": { - "post": { - "tags": [ - "PXCClusters" - ], - "summary": "CreatePXCCluster creates a new PXC cluster.", - "operationId": "CreatePXCCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "type": "string", - "title": "PXC cluster name.\na DNS-1035 label must consist of lower case alphanumeric characters or '-',\nstart with an alphabetic character, and end with an alphanumeric character\n(e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')", - "x-order": 1 - }, - "params": { - "description": "PXCClusterParams represents PXC cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "pxc": { - "description": "PXC container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for PXC.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - }, - "configuration": { - "type": "string", - "title": "Configuration for PXC cluster", - "x-order": 3 - }, - "storage_class": { - "description": "Storage Class for PXC cluster.", - "type": "string", - "x-order": 4 - } - }, - "x-order": 1 - }, - "proxysql": { - "description": "ProxySQL container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for ProxySQL.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - } - }, - "x-order": 2 - }, - "haproxy": { - "description": "HAProxy container parameters.\nNOTE: HAProxy does not need disk size as ProxySQL does because the container does not require it.", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for HAProxy.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - } - }, - "x-order": 3 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 4 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 5 - } - }, - "x-order": 2 - }, - "expose": { - "description": "Make DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 3 - }, - "internet_facing": { - "description": "Make DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 4 - }, - "source_ranges": { - "description": "Apply IP source ranges against the cluster.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PXCCluster/Resources/Get": { - "post": { - "tags": [ - "PXCClusters" - ], - "summary": "GetPXCClusterResources returns expected resources to be consumed by the cluster.", - "operationId": "GetPXCClusterResources", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "params": { - "description": "PXCClusterParams represents PXC cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "pxc": { - "description": "PXC container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for PXC.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - }, - "configuration": { - "type": "string", - "title": "Configuration for PXC cluster", - "x-order": 3 - }, - "storage_class": { - "description": "Storage Class for PXC cluster.", - "type": "string", - "x-order": 4 - } - }, - "x-order": 1 - }, - "proxysql": { - "description": "ProxySQL container parameters.\nTODO Do not use inner messages in all public APIs (for consistency).", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for ProxySQL.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "int64", - "x-order": 2 - } - }, - "x-order": 2 - }, - "haproxy": { - "description": "HAProxy container parameters.\nNOTE: HAProxy does not need disk size as ProxySQL does because the container does not require it.", - "type": "object", - "properties": { - "image": { - "description": "Docker image used for HAProxy.", - "type": "string", - "x-order": 0 - }, - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 1 - } - }, - "x-order": 3 - }, - "backup": { - "type": "object", - "title": "Backup configuration for a database cluster", - "properties": { - "location_id": { - "description": "Backup Location id of stored backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "keep_copies": { - "description": "Keep copies represents how many copyies should retain.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "schedule": { - "description": "Schedule represents schedule configration.", - "type": "object", - "properties": { - "week": { - "description": "Weekly runs.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "weekday": { - "description": "Weekday configuration.", - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "hour": { - "description": "Hour configuration.", - "type": "integer", - "format": "int32", - "x-order": 2 - }, - "minute": { - "description": "Minutes configuration.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 2 - } - }, - "x-order": 4 - }, - "restore": { - "type": "object", - "title": "Restore represents restoration payload to restore a database cluster from backup", - "properties": { - "location_id": { - "description": "Backup location in PMM.", - "type": "string", - "format": "int64", - "x-order": 0 - }, - "destination": { - "type": "string", - "title": "Destination filename", - "x-order": 1 - } - }, - "x-order": 5 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "expected": { - "description": "Resources contains Kubernetes cluster resources.", - "type": "object", - "properties": { - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "uint64", - "x-order": 0 - }, - "cpu_m": { - "description": "CPU in millicpus. For example 0.1 of CPU is equivalent to 100 millicpus.\nSee https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu.", - "type": "string", - "format": "uint64", - "x-order": 1 - }, - "disk_size": { - "description": "Disk size in bytes.", - "type": "string", - "format": "uint64", - "x-order": 2 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PXCCluster/Update": { - "post": { - "tags": [ - "PXCClusters" - ], - "summary": "UpdatePXCCluster updates existing PXC cluster.", - "operationId": "UpdatePXCCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "PXC cluster name.", - "type": "string", - "x-order": 1 - }, - "params": { - "description": "UpdatePXCClusterParams represents PXC cluster parameters that can be updated.", - "type": "object", - "properties": { - "cluster_size": { - "description": "Cluster size.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "pxc": { - "description": "PXC container parameters.", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - }, - "image": { - "description": "Image to use. If it's the same image but with different version tag, upgrade of database cluster to version\nin given tag is triggered. If entirely different image is given, error is returned.", - "type": "string", - "x-order": 1 - }, - "configuration": { - "type": "string", - "title": "Configuration for PXC cluster", - "x-order": 2 - }, - "storage_class": { - "description": "Storage Class for PXC cluster.", - "type": "string", - "x-order": 3 - } - }, - "x-order": 1 - }, - "proxysql": { - "description": "ProxySQL container parameters.", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - } - }, - "x-order": 2 - }, - "suspend": { - "description": "Suspend cluster `pause: true`.", - "type": "boolean", - "x-order": 3 - }, - "resume": { - "description": "Resume cluster `pause: false`.", - "type": "boolean", - "x-order": 4 - }, - "haproxy": { - "description": "HAProxy container parameters.", - "type": "object", - "properties": { - "compute_resources": { - "description": "ComputeResources represents container computer resources requests or limits.", - "type": "object", - "properties": { - "cpu_m": { - "description": "CPUs in milliCPUs; 1000m = 1 vCPU.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "memory_bytes": { - "description": "Memory in bytes.", - "type": "string", - "format": "int64", - "x-order": 1 - } - }, - "x-order": 0 - } - }, - "x-order": 5 - } - }, - "x-order": 2 - }, - "expose": { - "description": "Make DB cluster accessible outside of K8s cluster.", - "type": "boolean", - "x-order": 3 - }, - "internet_facing": { - "description": "Make DB cluster accessible via public internet.", - "type": "boolean", - "x-order": 4 - }, - "source_ranges": { - "description": "Apply IP source ranges against the cluster.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/DBaaS/PXCClusters/GetCredentials": { - "post": { - "tags": [ - "PXCClusters" - ], - "summary": "GetPXCClusterCredentials returns a PXC cluster credentials by cluster name.", - "operationId": "GetPXCClusterCredentials", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "kubernetes_cluster_name": { - "description": "Kubernetes cluster name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "PXC cluster name.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "connection_credentials": { - "description": "PXCClusterConnectionCredentials is cluster connection credentials.", - "type": "object", - "properties": { - "username": { - "description": "PXC username.", - "type": "string", - "x-order": 0 - }, - "password": { - "description": "PXC password.", - "type": "string", - "x-order": 1 - }, - "host": { - "description": "PXC host.", - "type": "string", - "x-order": 2 - }, - "port": { - "description": "PXC port.", - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/alerting/Rules/Create": { - "post": { - "tags": [ - "Alerting" - ], - "summary": "CreateRule creates alerting rule from the given template.", - "operationId": "CreateRule", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "template_name": { - "description": "Template name.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "group": { - "description": "Rule group name.", - "type": "string", - "x-order": 2 - }, - "folder_uid": { - "description": "Folder UID.", - "type": "string", - "x-order": 3 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 4 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 5 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 6 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 7 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter represents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "MATCH", - "MISMATCH" - ], - "x-order": 0 - }, - "label": { - "type": "string", - "x-order": 1 - }, - "regexp": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 8 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/alerting/Templates/Create": { - "post": { - "tags": [ - "Alerting" - ], - "summary": "CreateTemplate creates a new template.", - "operationId": "CreateTemplate", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "yaml": { - "description": "YAML (or JSON) template file content.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/alerting/Templates/Delete": { - "post": { - "tags": [ - "Alerting" - ], - "summary": "DeleteTemplate deletes existing, previously created via API.", - "operationId": "DeleteTemplate", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/alerting/Templates/List": { - "post": { - "tags": [ - "Alerting" - ], - "summary": "ListTemplates returns a list of all collected alert rule templates.", - "operationId": "ListTemplates", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "reload": { - "description": "If true, template files will be re-read from disk.", - "type": "boolean", - "x-order": 0 - }, - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "templates": { - "type": "array", - "items": { - "description": "Template represents Alert Template that is used to create Alert Rule.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID).", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "expr": { - "description": "PromQL query expression with templating parameters.", - "type": "string", - "x-order": 2 - }, - "params": { - "description": "Query parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - } - }, - "x-order": 5 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - } - }, - "x-order": 6 - } - } - }, - "x-order": 3 - }, - "for": { - "description": "Default duration value.", - "type": "string", - "x-order": 4 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 5 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 6 - }, - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 7 - }, - "source": { - "description": "TemplateSource defines template source.\n\n - BUILT_IN: Template that is shipped with PMM Server releases.\n - SAAS: Template that is downloaded from check.percona.com.\n - USER_FILE: Templated loaded from user-suplied file.\n - USER_API: Templated created via API.", - "type": "string", - "default": "TEMPLATE_SOURCE_INVALID", - "enum": [ - "TEMPLATE_SOURCE_INVALID", - "BUILT_IN", - "SAAS", - "USER_FILE", - "USER_API" - ], - "x-order": 8 - }, - "created_at": { - "description": "Template creation time. Empty for built-in and SaaS templates.", - "type": "string", - "format": "date-time", - "x-order": 9 - }, - "yaml": { - "description": "YAML (or JSON) template file content. Empty for built-in and SaaS templates.", - "type": "string", - "x-order": 10 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/alerting/Templates/Update": { - "post": { - "tags": [ - "Alerting" - ], - "summary": "UpdateTemplate updates existing template, previously created via API.", - "operationId": "UpdateTemplate", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID).", - "type": "string", - "x-order": 0 - }, - "yaml": { - "description": "YAML (or JSON) template file content.", - "type": "string", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/azure/AzureDatabase/Add": { - "post": { - "tags": [ - "AzureDatabase" - ], - "summary": "AddAzureDatabase adds Azure Database instance.", - "operationId": "AddAzureDatabase", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "region": { - "description": "Azure database location.", - "type": "string", - "x-order": 0 - }, - "az": { - "description": "Azure database availability zone.", - "type": "string", - "x-order": 1 - }, - "instance_id": { - "description": "Azure database instance ID.", - "type": "string", - "x-order": 2 - }, - "node_model": { - "description": "Represents a purchasable Stock Keeping Unit (SKU) under a product.\nhttps://docs.microsoft.com/en-us/partner-center/develop/product-resources#sku.", - "type": "string", - "x-order": 3 - }, - "address": { - "description": "Address used to connect to it.", - "type": "string", - "x-order": 4 - }, - "port": { - "description": "Access port.", - "type": "integer", - "format": "int64", - "x-order": 5 - }, - "node_name": { - "description": "Unique across all Nodes user-defined name. Defaults to Azure Database instance ID.", - "type": "string", - "x-order": 6 - }, - "service_name": { - "description": "Unique across all Services user-defined name. Defaults to Azure Database instance ID.", - "type": "string", - "x-order": 7 - }, - "environment": { - "description": "Environment name.", - "type": "string", - "x-order": 8 - }, - "username": { - "description": "Username for scraping metrics.", - "type": "string", - "x-order": 9 - }, - "password": { - "description": "Password for scraping metrics.", - "type": "string", - "x-order": 10 - }, - "azure_client_id": { - "description": "Azure client ID.", - "type": "string", - "x-order": 11 - }, - "azure_client_secret": { - "description": "Azure client secret.", - "type": "string", - "x-order": 12 - }, - "azure_tenant_id": { - "description": "Azure tanant ID.", - "type": "string", - "x-order": 13 - }, - "azure_subscription_id": { - "description": "Azure subscription ID.", - "type": "string", - "x-order": 14 - }, - "azure_resource_group": { - "description": "Azure resource group.", - "type": "string", - "x-order": 15 - }, - "azure_database_exporter": { - "description": "If true, adds azure_database_exporter.", - "type": "boolean", - "x-order": 16 - }, - "qan": { - "description": "If true, adds qan-mysql-perfschema-agent or qan-postgresql-pgstatements-agent.", - "type": "boolean", - "x-order": 17 - }, - "custom_labels": { - "description": "Custom user-assigned labels for Node and Service.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 18 - }, - "skip_connection_check": { - "description": "Skip connection check.", - "type": "boolean", - "x-order": 19 - }, - "tls": { - "description": "Use TLS for database connections.", - "type": "boolean", - "x-order": 20 - }, - "tls_skip_verify": { - "description": "Skip TLS certificate and hostname validation.", - "type": "boolean", - "x-order": 21 - }, - "disable_query_examples": { - "description": "Disable query examples.", - "type": "boolean", - "x-order": 22 - }, - "tablestats_group_table_limit": { - "description": "Tablestats group collectors will be disabled if there are more than that number of tables.\nIf zero, server's default value is used.\nUse negative value to disable them.", - "type": "integer", - "format": "int32", - "x-order": 23 - }, - "type": { - "description": "DiscoverAzureDatabaseType describes supported Azure Database instance engines.\n\n - DISCOVER_AZURE_DATABASE_TYPE_MYSQL: MySQL type: microsoft.dbformysql or MariaDB type: microsoft.dbformariadb\n - DISCOVER_AZURE_DATABASE_TYPE_POSTGRESQL: PostgreSQL type: microsoft.dbformysql", - "type": "string", - "default": "DISCOVER_AZURE_DATABASE_TYPE_INVALID", - "enum": [ - "DISCOVER_AZURE_DATABASE_TYPE_INVALID", - "DISCOVER_AZURE_DATABASE_TYPE_MYSQL", - "DISCOVER_AZURE_DATABASE_TYPE_POSTGRESQL" - ], - "x-order": 24 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "x-order": 0 - }, - "code": { - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "message": { - "type": "string", - "x-order": 2 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type_url": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "string", - "format": "byte", - "x-order": 1 - } - } - }, - "x-order": 3 - } - } - } - } - } - } - }, - "/v1/management/azure/AzureDatabase/Discover": { - "post": { - "tags": [ - "AzureDatabase" - ], - "summary": "DiscoverAzureDatabase discovers Azure Database for MySQL, MariaDB and PostgreSQL Server instances.", - "operationId": "DiscoverAzureDatabase", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "description": "DiscoverAzureDatabaseRequest discover azure databases request.", - "type": "object", - "properties": { - "azure_client_id": { - "description": "Azure client ID.", - "type": "string", - "x-order": 0 - }, - "azure_client_secret": { - "description": "Azure client secret.", - "type": "string", - "x-order": 1 - }, - "azure_tenant_id": { - "description": "Azure tanant ID.", - "type": "string", - "x-order": 2 - }, - "azure_subscription_id": { - "description": "Azure subscription ID.", - "type": "string", - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "description": "DiscoverAzureDatabaseResponse discover azure databases response.", - "type": "object", - "properties": { - "azure_database_instance": { - "type": "array", - "items": { - "description": "DiscoverAzureDatabaseInstance models an unique Azure Database instance for the list of instances returned by Discovery.", - "type": "object", - "properties": { - "instance_id": { - "description": "Azure database instance ID.", - "type": "string", - "x-order": 0 - }, - "region": { - "description": "Azure database location.", - "type": "string", - "x-order": 1 - }, - "service_name": { - "description": "Azure database server name.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Database username.", - "type": "string", - "x-order": 3 - }, - "address": { - "description": "Address used to connect to it.", - "type": "string", - "x-order": 4 - }, - "azure_resource_group": { - "description": "Azure Resource group.", - "type": "string", - "x-order": 5 - }, - "environment": { - "description": "Environment tag.", - "type": "string", - "x-order": 6 - }, - "type": { - "description": "DiscoverAzureDatabaseType describes supported Azure Database instance engines.\n\n - DISCOVER_AZURE_DATABASE_TYPE_MYSQL: MySQL type: microsoft.dbformysql or MariaDB type: microsoft.dbformariadb\n - DISCOVER_AZURE_DATABASE_TYPE_POSTGRESQL: PostgreSQL type: microsoft.dbformysql", - "type": "string", - "default": "DISCOVER_AZURE_DATABASE_TYPE_INVALID", - "enum": [ - "DISCOVER_AZURE_DATABASE_TYPE_INVALID", - "DISCOVER_AZURE_DATABASE_TYPE_MYSQL", - "DISCOVER_AZURE_DATABASE_TYPE_POSTGRESQL" - ], - "x-order": 7 - }, - "az": { - "description": "Azure database availability zone.", - "type": "string", - "x-order": 8 - }, - "node_model": { - "description": "Represents a purchasable Stock Keeping Unit (SKU) under a product.\nhttps://docs.microsoft.com/en-us/partner-center/develop/product-resources#sku.", - "type": "string", - "x-order": 9 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "x-order": 0 - }, - "code": { - "type": "integer", - "format": "int32", - "x-order": 1 - }, - "message": { - "type": "string", - "x-order": 2 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type_url": { - "type": "string", - "x-order": 0 - }, - "value": { - "type": "string", - "format": "byte", - "x-order": 1 - } - } - }, - "x-order": 3 - } - } - } - } - } - } - }, - "/v1/management/backup/Artifacts/Delete": { - "post": { - "tags": [ - "Artifacts" - ], - "summary": "DeleteArtifact deletes specified artifact.", - "operationId": "DeleteArtifact", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "artifact_id": { - "description": "Machine-readable artifact ID.", - "type": "string", - "x-order": 0 - }, - "remove_files": { - "description": "Removes all the backup files associated with artifact if flag is set.", - "type": "boolean", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Artifacts/List": { - "post": { - "tags": [ - "Artifacts" - ], - "summary": "ListArtifacts returns a list of all backup artifacts.", - "operationId": "ListArtifacts", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "artifacts": { - "type": "array", - "items": { - "description": "Artifact represents single backup artifact.", - "type": "object", - "properties": { - "artifact_id": { - "description": "Machine-readable artifact ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "type": "string", - "title": "Artifact name", - "x-order": 1 - }, - "vendor": { - "description": "Database vendor e.g. PostgreSQL, MongoDB, MySQL.", - "type": "string", - "x-order": 2 - }, - "location_id": { - "description": "Machine-readable location ID.", - "type": "string", - "x-order": 3 - }, - "location_name": { - "description": "Location name.", - "type": "string", - "x-order": 4 - }, - "service_id": { - "description": "Machine-readable service ID.", - "type": "string", - "x-order": 5 - }, - "service_name": { - "description": "Service name.", - "type": "string", - "x-order": 6 - }, - "data_model": { - "description": "DataModel is a model used for performing a backup.", - "type": "string", - "default": "DATA_MODEL_INVALID", - "enum": [ - "DATA_MODEL_INVALID", - "PHYSICAL", - "LOGICAL" - ], - "x-order": 7 - }, - "status": { - "description": "BackupStatus shows the current status of execution of backup.", - "type": "string", - "default": "BACKUP_STATUS_INVALID", - "enum": [ - "BACKUP_STATUS_INVALID", - "BACKUP_STATUS_PENDING", - "BACKUP_STATUS_IN_PROGRESS", - "BACKUP_STATUS_PAUSED", - "BACKUP_STATUS_SUCCESS", - "BACKUP_STATUS_ERROR", - "BACKUP_STATUS_DELETING", - "BACKUP_STATUS_FAILED_TO_DELETE" - ], - "x-order": 8 - }, - "created_at": { - "description": "Artifact creation time.", - "type": "string", - "format": "date-time", - "x-order": 9 - }, - "mode": { - "description": "BackupMode specifies backup mode.", - "type": "string", - "default": "BACKUP_MODE_INVALID", - "enum": [ - "BACKUP_MODE_INVALID", - "SNAPSHOT", - "INCREMENTAL", - "PITR" - ], - "x-order": 10 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Artifacts/ListPITRTimeranges": { - "post": { - "tags": [ - "Artifacts" - ], - "summary": "ListPitrTimeranges list the available MongoDB PITR timeranges in a given backup location", - "operationId": "ListPitrTimeranges", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "artifact_id": { - "description": "Artifact ID represents artifact whose location has PITR timeranges to be retrieved.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "timeranges": { - "type": "array", - "items": { - "type": "object", - "properties": { - "start_timestamp": { - "description": "start_timestamp is the time of the first event in the PITR chunk.", - "type": "string", - "format": "date-time", - "x-order": 0 - }, - "end_timestamp": { - "description": "end_timestamp is the time of the last event in the PITR chunk.", - "type": "string", - "format": "date-time", - "x-order": 1 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/ChangeScheduled": { - "post": { - "tags": [ - "Backups" - ], - "summary": "ChangeScheduledBackup changes existing scheduled backup.", - "operationId": "ChangeScheduledBackup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "scheduled_backup_id": { - "type": "string", - "x-order": 0 - }, - "enabled": { - "type": "boolean", - "x-order": 1 - }, - "cron_expression": { - "description": "How often backup should be run in cron format.", - "type": "string", - "x-order": 2 - }, - "start_time": { - "description": "First backup wouldn't happen before this time.", - "type": "string", - "format": "date-time", - "x-order": 3 - }, - "name": { - "description": "Name of backup.", - "type": "string", - "x-order": 4 - }, - "description": { - "description": "Human-readable description.", - "type": "string", - "x-order": 5 - }, - "retry_interval": { - "description": "Delay between each retry. Should have a suffix in JSON: 1s, 1m, 1h.", - "type": "string", - "x-order": 6 - }, - "retries": { - "description": "How many times to retry a failed backup before giving up.", - "type": "integer", - "format": "int64", - "x-order": 7 - }, - "retention": { - "description": "How many artifacts keep. 0 - unlimited.", - "type": "integer", - "format": "int64", - "x-order": 8 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/GetLogs": { - "post": { - "tags": [ - "Backups" - ], - "summary": "GetLogs returns logs for provided artifact.", - "operationId": "GetLogsMixin3", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "artifact_id": { - "type": "string", - "x-order": 0 - }, - "offset": { - "type": "integer", - "format": "int64", - "x-order": 1 - }, - "limit": { - "type": "integer", - "format": "int64", - "x-order": 2 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "logs": { - "type": "array", - "items": { - "description": "LogChunk represent one chunk of logs.", - "type": "object", - "properties": { - "chunk_id": { - "type": "integer", - "format": "int64", - "x-order": 0 - }, - "data": { - "type": "string", - "x-order": 1 - } - } - }, - "x-order": 0 - }, - "end": { - "type": "boolean", - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/ListArtifactCompatibleServices": { - "post": { - "tags": [ - "Backups" - ], - "summary": "ListArtifactCompatibleServices lists compatible services for restoring a backup.", - "operationId": "ListArtifactCompatibleServices", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "artifact_id": { - "description": "Artifact id used to determine restore compatibility.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "mysql": { - "type": "array", - "items": { - "description": "MySQLService represents a generic MySQL instance.", - "type": "object", - "properties": { - "service_id": { - "description": "Unique randomly generated instance identifier.", - "type": "string", - "x-order": 0 - }, - "service_name": { - "description": "Unique across all Services user-defined name.", - "type": "string", - "x-order": 1 - }, - "node_id": { - "description": "Node identifier where this instance runs.", - "type": "string", - "x-order": 2 - }, - "address": { - "description": "Access address (DNS name or IP).\nAddress (and port) or socket is required.", - "type": "string", - "x-order": 3 - }, - "port": { - "description": "Access port.\nPort is required when the address present.", - "type": "integer", - "format": "int64", - "x-order": 4 - }, - "socket": { - "description": "Access unix socket.\nAddress (and port) or socket is required.", - "type": "string", - "x-order": 5 - }, - "environment": { - "description": "Environment name.", - "type": "string", - "x-order": 6 - }, - "cluster": { - "description": "Cluster name.", - "type": "string", - "x-order": 7 - }, - "replication_set": { - "description": "Replication set name.", - "type": "string", - "x-order": 8 - }, - "custom_labels": { - "description": "Custom user-assigned labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 9 - } - } - }, - "x-order": 0 - }, - "mongodb": { - "type": "array", - "items": { - "description": "MongoDBService represents a generic MongoDB instance.", - "type": "object", - "properties": { - "service_id": { - "description": "Unique randomly generated instance identifier.", - "type": "string", - "x-order": 0 - }, - "service_name": { - "description": "Unique across all Services user-defined name.", - "type": "string", - "x-order": 1 - }, - "node_id": { - "description": "Node identifier where this instance runs.", - "type": "string", - "x-order": 2 - }, - "address": { - "description": "Access address (DNS name or IP).\nAddress (and port) or socket is required.", - "type": "string", - "x-order": 3 - }, - "port": { - "description": "Access port.\nPort is required when the address present.", - "type": "integer", - "format": "int64", - "x-order": 4 - }, - "socket": { - "description": "Access unix socket.\nAddress (and port) or socket is required.", - "type": "string", - "x-order": 5 - }, - "environment": { - "description": "Environment name.", - "type": "string", - "x-order": 6 - }, - "cluster": { - "description": "Cluster name.", - "type": "string", - "x-order": 7 - }, - "replication_set": { - "description": "Replication set name.", - "type": "string", - "x-order": 8 - }, - "custom_labels": { - "description": "Custom user-assigned labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 9 - } - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/ListScheduled": { - "post": { - "tags": [ - "Backups" - ], - "summary": "ListScheduledBackups returns all scheduled backups.", - "operationId": "ListScheduledBackups", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "scheduled_backups": { - "type": "array", - "items": { - "description": "ScheduledBackup represents scheduled task for backup.", - "type": "object", - "properties": { - "scheduled_backup_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "service_id": { - "description": "Machine-readable service ID.", - "type": "string", - "x-order": 1 - }, - "service_name": { - "description": "Service name.", - "type": "string", - "x-order": 2 - }, - "location_id": { - "description": "Machine-readable location ID.", - "type": "string", - "x-order": 3 - }, - "location_name": { - "description": "Location name.", - "type": "string", - "x-order": 4 - }, - "cron_expression": { - "description": "How often backup will be run in cron format.", - "type": "string", - "x-order": 5 - }, - "start_time": { - "description": "First backup wouldn't happen before this time.", - "type": "string", - "format": "date-time", - "x-order": 6 - }, - "name": { - "description": "Artifact name.", - "type": "string", - "x-order": 7 - }, - "description": { - "description": "Description.", - "type": "string", - "x-order": 8 - }, - "retry_interval": { - "description": "Delay between each retry. Should have a suffix in JSON: 1s, 1m, 1h.", - "type": "string", - "x-order": 9 - }, - "retries": { - "description": "How many times to retry a failed backup before giving up.", - "type": "integer", - "format": "int64", - "x-order": 10 - }, - "enabled": { - "description": "If scheduling is enabled.", - "type": "boolean", - "x-order": 11 - }, - "data_model": { - "description": "DataModel is a model used for performing a backup.", - "type": "string", - "default": "DATA_MODEL_INVALID", - "enum": [ - "DATA_MODEL_INVALID", - "PHYSICAL", - "LOGICAL" - ], - "x-order": 12 - }, - "vendor": { - "description": "Database vendor e.g. PostgreSQL, MongoDB, MySQL.", - "type": "string", - "x-order": 13 - }, - "last_run": { - "description": "Last run.", - "type": "string", - "format": "date-time", - "x-order": 14 - }, - "next_run": { - "description": "Next run.", - "type": "string", - "format": "date-time", - "x-order": 15 - }, - "retention": { - "description": "How many artifacts keep. 0 - unlimited.", - "type": "integer", - "format": "int64", - "x-order": 16 - }, - "mode": { - "description": "BackupMode specifies backup mode.", - "type": "string", - "default": "BACKUP_MODE_INVALID", - "enum": [ - "BACKUP_MODE_INVALID", - "SNAPSHOT", - "INCREMENTAL", - "PITR" - ], - "x-order": 17 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/RemoveScheduled": { - "post": { - "tags": [ - "Backups" - ], - "summary": "RemoveScheduledBackup removes existing scheduled backup.", - "operationId": "RemoveScheduledBackup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "scheduled_backup_id": { - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/Restore": { - "post": { - "description": "Could return the Error message in the details containing specific ErrorCode indicating failure reason:\nERROR_CODE_XTRABACKUP_NOT_INSTALLED - xtrabackup is not installed on the service\nERROR_CODE_INVALID_XTRABACKUP - different versions of xtrabackup and xbcloud\nERROR_CODE_INCOMPATIBLE_XTRABACKUP - xtrabackup is not compatible with MySQL for taking a backup\nERROR_CODE_INCOMPATIBLE_TARGET_MYSQL - target MySQL version is not compatible with the artifact for performing a restore of the backup", - "tags": [ - "Backups" - ], - "summary": "RestoreBackup requests the backup restore.", - "operationId": "RestoreBackup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "service_id": { - "description": "Service identifier where backup should be restored.", - "type": "string", - "x-order": 0 - }, - "artifact_id": { - "description": "Artifact id to restore.", - "type": "string", - "x-order": 1 - }, - "pitr_timestamp": { - "type": "string", - "format": "date-time", - "title": "Timestamp of PITR to restore to", - "x-order": 2 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "restore_id": { - "description": "Unique restore identifier.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/Schedule": { - "post": { - "tags": [ - "Backups" - ], - "summary": "ScheduleBackup schedules repeated backup.", - "operationId": "ScheduleBackup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "service_id": { - "description": "Service identifier where backup should be performed.", - "type": "string", - "x-order": 0 - }, - "location_id": { - "description": "Machine-readable location ID.", - "type": "string", - "x-order": 1 - }, - "cron_expression": { - "description": "How often backup should be run in cron format.", - "type": "string", - "x-order": 2 - }, - "start_time": { - "description": "First backup wouldn't happen before this time.", - "type": "string", - "format": "date-time", - "x-order": 3 - }, - "name": { - "description": "Name of backup.", - "type": "string", - "x-order": 4 - }, - "description": { - "description": "Human-readable description.", - "type": "string", - "x-order": 5 - }, - "retry_interval": { - "description": "Delay between each retry. Should have a suffix in JSON: 1s, 1m, 1h.", - "type": "string", - "x-order": 6 - }, - "retries": { - "description": "How many times to retry a failed backup before giving up.", - "type": "integer", - "format": "int64", - "x-order": 7 - }, - "enabled": { - "description": "If scheduling is enabled.", - "type": "boolean", - "x-order": 8 - }, - "retention": { - "description": "How many artifacts keep. 0 - unlimited.", - "type": "integer", - "format": "int64", - "x-order": 9 - }, - "mode": { - "description": "BackupMode specifies backup mode.", - "type": "string", - "default": "BACKUP_MODE_INVALID", - "enum": [ - "BACKUP_MODE_INVALID", - "SNAPSHOT", - "INCREMENTAL", - "PITR" - ], - "x-order": 10 - }, - "data_model": { - "description": "DataModel is a model used for performing a backup.", - "type": "string", - "default": "DATA_MODEL_INVALID", - "enum": [ - "DATA_MODEL_INVALID", - "PHYSICAL", - "LOGICAL" - ], - "x-order": 11 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "scheduled_backup_id": { - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Backups/Start": { - "post": { - "description": "Could return the Error message in the details containing specific ErrorCode indicating failure reason:\nERROR_CODE_XTRABACKUP_NOT_INSTALLED - xtrabackup is not installed on the service\nERROR_CODE_INVALID_XTRABACKUP - different versions of xtrabackup and xbcloud\nERROR_CODE_INCOMPATIBLE_XTRABACKUP - xtrabackup is not compatible with MySQL for taking a backup", - "tags": [ - "Backups" - ], - "summary": "StartBackup request backup specified service to location.", - "operationId": "StartBackup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "service_id": { - "description": "Service identifier.", - "type": "string", - "x-order": 0 - }, - "location_id": { - "description": "Machine-readable location ID.", - "type": "string", - "x-order": 1 - }, - "name": { - "description": "If empty then name is auto-generated.", - "type": "string", - "x-order": 2 - }, - "description": { - "description": "Human-readable description.", - "type": "string", - "x-order": 3 - }, - "retry_interval": { - "description": "Delay between each retry. Should have a suffix in JSON: 1s, 1m, 1h.", - "type": "string", - "x-order": 4 - }, - "retries": { - "description": "How many times to retry a failed backup before giving up.", - "type": "integer", - "format": "int64", - "x-order": 5 - }, - "data_model": { - "description": "DataModel is a model used for performing a backup.", - "type": "string", - "default": "DATA_MODEL_INVALID", - "enum": [ - "DATA_MODEL_INVALID", - "PHYSICAL", - "LOGICAL" - ], - "x-order": 6 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "artifact_id": { - "description": "Unique identifier.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Locations/Add": { - "post": { - "tags": [ - "Locations" - ], - "summary": "AddLocation adds backup location.", - "operationId": "AddLocation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "Location name", - "x-order": 0 - }, - "description": { - "type": "string", - "x-order": 1 - }, - "filesystem_config": { - "description": "FilesystemLocationConfig represents file system location config.", - "type": "object", - "properties": { - "path": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 2 - }, - "s3_config": { - "description": "S3LocationConfig represents S3 bucket configuration.", - "type": "object", - "properties": { - "endpoint": { - "type": "string", - "x-order": 0 - }, - "access_key": { - "type": "string", - "x-order": 1 - }, - "secret_key": { - "type": "string", - "x-order": 2 - }, - "bucket_name": { - "type": "string", - "x-order": 3 - } - }, - "x-order": 3 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "location_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Locations/Change": { - "post": { - "tags": [ - "Locations" - ], - "summary": "ChangeLocation changes backup location.", - "operationId": "ChangeLocation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "location_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "type": "string", - "title": "Location name", - "x-order": 1 - }, - "description": { - "type": "string", - "x-order": 2 - }, - "filesystem_config": { - "description": "FilesystemLocationConfig represents file system location config.", - "type": "object", - "properties": { - "path": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 3 - }, - "s3_config": { - "description": "S3LocationConfig represents S3 bucket configuration.", - "type": "object", - "properties": { - "endpoint": { - "type": "string", - "x-order": 0 - }, - "access_key": { - "type": "string", - "x-order": 1 - }, - "secret_key": { - "type": "string", - "x-order": 2 - }, - "bucket_name": { - "type": "string", - "x-order": 3 - } - }, - "x-order": 4 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Locations/List": { - "post": { - "tags": [ - "Locations" - ], - "summary": "ListLocations returns a list of all backup locations.", - "operationId": "ListLocations", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "locations": { - "type": "array", - "items": { - "description": "Location represents single Backup Location.", - "type": "object", - "properties": { - "location_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "type": "string", - "title": "Location name", - "x-order": 1 - }, - "description": { - "type": "string", - "title": "Short description", - "x-order": 2 - }, - "filesystem_config": { - "description": "FilesystemLocationConfig represents file system location config.", - "type": "object", - "properties": { - "path": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 3 - }, - "s3_config": { - "description": "S3LocationConfig represents S3 bucket configuration.", - "type": "object", - "properties": { - "endpoint": { - "type": "string", - "x-order": 0 - }, - "access_key": { - "type": "string", - "x-order": 1 - }, - "secret_key": { - "type": "string", - "x-order": 2 - }, - "bucket_name": { - "type": "string", - "x-order": 3 - } - }, - "x-order": 4 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Locations/Remove": { - "post": { - "tags": [ - "Locations" - ], - "summary": "RemoveLocation removes existing backup location.", - "operationId": "RemoveLocation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "location_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "force": { - "type": "boolean", - "title": "Force mode", - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/Locations/TestConfig": { - "post": { - "tags": [ - "Locations" - ], - "summary": "TestLocationConfig tests backup location and credentials.", - "operationId": "TestLocationConfig", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "filesystem_config": { - "description": "FilesystemLocationConfig represents file system location config.", - "type": "object", - "properties": { - "path": { - "type": "string", - "x-order": 0 - } - }, - "x-order": 0 - }, - "s3_config": { - "description": "S3LocationConfig represents S3 bucket configuration.", - "type": "object", - "properties": { - "endpoint": { - "type": "string", - "x-order": 0 - }, - "access_key": { - "type": "string", - "x-order": 1 - }, - "secret_key": { - "type": "string", - "x-order": 2 - }, - "bucket_name": { - "type": "string", - "x-order": 3 - } - }, - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/backup/RestoreHistory/List": { - "post": { - "tags": [ - "RestoreHistory" - ], - "summary": "ListRestoreHistory returns a list of all backup restore history items.", - "operationId": "ListRestoreHistory", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "description": "RestoreHistoryItem represents single backup restore item.", - "type": "object", - "properties": { - "restore_id": { - "description": "Machine-readable restore id.", - "type": "string", - "x-order": 0 - }, - "artifact_id": { - "description": "ID of the artifact used for restore.", - "type": "string", - "x-order": 1 - }, - "name": { - "description": "Artifact name used for restore.", - "type": "string", - "x-order": 2 - }, - "vendor": { - "description": "Database vendor e.g. PostgreSQL, MongoDB, MySQL.", - "type": "string", - "x-order": 3 - }, - "location_id": { - "description": "Machine-readable location ID.", - "type": "string", - "x-order": 4 - }, - "location_name": { - "description": "Location name.", - "type": "string", - "x-order": 5 - }, - "service_id": { - "description": "Machine-readable service ID.", - "type": "string", - "x-order": 6 - }, - "service_name": { - "description": "Service name.", - "type": "string", - "x-order": 7 - }, - "data_model": { - "description": "DataModel is a model used for performing a backup.", - "type": "string", - "default": "DATA_MODEL_INVALID", - "enum": [ - "DATA_MODEL_INVALID", - "PHYSICAL", - "LOGICAL" - ], - "x-order": 8 - }, - "status": { - "description": "RestoreStatus shows the current status of execution of restore.", - "type": "string", - "default": "RESTORE_STATUS_INVALID", - "enum": [ - "RESTORE_STATUS_INVALID", - "RESTORE_STATUS_IN_PROGRESS", - "RESTORE_STATUS_SUCCESS", - "RESTORE_STATUS_ERROR" - ], - "x-order": 9 - }, - "started_at": { - "description": "Restore start time.", - "type": "string", - "format": "date-time", - "x-order": 10 - }, - "finished_at": { - "description": "Restore finish time.", - "type": "string", - "format": "date-time", - "x-order": 11 - }, - "pitr_timestamp": { - "description": "PITR timestamp is filled for PITR restores, empty otherwise.", - "type": "string", - "format": "date-time", - "x-order": 12 - } - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Alerts/List": { - "post": { - "tags": [ - "Alerts" - ], - "summary": "ListAlerts returns a list of all Alerts.", - "operationId": "ListAlerts", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "alerts": { - "type": "array", - "items": { - "description": "Alert represents Alert.", - "type": "object", - "properties": { - "alert_id": { - "description": "ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Human-readable summary.", - "type": "string", - "x-order": 1 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 2 - }, - "status": { - "description": "Status represents Alert Rule's and Alert's combined status.\n\n - CLEAR: No alert.\n - PENDING: Pending, but not triggering alert.\n - TRIGGERING: Triggering (firing) alert.\n - SILENCED: Silenced alert.", - "type": "string", - "default": "STATUS_INVALID", - "enum": [ - "STATUS_INVALID", - "CLEAR", - "PENDING", - "TRIGGERING", - "SILENCED" - ], - "x-order": 3 - }, - "labels": { - "description": "Combined labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 4 - }, - "rule": { - "description": "Rule represents Alert Rule.", - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "summary": { - "description": "Rule human-readable summary.", - "type": "string", - "x-order": 2 - }, - "template_name": { - "description": "Template used for this rule.", - "type": "string", - "x-order": 3 - }, - "disabled": { - "description": "True if that rule is disabled.", - "type": "boolean", - "x-order": 4 - }, - "expr_template": { - "description": "Expression template.", - "type": "string", - "x-order": 5 - }, - "expr": { - "description": "Expression filled with parameters.", - "type": "string", - "x-order": 6 - }, - "params_definitions": { - "description": "Expression parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - } - }, - "x-order": 5 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - } - }, - "x-order": 6 - } - } - }, - "x-order": 7 - }, - "params_values": { - "description": "Expression parameters values.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 8 - }, - "default_for": { - "description": "Default for duration.", - "type": "string", - "x-order": 9 - }, - "for": { - "description": "For duration.", - "type": "string", - "x-order": 10 - }, - "default_severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 11 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 12 - }, - "custom_labels": { - "description": "Custom labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 13 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 14 - }, - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 15 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 16 - }, - "channels": { - "description": "Channels.", - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.\n\nreserved channels\n pushover_config = 5;\n opsgenie_config = 7;\n victorops_config = 9;\n wechat_config = 10;", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - } - } - }, - "x-order": 17 - }, - "created_at": { - "description": "Rule creation time.", - "type": "string", - "format": "date-time", - "x-order": 18 - } - }, - "x-order": 5 - }, - "created_at": { - "description": "Alert creation time.", - "type": "string", - "format": "date-time", - "x-order": 6 - }, - "updated_at": { - "description": "Alert last update time.", - "type": "string", - "format": "date-time", - "x-order": 7 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Alerts/Toggle": { - "post": { - "description": "Pass empty list to apply toggle action to all existing alerts", - "tags": [ - "Alerts" - ], - "summary": "ToggleAlerts allows to switch alerts state between silenced and unsilenced.", - "operationId": "ToggleAlerts", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "alert_ids": { - "description": "List of alerts that silence state should be switched. If provided array is empty than all\nexisting alerts are switched.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 0 - }, - "silenced": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Add": { - "post": { - "tags": [ - "Channels" - ], - "summary": "AddChannel adds notification channel.", - "operationId": "AddChannel", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 0 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 1 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 2 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 3 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 4 - }, - "disabled": { - "description": "New channel status.", - "type": "boolean", - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Change": { - "post": { - "tags": [ - "Channels" - ], - "summary": "ChangeChannel changes notification channel.", - "operationId": "ChangeChannel", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary. Empty value will not change it.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "Enables or disables that channel. Should be set.", - "type": "boolean", - "x-order": 6 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/List": { - "post": { - "tags": [ - "Channels" - ], - "summary": "ListChannels returns a list of all notifation channels.", - "operationId": "ListChannels", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "channels": { - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.\n\nreserved channels\n pushover_config = 5;\n opsgenie_config = 7;\n victorops_config = 9;\n wechat_config = 10;", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Remove": { - "post": { - "tags": [ - "Channels" - ], - "summary": "RemoveChannel removes notification channel.", - "operationId": "RemoveChannel", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_id": { - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Create": { - "post": { - "tags": [ - "Rules" - ], - "summary": "CreateAlertRule creates Alerting rule.", - "operationId": "CreateAlertRule", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "template_name": { - "description": "Template name. Can't be specified simultaneously with source_rule_id.", - "type": "string", - "x-order": 0 - }, - "source_rule_id": { - "description": "ID of the rule that will be used as source. Can't be specified simultaneously with template_name.", - "type": "string", - "x-order": 1 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 2 - }, - "disabled": { - "description": "New rule status.", - "type": "boolean", - "x-order": 3 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 4 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 5 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 6 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 7 - }, - "filters": { - "description": "Filters. Should be set.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 8 - }, - "channel_ids": { - "description": "Channels. Should be set.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 9 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Delete": { - "post": { - "tags": [ - "Rules" - ], - "summary": "DeleteAlertRule deletes Alerting rule.", - "operationId": "DeleteAlertRule", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/List": { - "post": { - "tags": [ - "Rules" - ], - "summary": "ListAlertRules returns a list of all Alerting rules.", - "operationId": "ListAlertRules", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "rules": { - "type": "array", - "items": { - "description": "Rule represents Alert Rule.", - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "summary": { - "description": "Rule human-readable summary.", - "type": "string", - "x-order": 2 - }, - "template_name": { - "description": "Template used for this rule.", - "type": "string", - "x-order": 3 - }, - "disabled": { - "description": "True if that rule is disabled.", - "type": "boolean", - "x-order": 4 - }, - "expr_template": { - "description": "Expression template.", - "type": "string", - "x-order": 5 - }, - "expr": { - "description": "Expression filled with parameters.", - "type": "string", - "x-order": 6 - }, - "params_definitions": { - "description": "Expression parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - } - }, - "x-order": 5 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - } - }, - "x-order": 6 - } - } - }, - "x-order": 7 - }, - "params_values": { - "description": "Expression parameters values.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 8 - }, - "default_for": { - "description": "Default for duration.", - "type": "string", - "x-order": 9 - }, - "for": { - "description": "For duration.", - "type": "string", - "x-order": 10 - }, - "default_severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 11 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 12 - }, - "custom_labels": { - "description": "Custom labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 13 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 14 - }, - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 15 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 16 - }, - "channels": { - "description": "Channels.", - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.\n\nreserved channels\n pushover_config = 5;\n opsgenie_config = 7;\n victorops_config = 9;\n wechat_config = 10;", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - } - } - }, - "x-order": 17 - }, - "created_at": { - "description": "Rule creation time.", - "type": "string", - "format": "date-time", - "x-order": 18 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Toggle": { - "post": { - "tags": [ - "Rules" - ], - "summary": "ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule.", - "operationId": "ToggleAlertRule", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "disabled": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Update": { - "post": { - "tags": [ - "Rules" - ], - "summary": "UpdateAlertRule updates Alerting rule.", - "operationId": "UpdateAlertRule", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name. Should be set.", - "type": "string", - "x-order": 1 - }, - "disabled": { - "description": "New rule status. Should be set.", - "type": "boolean", - "x-order": 2 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 3 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 4 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 5 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 6 - }, - "filters": { - "description": "Filters. Should be set.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 7 - }, - "channel_ids": { - "description": "Channels. Should be set.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 8 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - } - }, - "securityDefinitions": { - "basicAuth": { - "type": "basic" - } - }, - "security": [ - { - "basicAuth": [] - } - ], - "tags": [ - { - "name": "Components" - }, - { - "name": "DBClusters" - }, - { - "name": "Kubernetes" - }, - { - "name": "LogsAPI" - }, - { - "name": "PSMDBClusters" - }, - { - "name": "PXCClusters" - }, - { - "name": "Alerts" - }, - { - "name": "Channels" - }, - { - "name": "Rules" - }, - { - "name": "Alerting" - }, - { - "name": "Artifacts" - }, - { - "name": "Backups" - }, - { - "name": "Locations" - }, - { - "name": "RestoreHistory" - }, - { - "name": "Collector" - }, - { - "name": "Filters" - }, - { - "name": "MetricsNames" - }, - { - "name": "ObjectDetails" - }, - { - "name": "Profile" - }, - { - "name": "Platform" - } - ], - "x-readme": { - "samples-languages": [ - "curl", - "go", - "node", - "python" - ] - } -} \ No newline at end of file diff --git a/api/swagger/swagger-dev.json b/api/swagger/swagger-dev.json index 613c6b02ff..e2a34dc8a7 100644 --- a/api/swagger/swagger-dev.json +++ b/api/swagger/swagger-dev.json @@ -3085,83 +3085,14 @@ "type": "boolean", "x-order": 15 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - } - }, - "x-order": 16 - }, - "remove_email_alerting_settings": { - "description": "If true, removes Alerting email (SMTP) settings.", - "type": "boolean", - "x-order": 17 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 18 - }, - "remove_slack_alerting_settings": { - "description": "If true, removes Alerting Slack settings.", - "type": "boolean", - "x-order": 19 - }, "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 20 + "x-order": 16 }, "remove_pmm_public_address": { "type": "boolean", - "x-order": 21 + "x-order": 17 }, "stt_check_intervals": { "description": "STTCheckIntervals represents intervals between STT checks.", @@ -3183,37 +3114,37 @@ "x-order": 2 } }, - "x-order": 22 + "x-order": 18 }, "enable_azurediscover": { "description": "Enable Azure Discover.", "type": "boolean", - "x-order": 23 + "x-order": 19 }, "disable_azurediscover": { "description": "Disable Azure Discover.", "type": "boolean", - "x-order": 24 + "x-order": 20 }, "enable_backup_management": { "description": "Enable Backup Management.", "type": "boolean", - "x-order": 25 + "x-order": 21 }, "disable_backup_management": { "description": "Disable Backup Management.", "type": "boolean", - "x-order": 26 + "x-order": 22 }, "enable_access_control": { "type": "boolean", "title": "Enable Access Control", - "x-order": 27 + "x-order": 23 }, "disable_access_control": { "type": "boolean", "title": "Disable Access Control", - "x-order": 28 + "x-order": 24 } } } @@ -3301,69 +3232,10 @@ "type": "boolean", "x-order": 10 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - } - }, - "x-order": 11 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 12 - }, "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 13 + "x-order": 11 }, "stt_check_intervals": { "description": "STTCheckIntervals represents intervals between STT checks.", @@ -3385,22 +3257,22 @@ "x-order": 2 } }, - "x-order": 14 + "x-order": 12 }, "backup_management_enabled": { "description": "True if Backup Management is enabled.", "type": "boolean", - "x-order": 15 + "x-order": 13 }, "azurediscover_enabled": { "description": "True if Azure Discover is enabled.", "type": "boolean", - "x-order": 16 + "x-order": 14 }, "connected_to_platform": { "type": "boolean", "title": "True if the PMM instance is connected to Platform", - "x-order": 17 + "x-order": 15 }, "telemetry_summaries": { "type": "array", @@ -3408,18 +3280,18 @@ "items": { "type": "string" }, - "x-order": 18 + "x-order": 16 }, "enable_access_control": { "description": "True if Access Control is enabled.", "type": "boolean", - "x-order": 19 + "x-order": 17 }, "default_role_id": { "description": "Default Access Control role ID for new users.", "type": "integer", "format": "int64", - "x-order": 20 + "x-order": 18 } }, "x-order": 0 @@ -3563,69 +3435,10 @@ "type": "boolean", "x-order": 10 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - } - }, - "x-order": 11 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 12 - }, "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 13 + "x-order": 11 }, "stt_check_intervals": { "description": "STTCheckIntervals represents intervals between STT checks.", @@ -3647,22 +3460,22 @@ "x-order": 2 } }, - "x-order": 14 + "x-order": 12 }, "backup_management_enabled": { "description": "True if Backup Management is enabled.", "type": "boolean", - "x-order": 15 + "x-order": 13 }, "azurediscover_enabled": { "description": "True if Azure Discover is enabled.", "type": "boolean", - "x-order": 16 + "x-order": 14 }, "connected_to_platform": { "type": "boolean", "title": "True if the PMM instance is connected to Platform", - "x-order": 17 + "x-order": 15 }, "telemetry_summaries": { "type": "array", @@ -3670,139 +3483,24 @@ "items": { "type": "string" }, - "x-order": 18 + "x-order": 16 }, "enable_access_control": { "description": "True if Access Control is enabled.", "type": "boolean", - "x-order": 19 + "x-order": 17 }, "default_role_id": { "description": "Default Access Control role ID for new users.", "type": "integer", "format": "int64", - "x-order": 20 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }", - "type": "object", - "properties": { - "@type": { - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics.", - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Settings/TestEmailAlertingSettings": { - "post": { - "description": "Sends test email to check current SMTP settings for email alerting.", - "tags": [ - "Server" - ], - "summary": "Test email alerting", - "operationId": "TestEmailAlertingSettings", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 + "x-order": 18 } }, "x-order": 0 - }, - "email_to": { - "description": "Target email address to send the email to.", - "type": "string", - "x-order": 1 } } } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } }, "default": { "description": "An unexpected error response.", @@ -19065,7 +18763,7 @@ "Agent" ], "summary": "List Agents", - "operationId": "ListAgentsMixin9", + "operationId": "ListAgentsMixin8", "parameters": [ { "description": "Only one of the parameters below must be set.", @@ -21542,7 +21240,7 @@ "MgmtNode" ], "summary": "Get Node", - "operationId": "GetNodeMixin10", + "operationId": "GetNodeMixin9", "parameters": [ { "name": "body", @@ -21759,7 +21457,7 @@ "MgmtNode" ], "summary": "List Nodes", - "operationId": "ListNodesMixin10", + "operationId": "ListNodesMixin9", "parameters": [ { "name": "body", @@ -25770,7 +25468,7 @@ "MgmtService" ], "summary": "List Services", - "operationId": "ListServicesMixin11", + "operationId": "ListServicesMixin10", "parameters": [ { "name": "body", @@ -29438,2708 +29136,11 @@ } } }, - "/v1/management/ia/Alerts/List": { - "post": { + "/v1/readyz": { + "get": { + "description": "Returns an error when Server components being restarted are not ready yet. Use this API for checking the health of Docker containers and for probing Kubernetes readiness.", "tags": [ - "Alerts" - ], - "summary": "ListAlerts returns a list of all Alerts.", - "operationId": "ListAlerts", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "alerts": { - "type": "array", - "items": { - "description": "Alert represents Alert.", - "type": "object", - "properties": { - "alert_id": { - "description": "ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Human-readable summary.", - "type": "string", - "x-order": 1 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 2 - }, - "status": { - "description": "Status represents Alert Rule's and Alert's combined status.\n\n - CLEAR: No alert.\n - PENDING: Pending, but not triggering alert.\n - TRIGGERING: Triggering (firing) alert.\n - SILENCED: Silenced alert.", - "type": "string", - "default": "STATUS_INVALID", - "enum": [ - "STATUS_INVALID", - "CLEAR", - "PENDING", - "TRIGGERING", - "SILENCED" - ], - "x-order": 3 - }, - "labels": { - "description": "Combined labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 4 - }, - "rule": { - "description": "Rule represents Alert Rule.", - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "summary": { - "description": "Rule human-readable summary.", - "type": "string", - "x-order": 2 - }, - "template_name": { - "description": "Template used for this rule.", - "type": "string", - "x-order": 3 - }, - "disabled": { - "description": "True if that rule is disabled.", - "type": "boolean", - "x-order": 4 - }, - "expr_template": { - "description": "Expression template.", - "type": "string", - "x-order": 5 - }, - "expr": { - "description": "Expression filled with parameters.", - "type": "string", - "x-order": 6 - }, - "params_definitions": { - "description": "Expression parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - } - }, - "x-order": 5 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - } - }, - "x-order": 6 - } - } - }, - "x-order": 7 - }, - "params_values": { - "description": "Expression parameters values.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 8 - }, - "default_for": { - "description": "Default for duration.", - "type": "string", - "x-order": 9 - }, - "for": { - "description": "For duration.", - "type": "string", - "x-order": 10 - }, - "default_severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 11 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 12 - }, - "custom_labels": { - "description": "Custom labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 13 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 14 - }, - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 15 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 16 - }, - "channels": { - "description": "Channels.", - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - } - } - }, - "x-order": 17 - }, - "created_at": { - "description": "Rule creation time.", - "type": "string", - "format": "date-time", - "x-order": 18 - } - }, - "x-order": 5 - }, - "created_at": { - "description": "Alert creation time.", - "type": "string", - "format": "date-time", - "x-order": 6 - }, - "updated_at": { - "description": "Alert last update time.", - "type": "string", - "format": "date-time", - "x-order": 7 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Alerts/Toggle": { - "post": { - "description": "Pass empty list to apply toggle action to all existing alerts", - "tags": [ - "Alerts" - ], - "summary": "ToggleAlerts allows to switch alerts state between silenced and unsilenced.", - "operationId": "ToggleAlerts", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "alert_ids": { - "description": "List of alerts that silence state should be switched. If provided array is empty than all\nexisting alerts are switched.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 0 - }, - "silenced": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Add": { - "post": { - "tags": [ - "Channels" - ], - "summary": "AddChannel adds notification channel.", - "operationId": "AddChannel", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 0 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 1 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 2 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 3 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 4 - }, - "disabled": { - "description": "New channel status.", - "type": "boolean", - "x-order": 5 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Change": { - "post": { - "tags": [ - "Channels" - ], - "summary": "ChangeChannel changes notification channel.", - "operationId": "ChangeChannel", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary. Empty value will not change it.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "Enables or disables that channel. Should be set.", - "type": "boolean", - "x-order": 6 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/List": { - "post": { - "tags": [ - "Channels" - ], - "summary": "ListChannels returns a list of all notifation channels.", - "operationId": "ListChannels", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "channels": { - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Channels/Remove": { - "post": { - "tags": [ - "Channels" - ], - "summary": "RemoveChannel removes notification channel.", - "operationId": "RemoveChannel", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "channel_id": { - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Create": { - "post": { - "tags": [ - "Rules" - ], - "summary": "CreateAlertRule creates Alerting rule.", - "operationId": "CreateAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "template_name": { - "description": "Template name. Can't be specified simultaneously with source_rule_id.", - "type": "string", - "x-order": 0 - }, - "source_rule_id": { - "description": "ID of the rule that will be used as source. Can't be specified simultaneously with template_name.", - "type": "string", - "x-order": 1 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 2 - }, - "disabled": { - "description": "New rule status.", - "type": "boolean", - "x-order": 3 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 4 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 5 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 6 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 7 - }, - "filters": { - "description": "Filters. Should be set.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 8 - }, - "channel_ids": { - "description": "Channels. Should be set.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 9 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Delete": { - "post": { - "tags": [ - "Rules" - ], - "summary": "DeleteAlertRule deletes Alerting rule.", - "operationId": "DeleteAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/List": { - "post": { - "tags": [ - "Rules" - ], - "summary": "ListAlertRules returns a list of all Alerting rules.", - "operationId": "ListAlertRules", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "page_params": { - "description": "PageParams represents page request parameters for pagination.", - "type": "object", - "properties": { - "page_size": { - "description": "Maximum number of results per page.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "index": { - "description": "Index of the requested page, starts from 0.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 0 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": { - "rules": { - "type": "array", - "items": { - "description": "Rule represents Alert Rule.", - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name.", - "type": "string", - "x-order": 1 - }, - "summary": { - "description": "Rule human-readable summary.", - "type": "string", - "x-order": 2 - }, - "template_name": { - "description": "Template used for this rule.", - "type": "string", - "x-order": 3 - }, - "disabled": { - "description": "True if that rule is disabled.", - "type": "boolean", - "x-order": 4 - }, - "expr_template": { - "description": "Expression template.", - "type": "string", - "x-order": 5 - }, - "expr": { - "description": "Expression filled with parameters.", - "type": "string", - "x-order": 6 - }, - "params_definitions": { - "description": "Expression parameters definitions.", - "type": "array", - "items": { - "description": "ParamDefinition represents a single query parameter.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable parameter summary.", - "type": "string", - "x-order": 1 - }, - "unit": { - "description": "ParamUnit represents template parameter unit.\n\n - PARAM_UNIT_INVALID: Invalid, unknown or absent.\n - PERCENTAGE: %\n - SECONDS: s", - "type": "string", - "default": "PARAM_UNIT_INVALID", - "enum": [ - "PARAM_UNIT_INVALID", - "PERCENTAGE", - "SECONDS" - ], - "x-order": 2 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 3 - }, - "bool": { - "description": "BoolParamDefinition represents boolean parameter's default value.", - "type": "object", - "properties": { - "default": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 0 - } - }, - "x-order": 4 - }, - "float": { - "description": "FloatParamDefinition represents float parameter's default value and valid range.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "number", - "format": "double", - "x-order": 1 - }, - "has_min": { - "description": "True if minimal valid value is set.", - "type": "boolean", - "x-order": 2 - }, - "min": { - "description": "Minimal valid value (inclusive) if has_min is true.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "has_max": { - "description": "True if maximal valid value is set.", - "type": "boolean", - "x-order": 4 - }, - "max": { - "description": "Maximal valid value (inclusive) if has_max is true.", - "type": "number", - "format": "double", - "x-order": 5 - } - }, - "x-order": 5 - }, - "string": { - "description": "StringParamDefinition represents string parameter's default value.", - "type": "object", - "properties": { - "has_default": { - "description": "True if default value is set.", - "type": "boolean", - "x-order": 0 - }, - "default": { - "description": "Default value if has_default is true.", - "type": "string", - "x-order": 1 - } - }, - "x-order": 6 - } - } - }, - "x-order": 7 - }, - "params_values": { - "description": "Expression parameters values.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 8 - }, - "default_for": { - "description": "Default for duration.", - "type": "string", - "x-order": 9 - }, - "for": { - "description": "For duration.", - "type": "string", - "x-order": 10 - }, - "default_severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 11 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 12 - }, - "custom_labels": { - "description": "Custom labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 13 - }, - "labels": { - "description": "Labels.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 14 - }, - "annotations": { - "description": "Annotations.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 15 - }, - "filters": { - "description": "Filters.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 16 - }, - "channels": { - "description": "Channels.", - "type": "array", - "items": { - "description": "Channel represents a single Notification Channel.", - "type": "object", - "properties": { - "channel_id": { - "description": "Machine-readable ID.", - "type": "string", - "x-order": 0 - }, - "summary": { - "description": "Short human-readable summary.", - "type": "string", - "x-order": 1 - }, - "email_config": { - "description": "EmailConfig represents email configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "to": { - "type": "array", - "items": { - "type": "string" - }, - "x-order": 1 - } - }, - "x-order": 2 - }, - "pagerduty_config": { - "description": "PagerDutyConfig represents PagerDuty configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "routing_key": { - "description": "The PagerDuty key for \"Events API v2\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 1 - }, - "service_key": { - "description": "The PagerDuty key for \"Prometheus\" integration type. Exactly one key should be set.", - "type": "string", - "x-order": 2 - } - }, - "x-order": 3 - }, - "slack_config": { - "description": "SlackConfig represents Slack configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "channel": { - "type": "string", - "x-order": 1 - } - }, - "x-order": 4 - }, - "webhook_config": { - "description": "WebhookConfig represents webhook configuration.", - "type": "object", - "properties": { - "send_resolved": { - "type": "boolean", - "x-order": 0 - }, - "url": { - "type": "string", - "x-order": 1 - }, - "http_config": { - "description": "HTTPConfig represents HTTP client configuration.", - "type": "object", - "properties": { - "basic_auth": { - "description": "BasicAuth represents basic HTTP auth configuration.", - "type": "object", - "properties": { - "username": { - "type": "string", - "x-order": 0 - }, - "password": { - "type": "string", - "x-order": 1 - }, - "password_file": { - "type": "string", - "x-order": 2 - } - }, - "x-order": 0 - }, - "bearer_token": { - "type": "string", - "x-order": 1 - }, - "bearer_token_file": { - "type": "string", - "x-order": 2 - }, - "tls_config": { - "type": "object", - "title": "TLSConfig represents TLS configuration for alertmanager\nhttps://prometheus.io/docs/alerting/latest/configuration/#tls_config", - "properties": { - "ca_file": { - "description": "A path to the CA certificate file to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 0 - }, - "cert_file": { - "description": "A path to the certificate file for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 1 - }, - "key_file": { - "description": "A path to the key file for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 2 - }, - "server_name": { - "description": "Name of the server.", - "type": "string", - "x-order": 3 - }, - "insecure_skip_verify": { - "description": "Disable validation of the server certificate.", - "type": "boolean", - "x-order": 4 - }, - "ca_file_content": { - "description": "CA certificate to validate the server certificate with.\nca_file and ca_file_content should not be set at the same time.", - "type": "string", - "x-order": 5 - }, - "cert_file_content": { - "description": "A certificate for client cert authentication to the server.\ncert_file and cert_file_content should not be set at the same time.", - "type": "string", - "x-order": 6 - }, - "key_file_content": { - "description": "A key for client cert authentication to the server.\nkey_file and key_file_content should not be set at the same time.", - "type": "string", - "x-order": 7 - } - }, - "x-order": 3 - }, - "proxy_url": { - "type": "string", - "x-order": 4 - } - }, - "x-order": 2 - }, - "max_alerts": { - "type": "integer", - "format": "int32", - "x-order": 3 - } - }, - "x-order": 5 - }, - "disabled": { - "description": "True if that channel is disabled.", - "type": "boolean", - "x-order": 6 - } - } - }, - "x-order": 17 - }, - "created_at": { - "description": "Rule creation time.", - "type": "string", - "format": "date-time", - "x-order": 18 - } - } - }, - "x-order": 0 - }, - "totals": { - "description": "PageTotals represents total values for pagination.", - "type": "object", - "properties": { - "total_items": { - "description": "Total number of results.", - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "total_pages": { - "description": "Total number of pages.", - "type": "integer", - "format": "int32", - "x-order": 1 - } - }, - "x-order": 1 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Toggle": { - "post": { - "tags": [ - "Rules" - ], - "summary": "ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule.", - "operationId": "ToggleAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "disabled": { - "description": "BooleanFlag represent a command to set some boolean property to true,\nto false, or avoid changing that property.\n\n - DO_NOT_CHANGE: Do not change boolean property. Default value.\n - TRUE: True.\n - FALSE: False.", - "type": "string", - "default": "DO_NOT_CHANGE", - "enum": [ - "DO_NOT_CHANGE", - "TRUE", - "FALSE" - ], - "x-order": 1 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/management/ia/Rules/Update": { - "post": { - "tags": [ - "Rules" - ], - "summary": "UpdateAlertRule updates Alerting rule.", - "operationId": "UpdateAlertRule", - "deprecated": true, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "rule_id": { - "description": "Rule ID.", - "type": "string", - "x-order": 0 - }, - "name": { - "description": "Rule name. Should be set.", - "type": "string", - "x-order": 1 - }, - "disabled": { - "description": "New rule status. Should be set.", - "type": "boolean", - "x-order": 2 - }, - "params": { - "description": "Rule parameters. All template parameters should be set.", - "type": "array", - "items": { - "description": "ParamValue represents a single rule parameter value for List, Change and Update APIs.", - "type": "object", - "properties": { - "name": { - "description": "Machine-readable name (ID) that is used in expression.", - "type": "string", - "x-order": 0 - }, - "type": { - "description": "ParamType represents template parameter type.", - "type": "string", - "default": "PARAM_TYPE_INVALID", - "enum": [ - "PARAM_TYPE_INVALID", - "BOOL", - "FLOAT", - "STRING" - ], - "x-order": 1 - }, - "bool": { - "description": "Bool value.", - "type": "boolean", - "x-order": 2 - }, - "float": { - "description": "Float value.", - "type": "number", - "format": "double", - "x-order": 3 - }, - "string": { - "description": "String value.", - "type": "string", - "x-order": 4 - } - } - }, - "x-order": 3 - }, - "for": { - "description": "Rule duration. Should be set.", - "type": "string", - "x-order": 4 - }, - "severity": { - "description": "Severity represents severity level of the check result or alert.", - "type": "string", - "default": "SEVERITY_INVALID", - "enum": [ - "SEVERITY_INVALID", - "SEVERITY_EMERGENCY", - "SEVERITY_ALERT", - "SEVERITY_CRITICAL", - "SEVERITY_ERROR", - "SEVERITY_WARNING", - "SEVERITY_NOTICE", - "SEVERITY_INFO", - "SEVERITY_DEBUG" - ], - "x-order": 5 - }, - "custom_labels": { - "description": "All custom labels to add or remove (with empty values) to default labels from template.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-order": 6 - }, - "filters": { - "description": "Filters. Should be set.", - "type": "array", - "items": { - "description": "Filter repsents a single filter condition.", - "type": "object", - "properties": { - "type": { - "description": "FilterType represents filter matching type.\n\n - EQUAL: =\n\n!=\n NOT_EQUAL = 2;\n - REGEX: =~\n\n!~\n NOT_REGEX = 4;", - "type": "string", - "default": "FILTER_TYPE_INVALID", - "enum": [ - "FILTER_TYPE_INVALID", - "EQUAL", - "REGEX" - ], - "x-order": 0 - }, - "key": { - "type": "string", - "x-order": 1 - }, - "value": { - "type": "string", - "x-order": 2 - } - } - }, - "x-order": 7 - }, - "channel_ids": { - "description": "Channels. Should be set.", - "type": "array", - "items": { - "type": "string" - }, - "x-order": 8 - } - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "@type": { - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/readyz": { - "get": { - "description": "Returns an error when Server components being restarted are not ready yet. Use this API for checking the health of Docker containers and for probing Kubernetes readiness.", - "tags": [ - "Server" + "Server" ], "summary": "Check server readiness", "operationId": "Readiness", @@ -32604,15 +29605,6 @@ { "name": "Service" }, - { - "name": "Alerts" - }, - { - "name": "Channels" - }, - { - "name": "Rules" - }, { "name": "Alerting" }, diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index 7f942e85b7..ef2f3be6fb 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -241,83 +241,14 @@ "type": "boolean", "x-order": 15 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - } - }, - "x-order": 16 - }, - "remove_email_alerting_settings": { - "description": "If true, removes Alerting email (SMTP) settings.", - "type": "boolean", - "x-order": 17 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 18 - }, - "remove_slack_alerting_settings": { - "description": "If true, removes Alerting Slack settings.", - "type": "boolean", - "x-order": 19 - }, "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 20 + "x-order": 16 }, "remove_pmm_public_address": { "type": "boolean", - "x-order": 21 + "x-order": 17 }, "stt_check_intervals": { "description": "STTCheckIntervals represents intervals between STT checks.", @@ -339,37 +270,37 @@ "x-order": 2 } }, - "x-order": 22 + "x-order": 18 }, "enable_azurediscover": { "description": "Enable Azure Discover.", "type": "boolean", - "x-order": 23 + "x-order": 19 }, "disable_azurediscover": { "description": "Disable Azure Discover.", "type": "boolean", - "x-order": 24 + "x-order": 20 }, "enable_backup_management": { "description": "Enable Backup Management.", "type": "boolean", - "x-order": 25 + "x-order": 21 }, "disable_backup_management": { "description": "Disable Backup Management.", "type": "boolean", - "x-order": 26 + "x-order": 22 }, "enable_access_control": { "type": "boolean", "title": "Enable Access Control", - "x-order": 27 + "x-order": 23 }, "disable_access_control": { "type": "boolean", "title": "Disable Access Control", - "x-order": 28 + "x-order": 24 } } } @@ -457,69 +388,10 @@ "type": "boolean", "x-order": 10 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - } - }, - "x-order": 11 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 12 - }, "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 13 + "x-order": 11 }, "stt_check_intervals": { "description": "STTCheckIntervals represents intervals between STT checks.", @@ -541,22 +413,22 @@ "x-order": 2 } }, - "x-order": 14 + "x-order": 12 }, "backup_management_enabled": { "description": "True if Backup Management is enabled.", "type": "boolean", - "x-order": 15 + "x-order": 13 }, "azurediscover_enabled": { "description": "True if Azure Discover is enabled.", "type": "boolean", - "x-order": 16 + "x-order": 14 }, "connected_to_platform": { "type": "boolean", "title": "True if the PMM instance is connected to Platform", - "x-order": 17 + "x-order": 15 }, "telemetry_summaries": { "type": "array", @@ -564,18 +436,18 @@ "items": { "type": "string" }, - "x-order": 18 + "x-order": 16 }, "enable_access_control": { "description": "True if Access Control is enabled.", "type": "boolean", - "x-order": 19 + "x-order": 17 }, "default_role_id": { "description": "Default Access Control role ID for new users.", "type": "integer", "format": "int64", - "x-order": 20 + "x-order": 18 } }, "x-order": 0 @@ -719,69 +591,10 @@ "type": "boolean", "x-order": 10 }, - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 - } - }, - "x-order": 11 - }, - "slack_alerting_settings": { - "description": "SlackAlertingSettings represents Slack configuration for Alerting.", - "type": "object", - "properties": { - "url": { - "description": "Slack API (webhook) URL.", - "type": "string", - "x-order": 0 - } - }, - "x-order": 12 - }, "pmm_public_address": { "description": "PMM Server public address.", "type": "string", - "x-order": 13 + "x-order": 11 }, "stt_check_intervals": { "description": "STTCheckIntervals represents intervals between STT checks.", @@ -803,22 +616,22 @@ "x-order": 2 } }, - "x-order": 14 + "x-order": 12 }, "backup_management_enabled": { "description": "True if Backup Management is enabled.", "type": "boolean", - "x-order": 15 + "x-order": 13 }, "azurediscover_enabled": { "description": "True if Azure Discover is enabled.", "type": "boolean", - "x-order": 16 + "x-order": 14 }, "connected_to_platform": { "type": "boolean", "title": "True if the PMM instance is connected to Platform", - "x-order": 17 + "x-order": 15 }, "telemetry_summaries": { "type": "array", @@ -826,139 +639,24 @@ "items": { "type": "string" }, - "x-order": 18 + "x-order": 16 }, "enable_access_control": { "description": "True if Access Control is enabled.", "type": "boolean", - "x-order": 19 + "x-order": 17 }, "default_role_id": { "description": "Default Access Control role ID for new users.", "type": "integer", "format": "int64", - "x-order": 20 - } - }, - "x-order": 0 - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "x-order": 0 - }, - "message": { - "type": "string", - "x-order": 1 - }, - "details": { - "type": "array", - "items": { - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }", - "type": "object", - "properties": { - "@type": { - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics.", - "type": "string", - "x-order": 0 - } - }, - "additionalProperties": false - }, - "x-order": 2 - } - } - } - } - } - } - }, - "/v1/Settings/TestEmailAlertingSettings": { - "post": { - "description": "Sends test email to check current SMTP settings for email alerting.", - "tags": [ - "Server" - ], - "summary": "Test email alerting", - "operationId": "TestEmailAlertingSettings", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "email_alerting_settings": { - "description": "EmailAlertingSettings represents email (SMTP) configuration for Alerting.", - "type": "object", - "properties": { - "from": { - "description": "SMTP From header field.", - "type": "string", - "x-order": 0 - }, - "smarthost": { - "description": "SMTP host and port.", - "type": "string", - "x-order": 1 - }, - "hello": { - "description": "Hostname to identify to the SMTP server.", - "type": "string", - "x-order": 2 - }, - "username": { - "description": "Auth using CRAM-MD5, LOGIN and PLAIN.", - "type": "string", - "x-order": 3 - }, - "password": { - "description": "Auth using LOGIN and PLAIN.", - "type": "string", - "x-order": 4 - }, - "identity": { - "description": "Auth using PLAIN.", - "type": "string", - "x-order": 5 - }, - "secret": { - "description": "Auth using CRAM-MD5.", - "type": "string", - "x-order": 6 - }, - "require_tls": { - "description": "Require TLS.", - "type": "boolean", - "x-order": 7 + "x-order": 18 } }, "x-order": 0 - }, - "email_to": { - "description": "Target email address to send the email to.", - "type": "string", - "x-order": 1 } } } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object" - } }, "default": { "description": "An unexpected error response.", diff --git a/build/docker/server/README.md b/build/docker/server/README.md index 179c2e26f8..de8f59c05a 100644 --- a/build/docker/server/README.md +++ b/build/docker/server/README.md @@ -24,16 +24,16 @@ This example uses the tag `:2` to pull the latest PMM 2.x version, but other, [m You can use these environment variables (-e VAR) when running the Docker image. | Variable | Description | -| ------------------------ | --------------------------------------------------------------------------------------------------------------------------- | +|--------------------------|-----------------------------------------------------------------------------------------------------------------------------| | DISABLE_UPDATES | Disable automatic updates | | DISABLE_TELEMETRY | Disable built-in telemetry and disable STT if telemetry is disabled | +| DISABLE_ALERTING | Disable percona alerting | | METRICS_RESOLUTION | High metrics resolution in seconds | | METRICS_RESOLUTION_HR | High metrics resolution (same as above) | | METRICS_RESOLUTION_MR | Medium metrics resolution in seconds | | METRICS_RESOLUTION_LR | Low metrics resolution in seconds | | DATA_RETENTION | How long to keep time-series data in ClickHouse. This variable accepts golang style duration format, example: 24h, 30m, 10s | | ENABLE_VM_CACHE | Enable cache in VM | -| ENABLE_ALERTING | Enable integrated alerting | | ENABLE_AZUREDISCOVER | Enable support for discovery of Azure databases | | ENABLE_BACKUP_MANAGEMENT | Enable integrated backup tools | | PMM_PUBLIC_ADDRESS | External IP address or the DNS name on which PMM server is running. | diff --git a/descriptor.bin b/descriptor.bin index 053780940b..4e944d098e 100644 Binary files a/descriptor.bin and b/descriptor.bin differ diff --git a/go.mod b/go.mod index 5ad8a1b360..a900e5bc6b 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,6 @@ require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/alecthomas/kong v0.8.0 github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 - github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 github.com/aws/aws-sdk-go v1.45.2 github.com/blang/semver v3.5.1+incompatible github.com/brianvoe/gofakeit/v6 v6.23.0 @@ -60,7 +59,6 @@ require ( github.com/pganalyze/pg_query_go/v2 v2.2.0 github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 - github.com/prometheus/alertmanager v0.26.0 github.com/prometheus/client_golang v1.17.0 github.com/prometheus/common v0.44.0 github.com/ramr/go-reaper v0.2.1 @@ -86,13 +84,10 @@ require ( ) require ( + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/benbjohnson/clock v1.3.5 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/hashicorp/go-uuid v1.0.2 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.2 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/mwitkow/go-proto-validators v0.3.2 // indirect github.com/posener/complete v1.2.3 // indirect @@ -126,9 +121,7 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/andybalholm/brotli v1.0.5 // indirect - github.com/armon/go-metrics v0.4.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charmbracelet/harmonica v0.2.0 // indirect github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect @@ -138,29 +131,19 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/errors v0.6.1 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/loads v0.21.2 // indirect github.com/go-openapi/spec v0.20.8 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-msgpack v0.5.5 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-sockaddr v1.0.2 // indirect - github.com/hashicorp/golang-lru v0.6.0 // indirect - github.com/hashicorp/memberlist v0.5.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/jpillora/backoff v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.16.5 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect @@ -171,7 +154,6 @@ require ( github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/miekg/dns v1.1.50 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -182,8 +164,6 @@ require ( github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.15.2 // indirect - github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/oklog/run v1.1.0 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect @@ -192,16 +172,11 @@ require ( github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect - github.com/prometheus/common/sigv4 v0.1.0 // indirect - github.com/prometheus/exporter-toolkit v0.10.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rs/xid v1.5.0 // indirect - github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect - github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect - github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect @@ -210,9 +185,7 @@ require ( go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.16.0 // indirect - golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/term v0.13.0 // indirect - google.golang.org/appengine v1.6.7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gotest.tools/v3 v3.3.0 // indirect ) diff --git a/go.sum b/go.sum index 7dd17f158f..2ed1ee893a 100644 --- a/go.sum +++ b/go.sum @@ -58,7 +58,6 @@ github.com/ClickHouse/clickhouse-go/v2 v2.13.0 h1:oP1OlTQIbQKKLnqLzyDhiyNFvN3pbO github.com/ClickHouse/clickhouse-go/v2 v2.13.0/go.mod h1:xyL0De2K54/n+HGsdtPuyYJq76wefafaHfGUXTDEq/0= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= @@ -88,26 +87,18 @@ github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8V github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q= -github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.45.2 h1:hTong9YUklQKqzrGk3WnKABReb5R8GjbG4Y6dEQfjnk= github.com/aws/aws-sdk-go v1.45.2/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bkaradzic/go-lz4 v1.0.0 h1:RXc4wYsyz985CkXXeX04y4VnZFGG8Rd43pRaHsOXAKk= github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= @@ -116,8 +107,6 @@ github.com/brianvoe/gofakeit v3.18.0+incompatible h1:wDOmHc9DLG4nRjUVVaxA+CEglKO github.com/brianvoe/gofakeit v3.18.0+incompatible/go.mod h1:kfwdRA90vvNhPutZWfH7WPaDzUjz+CZFqG+rPkOjGOc= github.com/brianvoe/gofakeit/v6 v6.23.0 h1:pgVhyWpYq4e0GEVCh2gdZnS/nBX+8SnyTBliHg5xjks= github.com/brianvoe/gofakeit/v6 v6.23.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -133,8 +122,6 @@ github.com/charmbracelet/lipgloss v0.9.0/go.mod h1:h8KDyaivONasw1Bhb4nWiKlk4P1wH github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= @@ -142,8 +129,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -170,7 +155,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/go-co-op/gocron v1.35.1 h1:xi0tfAhxeAmGUKkjiA7bTIjh2VdBJpUYDJ+lPx/EPcM= github.com/go-co-op/gocron v1.35.1/go.mod h1:NLi+bkm4rRSy1F8U7iacZOz0xPseMoIOnvabGoSe/no= @@ -184,13 +168,9 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -260,10 +240,7 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= -github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -311,8 +288,6 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -339,8 +314,6 @@ github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbu github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -354,35 +327,15 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0/go.mod h1:TzP6duP4Py2pHLVPPQp4 github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= -github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= -github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= -github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.2 h1:Dwmkdr5Nc/oBiXgJS3CDHNhJtIHkuZ3DZF5twqnfBdU= -github.com/hashicorp/golang-lru/v2 v2.0.2/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= -github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -405,7 +358,6 @@ github.com/jotaen/kong-completion v0.0.5/go.mod h1:Pic1KtmJkOiWtr9XEVbyWXvn3AuCg github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -457,8 +409,6 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= @@ -474,17 +424,12 @@ github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= -github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.55 h1:ZXqUO/8cgfHzI+08h/zGuTTFpISSA32BZmBE3FCLJas= github.com/minio/minio-go/v7 v7.0.55/go.mod h1:NUDy4A4oXPq1l2yK6LTSvCEzAMeIcoz9lcj5dbzSrRE= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -517,8 +462,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/mwitkow/go-proto-validators v0.3.2 h1:qRlmpTzm2pstMKKzTdvwPCF5QfBNURSlAgN/R+qbKos= github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA7a5VarXUOUxD+oeD30w= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -528,9 +471,6 @@ github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/paulmach/orb v0.10.0 h1:guVYVqzxHE/CQ1KpfGO077TR0ATHSNjp4s6XGLn3W9s= github.com/paulmach/orb v0.10.0/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= @@ -562,14 +502,10 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/prometheus/alertmanager v0.26.0 h1:uOMJWfIwJguc3NaM3appWNbbrh6G/OjvaHMk22aBBYc= -github.com/prometheus/alertmanager v0.26.0/go.mod h1:rVcnARltVjavgVaNnmevxK7kOn7IZavyf0KNgHkbEpU= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= @@ -581,20 +517,13 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.31.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= -github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= -github.com/prometheus/exporter-toolkit v0.10.0 h1:yOAzZTi4M22ZzVxD+fhy1URTuNRj/36uQJJ5S8IPza8= -github.com/prometheus/exporter-toolkit v0.10.0/go.mod h1:+sVFzuvV5JDyw+Ih6p3zFxZNVnKQa3x5qPmDSiPu4ZY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= @@ -620,18 +549,11 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= -github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= -github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= @@ -658,7 +580,6 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= @@ -676,7 +597,6 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= @@ -742,7 +662,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= @@ -760,7 +679,6 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -776,10 +694,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= @@ -808,7 +723,6 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -823,7 +737,6 @@ golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -847,19 +760,15 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= @@ -886,8 +795,9 @@ golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -908,7 +818,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -940,7 +849,6 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= diff --git a/ia_migration.py b/ia_migration.py deleted file mode 100755 index 2ccfec126a..0000000000 --- a/ia_migration.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import requests - -# Copyright (C) 2017 Percona LLC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details.# // -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - - -# This script migrates Integrated Alerting alert rules to the new Alerting system that was introduced in PMM 2.31 -# Migration is partial, it covers only alert rules but not Notification Channels, Silences, etc... - - -def remove_prefix(string, prefix): - if string.startswith(prefix): - return string[len(prefix):] - return string - - -def prepare_labels(rule): - custom_labels = rule.get("custom_labels", {}) - labels = rule.get("labels", {}) - labels.update(custom_labels) - labels.update({ - "percona_alerting": "1", - "severity": remove_prefix(rule.get("severity", ""), "SEVERITY_").lower(), - "template_name": rule.get("template_name", "") - }) - return labels - - -def prepare_annotations(rule): - annotations = rule.get("annotations", {}) - annotations.update({"rule": rule.get("name")}) - - return annotations - - -def prepare_expression(rule): - expr = rule.get("expr", "") - - if "filters" not in rule: - return expr - - for f in rule["filters"]: - key = f.get("key", "") - value = f.get("value", "") - expr = f'label_match({expr}, "{key}", "{value}")' - - return expr - - -def convert_rule(rule, datasource_uid): - return { - "grafana_alert": { - "title": rule.get("name", "") + "_" + rule.get("rule_id", ""), - "condition": "A", - "no_data_state": "OK", - "exec_err_state": "Alerting", - "data": [ - { - "refId": "A", - "datasourceUid": datasource_uid, - "relativeTimeRange": {"from": 600, "to": 0}, - "model": { - "expr": prepare_expression(rule), - "refId": "A", - "instant": True, - }, - }, - ] - }, - "for": rule.get("for"), - "annotations": prepare_annotations(rule), - "labels": prepare_labels(rule), - } - - -def main(): - parser = argparse.ArgumentParser(description="Migration script for Integrated Alerting alert rules") - parser.add_argument("-u", "--user", required=True, help="PMM user login") - parser.add_argument("-p", "--password", required=True, help="PMM user password") - parser.add_argument("-s", "--server-url", default="http://localhost/", help="PMM server URL (default: %(default)s)") - parser.add_argument("-i", "--insecure", action="store_false", help="skip TLS certificates verification") - parser.add_argument("-f", "--folder", default="Experimental", - help="folder in Grafana where to put migrated alert rules (default: %(default)s)") - parser.add_argument("-g", "--group", default="migrated", - help="alert group name for migrated alert rules (default: %(default)s)") - - config = vars(parser.parse_args()) - auth = (config["user"], config["password"]) - - # Get existing Integrated Alerting alert rules - print("Request existing IA rules.") - ia_rules_url = '{server_url}/v1/management/ia/Rules/List'.format(**config) - ia_rules_resp = requests.post(ia_rules_url, auth=auth, verify=config["insecure"]) - ia_rules = ia_rules_resp.json() - print("Request existing IA rules done.") - - if "rules" not in ia_rules: - print("There are no rules to migrate, exiting.") - return - - print("Found rules: {count}.".format(count=len(ia_rules["rules"]))) - - # Create alert group for migrated rules - print("Create alert group for migrated rules.") - group_url = '{server_url}/graph/api/ruler/grafana/api/v1/rules/{folder}/{group}'.format(**config) - group_resp = requests.get(group_url, auth=auth, verify=config["insecure"]) - alert_rules_group = group_resp.json() - print("Create alert group for migrated rules done.") - if "interval" not in alert_rules_group: - alert_rules_group["interval"] = "1m" - - # Get Metrics datasource UID - print("Get datasource UID.") - datasource_url = '{server_url}/graph/api/datasources/1'.format(**config) - datasource_resp = requests.get(datasource_url, auth=auth, verify=config["insecure"]) - datasource = datasource_resp.json() - datasource_uid = datasource["uid"] - print("Get datasource UID done.") - - # Convert IA rules and add them to alert group - print("Convert IA rules.") - for rule in ia_rules["rules"]: - alert_rules_group["rules"].append(convert_rule(rule, datasource_uid)) - print("Convert IA rules done.") - - # Update alert group - print("Send request to create migrated alerts.") - rules_url = '{server_url}/graph/api/ruler/grafana/api/v1/rules/{folder}'.format(**config) - resp = requests.post(rules_url, None, alert_rules_group, auth=auth, verify=config["insecure"]) - print("Send request to create migrated alerts done.") - print("Server response:") - print(resp.text) - - -if __name__ == "__main__": - main() diff --git a/managed/CONTRIBUTING.md b/managed/CONTRIBUTING.md index 9db7826daa..08ceaa61ad 100644 --- a/managed/CONTRIBUTING.md +++ b/managed/CONTRIBUTING.md @@ -119,7 +119,6 @@ Devcontainer initialization code is located in `.devcontainer/setup.py`. It uses - If the changes require multiple PRs spanning multiple repos make sure to keep the branch names same. - If the PR requires any API changes then make your changes in `main` branch of the [API repo](https://github.com/percona/pmm) and pull those changes in your pmm-managed branch by mentioning the API changes branch name in the `Gopkg.toml` constraint and running `dep ensure -v -update github.com/percona/pmm`. -- If the PR introduces changes to the IA templates make sure to run `make gen` to udpate the generated code. - If the PR changes any files named `deps.go` make sure to run `make gen` to generate mock clients. Before making PR, please run these commands locally: - `make env TARGET=check-all` to run all checkers and linters. diff --git a/managed/cmd/pmm-managed/main.go b/managed/cmd/pmm-managed/main.go index 80e8cd1d4e..dfcbadb960 100644 --- a/managed/cmd/pmm-managed/main.go +++ b/managed/cmd/pmm-managed/main.go @@ -66,7 +66,6 @@ import ( alertingpb "github.com/percona/pmm/api/managementpb/alerting" azurev1beta1 "github.com/percona/pmm/api/managementpb/azure" backuppb "github.com/percona/pmm/api/managementpb/backup" - iav1beta1 "github.com/percona/pmm/api/managementpb/ia" nodev1beta1 "github.com/percona/pmm/api/managementpb/node" rolev1beta1 "github.com/percona/pmm/api/managementpb/role" servicev1beta1 "github.com/percona/pmm/api/managementpb/service" @@ -89,7 +88,6 @@ import ( managementbackup "github.com/percona/pmm/managed/services/management/backup" "github.com/percona/pmm/managed/services/management/common" managementgrpc "github.com/percona/pmm/managed/services/management/grpc" - "github.com/percona/pmm/managed/services/management/ia" "github.com/percona/pmm/managed/services/minio" "github.com/percona/pmm/managed/services/platform" "github.com/percona/pmm/managed/services/qan" @@ -195,9 +193,7 @@ type gRPCServerDeps struct { alertmanager *alertmanager.Service vmalert *vmalert.Service settings *models.Settings - alertsService *ia.AlertsService templatesService *alerting.Service - rulesService *ia.RulesService jobsService *agents.JobsService schedulerService *scheduler.Service backupService *backup.Service @@ -289,9 +285,6 @@ func runGRPCServer(ctx context.Context, deps *gRPCServerDeps) { rolev1beta1.RegisterRoleServer(gRPCServer, management.NewRoleService(deps.db)) - iav1beta1.RegisterChannelsServer(gRPCServer, ia.NewChannelsService(deps.db, deps.alertmanager)) - iav1beta1.RegisterRulesServer(gRPCServer, deps.rulesService) - iav1beta1.RegisterAlertsServer(gRPCServer, deps.alertsService) alertingpb.RegisterAlertingServer(gRPCServer, deps.templatesService) backuppb.RegisterBackupsServer(gRPCServer, mgmtBackupsService) @@ -400,9 +393,6 @@ func runHTTP1Server(ctx context.Context, deps *http1ServerDeps) { managementpb.RegisterSecurityChecksHandlerFromEndpoint, rolev1beta1.RegisterRoleHandlerFromEndpoint, - iav1beta1.RegisterAlertsHandlerFromEndpoint, - iav1beta1.RegisterChannelsHandlerFromEndpoint, - iav1beta1.RegisterRulesHandlerFromEndpoint, alertingpb.RegisterAlertingHandlerFromEndpoint, backuppb.RegisterBackupsHandlerFromEndpoint, @@ -890,15 +880,11 @@ func main() { //nolint:cyclop,maintidx checksService := checks.New(db, platformClient, actionsService, v1.NewAPI(vmClient), clickhouseClient) prom.MustRegister(checksService) - // Integrated alerts services - templatesService, err := alerting.NewService(db, platformClient, grafanaClient) + alertingService, err := alerting.NewService(db, platformClient, grafanaClient) if err != nil { - l.Fatalf("Could not create templates service: %s", err) + l.Fatalf("Could not create alerting service: %s", err) } - // We should collect templates before rules service created, because it will regenerate rule files on startup. - templatesService.CollectTemplates(ctx) - rulesService := ia.NewRulesService(db, templatesService, vmalert, alertManager) - alertsService := ia.NewAlertsService(db, alertManager, templatesService) + alertingService.CollectTemplates(ctx) agentService := agents.NewAgentService(agentsRegistry) @@ -910,7 +896,6 @@ func main() { //nolint:cyclop,maintidx schedulerService := scheduler.New(db, backupService) versionCache := versioncache.New(db, versioner) - emailer := alertmanager.NewEmailer(logrus.WithField("component", "alertmanager-emailer").Logger) serverParams := &server.Params{ DB: db, @@ -919,14 +904,12 @@ func main() { //nolint:cyclop,maintidx AgentsStateUpdater: agentsStateUpdater, Alertmanager: alertManager, ChecksService: checksService, - TemplatesService: templatesService, + TemplatesService: alertingService, Supervisord: supervisord, TelemetryService: telemetry, AwsInstanceChecker: awsInstanceChecker, GrafanaClient: grafanaClient, VMAlertExternalRules: externalRules, - RulesService: rulesService, - Emailer: emailer, } server, err := server.NewServer(serverParams) @@ -1078,9 +1061,7 @@ func main() { //nolint:cyclop,maintidx alertmanager: alertManager, vmalert: vmalert, settings: settings, - alertsService: alertsService, - templatesService: templatesService, - rulesService: rulesService, + templatesService: alertingService, jobsService: jobsService, schedulerService: schedulerService, backupService: backupService, diff --git a/managed/data/gen.go b/managed/data/gen.go index f47aa93ff7..e03dd475c0 100644 --- a/managed/data/gen.go +++ b/managed/data/gen.go @@ -18,7 +18,7 @@ package data import "embed" -// IATemplates holds IA template files in the struct of type embed.FS which implements the io/fs package's FS interface. +// AlertRuleTemplates holds Percona Alerting template files in the struct of type embed.FS which implements the io/fs package's FS interface. // //go:embed iatemplates/* -var IATemplates embed.FS +var AlertRuleTemplates embed.FS diff --git a/managed/models/channel.go b/managed/models/channel.go deleted file mode 100644 index 653085ac3b..0000000000 --- a/managed/models/channel.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package models - -import ( - "database/sql/driver" - "time" - - "gopkg.in/reform.v1" -) - -//go:generate ../../bin/reform - -// ChannelType represents notificaion channel type. -type ChannelType string - -// Available notification channel types. -const ( - Email = ChannelType("email") - PagerDuty = ChannelType("pagerduty") - Slack = ChannelType("slack") - WebHook = ChannelType("webhook") -) - -// Channel represents Integrated Alerting Notification Channel configuration. -// -//reform:ia_channels -type Channel struct { - ID string `reform:"id,pk"` - Summary string `reform:"summary"` - Type ChannelType `reform:"type"` - - EmailConfig *EmailConfig `reform:"email_config"` - PagerDutyConfig *PagerDutyConfig `reform:"pagerduty_config"` - SlackConfig *SlackConfig `reform:"slack_config"` - WebHookConfig *WebHookConfig `reform:"webhook_config"` - - Disabled bool `reform:"disabled"` - - CreatedAt time.Time `reform:"created_at"` - UpdatedAt time.Time `reform:"updated_at"` -} - -// BeforeInsert implements reform.BeforeInserter interface. -func (c *Channel) BeforeInsert() error { - now := Now() - c.CreatedAt = now - c.UpdatedAt = now - - return nil -} - -// BeforeUpdate implements reform.BeforeUpdater interface. -func (c *Channel) BeforeUpdate() error { - c.UpdatedAt = Now() - - return nil -} - -// AfterFind implements reform.AfterFinder interface. -func (c *Channel) AfterFind() error { - c.CreatedAt = c.CreatedAt.UTC() - c.UpdatedAt = c.UpdatedAt.UTC() - - return nil -} - -// EmailConfig is email notification channel configuration. -type EmailConfig struct { - SendResolved bool `json:"send_resolved"` - To []string `json:"to"` -} - -// Value implements database/sql/driver.Valuer interface. Should be defined on the value. -func (c EmailConfig) Value() (driver.Value, error) { return jsonValue(c) } - -// Scan implements database/sql.Scanner interface. Should be defined on the pointer. -func (c *EmailConfig) Scan(src interface{}) error { return jsonScan(c, src) } - -// PagerDutyConfig represents PagerDuty channel configuration. -type PagerDutyConfig struct { - SendResolved bool `json:"send_resolved"` - RoutingKey string `json:"routing_key,omitempty"` - ServiceKey string `json:"service_key,omitempty"` -} - -// Value implements database/sql/driver.Valuer interface. Should be defined on the value. -func (c PagerDutyConfig) Value() (driver.Value, error) { return jsonValue(c) } - -// Scan implements database/sql.Scanner interface. Should be defined on the pointer. -func (c *PagerDutyConfig) Scan(src interface{}) error { return jsonScan(c, src) } - -// SlackConfig is slack notification channel configuration. -type SlackConfig struct { - SendResolved bool `json:"send_resolved"` - Channel string `json:"channel"` -} - -// Value implements database/sql/driver.Valuer interface. Should be defined on the value. -func (c SlackConfig) Value() (driver.Value, error) { return jsonValue(c) } - -// Scan implements database/sql.Scanner interface. Should be defined on the pointer. -func (c *SlackConfig) Scan(src interface{}) error { return jsonScan(c, src) } - -// WebHookConfig is webhook notification channel configuration. -type WebHookConfig struct { - SendResolved bool ` json:"send_resolved"` - URL string ` json:"url"` - HTTPConfig *HTTPConfig ` json:"http_config,omitempty"` - MaxAlerts int32 ` json:"max_alerts"` -} - -// Value implements database/sql/driver.Valuer interface. Should be defined on the value. -func (c WebHookConfig) Value() (driver.Value, error) { return jsonValue(c) } - -// Scan implements database/sql.Scanner interface. Should be defined on the pointer. -func (c *WebHookConfig) Scan(src interface{}) error { return jsonScan(c, src) } - -// HTTPConfig is HTTP connection configuration. -type HTTPConfig struct { - BasicAuth *HTTPBasicAuth `json:"basic_auth,omitempty"` - BearerToken string `json:"bearer_token,omitempty"` - BearerTokenFile string `json:"bearer_token_file,omitempty"` - TLSConfig *TLSConfig `json:"tls_config,omitempty"` - ProxyURL string `json:"proxy_url,omitempty"` -} - -// HTTPBasicAuth is HTTP basic authentication configuration. -type HTTPBasicAuth struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - PasswordFile string `json:"password_file,omitempty"` -} - -// TLSConfig is TLS configuration. -type TLSConfig struct { - CAFile string `json:"ca_file,omitempty"` - CertFile string `json:"cert_file,omitempty"` - KeyFile string `json:"key_file,omitempty"` - ServerName string `json:"server_name,omitempty"` - InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` - CAFileContent string `json:"ca_file_content,omitempty"` - CertFileContent string `json:"cert_file_content,omitempty"` - KeyFileContent string `json:"key_file_content,omitempty"` -} - -// check interfaces. -var ( - _ reform.BeforeInserter = (*Channel)(nil) - _ reform.BeforeUpdater = (*Channel)(nil) - _ reform.AfterFinder = (*Channel)(nil) -) diff --git a/managed/models/channel_helpers.go b/managed/models/channel_helpers.go deleted file mode 100644 index 5d016e2906..0000000000 --- a/managed/models/channel_helpers.go +++ /dev/null @@ -1,391 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package models - -import ( - "fmt" - "strings" - - "github.com/google/uuid" - "github.com/pkg/errors" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gopkg.in/reform.v1" -) - -var invalidConfigurationError = status.Error(codes.InvalidArgument, "Channel should contain only one type of channel configuration.") - -func checkUniqueChannelID(q *reform.Querier, id string) error { - if id == "" { - panic("empty Channel ID") - } - - agent := &Channel{ID: id} - err := q.Reload(agent) - if err != nil { - if errors.Is(err, reform.ErrNoRows) { - return nil - } - return errors.WithStack(err) - } - - return status.Errorf(codes.AlreadyExists, "Channel with ID %q already exists.", id) -} - -func checkEmailConfig(c *EmailConfig) error { - if c == nil { - return status.Error(codes.InvalidArgument, "Email config is empty.") - } - - if len(c.To) == 0 { - return status.Error(codes.InvalidArgument, "Email to field is empty.") - } - - return nil -} - -func checkPagerDutyConfig(c *PagerDutyConfig) error { - if c == nil { - return status.Error(codes.InvalidArgument, "Pager duty config is empty.") - } - - if (c.RoutingKey == "" && c.ServiceKey == "") || (c.RoutingKey != "" && c.ServiceKey != "") { - return status.Error(codes.InvalidArgument, "Exactly one key should be present in pager duty configuration.") - } - - return nil -} - -func checkSlackConfig(c *SlackConfig) error { - if c == nil { - return status.Error(codes.InvalidArgument, "Slack config is empty.") - } - - if c.Channel == "" { - return status.Error(codes.InvalidArgument, "Slack channel field is empty.") - } - - return nil -} - -func checkWebHookConfig(c *WebHookConfig) error { - if c == nil { - return status.Error(codes.InvalidArgument, "Webhook config is empty.") - } - - if c.URL == "" { - return status.Error(codes.InvalidArgument, "Webhook url field is empty.") - } - - if c.HTTPConfig != nil && c.HTTPConfig.TLSConfig != nil { - tlsConfig := c.HTTPConfig.TLSConfig - if tlsConfig.CAFile != "" && tlsConfig.CAFileContent != "" { - return status.Error(codes.InvalidArgument, - "Fields CAFile and CAFileContent shouldn't be set at the same time.") - } - if tlsConfig.CertFile != "" && tlsConfig.CertFileContent != "" { - return status.Error(codes.InvalidArgument, - "Fields CertFile and CertFileContent shouldn't be set at the same time.") - } - if tlsConfig.KeyFile != "" && tlsConfig.KeyFileContent != "" { - return status.Error(codes.InvalidArgument, - "Fields KeyFile and KeyFileContent shouldn't be set at the same time.") - } - } - - return nil -} - -// FindChannels returns saved notification channels configuration. -func FindChannels(q *reform.Querier) ([]*Channel, error) { - rows, err := q.SelectAllFrom(ChannelTable, "") - if err != nil { - return nil, errors.Wrap(err, "failed to select notification channels") - } - - channels := make([]*Channel, len(rows)) - for i, s := range rows { - channels[i] = s.(*Channel) //nolint:forcetypeassert - } - - return channels, nil -} - -// FindChannelsOnPage returns a page with saved notification channels. -func FindChannelsOnPage(q *reform.Querier, pageIndex, pageSize int) ([]*Channel, error) { - rows, err := q.SelectAllFrom(ChannelTable, "ORDER BY id LIMIT $1 OFFSET $2", pageSize, pageIndex*pageSize) - if err != nil { - return nil, errors.Wrap(err, "failed to select notification channels") - } - - channels := make([]*Channel, len(rows)) - for i, s := range rows { - channels[i] = s.(*Channel) //nolint:forcetypeassert - } - - return channels, nil -} - -// CountChannels returns number of notification channels. -func CountChannels(q *reform.Querier) (int, error) { - count, err := q.Count(ChannelTable, "") - if err != nil { - return 0, errors.Wrap(err, "failed to count notification channels") - } - - return count, nil -} - -// FindChannelByID finds Channel by ID. -func FindChannelByID(q *reform.Querier, id string) (*Channel, error) { - if id == "" { - return nil, status.Error(codes.InvalidArgument, "Empty Channel ID.") - } - - channel := &Channel{ID: id} - err := q.Reload(channel) - if err != nil { - if errors.Is(err, reform.ErrNoRows) { - return nil, status.Errorf(codes.NotFound, "Channel with ID %q not found.", id) - } - return nil, errors.WithStack(err) - } - - return channel, nil -} - -// FindChannelsByIDs finds channels by IDs. -func FindChannelsByIDs(q *reform.Querier, ids []string) ([]*Channel, error) { - if len(ids) == 0 { - return []*Channel{}, nil - } - - p := strings.Join(q.Placeholders(1, len(ids)), ", ") - tail := fmt.Sprintf("WHERE id IN (%s) ORDER BY id", p) - args := make([]interface{}, len(ids)) - for i, id := range ids { - args[i] = id - } - - structs, err := q.SelectAllFrom(ChannelTable, tail, args...) - if err != nil { - return nil, errors.WithStack(err) - } - - res := make([]*Channel, len(structs)) - for i, s := range structs { - res[i] = s.(*Channel) //nolint:forcetypeassert - } - return res, nil -} - -// CreateChannelParams are params for creating new channel. -type CreateChannelParams struct { - Summary string - - EmailConfig *EmailConfig - PagerDutyConfig *PagerDutyConfig - SlackConfig *SlackConfig - WebHookConfig *WebHookConfig - - Disabled bool -} - -// CreateChannel persists notification channel. -func CreateChannel(q *reform.Querier, params *CreateChannelParams) (*Channel, error) { - id := "/channel_id/" + uuid.New().String() - - if err := checkUniqueChannelID(q, id); err != nil { - return nil, err - } - - if params.Summary == "" { - return nil, status.Error(codes.InvalidArgument, "Channel summary can't be empty.") - } - - row := &Channel{ - ID: id, - Summary: params.Summary, - Disabled: params.Disabled, - } - - if params.EmailConfig != nil { - if err := checkEmailConfig(params.EmailConfig); err != nil { - return nil, err - } - row.Type = Email - row.EmailConfig = params.EmailConfig - } - - if params.PagerDutyConfig != nil { - if row.Type != "" { - return nil, invalidConfigurationError - } - - if err := checkPagerDutyConfig(params.PagerDutyConfig); err != nil { - return nil, err - } - row.Type = PagerDuty - row.PagerDutyConfig = params.PagerDutyConfig - } - - if params.SlackConfig != nil { - if row.Type != "" { - return nil, invalidConfigurationError - } - if err := checkSlackConfig(params.SlackConfig); err != nil { - return nil, err - } - row.Type = Slack - row.SlackConfig = params.SlackConfig - } - - if params.WebHookConfig != nil { - if row.Type != "" { - return nil, invalidConfigurationError - } - if err := checkWebHookConfig(params.WebHookConfig); err != nil { - return nil, err - } - row.Type = WebHook - row.WebHookConfig = params.WebHookConfig - } - - if row.Type == "" { - return nil, status.Error(codes.InvalidArgument, "Missing channel configuration.") - } - - if err := q.Insert(row); err != nil { - return nil, errors.Wrap(err, "failed to create notifications channel") - } - - return row, nil -} - -// ChangeChannelParams is params for changing existing channel. -type ChangeChannelParams struct { - Summary string - - EmailConfig *EmailConfig - PagerDutyConfig *PagerDutyConfig - SlackConfig *SlackConfig - WebHookConfig *WebHookConfig - - Disabled bool -} - -// ChangeChannel updates existing notifications channel. -func ChangeChannel(q *reform.Querier, channelID string, params *ChangeChannelParams) (*Channel, error) { - row, err := FindChannelByID(q, channelID) - if err != nil { - return nil, err - } - - // remove previous configuration - row.Type = "" - row.EmailConfig = nil - row.PagerDutyConfig = nil - row.SlackConfig = nil - row.WebHookConfig = nil - - if params.Summary != "" { - row.Summary = params.Summary - } - - if params.EmailConfig != nil { - if err := checkEmailConfig(params.EmailConfig); err != nil { - return nil, err - } - row.Type = Email - row.EmailConfig = params.EmailConfig - } - - if params.PagerDutyConfig != nil { - if row.Type != "" { - return nil, invalidConfigurationError - } - - if err := checkPagerDutyConfig(params.PagerDutyConfig); err != nil { - return nil, err - } - row.Type = PagerDuty - row.PagerDutyConfig = params.PagerDutyConfig - } - - if params.SlackConfig != nil { - if row.Type != "" { - return nil, invalidConfigurationError - } - if err := checkSlackConfig(params.SlackConfig); err != nil { - return nil, err - } - row.Type = Slack - row.SlackConfig = params.SlackConfig - } - - if params.WebHookConfig != nil { - if row.Type != "" { - return nil, invalidConfigurationError - } - if err := checkWebHookConfig(params.WebHookConfig); err != nil { - return nil, err - } - row.Type = WebHook - row.WebHookConfig = params.WebHookConfig - } - - row.Disabled = params.Disabled - - if err = q.Update(row); err != nil { - return nil, errors.Wrap(err, "failed to update notifications channel") - } - - return row, nil -} - -// RemoveChannel removes notification channel with specified id. -func RemoveChannel(q *reform.Querier, id string) error { - channel, err := FindChannelByID(q, id) - if err != nil { - return err - } - - inUse, err := channelInUse(q, id) - if err != nil { - return err - } - - if inUse { - return status.Errorf(codes.FailedPrecondition, `You can't delete the "%s" channel when it's being used by a rule.`, channel.Summary) - } - - if err = q.Delete(&Channel{ID: id}); err != nil { - return errors.Wrap(err, "failed to delete notification channel") - } - - return nil -} - -func channelInUse(q *reform.Querier, id string) (bool, error) { - _, err := q.SelectOneFrom(RuleTable, "WHERE channel_ids ? $1", id) - if err != nil { - if errors.Is(err, reform.ErrNoRows) { - return false, nil - } - return false, errors.WithStack(err) - } - return true, nil -} diff --git a/managed/models/channel_helpers_test.go b/managed/models/channel_helpers_test.go deleted file mode 100644 index 9770efc18f..0000000000 --- a/managed/models/channel_helpers_test.go +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package models_test - -import ( - "testing" - - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gopkg.in/reform.v1" - "gopkg.in/reform.v1/dialects/postgresql" - - "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/utils/testdb" - "github.com/percona/pmm/managed/utils/tests" -) - -func TestNotificationChannels(t *testing.T) { - sqlDB := testdb.Open(t, models.SkipFixtures, nil) - defer func() { - require.NoError(t, sqlDB.Close()) - }() - db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) - - t.Run("create", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - params := models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - }, - Disabled: false, - } - - expected, err := models.CreateChannel(q, ¶ms) - require.NoError(t, err) - assert.Equal(t, models.Email, expected.Type) - assert.Equal(t, params.Summary, expected.Summary) - assert.Equal(t, params.Disabled, expected.Disabled) - assert.Equal(t, params.EmailConfig.SendResolved, expected.EmailConfig.SendResolved) - assert.EqualValues(t, params.EmailConfig.SendResolved, expected.EmailConfig.SendResolved) - - actual, err := models.FindChannelByID(q, expected.ID) - require.NoError(t, err) - assert.Equal(t, expected, actual) - }) - t.Run("create with textual tls config", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - tlsConfig := &models.TLSConfig{ - CAFileContent: "cafilecontent", - CertFileContent: "certfilecontent", - KeyFileContent: "keyfilecontent", - } - params := models.CreateChannelParams{ - Summary: "some summary", - WebHookConfig: &models.WebHookConfig{ - URL: "example.com", - HTTPConfig: &models.HTTPConfig{ - TLSConfig: tlsConfig, - }, - }, - Disabled: false, - } - - expected, err := models.CreateChannel(q, ¶ms) - require.NoError(t, err) - assert.Equal(t, models.WebHook, expected.Type) - assert.Equal(t, params.Summary, expected.Summary) - assert.Equal(t, params.Disabled, expected.Disabled) - - actual, err := models.FindChannelByID(q, expected.ID) - require.NoError(t, err) - assert.Equal(t, expected, actual) - require.NotNil(t, actual.WebHookConfig) - require.NotNil(t, actual.WebHookConfig.HTTPConfig) - require.NotNil(t, actual.WebHookConfig.HTTPConfig.TLSConfig) - assert.Equal(t, tlsConfig.CAFileContent, actual.WebHookConfig.HTTPConfig.TLSConfig.CAFileContent) - assert.Equal(t, tlsConfig.CertFileContent, actual.WebHookConfig.HTTPConfig.TLSConfig.CertFileContent) - assert.Equal(t, tlsConfig.KeyFileContent, actual.WebHookConfig.HTTPConfig.TLSConfig.KeyFileContent) - }) - - t.Run("change", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - createParams := &models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - SendResolved: false, - }, - Disabled: false, - } - - created, err := models.CreateChannel(q, createParams) - require.NoError(t, err) - - updateParams := &models.ChangeChannelParams{ - Summary: "completely new summary", - SlackConfig: &models.SlackConfig{ - SendResolved: true, - Channel: "general", - }, - Disabled: true, - } - - updated, err := models.ChangeChannel(q, created.ID, updateParams) - require.NoError(t, err) - assert.Equal(t, models.Slack, updated.Type) - assert.Equal(t, updateParams.Summary, updated.Summary) - assert.Equal(t, updateParams.Disabled, updated.Disabled) - assert.Nil(t, updated.EmailConfig) - assert.Equal(t, updateParams.SlackConfig.Channel, updated.SlackConfig.Channel) - assert.EqualValues(t, updateParams.SlackConfig.SendResolved, updated.SlackConfig.SendResolved) - - actual, err := models.FindChannelByID(q, created.ID) - require.NoError(t, err) - assert.Equal(t, updated, actual) - }) - - t.Run("remove", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - channel := createChannel(t, q) - - err = models.RemoveChannel(q, channel.ID) - require.NoError(t, err) - - cs, err := models.FindChannels(q) - require.NoError(t, err) - assert.Len(t, cs, 0) - }) - - t.Run("remove channel in use", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template, err := models.CreateTemplate(q, createTemplateParams(uuid.New().String())) - require.NoError(t, err) - - channel := createChannel(t, q) - - _ = createRule(t, q, channel.ID, template) - - err = models.RemoveChannel(q, channel.ID) - tests.AssertGRPCError(t, status.Newf(codes.FailedPrecondition, `You can't delete the "%s" channel when it's being used by a rule.`, channel.Summary), err) - - cs, err := models.FindChannels(q) - require.NoError(t, err) - assert.NotEmpty(t, cs) - }) - - t.Run("find", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - params1 := models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - }, - Disabled: false, - } - expected1, err := models.CreateChannel(q, ¶ms1) - require.NoError(t, err) - - params2 := models.CreateChannelParams{ - Summary: "another summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test2@test.test"}, - }, - Disabled: true, - } - expected2, err := models.CreateChannel(q, ¶ms2) - require.NoError(t, err) - - actual, err := models.FindChannels(q) - require.NoError(t, err) - var found1, found2 bool - for _, channel := range actual { - if channel.ID == expected1.ID { - found1 = true - } - if channel.ID == expected2.ID { - found2 = true - } - } - - assert.True(t, found1, "Fist channel not found") - assert.True(t, found2, "Second channel not found") - }) -} - -func TestChannelValidation(t *testing.T) { - sqlDB := testdb.Open(t, models.SkipFixtures, nil) - defer func() { - require.NoError(t, sqlDB.Close()) - }() - db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) - - cases := []struct { - name string - channel models.CreateChannelParams - errorMsg string - }{ - { - name: "normal email config", - channel: models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - }, - Disabled: false, - }, - errorMsg: "", - }, - { - name: "normal pager duty config", - channel: models.CreateChannelParams{ - Summary: "some summary", - PagerDutyConfig: &models.PagerDutyConfig{ - SendResolved: false, - RoutingKey: "some key", - }, - Disabled: false, - }, - errorMsg: "", - }, - { - name: "normal slack config", - channel: models.CreateChannelParams{ - Summary: "some summary", - SlackConfig: &models.SlackConfig{ - Channel: "channel", - }, - Disabled: false, - }, - errorMsg: "", - }, - { - name: "normal webhook config", - channel: models.CreateChannelParams{ - Summary: "some summary", - WebHookConfig: &models.WebHookConfig{ - URL: "test.test", - }, - Disabled: false, - }, - errorMsg: "", - }, - { - name: "missing summary", - channel: models.CreateChannelParams{ - Summary: "", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Channel summary can't be empty.", - }, - { - name: "missing email config", - channel: models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: nil, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Missing channel configuration.", - }, - { - name: "missing pager duty config", - channel: models.CreateChannelParams{ - Summary: "some summary", - PagerDutyConfig: nil, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Missing channel configuration.", - }, - { - name: "missing slack config", - channel: models.CreateChannelParams{ - Summary: "some summary", - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Missing channel configuration.", - }, - { - name: "missing webhook config", - channel: models.CreateChannelParams{ - Summary: "some summary", - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Missing channel configuration.", - }, - { - name: "missing to field in email configuration", - channel: models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: nil, - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Email to field is empty.", - }, - { - name: "no keys set in pager duty config", - channel: models.CreateChannelParams{ - Summary: "some summary", - PagerDutyConfig: &models.PagerDutyConfig{ - SendResolved: false, - RoutingKey: "", - ServiceKey: "", - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Exactly one key should be present in pager duty configuration.", - }, - { - name: "both keys set in pager duty config", - channel: models.CreateChannelParams{ - Summary: "some summary", - PagerDutyConfig: &models.PagerDutyConfig{ - SendResolved: false, - RoutingKey: "some key", - ServiceKey: "some key", - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Exactly one key should be present in pager duty configuration.", - }, - { - name: "missing channel in slack configuration", - channel: models.CreateChannelParams{ - Summary: "some summary", - SlackConfig: &models.SlackConfig{ - Channel: "", - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Slack channel field is empty.", - }, - { - name: "missing url in webhook configuration", - channel: models.CreateChannelParams{ - Summary: "some summary", - WebHookConfig: &models.WebHookConfig{ - URL: "", - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Webhook url field is empty.", - }, - { - name: "multiple configurations", - channel: models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - }, - WebHookConfig: &models.WebHookConfig{ - URL: "example.com", - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Channel should contain only one type of channel configuration.", - }, - { - name: "both CAFile and CAFileContent are set", - channel: models.CreateChannelParams{ - Summary: "some summary", - WebHookConfig: &models.WebHookConfig{ - URL: "example.com", - HTTPConfig: &models.HTTPConfig{ - TLSConfig: &models.TLSConfig{ - CAFile: "cafile", - CAFileContent: "cafile content", - }, - }, - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Fields CAFile and CAFileContent shouldn't be set at the same time.", - }, - { - name: "both CertFile and CertFileContent are set", - channel: models.CreateChannelParams{ - Summary: "some summary", - WebHookConfig: &models.WebHookConfig{ - URL: "example.com", - HTTPConfig: &models.HTTPConfig{ - TLSConfig: &models.TLSConfig{ - CertFile: "certfile", - CertFileContent: "certfile content", - }, - }, - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Fields CertFile and CertFileContent shouldn't be set at the same time.", - }, - { - name: "both KeyFile and KeyFileContent are set", - channel: models.CreateChannelParams{ - Summary: "some summary", - WebHookConfig: &models.WebHookConfig{ - URL: "example.com", - HTTPConfig: &models.HTTPConfig{ - TLSConfig: &models.TLSConfig{ - KeyFile: "keyfile", - KeyFileContent: "keyfile content", - }, - }, - }, - Disabled: false, - }, - errorMsg: "rpc error: code = InvalidArgument desc = Fields KeyFile and KeyFileContent shouldn't be set at the same time.", - }, - } - - for _, test := range cases { - test := test - - t.Run(test.name, func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - c, err := models.CreateChannel(q, &test.channel) - if test.errorMsg != "" { - assert.EqualError(t, err, test.errorMsg) - return - } - assert.NoError(t, err) - assert.NotNil(t, c) - }) - } -} diff --git a/managed/models/channel_reform.go b/managed/models/channel_reform.go deleted file mode 100644 index faee5f1943..0000000000 --- a/managed/models/channel_reform.go +++ /dev/null @@ -1,176 +0,0 @@ -// Code generated by gopkg.in/reform.v1. DO NOT EDIT. - -package models - -import ( - "fmt" - "strings" - - "gopkg.in/reform.v1" - "gopkg.in/reform.v1/parse" -) - -type channelTableType struct { - s parse.StructInfo - z []interface{} -} - -// Schema returns a schema name in SQL database (""). -func (v *channelTableType) Schema() string { - return v.s.SQLSchema -} - -// Name returns a view or table name in SQL database ("ia_channels"). -func (v *channelTableType) Name() string { - return v.s.SQLName -} - -// Columns returns a new slice of column names for that view or table in SQL database. -func (v *channelTableType) Columns() []string { - return []string{ - "id", - "summary", - "type", - "email_config", - "pagerduty_config", - "slack_config", - "webhook_config", - "disabled", - "created_at", - "updated_at", - } -} - -// NewStruct makes a new struct for that view or table. -func (v *channelTableType) NewStruct() reform.Struct { - return new(Channel) -} - -// NewRecord makes a new record for that table. -func (v *channelTableType) NewRecord() reform.Record { - return new(Channel) -} - -// PKColumnIndex returns an index of primary key column for that table in SQL database. -func (v *channelTableType) PKColumnIndex() uint { - return uint(v.s.PKFieldIndex) -} - -// ChannelTable represents ia_channels view or table in SQL database. -var ChannelTable = &channelTableType{ - s: parse.StructInfo{ - Type: "Channel", - SQLName: "ia_channels", - Fields: []parse.FieldInfo{ - {Name: "ID", Type: "string", Column: "id"}, - {Name: "Summary", Type: "string", Column: "summary"}, - {Name: "Type", Type: "ChannelType", Column: "type"}, - {Name: "EmailConfig", Type: "*EmailConfig", Column: "email_config"}, - {Name: "PagerDutyConfig", Type: "*PagerDutyConfig", Column: "pagerduty_config"}, - {Name: "SlackConfig", Type: "*SlackConfig", Column: "slack_config"}, - {Name: "WebHookConfig", Type: "*WebHookConfig", Column: "webhook_config"}, - {Name: "Disabled", Type: "bool", Column: "disabled"}, - {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, - {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}, - }, - PKFieldIndex: 0, - }, - z: new(Channel).Values(), -} - -// String returns a string representation of this struct or record. -func (s Channel) String() string { - res := make([]string, 10) - res[0] = "ID: " + reform.Inspect(s.ID, true) - res[1] = "Summary: " + reform.Inspect(s.Summary, true) - res[2] = "Type: " + reform.Inspect(s.Type, true) - res[3] = "EmailConfig: " + reform.Inspect(s.EmailConfig, true) - res[4] = "PagerDutyConfig: " + reform.Inspect(s.PagerDutyConfig, true) - res[5] = "SlackConfig: " + reform.Inspect(s.SlackConfig, true) - res[6] = "WebHookConfig: " + reform.Inspect(s.WebHookConfig, true) - res[7] = "Disabled: " + reform.Inspect(s.Disabled, true) - res[8] = "CreatedAt: " + reform.Inspect(s.CreatedAt, true) - res[9] = "UpdatedAt: " + reform.Inspect(s.UpdatedAt, true) - return strings.Join(res, ", ") -} - -// Values returns a slice of struct or record field values. -// Returned interface{} values are never untyped nils. -func (s *Channel) Values() []interface{} { - return []interface{}{ - s.ID, - s.Summary, - s.Type, - s.EmailConfig, - s.PagerDutyConfig, - s.SlackConfig, - s.WebHookConfig, - s.Disabled, - s.CreatedAt, - s.UpdatedAt, - } -} - -// Pointers returns a slice of pointers to struct or record fields. -// Returned interface{} values are never untyped nils. -func (s *Channel) Pointers() []interface{} { - return []interface{}{ - &s.ID, - &s.Summary, - &s.Type, - &s.EmailConfig, - &s.PagerDutyConfig, - &s.SlackConfig, - &s.WebHookConfig, - &s.Disabled, - &s.CreatedAt, - &s.UpdatedAt, - } -} - -// View returns View object for that struct. -func (s *Channel) View() reform.View { - return ChannelTable -} - -// Table returns Table object for that record. -func (s *Channel) Table() reform.Table { - return ChannelTable -} - -// PKValue returns a value of primary key for that record. -// Returned interface{} value is never untyped nil. -func (s *Channel) PKValue() interface{} { - return s.ID -} - -// PKPointer returns a pointer to primary key field for that record. -// Returned interface{} value is never untyped nil. -func (s *Channel) PKPointer() interface{} { - return &s.ID -} - -// HasPK returns true if record has non-zero primary key set, false otherwise. -func (s *Channel) HasPK() bool { - return s.ID != ChannelTable.z[ChannelTable.s.PKFieldIndex] -} - -// SetPK sets record primary key, if possible. -// -// Deprecated: prefer direct field assignment where possible: s.ID = pk. -func (s *Channel) SetPK(pk interface{}) { - reform.SetPK(s, pk) -} - -// check interfaces -var ( - _ reform.View = ChannelTable - _ reform.Struct = (*Channel)(nil) - _ reform.Table = ChannelTable - _ reform.Record = (*Channel)(nil) - _ fmt.Stringer = (*Channel)(nil) -) - -func init() { - parse.AssertUpToDate(&ChannelTable.s, new(Channel)) -} diff --git a/managed/models/database.go b/managed/models/database.go index 75dae25e5d..764f177439 100644 --- a/managed/models/database.go +++ b/managed/models/database.go @@ -921,6 +921,13 @@ var databaseSchema = [][]string{ 86: { `DROP TABLE kubernetes_clusters`, }, + 87: { + `DROP TABLE IF EXISTS ia_channels`, + `DROP TABLE IF EXISTS ia_rules`, + `ALTER TABLE ia_templates RENAME TO alert_rule_templates`, + `UPDATE settings SET settings = settings #- '{alerting, email_settings}';`, + `UPDATE settings SET settings = settings #- '{alerting, slack_settings}';`, + }, } // ^^^ Avoid default values in schema definition. ^^^ diff --git a/managed/models/models.go b/managed/models/models.go index 2ee68f37f4..c92479e1b0 100644 --- a/managed/models/models.go +++ b/managed/models/models.go @@ -33,7 +33,6 @@ import ( "strings" "time" - "github.com/percona-platform/saas/pkg/common" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -191,49 +190,3 @@ func jsonScan(v, src interface{}) error { } return nil } - -// Severity represents alert severity. -// Integer values is the same as common.Severity. Common constants can be used. -// Database representation is a string and is handled by Value and Scan methods below. -type Severity common.Severity - -// Value implements database/sql/driver Valuer interface. -func (s Severity) Value() (driver.Value, error) { - cs := common.Severity(s) - if err := cs.Validate(); err != nil { - return nil, err - } - return cs.String(), nil -} - -// Scan implements database/sql Scanner interface. -func (s *Severity) Scan(src interface{}) error { - switch src := src.(type) { - case string: - cs := common.ParseSeverity(src) - if err := cs.Validate(); err != nil { - return err - } - *s = Severity(cs) - return nil - default: - return errors.Errorf("expected string, got %T (%q)", src, src) - } -} - -// ParamType represents parameter type. -type ParamType string - -// Available parameter types. -const ( - Float = ParamType("float") - Bool = ParamType("bool") - String = ParamType("string") -) - -type ParamUnit string - -const ( - Percent = ParamUnit("%") - Seconds = ParamUnit("s") -) diff --git a/managed/models/models_json_test.go b/managed/models/models_json_test.go index 1e590c9d18..ad35313dc4 100644 --- a/managed/models/models_json_test.go +++ b/managed/models/models_json_test.go @@ -34,37 +34,45 @@ func TestJSON(t *testing.T) { //nolint:tparallel t.Run("Normal", func(t *testing.T) { t.Parallel() - c1 := models.Channel{ - ID: "Normal", - EmailConfig: &models.EmailConfig{ - To: []string{"foo@bar.test"}, + j1 := models.Job{ + ID: "Normal", + PMMAgentID: "test-agent", + Data: &models.JobData{ + MySQLBackup: &models.MySQLBackupJobData{ + ServiceID: "test_service", + ArtifactID: "test_artifact", + }, }, } - err := db.Save(&c1) + err := db.Save(&j1) require.NoError(t, err) - var c2 models.Channel - err = db.FindByPrimaryKeyTo(&c2, c1.ID) + var j2 models.Job + err = db.FindByPrimaryKeyTo(&j2, j1.ID) require.NoError(t, err) - assert.Equal(t, c1, c2) + assert.Equal(t, j1, j2) }) t.Run("Nil", func(t *testing.T) { t.Parallel() - c1 := models.Channel{ - ID: "Nil", + j1 := models.Job{ + PMMAgentID: "test-agent", + ID: "Nil", } - err := db.Save(&c1) + err := db.Save(&j1) require.NoError(t, err) - c2 := models.Channel{ - EmailConfig: &models.EmailConfig{ - To: []string{"foo@bar.test"}, + j2 := models.Job{ + Data: &models.JobData{ + MySQLBackup: &models.MySQLBackupJobData{ + ServiceID: "test_service", + ArtifactID: "test_artifact", + }, }, } - err = db.FindByPrimaryKeyTo(&c2, c1.ID) + err = db.FindByPrimaryKeyTo(&j2, j1.ID) require.NoError(t, err) - assert.Equal(t, c1, c2) + assert.Equal(t, j1, j2) }) } diff --git a/managed/models/models_test.go b/managed/models/models_test.go index 3490c90af7..4de96c5767 100644 --- a/managed/models/models_test.go +++ b/managed/models/models_test.go @@ -26,11 +26,13 @@ import ( ) func TestLabels(t *testing.T) { - var b []byte - var err error + t.Parallel() t.Run("Normal", func(t *testing.T) { - err = setLabels(map[string]string{"_1foo": "bar", "baz": " "}, &b) + t.Parallel() + + var b []byte + err := setLabels(map[string]string{"_1foo": "bar", "baz": " "}, &b) assert.NoError(t, err) assert.Equal(t, `{"_1foo":"bar","baz":""}`, string(b)) m, err := getLabels(b) @@ -39,7 +41,10 @@ func TestLabels(t *testing.T) { }) t.Run("Empty", func(t *testing.T) { - err = setLabels(make(map[string]string), &b) + t.Parallel() + + var b []byte + err := setLabels(make(map[string]string), &b) assert.NoError(t, err) assert.Nil(t, b) m, err := getLabels(b) @@ -48,12 +53,18 @@ func TestLabels(t *testing.T) { }) t.Run("Invalid", func(t *testing.T) { - err = setLabels(map[string]string{"1": "bar"}, &b) + t.Parallel() + + var b []byte + err := setLabels(map[string]string{"1": "bar"}, &b) tests.AssertGRPCError(t, status.New(codes.InvalidArgument, `Invalid label name "1".`), err) }) t.Run("Reserved", func(t *testing.T) { - err = setLabels(map[string]string{"__1": "bar"}, &b) + t.Parallel() + + var b []byte + err := setLabels(map[string]string{"__1": "bar"}, &b) tests.AssertGRPCError(t, status.New(codes.InvalidArgument, `Invalid label name "__1".`), err) }) } diff --git a/managed/models/rule_helpers.go b/managed/models/rule_helpers.go deleted file mode 100644 index 07580d162f..0000000000 --- a/managed/models/rule_helpers.go +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package models - -import ( - "encoding/json" - "time" - - "github.com/google/uuid" - "github.com/pkg/errors" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gopkg.in/reform.v1" -) - -func checkUniqueRuleID(q *reform.Querier, id string) error { - if id == "" { - panic("empty Rule ID") - } - - rule := &Rule{ID: id} - err := q.Reload(rule) - if err != nil { - if errors.Is(err, reform.ErrNoRows) { - return nil - } - return errors.WithStack(err) - } - - return status.Errorf(codes.AlreadyExists, "Rule with ID %q already exists.", id) -} - -// FindRules returns saved alert rules configuration. -func FindRules(q *reform.Querier) ([]*Rule, error) { - rows, err := q.SelectAllFrom(RuleTable, "") - if err != nil { - return nil, errors.Wrap(err, "failed to select alert rules") - } - - rules := make([]*Rule, len(rows)) - for i, s := range rows { - rules[i] = s.(*Rule) //nolint:forcetypeassert - } - - return rules, nil -} - -// FindRulesOnPage returns a page with saved alert rules configuration. -func FindRulesOnPage(q *reform.Querier, pageIndex, pageSize int) ([]*Rule, error) { - rows, err := q.SelectAllFrom(RuleTable, "ORDER BY id LIMIT $1 OFFSET $2", pageSize, pageIndex*pageSize) - if err != nil { - return nil, errors.Wrap(err, "failed to select alert rules") - } - - rules := make([]*Rule, len(rows)) - for i, s := range rows { - rules[i] = s.(*Rule) //nolint:forcetypeassert - } - - return rules, nil -} - -// CountRules returns number of alert rules. -func CountRules(q *reform.Querier) (int, error) { - count, err := q.Count(RuleTable, "") - if err != nil { - return 0, errors.Wrap(err, "failed to count alert rules") - } - - return count, nil -} - -// FindRuleByID finds Rule by ID. -func FindRuleByID(q *reform.Querier, id string) (*Rule, error) { - if id == "" { - return nil, status.Error(codes.InvalidArgument, "Empty Rule ID.") - } - - rule := &Rule{ID: id} - err := q.Reload(rule) - if err != nil { - if errors.Is(err, reform.ErrNoRows) { - return nil, status.Errorf(codes.NotFound, "Rule with ID %q not found.", id) - } - return nil, errors.WithStack(err) - } - - return rule, nil -} - -// CreateRuleParams are params for creating new Rule. -type CreateRuleParams struct { - Name string - TemplateName string - Summary string - Disabled bool - ExprTemplate string - ParamsDefinitions AlertExprParamsDefinitions - ParamsValues AlertExprParamsValues - DefaultFor time.Duration - For time.Duration - DefaultSeverity Severity - Severity Severity - CustomLabels map[string]string - Labels map[string]string - Annotations map[string]string - Filters Filters - ChannelIDs []string -} - -// CreateRule persists alert Rule. -func CreateRule(q *reform.Querier, params *CreateRuleParams) (*Rule, error) { - id := "/rule_id/" + uuid.New().String() - var err error - if err = checkUniqueRuleID(q, id); err != nil { - return nil, err - } - - row := &Rule{ - ID: id, - Name: params.Name, - TemplateName: params.TemplateName, - Summary: params.Summary, - Disabled: params.Disabled, - ExprTemplate: params.ExprTemplate, - ParamsDefinitions: params.ParamsDefinitions, - ParamsValues: params.ParamsValues, - DefaultFor: params.DefaultFor, - For: params.For, - DefaultSeverity: params.DefaultSeverity, - Severity: params.Severity, - Filters: params.Filters, - } - - if len(params.ChannelIDs) != 0 { - channelIDs := deduplicateStrings(params.ChannelIDs) - channels, err := FindChannelsByIDs(q, channelIDs) - if err != nil { - return nil, err - } - - if len(channelIDs) != len(channels) { - missingChannelsIDs := findMissingChannels(channelIDs, channels) - return nil, status.Errorf(codes.NotFound, "Failed to find all required channels: %v.", missingChannelsIDs) - } - - row.ChannelIDs = channelIDs - } - - if err = row.SetCustomLabels(params.CustomLabels); err != nil { - return nil, err - } - - if err = row.SetLabels(params.Labels); err != nil { - return nil, err - } - - if err = row.SetAnnotations(params.Annotations); err != nil { - return nil, err - } - - if err = q.Insert(row); err != nil { - return nil, errors.Wrap(err, "failed to create alert rule") - } - - return row, nil -} - -// ChangeRuleParams is params for updating existing Rule. -type ChangeRuleParams struct { - Name string - Disabled bool - ParamsValues AlertExprParamsValues - For time.Duration - Severity Severity - CustomLabels map[string]string - Filters Filters - ChannelIDs []string -} - -// ChangeRule updates existing alerts Rule. -func ChangeRule(q *reform.Querier, ruleID string, params *ChangeRuleParams) (*Rule, error) { - row, err := FindRuleByID(q, ruleID) - if err != nil { - return nil, err - } - - channelIDs := deduplicateStrings(params.ChannelIDs) - channels, err := FindChannelsByIDs(q, channelIDs) - if err != nil { - return nil, errors.Wrap(err, "failed to find channels") - } - - if len(channelIDs) != len(channels) { - missingChannelsIDs := findMissingChannels(channelIDs, channels) - return nil, status.Errorf(codes.NotFound, "Failed to find all required channels: %v.", missingChannelsIDs) - } - - row.Name = params.Name - row.Disabled = params.Disabled - row.For = params.For - row.Severity = params.Severity - row.Filters = params.Filters - row.ParamsValues = params.ParamsValues - - labels, err := json.Marshal(params.CustomLabels) - if err != nil { - return nil, errors.Wrap(err, "failed to update alert rule") - } - row.CustomLabels = labels - row.ChannelIDs = params.ChannelIDs - - if err = q.Update(row); err != nil { - return nil, errors.Wrap(err, "failed to change alerts Rule") - } - - return row, nil -} - -// ToggleRuleParams represents rule toggle parameters. -type ToggleRuleParams struct { - Disabled *bool // nil - do not change -} - -// ToggleRule updates some alert rule fields. -func ToggleRule(q *reform.Querier, ruleID string, params *ToggleRuleParams) (*Rule, error) { - row, err := FindRuleByID(q, ruleID) - if err != nil { - return nil, err - } - - if params.Disabled == nil { - return row, nil - } - - row.Disabled = *params.Disabled - - if err = q.Update(row); err != nil { - return nil, errors.Wrap(err, "failed to toggle alerts Rule") - } - - return row, nil -} - -// RemoveRule removes alert Rule with specified id. -func RemoveRule(q *reform.Querier, id string) error { - var err error - if _, err = FindRuleByID(q, id); err != nil { - return err - } - - if err = q.Delete(&Rule{ID: id}); err != nil { - return errors.Wrap(err, "failed to delete alert Rule") - } - return nil -} - -func findMissingChannels(ids []string, channels []*Channel) []string { - m := make(map[string]bool, len(ids)) - for _, id := range ids { - m[id] = false - } - - for _, channel := range channels { - if _, ok := m[channel.ID]; ok { - m[channel.ID] = true - } - } - - var res []string - for k, v := range m { - if !v { - res = append(res, k) - } - } - - return res -} diff --git a/managed/models/rule_helpers_test.go b/managed/models/rule_helpers_test.go deleted file mode 100644 index 277f7576b8..0000000000 --- a/managed/models/rule_helpers_test.go +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package models_test - -import ( - "testing" - "time" - - "github.com/google/uuid" - "github.com/percona-platform/saas/pkg/common" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gopkg.in/reform.v1" - "gopkg.in/reform.v1/dialects/postgresql" - - "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/utils/testdb" - "github.com/percona/pmm/managed/utils/tests" -) - -func TestRules(t *testing.T) { - sqlDB := testdb.Open(t, models.SkipFixtures, nil) - db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) - - nonEmptyFilters := []models.Filter{{Type: models.Equal, Key: "value", Val: "10"}} - - t.Run("create", func(t *testing.T) { - t.Run("normal", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - channel := createChannel(t, q) - - params := createCreateRuleParams(t, template, channel.ID, nonEmptyFilters) - rule, err := models.CreateRule(q, params) - require.NoError(t, err) - - assert.NotEmpty(t, rule.ID) - assert.Equal(t, template.Name, rule.TemplateName) - assert.Equal(t, template.Summary, rule.Summary) - assert.Equal(t, template.Severity, rule.DefaultSeverity) - assert.Equal(t, template.For, rule.DefaultFor) - assert.Equal(t, params.Name, rule.Name) - assert.Equal(t, params.Disabled, rule.Disabled) - assert.Equal(t, params.ParamsValues, rule.ParamsValues) - assert.Equal(t, params.For, rule.For) - assert.Equal(t, models.Severity(common.Warning), rule.Severity) - - customLabels, err := rule.GetCustomLabels() - require.NoError(t, err) - assert.Equal(t, params.CustomLabels, customLabels) - - labels, err := rule.GetLabels() - require.NoError(t, err) - templateLabels, err := template.GetLabels() - require.NoError(t, err) - assert.Equal(t, templateLabels, labels) - - annotations, err := rule.GetAnnotations() - require.NoError(t, err) - templateAnnotations, err := template.GetAnnotations() - require.NoError(t, err) - assert.Equal(t, templateAnnotations, annotations) - - assert.Equal(t, params.Filters, rule.Filters) - assert.ElementsMatch(t, params.ChannelIDs, rule.ChannelIDs) - }) - - t.Run("rule without channel and filters", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - - params := createCreateRuleParams(t, template, "", nil) - rule, err := models.CreateRule(q, params) - require.NoError(t, err) - - assert.NotEmpty(t, rule.ID) - assert.Equal(t, template.Name, rule.TemplateName) - assert.Equal(t, template.Summary, rule.Summary) - assert.Equal(t, template.Severity, rule.DefaultSeverity) - assert.Equal(t, template.For, rule.DefaultFor) - assert.Equal(t, params.Name, rule.Name) - assert.Equal(t, params.Disabled, rule.Disabled) - assert.Equal(t, params.ParamsValues, rule.ParamsValues) - assert.Equal(t, params.For, rule.For) - assert.Equal(t, models.Severity(common.Warning), rule.Severity) - - customLabels, err := rule.GetCustomLabels() - require.NoError(t, err) - assert.Equal(t, params.CustomLabels, customLabels) - - labels, err := rule.GetLabels() - require.NoError(t, err) - templateLabels, err := template.GetLabels() - require.NoError(t, err) - assert.Equal(t, templateLabels, labels) - - annotations, err := rule.GetAnnotations() - require.NoError(t, err) - templateAnnotations, err := template.GetAnnotations() - require.NoError(t, err) - assert.Equal(t, templateAnnotations, annotations) - - assert.Nil(t, rule.Filters) - assert.Empty(t, rule.ChannelIDs) - }) - - t.Run("unknown channel", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - channelID := uuid.New().String() - - params := createCreateRuleParams(t, template, channelID, nonEmptyFilters) - _, err = models.CreateRule(q, params) - tests.AssertGRPCError(t, status.Newf(codes.NotFound, "Failed to find all required channels: %v.", []string{channelID}), err) - }) - }) - - t.Run("change", func(t *testing.T) { - t.Run("normal", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - channel := createChannel(t, q) - rule, err := models.CreateRule(q, createCreateRuleParams(t, template, channel.ID, nonEmptyFilters)) - require.NoError(t, err) - - newChannel := createChannel(t, q) - - params := &models.ChangeRuleParams{ - Name: "summary", - Disabled: false, - ParamsValues: nil, - For: 3 * time.Second, - Severity: models.Severity(common.Info), - CustomLabels: map[string]string{"test": "example"}, - Filters: []models.Filter{{Type: models.Equal, Key: "number", Val: "42"}}, - ChannelIDs: []string{newChannel.ID}, - } - - updated, err := models.ChangeRule(q, rule.ID, params) - require.NoError(t, err) - - assert.NotEmpty(t, rule.ID, updated.ID) - assert.Equal(t, template.Name, updated.TemplateName) - assert.Equal(t, template.Summary, updated.Summary) - assert.Equal(t, template.Severity, updated.DefaultSeverity) - assert.Equal(t, template.For, updated.DefaultFor) - assert.Equal(t, params.Name, updated.Name) - assert.Equal(t, params.Disabled, updated.Disabled) - assert.Equal(t, params.ParamsValues, updated.ParamsValues) - assert.Equal(t, params.For, updated.For) - assert.Equal(t, models.Severity(common.Info), updated.Severity) - - labels, err := updated.GetCustomLabels() - require.NoError(t, err) - assert.Equal(t, params.CustomLabels, labels) - assert.Equal(t, params.Filters, updated.Filters) - assert.ElementsMatch(t, params.ChannelIDs, updated.ChannelIDs) - }) - - t.Run("unknown channel", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - channel := createChannel(t, q) - rule, err := models.CreateRule(q, createCreateRuleParams(t, template, channel.ID, nonEmptyFilters)) - require.NoError(t, err) - - newChannelID := uuid.New().String() - - params := &models.ChangeRuleParams{ - Disabled: false, - ParamsValues: nil, - For: 3 * time.Second, - Severity: models.Severity(common.Info), - CustomLabels: map[string]string{"test": "example"}, - Filters: []models.Filter{{Type: models.Equal, Key: "number", Val: "42"}}, - ChannelIDs: []string{newChannelID}, - } - - _, err = models.ChangeRule(q, rule.ID, params) - tests.AssertGRPCError(t, status.Newf(codes.NotFound, "Failed to find all required channels: %v.", []string{newChannelID}), err) - }) - }) - - t.Run("remove", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - channel := createChannel(t, q) - - params := createCreateRuleParams(t, template, channel.ID, nonEmptyFilters) - rule, err := models.CreateRule(q, params) - require.NoError(t, err) - - err = models.RemoveRule(q, rule.ID) - require.NoError(t, err) - - rules, err := models.FindRules(q) - require.NoError(t, err) - assert.Empty(t, rules) - }) - - t.Run("list", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template := createTemplate(t, q) - channel := createChannel(t, q) - - params := createCreateRuleParams(t, template, channel.ID, nonEmptyFilters) - rule, err := models.CreateRule(q, params) - require.NoError(t, err) - - rules, err := models.FindRules(q) - require.NoError(t, err) - assert.Len(t, rules, 1) - - actual := rules[0] - assert.NotEmpty(t, rule.ID) - assert.Equal(t, rule.Summary, actual.Summary) - assert.Equal(t, rule.TemplateName, actual.TemplateName) - assert.Equal(t, rule.Disabled, actual.Disabled) - assert.Equal(t, rule.ParamsValues, actual.ParamsValues) - assert.Equal(t, rule.For, actual.For) - assert.Equal(t, rule.Severity, actual.Severity) - assert.Equal(t, rule.CustomLabels, actual.CustomLabels) - assert.Equal(t, rule.Filters, actual.Filters) - assert.ElementsMatch(t, rule.ChannelIDs, actual.ChannelIDs) - }) -} - -func createCreateRuleParams(t *testing.T, template *models.Template, channelID string, filters []models.Filter) *models.CreateRuleParams { - t.Helper() - - labels, err := template.GetLabels() - require.NoError(t, err) - - annotations, err := template.GetAnnotations() - require.NoError(t, err) - - rule := &models.CreateRuleParams{ - TemplateName: template.Name, - Name: "rule name", - Summary: template.Summary, - Disabled: true, - ParamsValues: []models.AlertExprParamValue{ - { - Name: "test", - Type: models.Float, - FloatValue: 3.14, - }, - }, - DefaultFor: template.For, - For: 5 * time.Second, - DefaultSeverity: template.Severity, - Severity: models.Severity(common.Warning), - CustomLabels: map[string]string{"foo": "bar"}, - Labels: labels, - Annotations: annotations, - } - if channelID != "" { - rule.ChannelIDs = []string{channelID} - } - - if filters != nil { - rule.Filters = filters - } - - return rule -} - -func createTemplate(t *testing.T, q *reform.Querier) *models.Template { - t.Helper() - - template, err := models.CreateTemplate(q, createTemplateParams(uuid.New().String())) - require.NoError(t, err) - return template -} - -func createChannel(t *testing.T, q *reform.Querier) *models.Channel { - t.Helper() - - params := models.CreateChannelParams{ - Summary: "some summary", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test"}, - }, - Disabled: false, - } - - channel, err := models.CreateChannel(q, ¶ms) - require.NoError(t, err) - - return channel -} diff --git a/managed/models/rule_model.go b/managed/models/rule_model.go deleted file mode 100644 index fab7db7597..0000000000 --- a/managed/models/rule_model.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package models - -import ( - "database/sql/driver" - "fmt" - "time" - - "gopkg.in/reform.v1" -) - -//go:generate ../../bin/reform - -// Rule represents alert rule configuration. -// -//reform:ia_rules -type Rule struct { - ID string `reform:"id,pk"` - Name string `reform:"name"` - Summary string `reform:"summary"` - TemplateName string `reform:"template_name"` - Disabled bool `reform:"disabled"` - ExprTemplate string `reform:"expr_template"` - ParamsDefinitions AlertExprParamsDefinitions `reform:"params_definitions"` - ParamsValues AlertExprParamsValues `reform:"params_values"` - DefaultFor time.Duration `reform:"default_for"` - For time.Duration `reform:"for"` - DefaultSeverity Severity `reform:"default_severity"` - Severity Severity `reform:"severity"` - CustomLabels []byte `reform:"custom_labels"` - Labels []byte `reform:"labels"` - Annotations []byte `reform:"annotations"` - Filters Filters `reform:"filters"` - ChannelIDs ChannelIDs `reform:"channel_ids"` - CreatedAt time.Time `reform:"created_at"` - UpdatedAt time.Time `reform:"updated_at"` -} - -// BeforeInsert implements reform.BeforeInserter interface. -func (r *Rule) BeforeInsert() error { - now := Now() - r.CreatedAt = now - r.UpdatedAt = now - return nil -} - -// BeforeUpdate implements reform.BeforeUpdater interface. -func (r *Rule) BeforeUpdate() error { - r.UpdatedAt = Now() - - return nil -} - -// AfterFind implements reform.AfterFinder interface. -func (r *Rule) AfterFind() error { - r.CreatedAt = r.CreatedAt.UTC() - r.UpdatedAt = r.UpdatedAt.UTC() - - return nil -} - -// GetCustomLabels decodes template labels. -func (r *Rule) GetCustomLabels() (map[string]string, error) { - return getLabels(r.CustomLabels) -} - -// SetCustomLabels encodes template labels. -func (r *Rule) SetCustomLabels(m map[string]string) error { - return setLabels(m, &r.CustomLabels) -} - -// GetLabels decodes template labels. -func (r *Rule) GetLabels() (map[string]string, error) { - return getLabels(r.Labels) -} - -// SetLabels encodes template labels. -func (r *Rule) SetLabels(m map[string]string) error { - return setLabels(m, &r.Labels) -} - -// GetAnnotations decodes template annotations. -func (r *Rule) GetAnnotations() (map[string]string, error) { - return getLabels(r.Annotations) -} - -// SetAnnotations encodes template annotations. -func (r *Rule) SetAnnotations(m map[string]string) error { - return setLabels(m, &r.Annotations) -} - -// FilterType represents rule filter type. -type FilterType string - -// Available filter types. -const ( - Equal = FilterType("=") - Regex = FilterType("=~") -) - -// Filters represents filters slice. -type Filters []Filter - -// Value implements database/sql/driver Valuer interface. -func (t Filters) Value() (driver.Value, error) { return jsonValue(t) } - -// Scan implements database/sql Scanner interface. -func (t *Filters) Scan(src interface{}) error { return jsonScan(t, src) } - -// Filter represents rule filter. -type Filter struct { - Type FilterType `json:"type"` - Key string `json:"key"` - Val string `json:"value"` -} - -// Value implements database/sql/driver.Valuer interface. Should be defined on the value. -func (f Filter) Value() (driver.Value, error) { return jsonValue(f) } - -// Scan implements database/sql.Scanner interface. Should be defined on the pointer. -func (f *Filter) Scan(src interface{}) error { return jsonScan(f, src) } - -// AlertExprParamsValues represents rule parameters values slice. -type AlertExprParamsValues []AlertExprParamValue - -// Value implements database/sql/driver Valuer interface. -func (p AlertExprParamsValues) Value() (driver.Value, error) { return jsonValue(p) } - -// Scan implements database/sql Scanner interface. -func (p *AlertExprParamsValues) Scan(src interface{}) error { return jsonScan(p, src) } - -// AsStringMap convert param values to string map, where parameter name is a map key and parameter value is a map value. -func (p AlertExprParamsValues) AsStringMap() map[string]string { - m := make(map[string]string, len(p)) - for _, rp := range p { - var value string - switch rp.Type { - case Float: - value = fmt.Sprint(rp.FloatValue) - case Bool: - value = fmt.Sprint(rp.BoolValue) - case String: - value = rp.StringValue - } - // do not add `default:` to make exhaustive linter do its job - - m[rp.Name] = value - } - - return m -} - -// AlertExprParamValue represents rule parameter value. -type AlertExprParamValue struct { - Name string `json:"name"` - Type ParamType `json:"type"` - BoolValue bool `json:"bool"` - FloatValue float64 `json:"float"` - StringValue string `json:"string"` -} - -// Value implements database/sql/driver.Valuer interface. Should be defined on the value. -func (p AlertExprParamValue) Value() (driver.Value, error) { return jsonValue(p) } - -// Scan implements database/sql.Scanner interface. Should be defined on the pointer. -func (p *AlertExprParamValue) Scan(src interface{}) error { return jsonScan(p, src) } - -// ChannelIDs is a slice of notification channel ids. -type ChannelIDs []string - -// Value implements database/sql/driver Valuer interface. -func (t ChannelIDs) Value() (driver.Value, error) { return jsonValue(t) } - -// Scan implements database/sql Scanner interface. -func (t *ChannelIDs) Scan(src interface{}) error { return jsonScan(t, src) } - -// check interfaces. -var ( - _ reform.BeforeInserter = (*Rule)(nil) - _ reform.BeforeUpdater = (*Rule)(nil) - _ reform.AfterFinder = (*Rule)(nil) -) diff --git a/managed/models/rule_model_reform.go b/managed/models/rule_model_reform.go deleted file mode 100644 index e23b61961c..0000000000 --- a/managed/models/rule_model_reform.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gopkg.in/reform.v1. DO NOT EDIT. - -package models - -import ( - "fmt" - "strings" - - "gopkg.in/reform.v1" - "gopkg.in/reform.v1/parse" -) - -type ruleTableType struct { - s parse.StructInfo - z []interface{} -} - -// Schema returns a schema name in SQL database (""). -func (v *ruleTableType) Schema() string { - return v.s.SQLSchema -} - -// Name returns a view or table name in SQL database ("ia_rules"). -func (v *ruleTableType) Name() string { - return v.s.SQLName -} - -// Columns returns a new slice of column names for that view or table in SQL database. -func (v *ruleTableType) Columns() []string { - return []string{ - "id", - "name", - "summary", - "template_name", - "disabled", - "expr_template", - "params_definitions", - "params_values", - "default_for", - "for", - "default_severity", - "severity", - "custom_labels", - "labels", - "annotations", - "filters", - "channel_ids", - "created_at", - "updated_at", - } -} - -// NewStruct makes a new struct for that view or table. -func (v *ruleTableType) NewStruct() reform.Struct { - return new(Rule) -} - -// NewRecord makes a new record for that table. -func (v *ruleTableType) NewRecord() reform.Record { - return new(Rule) -} - -// PKColumnIndex returns an index of primary key column for that table in SQL database. -func (v *ruleTableType) PKColumnIndex() uint { - return uint(v.s.PKFieldIndex) -} - -// RuleTable represents ia_rules view or table in SQL database. -var RuleTable = &ruleTableType{ - s: parse.StructInfo{ - Type: "Rule", - SQLName: "ia_rules", - Fields: []parse.FieldInfo{ - {Name: "ID", Type: "string", Column: "id"}, - {Name: "Name", Type: "string", Column: "name"}, - {Name: "Summary", Type: "string", Column: "summary"}, - {Name: "TemplateName", Type: "string", Column: "template_name"}, - {Name: "Disabled", Type: "bool", Column: "disabled"}, - {Name: "ExprTemplate", Type: "string", Column: "expr_template"}, - {Name: "ParamsDefinitions", Type: "AlertExprParamsDefinitions", Column: "params_definitions"}, - {Name: "ParamsValues", Type: "AlertExprParamsValues", Column: "params_values"}, - {Name: "DefaultFor", Type: "time.Duration", Column: "default_for"}, - {Name: "For", Type: "time.Duration", Column: "for"}, - {Name: "DefaultSeverity", Type: "Severity", Column: "default_severity"}, - {Name: "Severity", Type: "Severity", Column: "severity"}, - {Name: "CustomLabels", Type: "[]uint8", Column: "custom_labels"}, - {Name: "Labels", Type: "[]uint8", Column: "labels"}, - {Name: "Annotations", Type: "[]uint8", Column: "annotations"}, - {Name: "Filters", Type: "Filters", Column: "filters"}, - {Name: "ChannelIDs", Type: "ChannelIDs", Column: "channel_ids"}, - {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, - {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}, - }, - PKFieldIndex: 0, - }, - z: new(Rule).Values(), -} - -// String returns a string representation of this struct or record. -func (s Rule) String() string { - res := make([]string, 19) - res[0] = "ID: " + reform.Inspect(s.ID, true) - res[1] = "Name: " + reform.Inspect(s.Name, true) - res[2] = "Summary: " + reform.Inspect(s.Summary, true) - res[3] = "TemplateName: " + reform.Inspect(s.TemplateName, true) - res[4] = "Disabled: " + reform.Inspect(s.Disabled, true) - res[5] = "ExprTemplate: " + reform.Inspect(s.ExprTemplate, true) - res[6] = "ParamsDefinitions: " + reform.Inspect(s.ParamsDefinitions, true) - res[7] = "ParamsValues: " + reform.Inspect(s.ParamsValues, true) - res[8] = "DefaultFor: " + reform.Inspect(s.DefaultFor, true) - res[9] = "For: " + reform.Inspect(s.For, true) - res[10] = "DefaultSeverity: " + reform.Inspect(s.DefaultSeverity, true) - res[11] = "Severity: " + reform.Inspect(s.Severity, true) - res[12] = "CustomLabels: " + reform.Inspect(s.CustomLabels, true) - res[13] = "Labels: " + reform.Inspect(s.Labels, true) - res[14] = "Annotations: " + reform.Inspect(s.Annotations, true) - res[15] = "Filters: " + reform.Inspect(s.Filters, true) - res[16] = "ChannelIDs: " + reform.Inspect(s.ChannelIDs, true) - res[17] = "CreatedAt: " + reform.Inspect(s.CreatedAt, true) - res[18] = "UpdatedAt: " + reform.Inspect(s.UpdatedAt, true) - return strings.Join(res, ", ") -} - -// Values returns a slice of struct or record field values. -// Returned interface{} values are never untyped nils. -func (s *Rule) Values() []interface{} { - return []interface{}{ - s.ID, - s.Name, - s.Summary, - s.TemplateName, - s.Disabled, - s.ExprTemplate, - s.ParamsDefinitions, - s.ParamsValues, - s.DefaultFor, - s.For, - s.DefaultSeverity, - s.Severity, - s.CustomLabels, - s.Labels, - s.Annotations, - s.Filters, - s.ChannelIDs, - s.CreatedAt, - s.UpdatedAt, - } -} - -// Pointers returns a slice of pointers to struct or record fields. -// Returned interface{} values are never untyped nils. -func (s *Rule) Pointers() []interface{} { - return []interface{}{ - &s.ID, - &s.Name, - &s.Summary, - &s.TemplateName, - &s.Disabled, - &s.ExprTemplate, - &s.ParamsDefinitions, - &s.ParamsValues, - &s.DefaultFor, - &s.For, - &s.DefaultSeverity, - &s.Severity, - &s.CustomLabels, - &s.Labels, - &s.Annotations, - &s.Filters, - &s.ChannelIDs, - &s.CreatedAt, - &s.UpdatedAt, - } -} - -// View returns View object for that struct. -func (s *Rule) View() reform.View { - return RuleTable -} - -// Table returns Table object for that record. -func (s *Rule) Table() reform.Table { - return RuleTable -} - -// PKValue returns a value of primary key for that record. -// Returned interface{} value is never untyped nil. -func (s *Rule) PKValue() interface{} { - return s.ID -} - -// PKPointer returns a pointer to primary key field for that record. -// Returned interface{} value is never untyped nil. -func (s *Rule) PKPointer() interface{} { - return &s.ID -} - -// HasPK returns true if record has non-zero primary key set, false otherwise. -func (s *Rule) HasPK() bool { - return s.ID != RuleTable.z[RuleTable.s.PKFieldIndex] -} - -// SetPK sets record primary key, if possible. -// -// Deprecated: prefer direct field assignment where possible: s.ID = pk. -func (s *Rule) SetPK(pk interface{}) { - reform.SetPK(s, pk) -} - -// check interfaces -var ( - _ reform.View = RuleTable - _ reform.Struct = (*Rule)(nil) - _ reform.Table = RuleTable - _ reform.Record = (*Rule)(nil) - _ fmt.Stringer = (*Rule)(nil) -) - -func init() { - parse.AssertUpToDate(&RuleTable.s, new(Rule)) -} diff --git a/managed/models/settings.go b/managed/models/settings.go index a0389a07a4..b821a2cc94 100644 --- a/managed/models/settings.go +++ b/managed/models/settings.go @@ -18,9 +18,7 @@ package models import ( "time" - "github.com/asaskevich/govalidator" "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/pkg/errors" ) // MetricsResolutions contains standard VictoriaMetrics metrics resolutions. @@ -40,11 +38,9 @@ type SaaS struct { STTCheckIntervals STTCheckIntervals `json:"stt_check_intervals"` } -// Alerting contains settings related to Alerting. +// Alerting contains settings related to Percona Alerting. type Alerting struct { - Disabled bool `json:"disabled"` - EmailAlertingSettings *EmailAlertingSettings `json:"email_settings"` - SlackAlertingSettings *SlackAlertingSettings `json:"slack_settings"` + Disabled bool `json:"disabled"` } // Settings contains PMM Server settings. @@ -102,42 +98,6 @@ type Settings struct { } `json:"access_control"` } -// EmailAlertingSettings represents email settings for Integrated Alerting. -type EmailAlertingSettings struct { - From string `json:"from"` - Smarthost string `json:"smarthost"` - Hello string `json:"hello"` - Username string `json:"username"` - Password string `json:"password"` - Identity string `json:"identity"` - Secret string `json:"secret"` - RequireTLS bool `json:"require_tls"` -} - -// Validate validates structure's fields. -func (e *EmailAlertingSettings) Validate() error { - if !govalidator.IsEmail(e.From) { - return errors.Errorf("invalid \"from\" email %q", e.From) - } - - if !govalidator.IsDialString(e.Smarthost) { - return errors.New("invalid server address, expected format host:port") - } - - if e.Hello != "" { - if !govalidator.IsHost(e.Hello) { - return errors.New("invalid hello field, expected valid host") - } - } - - return nil -} - -// SlackAlertingSettings represents Slack settings for Integrated Alerting. -type SlackAlertingSettings struct { - URL string `json:"url"` -} - // STTCheckIntervals represents intervals between STT checks. type STTCheckIntervals struct { StandardInterval time.Duration `json:"standard_interval"` diff --git a/managed/models/settings_helpers.go b/managed/models/settings_helpers.go index 056bc3bc5f..9892b28919 100644 --- a/managed/models/settings_helpers.go +++ b/managed/models/settings_helpers.go @@ -22,7 +22,6 @@ import ( "strings" "time" - "github.com/asaskevich/govalidator" "github.com/google/uuid" "github.com/pkg/errors" "gopkg.in/reform.v1" @@ -86,9 +85,9 @@ type ChangeSettingsParams struct { // Disable Azure Discover features. DisableAzurediscover bool - // Enable Integrated Alerting features. + // Enable Percona Alerting features. EnableAlerting bool - // Disable Integrated Alerting features. + // Disable Percona Alerting features. DisableAlerting bool // Enable Access Control features. @@ -96,16 +95,6 @@ type ChangeSettingsParams struct { // Disable Access Control features. DisableAccessControl bool - // Email config for Integrated Alerting. - EmailAlertingSettings *EmailAlertingSettings - // If true removes email alerting settings. - RemoveEmailAlertingSettings bool - - // Slack config for Integrated Alerting. - SlackAlertingSettings *SlackAlertingSettings - // If true removes Slack alerting settings. - RemoveSlackAlertingSettings bool - // EnableVMCache enables caching for vmdb search queries EnableVMCache bool // DisableVMCache disables caching for vmdb search queries @@ -273,21 +262,6 @@ func UpdateSettings(q reform.DBTX, params *ChangeSettingsParams) (*Settings, err settings.AccessControl.Enabled = true } - if params.RemoveEmailAlertingSettings { - settings.Alerting.EmailAlertingSettings = nil - } - - if params.RemoveSlackAlertingSettings { - settings.Alerting.SlackAlertingSettings = nil - } - - if params.EmailAlertingSettings != nil { - settings.Alerting.EmailAlertingSettings = params.EmailAlertingSettings - } - if params.SlackAlertingSettings != nil { - settings.Alerting.SlackAlertingSettings = params.SlackAlertingSettings - } - if params.DisableBackupManagement { settings.BackupManagement.Disabled = true } @@ -316,34 +290,6 @@ func lockRoleForChange(tx *reform.TX, roleID int) error { return nil } -func validateSlackAlertingSettings(params *ChangeSettingsParams) error { - if params.SlackAlertingSettings != nil && params.RemoveSlackAlertingSettings { - return errors.New("both slack_alerting_settings and remove_slack_alerting_settings are present") - } - - if params.SlackAlertingSettings == nil { - return nil - } - - if !govalidator.IsURL(params.SlackAlertingSettings.URL) { - return errors.New("invalid url value") - } - - return nil -} - -func validateEmailAlertingSettings(params *ChangeSettingsParams) error { - if params.EmailAlertingSettings != nil && params.RemoveEmailAlertingSettings { - return errors.New("both email_alerting_settings and remove_email_alerting_settings are present") - } - - if params.EmailAlertingSettings == nil { - return nil - } - - return params.EmailAlertingSettings.Validate() -} - // ValidateSettings validates settings changes. func ValidateSettings(params *ChangeSettingsParams) error { //nolint:cyclop if params.EnableUpdates && params.DisableUpdates { @@ -361,12 +307,6 @@ func ValidateSettings(params *ChangeSettingsParams) error { //nolint:cyclop if params.EnableAlerting && params.DisableAlerting { return errors.New("both enable_alerting and disable_alerting are present") } - if err := validateEmailAlertingSettings(params); err != nil { - return err - } - if err := validateSlackAlertingSettings(params); err != nil { - return err - } if params.EnableBackupManagement && params.DisableBackupManagement { return errors.New("both enable_backup_management and disable_backup_management are present") } diff --git a/managed/models/settings_helpers_test.go b/managed/models/settings_helpers_test.go index 81dd18299d..0474d3927b 100644 --- a/managed/models/settings_helpers_test.go +++ b/managed/models/settings_helpers_test.go @@ -19,14 +19,12 @@ import ( "testing" "time" - "github.com/brianvoe/gofakeit/v6" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/percona/pmm/managed/models" "github.com/percona/pmm/managed/utils/testdb" - "github.com/percona/pmm/managed/utils/tests" ) func TestSettings(t *testing.T) { @@ -345,131 +343,45 @@ func TestSettings(t *testing.T) { assert.True(t, ns.AccessControl.Enabled) }) - t.Run("Integrated Alerting settings validation", func(t *testing.T) { - emailSettings := &models.EmailAlertingSettings{ - From: tests.GenEmail(t), - Smarthost: "0.0.0.0:8080", - Hello: "smtp_host", - Username: "smtp_username", - Password: "smtp_password", - Secret: "smtp_secret", - } - slackSettings := &models.SlackAlertingSettings{URL: gofakeit.URL()} - ns, err := models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - EnableAlerting: true, - EmailAlertingSettings: emailSettings, - SlackAlertingSettings: slackSettings, - }) + t.Run("disable percona alerting", func(t *testing.T) { + s, err := models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{DisableAlerting: true}) require.NoError(t, err) - assert.False(t, ns.Alerting.Disabled) - assert.Equal(t, ns.Alerting.EmailAlertingSettings, emailSettings) - assert.Equal(t, ns.Alerting.SlackAlertingSettings, slackSettings) + assert.True(t, s.Alerting.Disabled) - // check that we don't lose settings on empty updates - ns, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{}) + ns, err := models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{EnableAlerting: true}) require.NoError(t, err) assert.False(t, ns.Alerting.Disabled) - assert.Equal(t, ns.Alerting.EmailAlertingSettings, emailSettings) - assert.Equal(t, ns.Alerting.SlackAlertingSettings, slackSettings) - - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - RemoveEmailAlertingSettings: true, - EmailAlertingSettings: emailSettings, - }) - var errInvalidArgument *models.InvalidArgumentError - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: both email_alerting_settings and remove_email_alerting_settings are present") - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - EmailAlertingSettings: &models.EmailAlertingSettings{ - From: "from", - Smarthost: "example.com:1234", - Hello: "example.com", - }, - }) - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: invalid \"from\" email \"from\"") - - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - EmailAlertingSettings: &models.EmailAlertingSettings{ - From: "from@example.com", - Smarthost: "@invalid-host", - Hello: "example.com", - }, - }) - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: invalid server address, expected format host:port") + }) - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - EmailAlertingSettings: &models.EmailAlertingSettings{ - From: "from@example.com", - Smarthost: "example.com:1234", - Hello: "%", - }, - }) - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: invalid hello field, expected valid host") + t.Run("Set PMM server ID", func(t *testing.T) { + t.Run("not set", func(t *testing.T) { + settings, err := models.GetSettings(sqlDB) + require.NoError(t, err) + require.NotNil(t, settings) + assert.Empty(t, settings.PMMServerID) - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - RemoveSlackAlertingSettings: true, - SlackAlertingSettings: slackSettings, - }) - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: both slack_alerting_settings and remove_slack_alerting_settings are present") + err = models.SetPMMServerID(sqlDB) + require.NoError(t, err) - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - SlackAlertingSettings: &models.SlackAlertingSettings{ - URL: "invalid@url", - }, + settings, err = models.GetSettings(sqlDB) + require.NoError(t, err) + require.NotNil(t, settings) + assert.NotEmpty(t, settings.PMMServerID) }) - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: invalid url value") + t.Run("already set", func(t *testing.T) { + settings, err := models.GetSettings(sqlDB) + require.NoError(t, err) + require.NotNil(t, settings) + pmmServerID := settings.PMMServerID - ns, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - DisableAlerting: true, - RemoveEmailAlertingSettings: true, - RemoveSlackAlertingSettings: true, - }) - require.NoError(t, err) - assert.Empty(t, ns.Alerting.EmailAlertingSettings) - assert.True(t, ns.Alerting.Disabled) + err = models.SetPMMServerID(sqlDB) + require.NoError(t, err) - _, err = models.UpdateSettings(sqlDB, &models.ChangeSettingsParams{ - DisableAlerting: true, - EnableAlerting: true, + settings, err = models.GetSettings(sqlDB) + require.NoError(t, err) + require.NotNil(t, settings) + assert.Equal(t, pmmServerID, settings.PMMServerID) }) - assert.True(t, errors.As(err, &errInvalidArgument)) - assert.EqualError(t, err, "invalid argument: both enable_alerting and disable_alerting are present") - }) - }) - - t.Run("Set PMM server ID", func(t *testing.T) { - t.Run("not set", func(t *testing.T) { - settings, err := models.GetSettings(sqlDB) - require.NoError(t, err) - require.NotNil(t, settings) - assert.Empty(t, settings.PMMServerID) - - err = models.SetPMMServerID(sqlDB) - require.NoError(t, err) - - settings, err = models.GetSettings(sqlDB) - require.NoError(t, err) - require.NotNil(t, settings) - assert.NotEmpty(t, settings.PMMServerID) - }) - t.Run("already set", func(t *testing.T) { - settings, err := models.GetSettings(sqlDB) - require.NoError(t, err) - require.NotNil(t, settings) - pmmServerID := settings.PMMServerID - - err = models.SetPMMServerID(sqlDB) - require.NoError(t, err) - - settings, err = models.GetSettings(sqlDB) - require.NoError(t, err) - require.NotNil(t, settings) - assert.Equal(t, pmmServerID, settings.PMMServerID) }) }) } diff --git a/managed/models/template_helpers_test.go b/managed/models/template_helpers_test.go index ab0782c364..4394cf8cce 100644 --- a/managed/models/template_helpers_test.go +++ b/managed/models/template_helpers_test.go @@ -177,30 +177,6 @@ func TestRuleTemplates(t *testing.T) { assert.Empty(t, templates) }) - t.Run("remove template that is used for some rule", func(t *testing.T) { - tx, err := db.Begin() - require.NoError(t, err) - defer func() { - require.NoError(t, tx.Rollback()) - }() - - q := tx.Querier - - template, err := models.CreateTemplate(q, createTemplateParams(uuid.New().String())) - require.NoError(t, err) - - channel := createChannel(t, q) - - _ = createRule(t, q, channel.ID, template) - - err = models.RemoveTemplate(q, template.Name) - require.NoError(t, err) - - templates, err := models.FindTemplates(q) - require.NoError(t, err) - assert.Empty(t, templates) - }) - t.Run("list", func(t *testing.T) { tx, err := db.Begin() require.NoError(t, err) @@ -281,26 +257,3 @@ func changeTemplateParams(name string) *models.ChangeTemplateParams { }, } } - -func createRule(t *testing.T, q *reform.Querier, channelID string, template *models.Template) string { //nolint:unparam - t.Helper() - rule, err := models.CreateRule(q, &models.CreateRuleParams{ - TemplateName: template.Name, - Disabled: true, - ParamsValues: []models.AlertExprParamValue{ - { - Name: "test", - Type: models.Float, - FloatValue: 3.14, - }, - }, - For: 5 * time.Second, - DefaultSeverity: models.Severity(common.Info), - Severity: models.Severity(common.Warning), - CustomLabels: map[string]string{"foo": "bar"}, - Filters: []models.Filter{{Type: models.Equal, Key: "value", Val: "10"}}, - ChannelIDs: []string{channelID}, - }) - require.NoError(t, err) - return rule.ID -} diff --git a/managed/models/template_model.go b/managed/models/template_model.go index 500774b965..fc1794f6a5 100644 --- a/managed/models/template_model.go +++ b/managed/models/template_model.go @@ -20,14 +20,15 @@ import ( "time" "github.com/percona-platform/saas/pkg/common" + "github.com/pkg/errors" "gopkg.in/reform.v1" ) //go:generate ../../bin/reform -// Template represents Integrated Alerting rule template. +// Template represents Percona Alerting rule template. // -//reform:ia_templates +//reform:alert_rule_templates type Template struct { Name string `reform:"name,pk"` Version uint32 `reform:"version"` @@ -119,6 +120,25 @@ type AlertExprParamDefinition struct { // StringParam *StringParam `json:"string_param"` } +// ParamType represents parameter type. +type ParamType string + +// Available parameter types. +const ( + Float = ParamType("float") + Bool = ParamType("bool") + String = ParamType("string") +) + +// ParamUnit parameter unit. +type ParamUnit string + +// Available parameter units. +const ( + Percent = ParamUnit("%") + Seconds = ParamUnit("s") +) + // BoolParam represents boolean template parameter. type BoolParam struct { Default *bool `json:"default,omitempty"` @@ -136,6 +156,35 @@ type StringParam struct { Default *string `json:"default,omitempty"` } +// Severity represents alert severity. +// Integer values is the same as common.Severity. Common constants can be used. +// Database representation is a string and is handled by Value and Scan methods below. +type Severity common.Severity + +// Value implements database/sql/driver Valuer interface. +func (s Severity) Value() (driver.Value, error) { + cs := common.Severity(s) + if err := cs.Validate(); err != nil { + return nil, err + } + return cs.String(), nil +} + +// Scan implements database/sql Scanner interface. +func (s *Severity) Scan(src interface{}) error { + switch src := src.(type) { + case string: + cs := common.ParseSeverity(src) + if err := cs.Validate(); err != nil { + return err + } + *s = Severity(cs) + return nil + default: + return errors.Errorf("expected string, got %T (%q)", src, src) + } +} + // Source represents template source. type Source string diff --git a/managed/models/template_model_reform.go b/managed/models/template_model_reform.go index 65e695524d..95b23a885e 100644 --- a/managed/models/template_model_reform.go +++ b/managed/models/template_model_reform.go @@ -20,7 +20,7 @@ func (v *templateTableType) Schema() string { return v.s.SQLSchema } -// Name returns a view or table name in SQL database ("ia_templates"). +// Name returns a view or table name in SQL database ("alert_rule_templates"). func (v *templateTableType) Name() string { return v.s.SQLName } @@ -59,11 +59,11 @@ func (v *templateTableType) PKColumnIndex() uint { return uint(v.s.PKFieldIndex) } -// TemplateTable represents ia_templates view or table in SQL database. +// TemplateTable represents alert_rule_templates view or table in SQL database. var TemplateTable = &templateTableType{ s: parse.StructInfo{ Type: "Template", - SQLName: "ia_templates", + SQLName: "alert_rule_templates", Fields: []parse.FieldInfo{ {Name: "Name", Type: "string", Column: "name"}, {Name: "Version", Type: "uint32", Column: "version"}, diff --git a/managed/services/alertmanager/alertmanager.go b/managed/services/alertmanager/alertmanager.go index 8a52c24a7a..37027a72c8 100644 --- a/managed/services/alertmanager/alertmanager.go +++ b/managed/services/alertmanager/alertmanager.go @@ -18,23 +18,19 @@ package alertmanager import ( "context" - "crypto/sha256" _ "embed" // for email templates - "encoding/hex" "fmt" "io" "net/http" "os" "os/exec" "path" - "sort" "strings" "time" "github.com/AlekSi/pointer" httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "github.com/percona/promconfig" "github.com/percona/promconfig/alertmanager" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -46,7 +42,6 @@ import ( "github.com/percona/pmm/api/alertmanager/amclient/alert" "github.com/percona/pmm/api/alertmanager/amclient/silence" "github.com/percona/pmm/api/alertmanager/ammodels" - "github.com/percona/pmm/managed/models" "github.com/percona/pmm/managed/services" "github.com/percona/pmm/managed/utils/dir" "github.com/percona/pmm/utils/pdeathsig" @@ -64,12 +59,8 @@ const ( alertmanagerConfigPath = "/etc/alertmanager.yml" alertmanagerBaseConfigPath = "/srv/alertmanager/alertmanager.base.yml" - receiverNameSeparator = " + " - // CheckFilter represents AlertManager filter for Checks/Advisor results. CheckFilter = "stt_check=1" - // IAFilter represents AlertManager filter for Integrated Alerts. - IAFilter = "ia=1" ) var notificationLabels = []string{ @@ -77,9 +68,6 @@ var notificationLabels = []string{ "alertgroup", "template_name", "severity", "agent_id", "agent_type", "job", } -//go:embed email_template.html -var emailTemplate string - // Service is responsible for interactions with Alertmanager. type Service struct { db *reform.DB @@ -258,12 +246,7 @@ func (svc *Service) loadBaseConfig() *alertmanager.Config { // marshalConfig marshals Alertmanager configuration. func (svc *Service) marshalConfig(base *alertmanager.Config) ([]byte, error) { - cfg := base - if err := svc.populateConfig(cfg); err != nil { - return nil, err - } - - b, err := yaml.Marshal(cfg) + b, err := yaml.Marshal(base) if err != nil { return nil, errors.Wrap(err, "can't marshal Alertmanager configuration file") } @@ -344,36 +327,6 @@ func (svc *Service) configAndReload(ctx context.Context, b []byte) error { return nil } -// convertTLSConfig converts model TLSConfig to promconfig TLSConfig. -// Resulting promconfig field -// - CAFile is set to corresponding model field if CAFileContent is not specified, `sha256(id).ca` otherwise. -// - CertFile is set to corresponding model field if CertFileContent is not specified, `sha256(id).crt` otherwise. -// - KeyFile is set to corresponding model field if KeyFileContent is not specified, `sha256(id).key` otherwise. -func convertTLSConfig(id string, tls *models.TLSConfig) promconfig.TLSConfig { - hashedIDBytes := sha256.Sum256([]byte(id)) - hashedID := hex.EncodeToString(hashedIDBytes[:]) - - caFile := tls.CAFile - if tls.CAFileContent != "" { - caFile = path.Join(alertmanagerCertDir, fmt.Sprintf("%s.ca", hashedID)) - } - certFile := tls.CertFile - if tls.CertFileContent != "" { - certFile = path.Join(alertmanagerCertDir, fmt.Sprintf("%s.crt", hashedID)) - } - keyFile := tls.KeyFile - if tls.KeyFileContent != "" { - keyFile = path.Join(alertmanagerCertDir, fmt.Sprintf("%s.key", hashedID)) - } - return promconfig.TLSConfig{ - CAFile: caFile, - CertFile: certFile, - KeyFile: keyFile, - ServerName: tls.ServerName, - InsecureSkipVerify: tls.InsecureSkipVerify, - } -} - func cleanupTLSConfigFiles() error { des, err := os.ReadDir(alertmanagerCertDir) if err != nil { @@ -392,332 +345,6 @@ func cleanupTLSConfigFiles() error { return nil } -func tlsConfig(c *models.Channel) *models.TLSConfig { - if c.WebHookConfig != nil && - c.WebHookConfig.HTTPConfig != nil && - c.WebHookConfig.HTTPConfig.TLSConfig != nil { - return c.WebHookConfig.HTTPConfig.TLSConfig - } - - return nil -} - -// recreateTLSConfigFiles cleanups old tls config files and creates new ones for each channel using the content -// from CAFileContent, CertFileContent, KeyFileContent if it is set. -func recreateTLSConfigFiles(chanMap map[string]*models.Channel) error { - fi, err := os.Stat(alertmanagerCertDir) - if err != nil { - return errors.WithStack(err) - } - - if err := cleanupTLSConfigFiles(); err != nil { - return errors.WithStack(err) - } - - for _, c := range chanMap { - tlsConfig := tlsConfig(c) - if tlsConfig == nil { - continue - } - - convertedTLSConfig := convertTLSConfig(c.ID, tlsConfig) - fileContentMap := map[string]string{ - convertedTLSConfig.CAFile: tlsConfig.CAFileContent, - convertedTLSConfig.CertFile: tlsConfig.CertFileContent, - convertedTLSConfig.KeyFile: tlsConfig.KeyFileContent, - } - for filePath, content := range fileContentMap { - if filePath == "" || content == "" { - continue - } - - if err := os.WriteFile(filePath, []byte(content), fi.Mode()); err != nil { - return errors.WithStack(err) - } - } - } - - return nil -} - -// populateConfig adds configuration from the database to cfg. -func (svc *Service) populateConfig(cfg *alertmanager.Config) error { - var settings *models.Settings - var rules []*models.Rule - var channels []*models.Channel - e := svc.db.InTransaction(func(tx *reform.TX) error { - var err error - settings, err = models.GetSettings(tx.Querier) - if err != nil { - return err - } - - rules, err = models.FindRules(tx.Querier) - if err != nil { - return err - } - - channels, err = models.FindChannels(tx.Querier) - if err != nil { - return err - } - return nil - }) - if e != nil { - return errors.Errorf("failed to fetch items from database: %v", e) - } - - chanMap := make(map[string]*models.Channel, len(channels)) - for _, ch := range channels { - chanMap[ch.ID] = ch - } - if err := recreateTLSConfigFiles(chanMap); err != nil { - return err - } - - if cfg.Global == nil { - cfg.Global = &alertmanager.GlobalConfig{} - } - - findReceiverIdx := func(name string) int { - for i, r := range cfg.Receivers { - if r.Name == name { - return i - } - } - return -1 - } - - // make sure that "empty" receiver is there - if findReceiverIdx("empty") == -1 { - cfg.Receivers = append(cfg.Receivers, &alertmanager.Receiver{ - Name: "empty", - }) - } - - disabledReceiver := &alertmanager.Receiver{ - Name: "disabled", - } - // Override if there is any user defined receiver `disabled`, needs to be empty - if disabledReceiverIdx := findReceiverIdx("disabled"); disabledReceiverIdx != -1 { - cfg.Receivers[disabledReceiverIdx] = disabledReceiver - } else { - cfg.Receivers = append(cfg.Receivers, disabledReceiver) - } - - // set default route if absent - if cfg.Route == nil { - cfg.Route = &alertmanager.Route{ - Receiver: "empty", - } - } - - if settings.Alerting.EmailAlertingSettings != nil { - svc.l.Warn("Setting global email config, any user defined changes to the base config might be overwritten.") - - cfg.Global.SMTPFrom = settings.Alerting.EmailAlertingSettings.From - cfg.Global.SMTPHello = settings.Alerting.EmailAlertingSettings.Hello - cfg.Global.SMTPSmarthost = settings.Alerting.EmailAlertingSettings.Smarthost - cfg.Global.SMTPAuthIdentity = settings.Alerting.EmailAlertingSettings.Identity - cfg.Global.SMTPAuthUsername = settings.Alerting.EmailAlertingSettings.Username - cfg.Global.SMTPAuthPassword = settings.Alerting.EmailAlertingSettings.Password - cfg.Global.SMTPAuthSecret = settings.Alerting.EmailAlertingSettings.Secret - cfg.Global.SMTPRequireTLS = settings.Alerting.EmailAlertingSettings.RequireTLS - } - - if settings.Alerting.SlackAlertingSettings != nil { - svc.l.Warn("Setting global Slack config, any user defined changes to the base config might be overwritten.") - - cfg.Global.SlackAPIURL = settings.Alerting.SlackAlertingSettings.URL - } - - recvSet := make(map[string]models.ChannelIDs) // stores unique combinations of channel IDs - for _, r := range rules { - // skip rules with 0 notification channels - if len(r.ChannelIDs) == 0 { - continue - } - - route := &alertmanager.Route{ - Match: map[string]string{ - "rule_id": r.ID, - }, - MatchRE: make(map[string]string), - } - - for _, f := range r.Filters { - switch f.Type { - case models.Equal: - route.Match[f.Key] = f.Val - case models.Regex: - route.MatchRE[f.Key] = f.Val - default: - svc.l.Warnf("Unhandled filter: %+v", f) - } - } - enabledChannels := make(models.ChannelIDs, 0, len(r.ChannelIDs)) - for _, chID := range r.ChannelIDs { - if channel, ok := chanMap[chID]; ok { - if !channel.Disabled { - enabledChannels = append(enabledChannels, chID) - } - } - } - // make sure same slice with different order are not considered unique. - sort.Strings(enabledChannels) - recv := strings.Join(enabledChannels, receiverNameSeparator) - if len(enabledChannels) == 0 { - recv = "disabled" - } else { - recvSet[recv] = enabledChannels - } - route.Receiver = recv - - cfg.Route.Routes = append(cfg.Route.Routes, route) - } - - receivers, err := svc.generateReceivers(chanMap, recvSet) - if err != nil { - return err - } - - cfg.Receivers = append(cfg.Receivers, receivers...) - return nil -} - -func formatSlackText(labels ...string) string { - const listEntryFormat = "{{ if .Labels.%[1]s }} • *%[1]s:* `{{ .Labels.%[1]s }}`\n{{ end }}" - - text := "{{ range .Alerts -}}\n" + - "*Alert:* {{ if .Labels.severity }}`{{ .Labels.severity | toUpper }}`{{ end }} {{ .Annotations.summary }}\n" + - "*Description:* {{ .Annotations.description }}\n" + - "*Details:*\n" - for _, l := range labels { - text += fmt.Sprintf(listEntryFormat, l) - } - - text += "\n\n{{ end }}" - - return text -} - -func formatPagerDutyFiringDetails(labels ...string) string { - const listEntryFormat = "{{ if .Labels.%[1]s }} - %[1]s: {{ .Labels.%[1]s }}\n{{ end }}" - - text := "{{ range .Alerts -}}\n" + - "Alert: {{ if .Labels.severity }}[{{ .Labels.severity | toUpper }}]{{ end }} {{ .Annotations.summary }}\n" + - "Description: {{ .Annotations.description }}\n" + - "Details:\n" - for _, l := range labels { - text += fmt.Sprintf(listEntryFormat, l) - } - - text += "\n\n{{ end }}" - - return text -} - -// generateReceivers takes the channel map and a unique set of rule combinations and generates a slice of receivers. -func (svc *Service) generateReceivers(chanMap map[string]*models.Channel, recvSet map[string]models.ChannelIDs) ([]*alertmanager.Receiver, error) { - receivers := make([]*alertmanager.Receiver, 0, len(recvSet)) - - for name, channelIDs := range recvSet { - recv := &alertmanager.Receiver{ - Name: name, - } - - for _, ch := range channelIDs { - channel, ok := chanMap[ch] - if !ok { - svc.l.Warnf("Missing channel %s, skip it.", ch) - continue - } - switch channel.Type { - case models.Email: - for _, to := range channel.EmailConfig.To { - recv.EmailConfigs = append(recv.EmailConfigs, &alertmanager.EmailConfig{ - NotifierConfig: alertmanager.NotifierConfig{ - SendResolved: channel.EmailConfig.SendResolved, - }, - To: to, - HTML: emailTemplate, - Headers: map[string]string{ - "Subject": `[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]`, - }, - }) - } - - case models.PagerDuty: - pdConfig := &alertmanager.PagerdutyConfig{ - NotifierConfig: alertmanager.NotifierConfig{ - SendResolved: channel.PagerDutyConfig.SendResolved, - }, - Description: `[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]` + - "{{ range .Alerts -}}{{ if .Labels.severity }}[{{ .Labels.severity | toUpper }}]{{ end }} {{ .Annotations.summary }}{{ end }}", - Details: map[string]string{ - "firing": formatPagerDutyFiringDetails(notificationLabels...), - }, - } - if channel.PagerDutyConfig.RoutingKey != "" { - pdConfig.RoutingKey = channel.PagerDutyConfig.RoutingKey - } - if channel.PagerDutyConfig.ServiceKey != "" { - pdConfig.ServiceKey = channel.PagerDutyConfig.ServiceKey - } - recv.PagerdutyConfigs = append(recv.PagerdutyConfigs, pdConfig) - - case models.Slack: - recv.SlackConfigs = append(recv.SlackConfigs, &alertmanager.SlackConfig{ - NotifierConfig: alertmanager.NotifierConfig{ - SendResolved: channel.SlackConfig.SendResolved, - }, - Channel: channel.SlackConfig.Channel, - Title: `[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]`, - Text: formatSlackText(notificationLabels...), - }) - - case models.WebHook: - webhookConfig := &alertmanager.WebhookConfig{ - NotifierConfig: alertmanager.NotifierConfig{ - SendResolved: channel.WebHookConfig.SendResolved, - }, - URL: channel.WebHookConfig.URL, - MaxAlerts: uint64(channel.WebHookConfig.MaxAlerts), - } - - if channel.WebHookConfig.HTTPConfig != nil { - webhookConfig.HTTPConfig = promconfig.HTTPClientConfig{ - BearerToken: channel.WebHookConfig.HTTPConfig.BearerToken, - BearerTokenFile: channel.WebHookConfig.HTTPConfig.BearerTokenFile, - ProxyURL: channel.WebHookConfig.HTTPConfig.ProxyURL, - } - if channel.WebHookConfig.HTTPConfig.BasicAuth != nil { - webhookConfig.HTTPConfig.BasicAuth = &promconfig.BasicAuth{ - Username: channel.WebHookConfig.HTTPConfig.BasicAuth.Username, - Password: channel.WebHookConfig.HTTPConfig.BasicAuth.Password, - PasswordFile: channel.WebHookConfig.HTTPConfig.BasicAuth.PasswordFile, - } - } - if channel.WebHookConfig.HTTPConfig.TLSConfig != nil { - webhookConfig.HTTPConfig.TLSConfig = convertTLSConfig(channel.ID, - channel.WebHookConfig.HTTPConfig.TLSConfig) - } - } - - recv.WebhookConfigs = append(recv.WebhookConfigs, webhookConfig) - - default: - return nil, errors.Errorf("invalid channel type: %q", channel.Type) - } - } - - receivers = append(receivers, recv) - } - - sort.Slice(receivers, func(i, j int) bool { return receivers[i].Name < receivers[j].Name }) - return receivers, nil -} - // SendAlerts sends given alerts. It is the caller's responsibility // to call this method every now and then. func (svc *Service) SendAlerts(ctx context.Context, alerts ammodels.PostableAlerts) { @@ -745,9 +372,6 @@ func (svc *Service) GetAlerts(ctx context.Context, fp *services.FilterParams) ([ if fp.IsCheck { alertParams.Filter = append(alertParams.Filter, CheckFilter) } - if fp.IsIA { - alertParams.Filter = append(alertParams.Filter, IAFilter) - } if fp.ServiceID != "" { alertParams.Filter = append(alertParams.Filter, fmt.Sprintf("service_id=\"%s\"", fp.ServiceID)) } diff --git a/managed/services/alertmanager/alertmanager_test.go b/managed/services/alertmanager/alertmanager_test.go index f3461dcb03..0ad493e571 100644 --- a/managed/services/alertmanager/alertmanager_test.go +++ b/managed/services/alertmanager/alertmanager_test.go @@ -17,21 +17,14 @@ package alertmanager import ( "context" - "fmt" - "os" "strings" "testing" - "time" - "github.com/percona-platform/saas/pkg/alert" - "github.com/percona-platform/saas/pkg/common" - "github.com/percona/promconfig" "github.com/percona/promconfig/alertmanager" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/reform.v1" "gopkg.in/reform.v1/dialects/postgresql" - "gopkg.in/yaml.v3" "github.com/percona/pmm/managed/models" "github.com/percona/pmm/managed/utils/testdb" @@ -353,7 +346,7 @@ func marshalAndValidate(t *testing.T, svc *Service, base *alertmanager.Config) s return string(b) } -func TestPopulateConfig(t *testing.T) { +func TestConfig(t *testing.T) { New(nil).GenerateBaseConfigs() // this method should not use database t.Run("without receivers and routes", func(t *testing.T) { @@ -380,399 +373,8 @@ route: continue: false receivers: - name: empty - - name: disabled templates: [] `) + "\n" assert.Equal(t, expected, actual, "actual:\n%s", actual) }) - - t.Run("with receivers and routes", func(t *testing.T) { - tests.SetTestIDReader(t) - sqlDB := testdb.Open(t, models.SkipFixtures, nil) - db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) - svc := New(db) - - channel1, err := models.CreateChannel(db.Querier, &models.CreateChannelParams{ - Summary: "channel1", - EmailConfig: &models.EmailConfig{ - To: []string{"test@test.test", "test2@test.test"}, - }, - Disabled: false, - }) - require.NoError(t, err) - - channel2, err := models.CreateChannel(db.Querier, &models.CreateChannelParams{ - Summary: "channel2", - PagerDutyConfig: &models.PagerDutyConfig{ - RoutingKey: "ms-pagerduty-dev", - }, - Disabled: false, - }) - require.NoError(t, err) - - channel3, err := models.CreateChannel(db.Querier, &models.CreateChannelParams{ - Summary: "channel3", - PagerDutyConfig: &models.PagerDutyConfig{ - RoutingKey: "ms-pagerduty-dev", - }, - Disabled: true, - }) - require.NoError(t, err) - - tlsConfig := &models.TLSConfig{ - CAFileContent: "cafilecontent", - CertFileContent: "certfilecontent", - KeyFileContent: "keyfilecontent", - } - channel4, err := models.CreateChannel(db.Querier, &models.CreateChannelParams{ - Summary: "channel4", - WebHookConfig: &models.WebHookConfig{ - URL: "https://example.com", - HTTPConfig: &models.HTTPConfig{ - TLSConfig: tlsConfig, - }, - }, - Disabled: false, - }) - require.NoError(t, err) - - _, err = models.CreateTemplate(db.Querier, &models.CreateTemplateParams{ - Template: &alert.Template{ - Name: "test_template", - Version: 1, - Summary: "summary", - Tiers: []common.Tier{common.Anonymous}, - Expr: "expr", - Params: []alert.Parameter{{ - Name: "param", - Summary: "param summary", - Unit: "%", - Type: alert.Float, - Range: []interface{}{float64(10), float64(100)}, - Value: float64(50), - }}, - For: promconfig.Duration(3 * time.Second), - Severity: common.Warning, - Labels: map[string]string{"foo": "bar"}, - Annotations: nil, - }, - Source: "USER_FILE", - }) - require.NoError(t, err) - - rule1, err := models.CreateRule(db.Querier, &models.CreateRuleParams{ - TemplateName: "test_template", - Disabled: true, - ParamsValues: []models.AlertExprParamValue{{ - Name: "test", - Type: models.Float, - FloatValue: 3.14, - }}, - For: 5 * time.Second, - DefaultSeverity: models.Severity(common.Warning), - Severity: models.Severity(common.Warning), - CustomLabels: map[string]string{ - "foo": "bar", - }, - Filters: []models.Filter{{ - Type: models.Equal, - Key: "service_name", - Val: "mysql1", - }}, - ChannelIDs: []string{channel1.ID, channel2.ID}, - }) - require.NoError(t, err) - - // create another rule with same channelIDs to check for redundant receivers. - rule2, err := models.CreateRule(db.Querier, &models.CreateRuleParams{ - TemplateName: "test_template", - Disabled: true, - ParamsValues: []models.AlertExprParamValue{{ - Name: "test", - Type: models.Float, - FloatValue: 3.14, - }}, - For: 5 * time.Second, - DefaultSeverity: models.Severity(common.Warning), - Severity: models.Severity(common.Warning), - CustomLabels: map[string]string{ - "foo": "baz", - }, - Filters: []models.Filter{{ - Type: models.Equal, - Key: "service_name", - Val: "mysql2", - }}, - ChannelIDs: []string{channel1.ID, channel2.ID, channel3.ID, channel4.ID}, - }) - require.NoError(t, err) - - // create another rule without channelID and check if it is absent in the config. - _, err = models.CreateRule(db.Querier, &models.CreateRuleParams{ - TemplateName: "test_template", - Disabled: true, - ParamsValues: []models.AlertExprParamValue{{ - Name: "test", - Type: models.Float, - FloatValue: 3.14, - }}, - For: 5 * time.Second, - DefaultSeverity: models.Severity(common.Warning), - Severity: models.Severity(common.Warning), - CustomLabels: map[string]string{ - "foo": "baz", - }, - }) - require.NoError(t, err) - - // CreateRule with disabled channel - rule4, err := models.CreateRule(db.Querier, &models.CreateRuleParams{ - TemplateName: "test_template", - Disabled: true, - ParamsValues: []models.AlertExprParamValue{{ - Name: "test", - Type: models.Float, - FloatValue: 3.14, - }}, - Filters: []models.Filter{{ - Type: models.Equal, - Key: "service_name", - Val: "mysql3", - }}, - For: 5 * time.Second, - DefaultSeverity: models.Severity(common.Warning), - Severity: models.Severity(common.Warning), - CustomLabels: map[string]string{ - "foo": "baz", - }, - ChannelIDs: []string{channel3.ID}, - }) - require.NoError(t, err) - - _, err = models.UpdateSettings(db.Querier, &models.ChangeSettingsParams{ - EmailAlertingSettings: &models.EmailAlertingSettings{ - From: "from@test.com", - Smarthost: "1.2.3.4:80", - Hello: "host", - Username: "user", - Password: "password", - Identity: "id", - Secret: "secret", - RequireTLS: true, - }, - SlackAlertingSettings: &models.SlackAlertingSettings{ - URL: "https://hooks.slack.com/services/abc/456/xyz", - }, - }) - require.NoError(t, err) - - actual := marshalAndValidate(t, svc, svc.loadBaseConfig()) - convertedTLSConfig := convertTLSConfig(channel4.ID, tlsConfig) - - tlsFileContents := []struct { - file string - content string - }{ - { - file: convertedTLSConfig.CAFile, - content: "cafilecontent", - }, - { - file: convertedTLSConfig.CertFile, - content: "certfilecontent", - }, - { - file: convertedTLSConfig.KeyFile, - content: "keyfilecontent", - }, - } - for _, f := range tlsFileContents { - actualContent, err := os.ReadFile(f.file) - require.NoError(t, err) - assert.Equal(t, f.content, string(actualContent)) - } - - pagerDutyConfigs := ` pagerduty_configs: - - send_resolved: false - routing_key: ms-pagerduty-dev - description: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]{{ range .Alerts -}}{{ if .Labels.severity }}[{{ .Labels.severity | toUpper }}]{{ end }} {{ .Annotations.summary }}{{ end }}' - details: - firing: |- - {{ range .Alerts -}} - Alert: {{ if .Labels.severity }}[{{ .Labels.severity | toUpper }}]{{ end }} {{ .Annotations.summary }} - Description: {{ .Annotations.description }} - Details: - {{ if .Labels.node_name }} - node_name: {{ .Labels.node_name }} - {{ end }}{{ if .Labels.node_id }} - node_id: {{ .Labels.node_id }} - {{ end }}{{ if .Labels.service_name }} - service_name: {{ .Labels.service_name }} - {{ end }}{{ if .Labels.service_id }} - service_id: {{ .Labels.service_id }} - {{ end }}{{ if .Labels.service_type }} - service_type: {{ .Labels.service_type }} - {{ end }}{{ if .Labels.rule_id }} - rule_id: {{ .Labels.rule_id }} - {{ end }}{{ if .Labels.alertgroup }} - alertgroup: {{ .Labels.alertgroup }} - {{ end }}{{ if .Labels.template_name }} - template_name: {{ .Labels.template_name }} - {{ end }}{{ if .Labels.severity }} - severity: {{ .Labels.severity }} - {{ end }}{{ if .Labels.agent_id }} - agent_id: {{ .Labels.agent_id }} - {{ end }}{{ if .Labels.agent_type }} - agent_type: {{ .Labels.agent_type }} - {{ end }}{{ if .Labels.job }} - job: {{ .Labels.job }} - {{ end }} - - {{ end }}` - - expected := strings.TrimSpace(fmt.Sprintf(` -# Managed by pmm-managed. DO NOT EDIT. ---- -global: - resolve_timeout: 0s - smtp_from: from@test.com - smtp_hello: host - smtp_smarthost: 1.2.3.4:80 - smtp_auth_username: user - smtp_auth_password: password - smtp_auth_secret: secret - smtp_auth_identity: id - smtp_require_tls: true - slack_api_url: https://hooks.slack.com/services/abc/456/xyz -route: - receiver: empty - continue: false - routes: - - receiver: %[1]s + %[2]s - match: - rule_id: %[3]s - service_name: mysql1 - continue: false - - receiver: %[1]s + %[2]s + %[8]s - match: - rule_id: %[4]s - service_name: mysql2 - continue: false - - receiver: disabled - match: - rule_id: %[5]s - service_name: mysql3 - continue: false -receivers: - - name: empty - - name: disabled - - name: %[1]s + %[2]s - email_configs: - - send_resolved: false - to: test@test.test - headers: - Subject: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]' - html: %[12]s - - send_resolved: false - to: test2@test.test - headers: - Subject: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]' - html: %[12]s -`+pagerDutyConfigs+` - - name: %[6]s + %[7]s + %[8]s - email_configs: - - send_resolved: false - to: test@test.test - headers: - Subject: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]' - html: %[12]s - - send_resolved: false - to: test2@test.test - headers: - Subject: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]' - html: %[12]s -`+pagerDutyConfigs+` - webhook_configs: - - send_resolved: false - http_config: - tls_config: - ca_file: %[9]s - cert_file: %[10]s - key_file: %[11]s - insecure_skip_verify: false - follow_redirects: false - url: https://example.com - max_alerts: 0 -templates: []`, channel1.ID, channel2.ID, rule1.ID, rule2.ID, rule4.ID, channel1.ID, channel2.ID, channel4.ID, - tlsFileContents[0].file, tlsFileContents[1].file, tlsFileContents[2].file, htmlTemplate)) + "\n" - assert.Equal(t, expected, actual, "actual:\n%s", actual) - }) -} - -func TestGenerateReceivers(t *testing.T) { - t.Parallel() - - chanMap := map[string]*models.Channel{ - "1": { - ID: "1", - Type: models.Slack, - SlackConfig: &models.SlackConfig{ - Channel: "channel1", - }, - }, - "2": { - ID: "2", - Type: models.Slack, - SlackConfig: &models.SlackConfig{ - Channel: "channel2", - }, - }, - "3": { - ID: "3", - Type: models.Slack, - SlackConfig: &models.SlackConfig{ - Channel: "channel3", - }, - Disabled: true, - }, - } - recvSet := map[string]models.ChannelIDs{ - "1": {"1"}, - "2": {"2"}, - "1+2": {"1", "2"}, - } - s := New(nil) - actualR, err := s.generateReceivers(chanMap, recvSet) - require.NoError(t, err) - actual, err := yaml.Marshal(actualR) - require.NoError(t, err) - - slackConfigs := func(channelName string) string { - return fmt.Sprintf(` - send_resolved: false - channel: %s - title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]' - text: |- - {{ range .Alerts -}} - *Alert:* {{ if .Labels.severity }}`+"`{{ .Labels.severity | toUpper }}`"+`{{ end }} {{ .Annotations.summary }} - *Description:* {{ .Annotations.description }} - *Details:* - {{ if .Labels.node_name }} • *node_name:* `+"`{{ .Labels.node_name }}`"+` - {{ end }}{{ if .Labels.node_id }} • *node_id:* `+"`{{ .Labels.node_id }}`"+` - {{ end }}{{ if .Labels.service_name }} • *service_name:* `+"`{{ .Labels.service_name }}`"+` - {{ end }}{{ if .Labels.service_id }} • *service_id:* `+"`{{ .Labels.service_id }}`"+` - {{ end }}{{ if .Labels.service_type }} • *service_type:* `+"`{{ .Labels.service_type }}`"+` - {{ end }}{{ if .Labels.rule_id }} • *rule_id:* `+"`{{ .Labels.rule_id }}`"+` - {{ end }}{{ if .Labels.alertgroup }} • *alertgroup:* `+"`{{ .Labels.alertgroup }}`"+` - {{ end }}{{ if .Labels.template_name }} • *template_name:* `+"`{{ .Labels.template_name }}`"+` - {{ end }}{{ if .Labels.severity }} • *severity:* `+"`{{ .Labels.severity }}`"+` - {{ end }}{{ if .Labels.agent_id }} • *agent_id:* `+"`{{ .Labels.agent_id }}`"+` - {{ end }}{{ if .Labels.agent_type }} • *agent_type:* `+"`{{ .Labels.agent_type }}`"+` - {{ end }}{{ if .Labels.job }} • *job:* `+"`{{ .Labels.job }}`"+` - {{ end }} - - {{ end }} - short_fields: false - link_names: false`, channelName) - } - - expected := strings.TrimSpace(` -- name: "1" - slack_configs: -`+slackConfigs("channel1")+` -- name: 1+2 - slack_configs: -`+slackConfigs("channel1")+` -`+slackConfigs("channel2")+` -- name: "2" - slack_configs: -`+slackConfigs("channel2")) + "\n" - assert.Equal(t, expected, string(actual), "actual:\n%s", actual) } diff --git a/managed/services/alertmanager/email_template.html b/managed/services/alertmanager/email_template.html deleted file mode 100644 index 72b699f714..0000000000 --- a/managed/services/alertmanager/email_template.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - {{ template "__subject" . }} - - - - - - - - - - -
-
- - - {{ if eq .CommonLabels.severity "notice" }} - - - - - -
- {{ else if eq .CommonLabels.severity "warning" }} - - {{ else if eq .CommonLabels.severity "error" }} - - {{ else }} - - {{ end }} - You have {{ .Alerts | len }} {{ .CommonLabels.severity }} alert{{ if gt (len .Alerts) 1 }}s{{ end }} firing -
- - - - - {{ range .Alerts.Firing }} - - - - {{ end }} -
- View in {{ template "__alertmanager" . }} -
-
-
- Alert: - {{ if .Labels.severity }} - [{{ .Labels.severity | toUpper }}] - {{ end }} - {{ .Annotations.summary }} -
-
- Description: - {{ .Annotations.description }} -
-
- Violated rule: - {{ .Annotations.rule }} -
- Details:
- {{ with .Labels }} - {{ with .Remove (stringSlice "alertname" "ia" "instance" "node_type" "server") }} - {{ range .SortedPairs }} - • {{ .Name }}: {{ .Value }}
- {{ end }} - {{ end }} - {{ end }} -
-
- - -
-
- - - - diff --git a/managed/services/alertmanager/emailer.go b/managed/services/alertmanager/emailer.go deleted file mode 100644 index e07da67a3f..0000000000 --- a/managed/services/alertmanager/emailer.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package alertmanager - -import ( - "context" - "fmt" - "net" - "net/url" - "time" - - "github.com/prometheus/alertmanager/config" - "github.com/prometheus/alertmanager/notify/email" - "github.com/prometheus/alertmanager/template" - "github.com/prometheus/alertmanager/types" - "github.com/prometheus/common/model" - "github.com/sirupsen/logrus" - - "github.com/percona/pmm/managed/models" -) - -// Emailer is responsible for sending emails using alertmanger Email notifier. -type Emailer struct { - l *logrus.Logger -} - -// NewEmailer creates Emailer instance. -func NewEmailer(l *logrus.Logger) *Emailer { - return &Emailer{l: l} -} - -type loggerFunc func(level logrus.Level, args ...interface{}) - -// Log performs logging operation to logrus logger. -func (f loggerFunc) Log(values ...interface{}) error { - f(logrus.DebugLevel, values) - return nil -} - -// Send sends an email to `emailTo` recipient using given settings. -func (e *Emailer) Send(ctx context.Context, settings *models.EmailAlertingSettings, emailTo string) error { - host, port, err := net.SplitHostPort(settings.Smarthost) - if err != nil { - return models.NewInvalidArgumentError("invalid smarthost: %q", err.Error()) - } - - if port == "" { - return models.NewInvalidArgumentError("address %q: port cannot be empty", port) - } - - emailConfig := &config.EmailConfig{ - NotifierConfig: config.NotifierConfig{}, - To: emailTo, - From: settings.From, - Hello: settings.Hello, - Smarthost: config.HostPort{ - Host: host, - Port: port, - }, - AuthUsername: settings.Username, - AuthPassword: config.Secret(settings.Password), - AuthSecret: config.Secret(settings.Secret), - AuthIdentity: settings.Identity, - Headers: map[string]string{ - "Subject": `Test alert.`, - }, - HTML: emailTemplate, - RequireTLS: &settings.RequireTLS, - } - - tmpl, err := template.FromGlobs([]string{"*"}) - if err != nil { - return err - } - tmpl.ExternalURL, err = url.Parse("https://example.com") - if err != nil { - return err - } - - alertmanagerEmail := email.New(emailConfig, tmpl, loggerFunc(e.l.Log)) - if _, err := alertmanagerEmail.Notify(ctx, &types.Alert{ - Alert: model.Alert{ - Labels: model.LabelSet{ - model.AlertNameLabel: model.LabelValue(fmt.Sprintf("Test alert %s", time.Now().String())), - "severity": "notice", - }, - Annotations: model.LabelSet{ - "summary": "This is a test alert.", - "description": "Long description.", - "rule": "example-violated-rule", - }, - StartsAt: time.Now(), - EndsAt: time.Now().Add(time.Minute), - }, - Timeout: true, - }); err != nil { - return models.NewInvalidArgumentError(err.Error()) - } - - return nil -} diff --git a/managed/services/errors.go b/managed/services/errors.go index 9de5a80d00..5e752cd96c 100644 --- a/managed/services/errors.go +++ b/managed/services/errors.go @@ -20,9 +20,10 @@ import "github.com/pkg/errors" var ( // ErrAdvisorsDisabled means that advisors checks are disabled and can't be executed. ErrAdvisorsDisabled = errors.New("Advisor checks are disabled") + // ErrLocationFolderPairAlreadyUsed returned when location-folder pair already in use and cannot be used for backup. ErrLocationFolderPairAlreadyUsed = errors.New("location-folder pair already used") - // ErrAlertingDisabled means Integrated Alerting is disabled and IA APIs can't be executed. - ErrAlertingDisabled = errors.New("Alerting is disabled") // TODO Looks like this error is unused. + // ErrAlertingDisabled means Percona Alerting is disabled and its APIs can't be executed. + ErrAlertingDisabled = errors.New("Alerting is disabled") ) diff --git a/managed/services/grafana/client.go b/managed/services/grafana/client.go index 20333cf1bb..684fe94864 100644 --- a/managed/services/grafana/client.go +++ b/managed/services/grafana/client.go @@ -491,6 +491,41 @@ func (c *Client) GetDatasourceUIDByID(ctx context.Context, id int64) (string, er return ds.UID, nil } +// CreateFolder creates grafana folder. +func (c *Client) CreateFolder(ctx context.Context, title string) (*gapi.Folder, error) { + grafanaClient, err := c.createGrafanaClient(ctx) + if err != nil { + return nil, errors.Wrap(err, "failed to create grafana client") + } + + folder, err := grafanaClient.NewFolder(title) + if err != nil { + return nil, errors.Wrap(err, "failed to create folder") + } + + return &folder, nil +} + +// DeleteFolder deletes grafana folder. +func (c *Client) DeleteFolder(ctx context.Context, id string, force bool) error { + grafanaClient, err := c.createGrafanaClient(ctx) + if err != nil { + return errors.Wrap(err, "failed to create grafana client") + } + + params := make(url.Values) + if force { + params.Add("forceDeleteRules", "true") + } + + err = grafanaClient.DeleteFolder(id, params) + if err != nil { + return errors.Wrap(err, "failed to delete folder") + } + + return nil +} + // GetFolderByUID returns folder with given UID. func (c *Client) GetFolderByUID(ctx context.Context, uid string) (*gapi.Folder, error) { grafanaClient, err := c.createGrafanaClient(ctx) diff --git a/managed/services/management/alerting/service.go b/managed/services/management/alerting/service.go index 3c5aca955f..cd972dd2b7 100644 --- a/managed/services/management/alerting/service.go +++ b/managed/services/management/alerting/service.go @@ -123,7 +123,7 @@ func (s *Service) GetTemplates() map[string]models.Template { return res } -// CollectTemplates collects IA rule templates from various sources like: +// CollectTemplates collects Percona Alerting rule templates from various sources like: // builtin templates: read from the generated variable of type embed.FS // SaaS templates: templates downloaded from checks service. // User file templates: read from yaml files created by the user in `/srv/alerting/templates`. @@ -184,7 +184,7 @@ func (s *Service) loadTemplatesFromAssets(ctx context.Context) ([]*models.Templa return nil } - data, err := fs.ReadFile(data.IATemplates, path) + data, err := fs.ReadFile(data.AlertRuleTemplates, path) if err != nil { return errors.Wrapf(err, "failed to read rule template asset: %s", path) } @@ -230,7 +230,8 @@ func (s *Service) loadTemplatesFromAssets(ctx context.Context) ([]*models.Templa res = append(res, tm) return nil } - if err := fs.WalkDir(data.IATemplates, ".", walkDirFunc); err != nil { + err := fs.WalkDir(data.AlertRuleTemplates, ".", walkDirFunc) + if err != nil { return nil, err } return res, nil @@ -298,7 +299,7 @@ func (s *Service) loadTemplatesFromDB() ([]*models.Template, error) { return templates, nil } -// downloadTemplates downloads alerting templates from SaaS. +// downloadTemplates downloads Percona Alerting templates from Percona Portal. func (s *Service) downloadTemplates(ctx context.Context) ([]*models.Template, error) { settings, err := models.GetSettings(s.db) if err != nil { @@ -412,6 +413,15 @@ func convertParamType(t models.ParamType) alerting.ParamType { // ListTemplates returns a list of all collected Alert Rule Templates. func (s *Service) ListTemplates(ctx context.Context, req *alerting.ListTemplatesRequest) (*alerting.ListTemplatesResponse, error) { + settings, err := models.GetSettings(s.db) + if err != nil { + return nil, err + } + + if settings.Alerting.Disabled { + return nil, services.ErrAlertingDisabled + } + var pageIndex int var pageSize int if req.PageParams != nil { @@ -468,6 +478,15 @@ func (s *Service) ListTemplates(ctx context.Context, req *alerting.ListTemplates // CreateTemplate creates a new template. func (s *Service) CreateTemplate(ctx context.Context, req *alerting.CreateTemplateRequest) (*alerting.CreateTemplateResponse, error) { + settings, err := models.GetSettings(s.db) + if err != nil { + return nil, err + } + + if settings.Alerting.Disabled { + return nil, services.ErrAlertingDisabled + } + pParams := &alert.ParseParams{ DisallowUnknownFields: true, DisallowInvalidTemplates: true, @@ -513,6 +532,15 @@ func (s *Service) CreateTemplate(ctx context.Context, req *alerting.CreateTempla // UpdateTemplate updates existing template, previously created via API. func (s *Service) UpdateTemplate(ctx context.Context, req *alerting.UpdateTemplateRequest) (*alerting.UpdateTemplateResponse, error) { + settings, err := models.GetSettings(s.db) + if err != nil { + return nil, err + } + + if settings.Alerting.Disabled { + return nil, services.ErrAlertingDisabled + } + parseParams := &alert.ParseParams{ DisallowUnknownFields: true, DisallowInvalidTemplates: true, @@ -555,6 +583,15 @@ func (s *Service) UpdateTemplate(ctx context.Context, req *alerting.UpdateTempla // DeleteTemplate deletes existing, previously created via API. func (s *Service) DeleteTemplate(ctx context.Context, req *alerting.DeleteTemplateRequest) (*alerting.DeleteTemplateResponse, error) { + settings, err := models.GetSettings(s.db) + if err != nil { + return nil, err + } + + if settings.Alerting.Disabled { + return nil, services.ErrAlertingDisabled + } + e := s.db.InTransaction(func(tx *reform.TX) error { return models.RemoveTemplate(tx.Querier, req.Name) }) @@ -643,6 +680,15 @@ func convertParamDefinitions(l *logrus.Entry, params models.AlertExprParamsDefin // CreateRule creates alert rule from the given template. func (s *Service) CreateRule(ctx context.Context, req *alerting.CreateRuleRequest) (*alerting.CreateRuleResponse, error) { + settings, err := models.GetSettings(s.db) + if err != nil { + return nil, err + } + + if settings.Alerting.Disabled { + return nil, services.ErrAlertingDisabled + } + if req.TemplateName == "" { return nil, status.Error(codes.InvalidArgument, "Template name should be specified.") } @@ -765,10 +811,10 @@ func (s *Service) CreateRule(ctx context.Context, req *alerting.CreateRuleReques return &alerting.CreateRuleResponse{}, nil } -func convertParamsValuesToModel(params []*alerting.ParamValue) (models.AlertExprParamsValues, error) { - ruleParams := make(models.AlertExprParamsValues, len(params)) +func convertParamsValuesToModel(params []*alerting.ParamValue) (AlertExprParamsValues, error) { + ruleParams := make(AlertExprParamsValues, len(params)) for i, param := range params { - p := models.AlertExprParamValue{Name: param.Name} + p := AlertExprParamValue{Name: param.Name} switch param.Type { case alerting.ParamType_PARAM_TYPE_INVALID: @@ -837,13 +883,13 @@ func fillExprWithParams(expr string, values map[string]string) (string, error) { return buf.String(), nil } -func validateParameters(definitions models.AlertExprParamsDefinitions, values models.AlertExprParamsValues) error { +func validateParameters(definitions models.AlertExprParamsDefinitions, values AlertExprParamsValues) error { if len(definitions) != len(values) { return status.Errorf(codes.InvalidArgument, "Expression requires %d parameters, but got %d.", len(definitions), len(values)) } - valuesM := make(map[string]models.AlertExprParamValue) + valuesM := make(map[string]AlertExprParamValue) for _, v := range values { valuesM[v.Name] = v } @@ -881,3 +927,36 @@ func validateParameters(definitions models.AlertExprParamsDefinitions, values mo var ( _ alerting.AlertingServer = (*Service)(nil) ) + +// AlertExprParamValue represents rule parameter value. +type AlertExprParamValue struct { + Name string `json:"name"` + Type models.ParamType `json:"type"` + BoolValue bool `json:"bool"` + FloatValue float64 `json:"float"` + StringValue string `json:"string"` +} + +// AlertExprParamsValues represents rule parameters values slice. +type AlertExprParamsValues []AlertExprParamValue + +// AsStringMap convert param values to string map, where parameter name is a map key and parameter value is a map value. +func (p AlertExprParamsValues) AsStringMap() map[string]string { + m := make(map[string]string, len(p)) + for _, rp := range p { + var value string + switch rp.Type { + case models.Float: + value = fmt.Sprint(rp.FloatValue) + case models.Bool: + value = fmt.Sprint(rp.BoolValue) + case models.String: + value = rp.StringValue + } + // do not add `default:` to make exhaustive linter do its job + + m[rp.Name] = value + } + + return m +} diff --git a/managed/services/management/alerting/service_test.go b/managed/services/management/alerting/service_test.go index 812637ca9f..08bc38d10d 100644 --- a/managed/services/management/alerting/service_test.go +++ b/managed/services/management/alerting/service_test.go @@ -35,9 +35,9 @@ import ( const ( devPlatformAddress = "https://check-dev.percona.com" devPlatformPublicKey = "RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX" - testBadTemplates = "../../../testdata/ia/bad" - testTemplates = "../../../testdata/ia/user2" - testTemplates2 = "../../../testdata/ia/user" + testBadTemplates = "../../../testdata/alerting/bad" + testTemplates = "../../../testdata/alerting/user2" + testTemplates2 = "../../../testdata/alerting/user" issuerURL = "https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7/v1" ) @@ -168,13 +168,6 @@ func TestTemplateValidation(t *testing.T) { platformClient, err := platform.NewClient(db, devPlatformAddress) require.NoError(t, err) - // Enable IA - settings, err := models.GetSettings(db) - require.NoError(t, err) - settings.Alerting.Disabled = true - err = models.SaveSettings(db, settings) - require.NoError(t, err) - t.Run("create a template with missing param", func(t *testing.T) { t.Parallel() diff --git a/managed/services/management/ia/alerts_service.go b/managed/services/management/ia/alerts_service.go deleted file mode 100644 index d1809ab0cb..0000000000 --- a/managed/services/management/ia/alerts_service.go +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Package ia contains Integrated Alerting APIs implementations. -package ia - -import ( - "context" - "regexp" - "strings" - "time" - - "github.com/percona-platform/saas/pkg/common" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/timestamppb" - "gopkg.in/reform.v1" - - "github.com/percona/pmm/api/alertmanager/ammodels" - "github.com/percona/pmm/api/managementpb" - iav1beta1 "github.com/percona/pmm/api/managementpb/ia" - "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/services" -) - -// AlertsService represents integrated alerting alerts API. -// Deprecated. Do not use. -type AlertsService struct { - db *reform.DB - l *logrus.Entry - alertManager alertManager - templatesService templatesService - - iav1beta1.UnimplementedAlertsServer -} - -// NewAlertsService creates new alerts API service. -func NewAlertsService(db *reform.DB, alertManager alertManager, templatesService templatesService) *AlertsService { - return &AlertsService{ - l: logrus.WithField("component", "management/ia/alerts"), - db: db, - alertManager: alertManager, - templatesService: templatesService, - } -} - -// Enabled returns if service is enabled and can be used. -// Deprecated. Do not use. -func (s *AlertsService) Enabled() bool { - settings, err := models.GetSettings(s.db) - if err != nil { - s.l.WithError(err).Error("can't get settings") - return false - } - return !settings.Alerting.Disabled -} - -// ListAlerts returns list of existing alerts. -// Deprecated. Do not use. -func (s *AlertsService) ListAlerts(ctx context.Context, req *iav1beta1.ListAlertsRequest) (*iav1beta1.ListAlertsResponse, error) { - filter := &services.FilterParams{ - IsIA: true, - } - alerts, err := s.alertManager.GetAlerts(ctx, filter) - if err != nil { - return nil, errors.Wrap(err, "failed to get alerts from alertmanager") - } - - var res []*iav1beta1.Alert //nolint:prealloc - for _, alert := range alerts { - updatedAt := timestamppb.New(time.Time(*alert.UpdatedAt)) - if err := updatedAt.CheckValid(); err != nil { - return nil, errors.Wrap(err, "failed to convert timestamp") - } - - createdAt := timestamppb.New(time.Time(*alert.StartsAt)) - if err := updatedAt.CheckValid(); err != nil { - return nil, errors.Wrap(err, "failed to convert timestamp") - } - - st := iav1beta1.Status_STATUS_INVALID - if *alert.Status.State == "active" { - st = iav1beta1.Status_TRIGGERING - } - - if len(alert.Status.SilencedBy) != 0 { - st = iav1beta1.Status_SILENCED - } - - var rule *iav1beta1.Rule - // Rules files created by user in directory /srv/prometheus/rules/ doesn't have associated rules in DB. - // So alertname field will be empty or will keep invalid value. Don't fill rule field in that case. - ruleID, ok := alert.Labels["alertname"] - if ok && strings.HasPrefix(ruleID, "/rule_id/") { - var r *models.Rule - var channels []*models.Channel - e := s.db.InTransaction(func(tx *reform.TX) error { - var err error - r, err = models.FindRuleByID(tx.Querier, ruleID) - if err != nil { - return err - } - - channels, err = models.FindChannelsByIDs(tx.Querier, r.ChannelIDs) - return err - }) - if e != nil { - // The codes.NotFound code can be returned just only by the FindRulesByID func - // from the transaction above. - if st, ok := status.FromError(e); ok && st.Code() == codes.NotFound { - s.l.Warnf("The related alert rule was most likely removed: %s", st.Message()) - continue - } - - return nil, e - } - - rule, err = convertRule(s.l, r, channels) - if err != nil { - return nil, errors.Wrapf(err, "failed to convert alert rule") - } - } - - if rule != nil && len(rule.Filters) != 0 { - pass, err := satisfiesFilters(alert, rule.Filters) - if err != nil { - return nil, err - } - - if !pass { - continue - } - } - - res = append(res, &iav1beta1.Alert{ - AlertId: getAlertID(alert), - Summary: alert.Annotations["summary"], - Severity: managementpb.Severity(common.ParseSeverity(alert.Labels["severity"])), - Status: st, - Labels: alert.Labels, - Rule: rule, - CreatedAt: createdAt, - UpdatedAt: updatedAt, - }) - } - - pageTotals := &managementpb.PageTotals{ - TotalPages: 1, - } - - var pageIndex int - var pageSize int - if req.PageParams != nil { - pageIndex = int(req.PageParams.Index) - pageSize = int(req.PageParams.PageSize) - } - - from, to := pageIndex*pageSize, (pageIndex+1)*pageSize - if to > len(res) || to == 0 { - to = len(res) - } - - if from > len(res) { - from = len(res) - } - - if pageSize > 0 { - pageTotals.TotalPages = int32(len(res) / pageSize) - if len(res)%pageSize > 0 { - pageTotals.TotalPages++ - } - } - pageTotals.TotalItems = int32(len(res)) - - return &iav1beta1.ListAlertsResponse{Alerts: res[from:to], Totals: pageTotals}, nil -} - -// satisfiesFilters checks that alert passes filters, returns true in case of success. -func satisfiesFilters(alert *ammodels.GettableAlert, filters []*iav1beta1.Filter) (bool, error) { - for _, filter := range filters { - value, ok := alert.Labels[filter.Key] - if !ok { - return false, nil - } - - switch filter.Type { - case iav1beta1.FilterType_EQUAL: - if filter.Value != value { - return false, nil - } - case iav1beta1.FilterType_REGEX: - match, err := regexp.Match(filter.Value, []byte(value)) - if err != nil { - return false, status.Errorf(codes.InvalidArgument, "bad regular expression: +%v", err) - } - - if !match { - return false, nil - } - case iav1beta1.FilterType_FILTER_TYPE_INVALID: - fallthrough - default: - return false, status.Error(codes.Internal, "Unexpected filter type.") - } - } - - return true, nil -} - -// getAlertID returns the alert's ID. -// Deprecated. Do not use. -func getAlertID(alert *ammodels.GettableAlert) string { - return *alert.Fingerprint -} - -// ToggleAlerts allows to silence/unsilence specified alerts. -// Deprecated. Do not use. -func (s *AlertsService) ToggleAlerts(ctx context.Context, req *iav1beta1.ToggleAlertsRequest) (*iav1beta1.ToggleAlertsResponse, error) { - var err error - var alerts []*ammodels.GettableAlert - - filters := &services.FilterParams{ - IsIA: true, - } - if len(req.AlertIds) == 0 { - alerts, err = s.alertManager.GetAlerts(ctx, filters) - } else { - alerts, err = s.alertManager.FindAlertsByID(ctx, filters, req.AlertIds) - } - if err != nil { - return nil, err - } - - switch req.Silenced { - case managementpb.BooleanFlag_DO_NOT_CHANGE: - // nothing - case managementpb.BooleanFlag_TRUE: - err = s.alertManager.SilenceAlerts(ctx, alerts) - case managementpb.BooleanFlag_FALSE: - err = s.alertManager.UnsilenceAlerts(ctx, alerts) - } - if err != nil { - return nil, err - } - - return &iav1beta1.ToggleAlertsResponse{}, nil -} - -// Check interfaces. -var ( - _ iav1beta1.AlertsServer = (*AlertsService)(nil) -) diff --git a/managed/services/management/ia/alerts_service_test.go b/managed/services/management/ia/alerts_service_test.go deleted file mode 100644 index 21e452dcce..0000000000 --- a/managed/services/management/ia/alerts_service_test.go +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "context" - "strconv" - "testing" - "time" - - "github.com/AlekSi/pointer" - "github.com/brianvoe/gofakeit/v6" - "github.com/go-openapi/strfmt" - "github.com/percona-platform/saas/pkg/alert" - "github.com/percona-platform/saas/pkg/common" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "gopkg.in/reform.v1" - "gopkg.in/reform.v1/dialects/postgresql" - - "github.com/percona/pmm/api/alertmanager/ammodels" - "github.com/percona/pmm/api/managementpb" - iav1beta1 "github.com/percona/pmm/api/managementpb/ia" - "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/utils/testdb" -) - -func TestSatisfiesFilters(t *testing.T) { - t.Parallel() - - t.Run("alerts", func(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - alert *ammodels.GettableAlert - result bool - errMsg string - }{{ - name: "normal", - alert: &ammodels.GettableAlert{Alert: ammodels.Alert{Labels: map[string]string{ - "label1": "value1", - "label2": "value2", - }}}, - result: true, - errMsg: "", - }, { - name: "only one label match", - alert: &ammodels.GettableAlert{Alert: ammodels.Alert{Labels: map[string]string{ - "label1": "value1", - "label2": "wrong", - }}}, - result: false, - errMsg: "", - }, { - name: "only one label present", - alert: &ammodels.GettableAlert{Alert: ammodels.Alert{Labels: map[string]string{ - "label2": "value2", - }}}, - result: false, - errMsg: "", - }, { - name: "no labels", - alert: &ammodels.GettableAlert{ - Alert: ammodels.Alert{Labels: make(map[string]string)}, - }, - result: false, - errMsg: "", - }, { - name: "match labels + unknown label", - alert: &ammodels.GettableAlert{Alert: ammodels.Alert{Labels: map[string]string{ - "label1": "value1", - "label2": "value2", - "unknown": "value", - }}}, - result: true, - errMsg: "", - }, { - name: "not match labels + unknown label", - alert: &ammodels.GettableAlert{Alert: ammodels.Alert{Labels: map[string]string{ - "label2": "value2", - "unknown": "value", - }}}, - result: false, - errMsg: "", - }} - - filters := []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType_EQUAL, - Key: "label1", - Value: "value1", - }, { - Type: iav1beta1.FilterType_REGEX, - Key: "label2", - Value: "v.*2", - }} - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - res, err := satisfiesFilters(tt.alert, filters) - if tt.errMsg != "" { - assert.EqualError(t, err, tt.errMsg) - return - } - - require.NoError(t, err) - assert.Equal(t, tt.result, res) - }) - } - }) - - t.Run("filters", func(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - filters []*iav1beta1.Filter - result bool - errMsg string - }{ - { - name: "normal multiple filters", - filters: []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType_EQUAL, - Key: "label1", - Value: "value1", - }, { - Type: iav1beta1.FilterType_REGEX, - Key: "label2", - Value: "v.*2", - }}, - result: true, - errMsg: "", - }, { - name: "normal simple filter", - filters: []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType_EQUAL, - Key: "label1", - Value: "value1", - }}, - result: true, - errMsg: "", - }, { - name: "normal regex filter", - filters: []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType_REGEX, - Key: "label2", - Value: "v.*2", - }}, - result: true, - errMsg: "", - }, { - name: "invalid type", - filters: []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType_FILTER_TYPE_INVALID, - Key: "label1", - Value: "value1", - }}, - result: false, - errMsg: "rpc error: code = Internal desc = Unexpected filter type.", - }, { - name: "unknown type", - filters: []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType(12), - Key: "label1", - Value: "value1", - }}, - result: false, - errMsg: "rpc error: code = Internal desc = Unexpected filter type.", - }, { - name: "bad regexp", - filters: []*iav1beta1.Filter{{ - Type: iav1beta1.FilterType_REGEX, - Key: "label2", - Value: ".***", - }}, - result: false, - errMsg: "rpc error: code = InvalidArgument desc = bad regular expression: +error parsing regexp: invalid nested repetition operator: `**`", - }, - } - - alert := &ammodels.GettableAlert{ - Alert: ammodels.Alert{ - Labels: map[string]string{ - "label1": "value1", - "label2": "value2", - }, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - res, err := satisfiesFilters(alert, tt.filters) - if tt.errMsg != "" { - assert.EqualError(t, err, tt.errMsg) - return - } - - require.NoError(t, err) - assert.Equal(t, tt.result, res) - }) - } - }) -} - -func TestListAlerts(t *testing.T) { - ctx := context.Background() - sqlDB := testdb.Open(t, models.SkipFixtures, nil) - db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) - - q := db.Querier - now := strfmt.DateTime(time.Now()) - - tmpl, err := models.CreateTemplate(q, &models.CreateTemplateParams{ - Template: &alert.Template{ - Name: "test_Template", - Version: 1, - Summary: gofakeit.Quote(), - Expr: gofakeit.Quote(), - Severity: common.Warning, - }, - Source: "USER_FILE", - }) - require.NoError(t, err) - - rule, err := models.CreateRule(q, &models.CreateRuleParams{ - TemplateName: tmpl.Name, - DefaultSeverity: tmpl.Severity, - Severity: models.Severity(common.Warning), - }) - require.NoError(t, err) - - const alertsCount = 25 - mockAlert := &mockAlertManager{} - var mockedAlerts []*ammodels.GettableAlert - - for i := 0; i < alertsCount-1; i++ { - mockedAlerts = append(mockedAlerts, &ammodels.GettableAlert{ - Alert: ammodels.Alert{ - Labels: map[string]string{ - "ia": "1", - "alertname": rule.ID, - }, - }, - Fingerprint: pointer.ToString(strconv.Itoa(i)), - Status: &ammodels.AlertStatus{ - State: pointer.ToString("active"), - }, - StartsAt: &now, - UpdatedAt: &now, - }) - } - - // This additional alert emulates the one created by user directly, without IA UI. - // Since user added "ia" label, he wants to see alert in IA UI. We want to be sure he will. - mockedAlerts = append(mockedAlerts, &ammodels.GettableAlert{ - Alert: ammodels.Alert{ - Labels: map[string]string{ - "ia": "1", - }, - }, - Fingerprint: pointer.ToString(strconv.Itoa(alertsCount - 1)), - Status: &ammodels.AlertStatus{ - State: pointer.ToString("active"), - }, - StartsAt: &now, - UpdatedAt: &now, - }) - - mockAlert.On("GetAlerts", ctx, mock.Anything).Return(mockedAlerts, nil) - - var tmplSvc mockTemplatesService - require.NoError(t, err) - svc := NewAlertsService(db, mockAlert, &tmplSvc) - - findAlerts := func(alerts []*iav1beta1.Alert, alertIDs ...string) bool { - if len(alerts) != len(alertIDs) { - return false - } - m := make(map[string]bool) - for _, alertID := range alertIDs { - m[alertID] = false - } - for _, a := range alerts { - val, ok := m[a.AlertId] - // Extra alert - if !ok { - return false - } - // Duplicate - if val { - return false - } - m[a.AlertId] = true - } - for _, v := range m { - // AlertID was not in alerts - if !v { - return false - } - } - return true - } - - t.Run("without pagination", func(t *testing.T) { - res, err := svc.ListAlerts(ctx, &iav1beta1.ListAlertsRequest{}) - assert.NoError(t, err) - var expect []string - for _, m := range mockedAlerts { - expect = append(expect, *m.Fingerprint) - } - assert.True(t, findAlerts(res.Alerts, expect...), "wrong alerts returned") - assert.EqualValues(t, res.Totals.TotalItems, len(mockedAlerts)) - }) - - t.Run("pagination", func(t *testing.T) { - res, err := svc.ListAlerts(ctx, &iav1beta1.ListAlertsRequest{ - PageParams: &managementpb.PageParams{ - PageSize: 1, - }, - }) - assert.NoError(t, err) - assert.Len(t, res.Alerts, 1) - assert.True(t, findAlerts(res.Alerts, "0"), "wrong alerts returned") - assert.EqualValues(t, res.Totals.TotalItems, alertsCount) - assert.EqualValues(t, res.Totals.TotalPages, alertsCount) - - res, err = svc.ListAlerts(ctx, &iav1beta1.ListAlertsRequest{ - PageParams: &managementpb.PageParams{ - PageSize: 10, - Index: 2, - }, - }) - assert.NoError(t, err) - assert.Len(t, res.Alerts, 5) - assert.True(t, findAlerts(res.Alerts, "20", "21", "22", "23", "24"), "wrong alerts returned") - assert.EqualValues(t, res.Totals.TotalItems, alertsCount) - assert.EqualValues(t, res.Totals.TotalPages, 3) - }) - - t.Run("fetch more than available", func(t *testing.T) { - var expect []string - for _, m := range mockedAlerts { - expect = append(expect, *m.Fingerprint) - } - res, err := svc.ListAlerts(ctx, &iav1beta1.ListAlertsRequest{ - PageParams: &managementpb.PageParams{ - PageSize: alertsCount * 2, - }, - }) - assert.NoError(t, err) - assert.True(t, findAlerts(res.Alerts, expect...), "wrong alerts returned") - assert.EqualValues(t, res.Totals.TotalItems, len(mockedAlerts)) - - res, err = svc.ListAlerts(ctx, &iav1beta1.ListAlertsRequest{ - PageParams: &managementpb.PageParams{ - PageSize: 1, - Index: alertsCount * 2, - }, - }) - assert.NoError(t, err) - assert.Len(t, res.Alerts, 0) - assert.EqualValues(t, res.Totals.TotalItems, len(mockedAlerts)) - }) -} diff --git a/managed/services/management/ia/channels_service.go b/managed/services/management/ia/channels_service.go deleted file mode 100644 index 96990bc337..0000000000 --- a/managed/services/management/ia/channels_service.go +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "context" - - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "gopkg.in/reform.v1" - - "github.com/percona/pmm/api/managementpb" - iav1beta1 "github.com/percona/pmm/api/managementpb/ia" - "github.com/percona/pmm/managed/models" -) - -// ChannelsService represents integrated alerting channels API. -// Deprecated. Do not use. -type ChannelsService struct { - l *logrus.Entry - db *reform.DB - alertManager alertManager - - iav1beta1.UnimplementedChannelsServer -} - -// NewChannelsService creates new channels API service. -// Deprecated. Do not use. -func NewChannelsService(db *reform.DB, alertManager alertManager) *ChannelsService { - return &ChannelsService{ - l: logrus.WithField("component", "management/ia/channels"), - db: db, - alertManager: alertManager, - } -} - -// Enabled returns if service is enabled and can be used. -// Deprecated. Do not use. -func (s *ChannelsService) Enabled() bool { - settings, err := models.GetSettings(s.db) - if err != nil { - s.l.WithError(err).Error("can't get settings") - return false - } - return !settings.Alerting.Disabled -} - -// ListChannels returns list of available channels. -// Deprecated. Do not use. -func (s *ChannelsService) ListChannels(ctx context.Context, req *iav1beta1.ListChannelsRequest) (*iav1beta1.ListChannelsResponse, error) { - var pageIndex int - var pageSize int - if req.PageParams != nil { - pageIndex = int(req.PageParams.Index) - pageSize = int(req.PageParams.PageSize) - } - - var channels []*iav1beta1.Channel - pageTotals := &managementpb.PageTotals{ - TotalPages: 1, - } - - var err error - if pageSize == 0 { - channels, err = s.getNotificationChannels() - pageTotals.TotalItems = int32(len(channels)) - } else { - channels, pageTotals, err = s.getNotificationChannelsPage(pageIndex, pageSize) - } - - if err != nil { - return nil, err - } - - return &iav1beta1.ListChannelsResponse{Channels: channels, Totals: pageTotals}, nil -} - -func (s *ChannelsService) getNotificationChannels() ([]*iav1beta1.Channel, error) { - var channels []*models.Channel - errTx := s.db.InTransaction(func(tx *reform.TX) error { - var err error - channels, err = models.FindChannels(tx.Querier) - if err != nil { - return errors.WithStack(err) - } - return nil - }) - - if errTx != nil { - return nil, errors.WithStack(errTx) - } - - res := make([]*iav1beta1.Channel, len(channels)) - for i, channel := range channels { - c, err := convertChannel(channel) - if err != nil { - return nil, err - } - res[i] = c - } - - return res, nil -} - -// Deprecated. Do not use. -func (s *ChannelsService) getNotificationChannelsPage(pageIndex, pageSize int) ([]*iav1beta1.Channel, *managementpb.PageTotals, error) { - var channels []*models.Channel - var totalItems int - errTx := s.db.InTransaction(func(tx *reform.TX) error { - var err error - channels, err = models.FindChannelsOnPage(tx.Querier, pageIndex, pageSize) - if err != nil { - return errors.WithStack(err) - } - - totalItems, err = models.CountChannels(tx.Querier) - if err != nil { - return errors.WithStack(err) - } - - return nil - }) - if errTx != nil { - return nil, nil, errors.WithStack(errTx) - } - - res := make([]*iav1beta1.Channel, len(channels)) - for i, channel := range channels { - c, err := convertChannel(channel) - if err != nil { - return nil, nil, err - } - res[i] = c - } - - totalPages := totalItems / pageSize - if totalItems%pageSize > 0 { - totalPages++ - } - - totals := &managementpb.PageTotals{ - TotalItems: int32(totalItems), - TotalPages: int32(totalPages), - } - - return res, totals, nil -} - -// AddChannel adds new notification channel. -// Deprecated. Do not use. -func (s *ChannelsService) AddChannel(ctx context.Context, req *iav1beta1.AddChannelRequest) (*iav1beta1.AddChannelResponse, error) { - params := &models.CreateChannelParams{ - Summary: req.Summary, - Disabled: req.Disabled, - } - - if req.EmailConfig != nil { - params.EmailConfig = &models.EmailConfig{ - SendResolved: req.EmailConfig.SendResolved, - To: req.EmailConfig.To, - } - } - if req.PagerdutyConfig != nil { - params.PagerDutyConfig = &models.PagerDutyConfig{ - SendResolved: req.PagerdutyConfig.SendResolved, - RoutingKey: req.PagerdutyConfig.RoutingKey, - ServiceKey: req.PagerdutyConfig.ServiceKey, - } - } - if req.SlackConfig != nil { - params.SlackConfig = &models.SlackConfig{ - SendResolved: req.SlackConfig.SendResolved, - Channel: req.SlackConfig.Channel, - } - } - if req.WebhookConfig != nil { - params.WebHookConfig = &models.WebHookConfig{ - SendResolved: req.WebhookConfig.SendResolved, - URL: req.WebhookConfig.Url, - MaxAlerts: req.WebhookConfig.MaxAlerts, - HTTPConfig: convertHTTPConfigToModel(req.WebhookConfig.HttpConfig), - } - } - - var channel *models.Channel - e := s.db.InTransaction(func(tx *reform.TX) error { - var err error - channel, err = models.CreateChannel(tx.Querier, params) - return err - }) - if e != nil { - return nil, e - } - - s.alertManager.RequestConfigurationUpdate() - - return &iav1beta1.AddChannelResponse{ChannelId: channel.ID}, nil -} - -// ChangeChannel changes existing notification channel. -// Deprecated. Do not use. -func (s *ChannelsService) ChangeChannel(ctx context.Context, req *iav1beta1.ChangeChannelRequest) (*iav1beta1.ChangeChannelResponse, error) { - params := &models.ChangeChannelParams{ - Summary: req.Summary, - Disabled: req.Disabled, - } - - if c := req.EmailConfig; c != nil { - params.EmailConfig = &models.EmailConfig{ - SendResolved: c.SendResolved, - To: c.To, - } - } - if c := req.PagerdutyConfig; c != nil { - params.PagerDutyConfig = &models.PagerDutyConfig{ - SendResolved: c.SendResolved, - RoutingKey: c.RoutingKey, - ServiceKey: c.ServiceKey, - } - } - if c := req.SlackConfig; c != nil { - params.SlackConfig = &models.SlackConfig{ - SendResolved: c.SendResolved, - Channel: c.Channel, - } - } - if c := req.WebhookConfig; c != nil { - params.WebHookConfig = &models.WebHookConfig{ - SendResolved: c.SendResolved, - URL: c.Url, - MaxAlerts: c.MaxAlerts, - HTTPConfig: convertHTTPConfigToModel(req.WebhookConfig.HttpConfig), - } - } - - e := s.db.InTransaction(func(tx *reform.TX) error { - _, err := models.ChangeChannel(tx.Querier, req.ChannelId, params) - return err - }) - if e != nil { - return nil, e - } - - s.alertManager.RequestConfigurationUpdate() - - return &iav1beta1.ChangeChannelResponse{}, nil -} - -// RemoveChannel removes notification channel. -// Deprecated. Do not use. -func (s *ChannelsService) RemoveChannel(ctx context.Context, req *iav1beta1.RemoveChannelRequest) (*iav1beta1.RemoveChannelResponse, error) { - e := s.db.InTransaction(func(tx *reform.TX) error { - return models.RemoveChannel(tx.Querier, req.ChannelId) - }) - if e != nil { - return nil, e - } - - s.alertManager.RequestConfigurationUpdate() - - return &iav1beta1.RemoveChannelResponse{}, nil -} - -// convertChannel converts a channel model to its protobuf representation. -// Deprecated. Do not use. -func convertChannel(channel *models.Channel) (*iav1beta1.Channel, error) { - c := &iav1beta1.Channel{ - ChannelId: channel.ID, - Summary: channel.Summary, - Disabled: channel.Disabled, - } - - switch channel.Type { - case models.Email: - config := channel.EmailConfig - c.Channel = &iav1beta1.Channel_EmailConfig{ - EmailConfig: &iav1beta1.EmailConfig{ - SendResolved: config.SendResolved, - To: config.To, - }, - } - case models.PagerDuty: - config := channel.PagerDutyConfig - c.Channel = &iav1beta1.Channel_PagerdutyConfig{ - PagerdutyConfig: &iav1beta1.PagerDutyConfig{ - SendResolved: config.SendResolved, - RoutingKey: config.RoutingKey, - ServiceKey: config.ServiceKey, - }, - } - case models.Slack: - config := channel.SlackConfig - c.Channel = &iav1beta1.Channel_SlackConfig{ - SlackConfig: &iav1beta1.SlackConfig{ - SendResolved: config.SendResolved, - Channel: config.Channel, - }, - } - case models.WebHook: - config := channel.WebHookConfig - c.Channel = &iav1beta1.Channel_WebhookConfig{ - WebhookConfig: &iav1beta1.WebhookConfig{ - SendResolved: config.SendResolved, - Url: config.URL, - HttpConfig: convertModelToHTTPConfig(config.HTTPConfig), - MaxAlerts: config.MaxAlerts, - }, - } - default: - return nil, errors.Errorf("unknown notification channel type %s", channel.Type) - } - - return c, nil -} - -// convertHTTPConfigToModel converts a protobuf HTTPConfig to its model representation. -// Deprecated. Do not use. -func convertHTTPConfigToModel(config *iav1beta1.HTTPConfig) *models.HTTPConfig { - if config == nil { - return nil - } - - res := &models.HTTPConfig{ - BearerToken: config.BearerToken, - BearerTokenFile: config.BearerTokenFile, - ProxyURL: config.ProxyUrl, - } - - if basicAuthConf := config.BasicAuth; basicAuthConf != nil { - res.BasicAuth = &models.HTTPBasicAuth{ - Username: basicAuthConf.Username, - Password: basicAuthConf.Password, - PasswordFile: basicAuthConf.PasswordFile, - } - } - - if tlsConfig := config.TlsConfig; tlsConfig != nil { - res.TLSConfig = &models.TLSConfig{ - CAFile: tlsConfig.CaFile, - CertFile: tlsConfig.CertFile, - KeyFile: tlsConfig.KeyFile, - ServerName: tlsConfig.ServerName, - InsecureSkipVerify: tlsConfig.InsecureSkipVerify, - CAFileContent: tlsConfig.CaFileContent, - CertFileContent: tlsConfig.CertFileContent, - KeyFileContent: tlsConfig.KeyFileContent, - } - } - - return res -} - -// convertModelToHTTPConfig converts a HTTPConfig model to its protobuf representation. -// Deprecated. Do not use. -func convertModelToHTTPConfig(config *models.HTTPConfig) *iav1beta1.HTTPConfig { - if config == nil { - return nil - } - - res := &iav1beta1.HTTPConfig{ - BearerToken: config.BearerToken, - BearerTokenFile: config.BearerTokenFile, - ProxyUrl: config.ProxyURL, - } - - if basicAuthConf := config.BasicAuth; basicAuthConf != nil { - res.BasicAuth = &iav1beta1.BasicAuth{ - Username: basicAuthConf.Username, - Password: basicAuthConf.Password, - PasswordFile: basicAuthConf.PasswordFile, - } - } - - if tlsConfig := config.TLSConfig; tlsConfig != nil { - res.TlsConfig = &iav1beta1.TLSConfig{ - CaFile: tlsConfig.CAFile, - CertFile: tlsConfig.CertFile, - KeyFile: tlsConfig.KeyFile, - ServerName: tlsConfig.ServerName, - InsecureSkipVerify: tlsConfig.InsecureSkipVerify, - CaFileContent: tlsConfig.CAFileContent, - CertFileContent: tlsConfig.CertFileContent, - KeyFileContent: tlsConfig.KeyFileContent, - } - } - - return res -} - -// Check interfaces. -var ( - _ iav1beta1.ChannelsServer = (*ChannelsService)(nil) -) diff --git a/managed/services/management/ia/common.go b/managed/services/management/ia/common.go deleted file mode 100644 index 73af3400e0..0000000000 --- a/managed/services/management/ia/common.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "bytes" - "os" - "text/template" - - "github.com/AlekSi/pointer" - "github.com/percona-platform/saas/pkg/alert" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/timestamppb" - - "github.com/percona/pmm/api/managementpb" - alerting "github.com/percona/pmm/api/managementpb/alerting" - iav1beta1 "github.com/percona/pmm/api/managementpb/ia" - "github.com/percona/pmm/managed/models" -) - -const ( - dirPerm = os.FileMode(0o775) -) - -func convertParamUnit(u alert.Unit) alerting.ParamUnit { - switch u { - case alert.Percentage: - return alerting.ParamUnit_PERCENTAGE - case alert.Seconds: - return alerting.ParamUnit_SECONDS - } - - // do not add `default:` to make exhaustive linter do its job - - return alerting.ParamUnit_PARAM_UNIT_INVALID -} - -func convertRule(l *logrus.Entry, rule *models.Rule, channels []*models.Channel) (*iav1beta1.Rule, error) { - r := &iav1beta1.Rule{ - RuleId: rule.ID, - TemplateName: rule.TemplateName, - Disabled: rule.Disabled, - Summary: rule.Summary, - Name: rule.Name, - ExprTemplate: rule.ExprTemplate, - DefaultSeverity: managementpb.Severity(rule.DefaultSeverity), - Severity: managementpb.Severity(rule.Severity), - DefaultFor: durationpb.New(rule.DefaultFor), - For: durationpb.New(rule.For), - CreatedAt: timestamppb.New(rule.CreatedAt), - } - - var err error - if err = r.CreatedAt.CheckValid(); err != nil { - return nil, errors.Wrap(err, "failed to convert timestamp") - } - - r.Expr, err = fillExprWithParams(rule.ExprTemplate, rule.ParamsValues.AsStringMap()) - if err != nil { - return nil, errors.Wrap(err, "failed to fill expression template with parameters values") - } - - r.ParamsDefinitions, err = convertModelToParamsDefinitions(rule.ParamsDefinitions) - if err != nil { - return nil, errors.Wrap(err, "failed to convert parameters definitions") - } - - r.ParamsValues, err = convertModelToParamValues(rule.ParamsValues) - if err != nil { - return nil, errors.Wrap(err, "failed to convert parameters values") - } - - r.CustomLabels, err = rule.GetCustomLabels() - if err != nil { - return nil, errors.Wrap(err, "failed to load rule custom labels") - } - - r.Labels, err = rule.GetLabels() - if err != nil { - return nil, errors.Wrap(err, "failed to load rule labels") - } - - r.Annotations, err = rule.GetAnnotations() - if err != nil { - return nil, errors.Wrap(err, "failed to load rule annotations") - } - - r.Filters = make([]*iav1beta1.Filter, len(rule.Filters)) - for i, filter := range rule.Filters { - r.Filters[i] = &iav1beta1.Filter{ - Type: convertModelToFilterType(filter.Type), - Key: filter.Key, - Value: filter.Val, - } - } - - cm := make(map[string]*models.Channel) - for _, channel := range channels { - cm[channel.ID] = channel - } - - for _, id := range rule.ChannelIDs { - channel, ok := cm[id] - if !ok { - l.Warningf("Skip missing channel with ID %s", id) - continue - } - - c, err := convertChannel(channel) - if err != nil { - return nil, errors.Wrap(err, "failed to convert channel") - } - r.Channels = append(r.Channels, c) - } - - return r, nil -} - -func newParamTemplate() *template.Template { - return template.New("").Option("missingkey=error").Delims("[[", "]]") -} - -func fillExprWithParams(expr string, values map[string]string) (string, error) { - var buf bytes.Buffer - t, err := newParamTemplate().Parse(expr) - if err != nil { - return "", errors.Wrap(err, "failed to parse expression") - } - if err = t.Execute(&buf, values); err != nil { - return "", errors.Wrap(err, "failed to fill expression placeholders") - } - return buf.String(), nil -} - -func validateParameters(definitions models.AlertExprParamsDefinitions, values models.AlertExprParamsValues) error { - if len(definitions) != len(values) { - return status.Errorf(codes.InvalidArgument, "Expression requires %d parameters, but got %d.", - len(definitions), len(values)) - } - - valuesM := make(map[string]models.AlertExprParamValue) - for _, v := range values { - valuesM[v.Name] = v - } - - for _, d := range definitions { - value, ok := valuesM[d.Name] - if !ok { - return status.Errorf(codes.InvalidArgument, "Parameter %s is missing.", d.Name) - } - - if string(d.Type) != string(value.Type) { - return status.Errorf(codes.InvalidArgument, "Parameter %s has type %s instead of %s.", d.Name, value.Type, d.Type) - } - - if d.Type == models.Float { - v := d.FloatParam - fv := value.FloatValue - if v.Min != nil && pointer.GetFloat64(v.Min) > fv { - return status.Errorf(codes.InvalidArgument, "Parameter %s value is less than required minimum.", d.Name) - } - - if v.Max != nil && pointer.GetFloat64(v.Max) < fv { - return status.Errorf(codes.InvalidArgument, "Parameter %s value is greater than required maximum.", d.Name) - } - } - } - - return nil -} diff --git a/managed/services/management/ia/deps.go b/managed/services/management/ia/deps.go deleted file mode 100644 index 02ed8f676c..0000000000 --- a/managed/services/management/ia/deps.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "context" - - "github.com/percona/pmm/api/alertmanager/ammodels" - "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/services" -) - -//go:generate ../../../../bin/mockery --name=alertManager --case=snake --inpackage --testonly -//go:generate ../../../../bin/mockery --name=vmAlert --case=snake --inpackage --testonly -//go:generate ../../../../bin/mockery --name=templatesService --case=snake --inpackage --testonly - -// alertManager is a subset of methods of alertmanager.Service used by this package. -// We use it instead of real type for testing and to avoid dependency cycle. -type alertManager interface { - GetAlerts(ctx context.Context, params *services.FilterParams) ([]*ammodels.GettableAlert, error) - FindAlertsByID(ctx context.Context, params *services.FilterParams, ids []string) ([]*ammodels.GettableAlert, error) - SilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error - UnsilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error - RequestConfigurationUpdate() -} - -// vmAlert is a subset of methods of vmalert.Service used by this package. -// We use it instead of real type for testing and to avoid dependency cycle. -type vmAlert interface { - RequestConfigurationUpdate() -} - -type templatesService interface { - GetTemplates() map[string]models.Template -} diff --git a/managed/services/management/ia/mock_alert_manager_test.go b/managed/services/management/ia/mock_alert_manager_test.go deleted file mode 100644 index 01b4f1b532..0000000000 --- a/managed/services/management/ia/mock_alert_manager_test.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by mockery v2.35.1. DO NOT EDIT. - -package ia - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - ammodels "github.com/percona/pmm/api/alertmanager/ammodels" - services "github.com/percona/pmm/managed/services" -) - -// mockAlertManager is an autogenerated mock type for the alertManager type -type mockAlertManager struct { - mock.Mock -} - -// FindAlertsByID provides a mock function with given fields: ctx, params, ids -func (_m *mockAlertManager) FindAlertsByID(ctx context.Context, params *services.FilterParams, ids []string) ([]*ammodels.GettableAlert, error) { - ret := _m.Called(ctx, params, ids) - - var r0 []*ammodels.GettableAlert - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *services.FilterParams, []string) ([]*ammodels.GettableAlert, error)); ok { - return rf(ctx, params, ids) - } - if rf, ok := ret.Get(0).(func(context.Context, *services.FilterParams, []string) []*ammodels.GettableAlert); ok { - r0 = rf(ctx, params, ids) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*ammodels.GettableAlert) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *services.FilterParams, []string) error); ok { - r1 = rf(ctx, params, ids) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetAlerts provides a mock function with given fields: ctx, params -func (_m *mockAlertManager) GetAlerts(ctx context.Context, params *services.FilterParams) ([]*ammodels.GettableAlert, error) { - ret := _m.Called(ctx, params) - - var r0 []*ammodels.GettableAlert - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *services.FilterParams) ([]*ammodels.GettableAlert, error)); ok { - return rf(ctx, params) - } - if rf, ok := ret.Get(0).(func(context.Context, *services.FilterParams) []*ammodels.GettableAlert); ok { - r0 = rf(ctx, params) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*ammodels.GettableAlert) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *services.FilterParams) error); ok { - r1 = rf(ctx, params) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RequestConfigurationUpdate provides a mock function with given fields: -func (_m *mockAlertManager) RequestConfigurationUpdate() { - _m.Called() -} - -// SilenceAlerts provides a mock function with given fields: ctx, alerts -func (_m *mockAlertManager) SilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error { - ret := _m.Called(ctx, alerts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []*ammodels.GettableAlert) error); ok { - r0 = rf(ctx, alerts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// UnsilenceAlerts provides a mock function with given fields: ctx, alerts -func (_m *mockAlertManager) UnsilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error { - ret := _m.Called(ctx, alerts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []*ammodels.GettableAlert) error); ok { - r0 = rf(ctx, alerts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// newMockAlertManager creates a new instance of mockAlertManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockAlertManager(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockAlertManager { - mock := &mockAlertManager{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/managed/services/management/ia/mock_templates_service_test.go b/managed/services/management/ia/mock_templates_service_test.go deleted file mode 100644 index b2da2f969e..0000000000 --- a/managed/services/management/ia/mock_templates_service_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by mockery v2.35.1. DO NOT EDIT. - -package ia - -import ( - mock "github.com/stretchr/testify/mock" - - models "github.com/percona/pmm/managed/models" -) - -// mockTemplatesService is an autogenerated mock type for the templatesService type -type mockTemplatesService struct { - mock.Mock -} - -// GetTemplates provides a mock function with given fields: -func (_m *mockTemplatesService) GetTemplates() map[string]models.Template { - ret := _m.Called() - - var r0 map[string]models.Template - if rf, ok := ret.Get(0).(func() map[string]models.Template); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]models.Template) - } - } - - return r0 -} - -// newMockTemplatesService creates a new instance of mockTemplatesService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockTemplatesService(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockTemplatesService { - mock := &mockTemplatesService{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/managed/services/management/ia/mock_vm_alert_test.go b/managed/services/management/ia/mock_vm_alert_test.go deleted file mode 100644 index 8d148a7db6..0000000000 --- a/managed/services/management/ia/mock_vm_alert_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by mockery v2.35.1. DO NOT EDIT. - -package ia - -import mock "github.com/stretchr/testify/mock" - -// mockVmAlert is an autogenerated mock type for the vmAlert type -type mockVmAlert struct { - mock.Mock -} - -// RequestConfigurationUpdate provides a mock function with given fields: -func (_m *mockVmAlert) RequestConfigurationUpdate() { - _m.Called() -} - -// newMockVmAlert creates a new instance of mockVmAlert. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockVmAlert(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockVmAlert { - mock := &mockVmAlert{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/managed/services/management/ia/rules_service.go b/managed/services/management/ia/rules_service.go deleted file mode 100644 index 9b196d21e0..0000000000 --- a/managed/services/management/ia/rules_service.go +++ /dev/null @@ -1,711 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "bytes" - "context" - "math" - "os" - "path/filepath" - "strings" - - "github.com/AlekSi/pointer" - "github.com/percona-platform/saas/pkg/alert" - "github.com/percona-platform/saas/pkg/common" - "github.com/percona/promconfig" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "gopkg.in/reform.v1" - "gopkg.in/yaml.v3" - - "github.com/percona/pmm/api/managementpb" - alerting "github.com/percona/pmm/api/managementpb/alerting" - iav1beta1 "github.com/percona/pmm/api/managementpb/ia" - "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/utils/dir" - "github.com/percona/pmm/managed/utils/stringset" -) - -const ( - rulesDir = "/etc/ia/rules" -) - -// RulesService represents API for Integrated Alerting Rules. -// Deprecated. Do not use. -type RulesService struct { - db *reform.DB - l *logrus.Entry - templates templatesService - vmalert vmAlert - alertManager alertManager - rulesPath string // used for testing - - iav1beta1.UnimplementedRulesServer -} - -// NewRulesService creates an API for Integrated Alerting Rules. -// Deprecated. Do not use. -func NewRulesService(db *reform.DB, templates templatesService, vmalert vmAlert, alertManager alertManager) *RulesService { - l := logrus.WithField("component", "management/ia/rules") - - err := dir.CreateDataDir(rulesDir, "pmm", "pmm", dirPerm) - if err != nil { - l.Error(err) - } - - s := &RulesService{ - db: db, - l: l, - templates: templates, - vmalert: vmalert, - alertManager: alertManager, - rulesPath: rulesDir, - } - s.updateConfigurations() - - return s -} - -// Enabled returns if service is enabled and can be used. -// Deprecated. Do not use. -func (s *RulesService) Enabled() bool { - settings, err := models.GetSettings(s.db) - if err != nil { - s.l.WithError(err).Error("can't get settings") - return false - } - return !settings.Alerting.Disabled -} - -// TODO Move this and related types to https://github.com/percona/promconfig -// https://jira.percona.com/browse/PMM-7069 -type ruleFile struct { - Group []ruleGroup `yaml:"groups"` -} - -type ruleGroup struct { - Name string `yaml:"name"` - Rules []rule `yaml:"rules"` -} - -type rule struct { - Alert string `yaml:"alert"` // Rule ID. - Expr string `yaml:"expr"` - Duration promconfig.Duration `yaml:"for"` - Labels map[string]string `yaml:"labels,omitempty"` - Annotations map[string]string `yaml:"annotations,omitempty"` -} - -// RemoveVMAlertRulesFiles removes all generated rules files (*.yml) on the ia path. -// Deprecated. Do not use. -func (s *RulesService) RemoveVMAlertRulesFiles() error { - matches, err := filepath.Glob(s.rulesPath + "/*.yml") - if err != nil { - return errors.WithStack(err) - } - for _, match := range matches { - if err = os.RemoveAll(match); err != nil { - return errors.WithStack(err) - } - } - - return nil -} - -// WriteVMAlertRulesFiles converts all available rules to VMAlert rule files. -// Deprecated. Do not use. -func (s *RulesService) WriteVMAlertRulesFiles() { - rules, err := models.FindRules(s.db.Querier) - if err != nil { - s.l.Errorf("Failed to get available alert rules: %+v", err) - return - } - - ruleFiles, err := s.prepareRulesFiles(rules) - if err != nil { - s.l.Errorf("Failed to prepare alert rule files: %+v", err) - return - } - - if err = s.RemoveVMAlertRulesFiles(); err != nil { - s.l.Errorf("Failed to clean old alert rule files: %+v", err) - return - } - - for _, file := range ruleFiles { - err = s.writeRuleFile(&file) //nolint:gosec - if err != nil { - s.l.Errorf("Failed to write alert rule file: %+v", err) - } - } -} - -// prepareRulesFiles converts collected IA rules to Alertmanager rule files content. -// Deprecated. Do not use. -func (s *RulesService) prepareRulesFiles(rules []*models.Rule) ([]ruleFile, error) { - res := make([]ruleFile, 0, len(rules)) - for _, ruleM := range rules { - if ruleM.Disabled { - s.l.Debugf("Skipping rule %s as it is disabled.", ruleM.ID) - continue - } - - r := rule{ - Alert: ruleM.ID, - Duration: promconfig.Duration(ruleM.For), - Labels: make(map[string]string), - Annotations: make(map[string]string), - } - - params := ruleM.ParamsValues.AsStringMap() - - var err error - r.Expr, err = fillExprWithParams(ruleM.ExprTemplate, params) - if err != nil { - return nil, errors.Wrap(err, "failed to fill rule expression with parameters") - } - - annotations, err := ruleM.GetAnnotations() - if err != nil { - return nil, errors.Wrap(err, "failed to read rule annotations") - } - // Copy annotations form template - if err = transformMaps(annotations, r.Annotations, params); err != nil { - return nil, errors.Wrap(err, "failed to fill template annotations placeholders") - } - - r.Annotations["rule"] = ruleM.Name - - labels, err := ruleM.GetLabels() - if err != nil { - return nil, errors.Wrap(err, "failed to read rule labels") - } - - // Copy labels form template - if err = transformMaps(labels, r.Labels, params); err != nil { - return nil, errors.Wrap(err, "failed to fill template labels placeholders") - } - - customLabels, err := ruleM.GetCustomLabels() - if err != nil { - return nil, errors.Wrap(err, "failed to read rule custom labels") - } - - // Add rule labels - if err = transformMaps(customLabels, r.Labels, params); err != nil { - return nil, errors.Wrap(err, "failed to fill rule labels placeholders") - } - - // Do not add volatile values like `{{ $value }}` to labels as it will break alerts identity. - r.Labels["ia"] = "1" - r.Labels["severity"] = common.Severity(ruleM.Severity).String() - r.Labels["rule_id"] = ruleM.ID - r.Labels["template_name"] = ruleM.TemplateName - - res = append(res, ruleFile{ - Group: []ruleGroup{{ - Name: "PMM Integrated Alerting", - Rules: []rule{r}, - }}, - }) - } - - return res, nil -} - -// fills templates found in labels and annotaitons with values. -// Deprecated. Do not use. -func transformMaps(src map[string]string, dest map[string]string, data map[string]string) error { - var buf bytes.Buffer - for k, v := range src { - buf.Reset() - t, err := newParamTemplate().Parse(v) - if err != nil { - return err - } - if err = t.Execute(&buf, data); err != nil { - return err - } - dest[k] = buf.String() - } - return nil -} - -// dump the transformed IA templates to a file. -// Deprecated. Do not use. -func (s *RulesService) writeRuleFile(rule *ruleFile) error { - b, err := yaml.Marshal(rule) - if err != nil { - return errors.Errorf("failed to marshal rule %v", err) - } - b = append([]byte("---\n"), b...) - - alertRule := rule.Group[0].Rules[0] - if alertRule.Alert == "" { - return errors.New("alert rule not initialized") - } - - fileName := strings.TrimPrefix(alertRule.Alert, "/rule_id/") - path := s.rulesPath + "/" + fileName + ".yml" - if err = os.WriteFile(path, b, 0o644); err != nil { //nolint:gosec - return errors.Errorf("failed to dump rule to file %s: %v", s.rulesPath, err) - } - - return nil -} - -// ListAlertRules returns a list of all Integrated Alerting rules. -// Deprecated. Do not use. -func (s *RulesService) ListAlertRules(ctx context.Context, req *iav1beta1.ListAlertRulesRequest) (*iav1beta1.ListAlertRulesResponse, error) { - var pageIndex int - pageSize := math.MaxInt32 - if req.PageParams != nil { - pageIndex = int(req.PageParams.Index) - pageSize = int(req.PageParams.PageSize) - } - - var rules []*models.Rule - var channels []*models.Channel - var totalItems int - errTx := s.db.InTransaction(func(tx *reform.TX) error { - var err error - rules, err = models.FindRulesOnPage(tx.Querier, pageIndex, pageSize) - if err != nil { - return errors.WithStack(err) - } - - totalItems, err = models.CountRules(tx.Querier) - if err != nil { - return errors.WithStack(err) - } - - channelsIDs := make(map[string]struct{}, len(rules)) - for _, rule := range rules { - for _, id := range rule.ChannelIDs { - channelsIDs[id] = struct{}{} - } - } - - channels, err = models.FindChannelsByIDs(tx.Querier, stringset.ToSlice(channelsIDs)) - if err != nil { - return errors.WithStack(err) - } - - return nil - }) - if errTx != nil { - return nil, errors.WithStack(errTx) - } - - res, err := s.convertAlertRules(rules, channels) - if err != nil { - return nil, errors.WithStack(err) - } - - totalPages := totalItems / pageSize - if totalItems%pageSize > 0 { - totalPages++ - } - - totals := &managementpb.PageTotals{ - TotalItems: int32(totalItems), - TotalPages: int32(totalPages), - } - - return &iav1beta1.ListAlertRulesResponse{Rules: res, Totals: totals}, nil -} - -func (s *RulesService) convertAlertRules(rules []*models.Rule, channels []*models.Channel) ([]*iav1beta1.Rule, error) { - res := make([]*iav1beta1.Rule, 0, len(rules)) - for _, rule := range rules { - r, err := convertRule(s.l, rule, channels) - if err != nil { - return nil, errors.WithStack(err) - } - res = append(res, r) - } - - return res, nil -} - -// CreateAlertRule creates Integrated Alerting rule. -// Deprecated. Do not use. -func (s *RulesService) CreateAlertRule(ctx context.Context, req *iav1beta1.CreateAlertRuleRequest) (*iav1beta1.CreateAlertRuleResponse, error) { - if req.TemplateName != "" && req.SourceRuleId != "" { - return nil, status.Errorf(codes.InvalidArgument, "Both template name and source rule id are specified.") - } - if req.TemplateName == "" && req.SourceRuleId == "" { - return nil, status.Errorf(codes.InvalidArgument, "Template name or source rule id should be specified.") - } - - params := &models.CreateRuleParams{ - Name: req.Name, - Disabled: req.Disabled, - For: req.For.AsDuration(), - Severity: models.Severity(req.Severity), - CustomLabels: req.CustomLabels, - ChannelIDs: req.ChannelIds, - } - - var err error - params.ParamsValues, err = convertParamsValuesToModel(req.Params) - if err != nil { - return nil, err - } - - params.Filters, err = convertFiltersToModel(req.Filters) - if err != nil { - return nil, err - } - - if req.TemplateName != "" { //nolint:nestif - template, ok := s.templates.GetTemplates()[req.TemplateName] - if !ok { - return nil, status.Errorf(codes.NotFound, "Unknown template %s.", req.TemplateName) - } - - params.TemplateName = template.Name - params.Summary = template.Summary - params.ExprTemplate = template.Expr - params.DefaultFor = template.For - params.DefaultSeverity = template.Severity - params.ParamsDefinitions = template.Params - - params.Labels, err = template.GetLabels() - if err != nil { - return nil, errors.WithStack(err) - } - - params.Annotations, err = template.GetAnnotations() - if err != nil { - return nil, errors.WithStack(err) - } - } else { - sourceRule, err := models.FindRuleByID(s.db.Querier, req.SourceRuleId) - if err != nil { - return nil, err - } - - params.TemplateName = sourceRule.TemplateName - params.Summary = sourceRule.Summary - params.ExprTemplate = sourceRule.ExprTemplate - params.DefaultFor = sourceRule.DefaultFor - params.DefaultSeverity = sourceRule.DefaultSeverity - params.ParamsDefinitions = sourceRule.ParamsDefinitions - - params.Labels, err = sourceRule.GetLabels() - if err != nil { - return nil, err - } - - params.Annotations, err = sourceRule.GetAnnotations() - if err != nil { - return nil, err - } - } - - if err := validateParameters(params.ParamsDefinitions, params.ParamsValues); err != nil { - return nil, err - } - - // Check that we can compile expression with given parameters - _, err = fillExprWithParams(params.ExprTemplate, params.ParamsValues.AsStringMap()) - if err != nil { - return nil, err - } - - var rule *models.Rule - errTX := s.db.InTransaction(func(tx *reform.TX) error { - var err error - rule, err = models.CreateRule(tx.Querier, params) - return err - }) - if errTX != nil { - return nil, errTX - } - - s.updateConfigurations() - - return &iav1beta1.CreateAlertRuleResponse{RuleId: rule.ID}, nil -} - -// UpdateAlertRule updates Integrated Alerting rule. -// Deprecated. Do not use. -func (s *RulesService) UpdateAlertRule(ctx context.Context, req *iav1beta1.UpdateAlertRuleRequest) (*iav1beta1.UpdateAlertRuleResponse, error) { - params := &models.ChangeRuleParams{ - Name: req.Name, - Disabled: req.Disabled, - For: req.For.AsDuration(), - Severity: models.Severity(req.Severity), - CustomLabels: req.CustomLabels, - ChannelIDs: req.ChannelIds, - } - - var err error - params.Filters, err = convertFiltersToModel(req.Filters) - if err != nil { - return nil, err - } - - params.ParamsValues, err = convertParamsValuesToModel(req.Params) - if err != nil { - return nil, err - } - e := s.db.InTransaction(func(tx *reform.TX) error { - rule, err := models.FindRuleByID(tx.Querier, req.RuleId) - if err != nil { - return err - } - - if err = validateParameters(rule.ParamsDefinitions, params.ParamsValues); err != nil { - return err - } - - // Check that we can compile expression with given parameters - if _, err = fillExprWithParams(rule.ExprTemplate, params.ParamsValues.AsStringMap()); err != nil { - return errors.Wrap(err, "failed to fill expression template with parameters values") - } - - _, err = models.ChangeRule(tx.Querier, req.RuleId, params) - return err - }) - if e != nil { - return nil, e - } - - s.updateConfigurations() - - return &iav1beta1.UpdateAlertRuleResponse{}, nil -} - -// ToggleAlertRule allows switching between disabled and enabled states of an Alert Rule. -// Deprecated. Do not use. -func (s *RulesService) ToggleAlertRule(ctx context.Context, req *iav1beta1.ToggleAlertRuleRequest) (*iav1beta1.ToggleAlertRuleResponse, error) { - params := &models.ToggleRuleParams{Disabled: parseBooleanFlag(req.Disabled)} - e := s.db.InTransaction(func(tx *reform.TX) error { - _, err := models.ToggleRule(tx.Querier, req.RuleId, params) - return err - }) - if e != nil { - return nil, e - } - - s.updateConfigurations() - - return &iav1beta1.ToggleAlertRuleResponse{}, nil -} - -// DeleteAlertRule deletes Integrated Alerting rule. -// Deprecated. Do not use. -func (s *RulesService) DeleteAlertRule(ctx context.Context, req *iav1beta1.DeleteAlertRuleRequest) (*iav1beta1.DeleteAlertRuleResponse, error) { - e := s.db.InTransaction(func(tx *reform.TX) error { - return models.RemoveRule(tx.Querier, req.RuleId) - }) - if e != nil { - return nil, e - } - - s.updateConfigurations() - - return &iav1beta1.DeleteAlertRuleResponse{}, nil -} - -func (s *RulesService) updateConfigurations() { - s.WriteVMAlertRulesFiles() - s.vmalert.RequestConfigurationUpdate() - s.alertManager.RequestConfigurationUpdate() -} - -// convertParamType converts an alert type to its alerting API equivalent. -// Deprecated. Do not use. -func convertParamType(t alert.Type) alerting.ParamType { - // TODO: add another types. - switch t { - case alert.Float: - return alerting.ParamType_FLOAT - default: - return alerting.ParamType_PARAM_TYPE_INVALID - } -} - -// convertModelToParamsDefinitions converts a parameter definition model to its alerting API equivalent. -// Deprecated. Do not use. -func convertModelToParamsDefinitions(definitions models.AlertExprParamsDefinitions) ([]*alerting.ParamDefinition, error) { - res := make([]*alerting.ParamDefinition, 0, len(definitions)) - for _, definition := range definitions { - t := alert.Type(definition.Type) - p := &alerting.ParamDefinition{ - Name: definition.Name, - Summary: definition.Summary, - Unit: convertParamUnit(alert.Unit(definition.Unit)), - Type: convertParamType(t), - } - - switch t { - case alert.Float: - var value alerting.FloatParamDefinition - float := definition.FloatParam - if float.Default != nil { - value.HasDefault = true - value.Default = pointer.GetFloat64(float.Default) - } - - if float.Min != nil { - value.HasMin = true - value.Min = pointer.GetFloat64(float.Min) - } - - if float.Max != nil { - value.HasMax = true - value.Max = pointer.GetFloat64(float.Max) - } - p.Value = &alerting.ParamDefinition_Float{Float: &value} - case alert.Bool, alert.String: - return nil, errors.Errorf("unsupported parameter type %s", t) - } - - // do not add `default:` to make exhaustive linter do its job - - res = append(res, p) - } - - return res, nil -} - -// convertModelToParamValues converts a parameter value to its protobuf representation. -// Deprecated. Do not use. -func convertModelToParamValues(values models.AlertExprParamsValues) ([]*iav1beta1.ParamValue, error) { - res := make([]*iav1beta1.ParamValue, len(values)) - for i, param := range values { - p := &iav1beta1.ParamValue{Name: param.Name} - - switch param.Type { - case models.Bool: - p.Type = alerting.ParamType_BOOL - p.Value = &iav1beta1.ParamValue_Bool{Bool: param.BoolValue} - case models.Float: - p.Type = alerting.ParamType_FLOAT - p.Value = &iav1beta1.ParamValue_Float{Float: param.FloatValue} - case models.String: - p.Type = alerting.ParamType_STRING - p.Value = &iav1beta1.ParamValue_String_{String_: param.StringValue} - default: - return nil, errors.Errorf("unknown rule param value type %s", param.Type) - } - res[i] = p - } - return res, nil -} - -// convertParamsValuesToModel converts a parameter value to its model equivalent. -// Deprecated. Do not use. -func convertParamsValuesToModel(params []*iav1beta1.ParamValue) (models.AlertExprParamsValues, error) { - ruleParams := make(models.AlertExprParamsValues, len(params)) - for i, param := range params { - p := models.AlertExprParamValue{Name: param.Name} - - switch param.Type { - case alerting.ParamType_PARAM_TYPE_INVALID: - return nil, errors.New("invalid model rule param value type") - case alerting.ParamType_BOOL: - p.Type = models.Bool - p.BoolValue = param.GetBool() - case alerting.ParamType_FLOAT: - p.Type = models.Float - p.FloatValue = param.GetFloat() - case alerting.ParamType_STRING: - p.Type = models.Float - p.StringValue = param.GetString_() - default: - return nil, errors.New("invalid model rule param value type") - } - - ruleParams[i] = p - } - return ruleParams, nil -} - -// parseBooleanFlag converts a protobuf boolean value to a boolean pointer. -// Deprecated. Do not use. -func parseBooleanFlag(bf managementpb.BooleanFlag) *bool { - switch bf { - case managementpb.BooleanFlag_TRUE: - return pointer.ToBool(true) - case managementpb.BooleanFlag_FALSE: - return pointer.ToBool(false) - case managementpb.BooleanFlag_DO_NOT_CHANGE: - return nil - default: - panic("unexpected value of boolean flag") - } -} - -// convertModelToFilterType converts a filter type model to its protobuf representation. -// Deprecated. Do not use. -func convertModelToFilterType(filterType models.FilterType) iav1beta1.FilterType { - switch filterType { - case models.Equal: - return iav1beta1.FilterType_EQUAL - case models.Regex: - return iav1beta1.FilterType_REGEX - default: - return iav1beta1.FilterType_FILTER_TYPE_INVALID - } -} - -// convertFiltersToModel converts an IA filter to its model representation. -// Deprecated. Do not use. -func convertFiltersToModel(filters []*iav1beta1.Filter) (models.Filters, error) { - res := make(models.Filters, len(filters)) - for i, filter := range filters { - f := models.Filter{ - Key: filter.Key, - } - - // Unquote the first encountered quote. - // Do it only for filters as only they can be set in PMM 2.13. - f.Val = filter.Value - for _, q := range []string{`"`, `'`} { - if strings.HasPrefix(f.Val, q) && strings.HasSuffix(f.Val, q) { - f.Val = strings.TrimPrefix(f.Val, q) - f.Val = strings.TrimSuffix(f.Val, q) - break - } - } - - switch filter.Type { - case iav1beta1.FilterType_EQUAL: - f.Type = models.Equal - case iav1beta1.FilterType_REGEX: - f.Type = models.Regex - case iav1beta1.FilterType_FILTER_TYPE_INVALID: - fallthrough - default: - return nil, status.Errorf(codes.InvalidArgument, "Unexpected filter type.") - } - res[i] = f - } - - return res, nil -} - -// Check interfaces. -var ( - _ iav1beta1.RulesServer = (*RulesService)(nil) -) diff --git a/managed/services/management/ia/rules_service_test.go b/managed/services/management/ia/rules_service_test.go deleted file mode 100644 index a925fd51d7..0000000000 --- a/managed/services/management/ia/rules_service_test.go +++ /dev/null @@ -1,380 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ia - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -/* -// func TestCreateAlertRule(t *testing.T) { -// ctx := context.Background() -// sqlDB := testdb.Open(t, models.SkipFixtures, nil) -// db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) -// -// // Enable IA and disable telemetry to prevent network calls -// settings, err := models.GetSettings(db) -// require.NoError(t, err) -// settings.Alerting.Disabled = false -// settings.Telemetry.Disabled = true -// err = models.SaveSettings(db, settings) -// require.NoError(t, err) -// -// var alertManager mockAlertManager -// alertManager.On("RequestConfigurationUpdate").Return() -// var vmAlert mockVmAlert -// vmAlert.On("RequestConfigurationUpdate").Return() -// -// // Create channel -// channels := NewChannelsService(db, &alertManager) -// respC, err := channels.AddChannel(context.Background(), &iav1beta1.AddChannelRequest{ -// Summary: "test channel", -// EmailConfig: &iav1beta1.EmailConfig{ -// SendResolved: false, -// To: []string{"test@test.test"}, -// }, -// Disabled: false, -// }) -// require.NoError(t, err) -// channelID := respC.ChannelId -// -// // Load test templates -// templates, err := NewTemplatesService(db, nil) -// require.NoError(t, err) -// templates.userTemplatesPath = testTemplates2 -// templates.CollectTemplates(ctx) -// -// t.Run("normal", func(t *testing.T) { -// testDir := t.TempDir() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// resp, err := rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "test_template", -// Disabled: false, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{ -// { -// Name: "param1", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 85}, -// }, -// { -// Name: "param2", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 1.22}, -// }, -// }, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "'60'", -// }}, -// ChannelIds: []string{channelID}, -// }) -// require.NoError(t, err) -// ruleID := resp.RuleId -// -// // Write vmAlert rules files -// rules.WriteVMAlertRulesFiles() -// -// file, err := os.ReadFile(ruleFileName(testDir, ruleID)) -// require.NoError(t, err) -// -// expected := fmt.Sprintf(`--- -// groups: -// - name: PMM Integrated Alerting -// rules: -// - alert: %s -// expr: 1.22 * 100 > 85 -// for: 2s -// labels: -// baz: faz -// foo: bar -// ia: "1" -// rule_id: %s -// severity: info -// template_name: test_template -// annotations: -// description: |- -// Test template with param1=85 and param2=1.22 -// VALUE = {{ $value }} -// LABELS: {{ $labels }} -// rule: some testing rule -// summary: Test rule (instance {{ $labels.instance }}) -// `, ruleID, ruleID) -// -// assert.Equal(t, expected, string(file)) -// -// // Removes the rules files -// err = rules.RemoveVMAlertRulesFiles() -// require.NoError(t, err) -// -// matches, err := dir.FindFilesWithExtensions(testDir, "yml", "yaml") -// -// assert.Empty(t, matches) -// assert.NoError(t, err) -// }) -// -// t.Run("wrong parameter value", func(t *testing.T) { -// testDir := t.TempDir() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// _, err = rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "test_template", -// Disabled: false, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{ -// { -// Name: "param1", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 123}, -// }, { -// Name: "param2", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 1.22}, -// }, -// }, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "'60'", -// }}, -// ChannelIds: []string{channelID}, -// }) -// tests.AssertGRPCError(t, status.New(codes.InvalidArgument, "Parameter param1 value is greater than required maximum."), err) -// }) -// -// t.Run("wrong parameter", func(t *testing.T) { -// testDir := t.TempDir() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// _, err = rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "test_template", -// Disabled: false, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{ -// { -// Name: "param2", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 22.1}, -// }, { -// Name: "unknown parameter", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 1.22}, -// }, -// }, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "'60'", -// }}, -// ChannelIds: []string{channelID}, -// }) -// tests.AssertGRPCError(t, status.New(codes.InvalidArgument, "Parameter param1 is missing."), err) -// }) -// -// t.Run("missing parameter", func(t *testing.T) { -// testDir := t.TempDir() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// _, err = rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "test_template", -// Disabled: false, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{ -// { -// Name: "param2", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 22.1}, -// }, -// }, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "'60'", -// }}, -// ChannelIds: []string{channelID}, -// }) -// tests.AssertGRPCError(t, status.New(codes.InvalidArgument, "Expression requires 2 parameters, but got 1."), err) -// }) -// -// t.Run("wrong parameter type", func(t *testing.T) { -// testDir := t.TempDir() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// _, err = rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "test_template", -// Disabled: false, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{ -// { -// Name: "param1", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 1.22}, -// }, -// { -// Name: "param2", -// Type: alerting.ParamType_BOOL, -// Value: &iav1beta1.ParamValue_Bool{Bool: true}, -// }, -// }, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "'60'", -// }}, -// ChannelIds: []string{channelID}, -// }) -// tests.AssertGRPCError(t, status.New(codes.InvalidArgument, "Parameter param2 has type bool instead of float."), err) -// }) -// -// t.Run("missing template", func(t *testing.T) { -// testDir := t.TempDir() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// _, err = rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "unknown template", -// Disabled: false, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{{ -// Name: "param2", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{ -// Float: 1.22, -// }, -// }}, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "'60'", -// }}, -// ChannelIds: []string{channelID}, -// }) -// tests.AssertGRPCError(t, status.New(codes.NotFound, "Unknown template unknown template."), err) -// }) -// -// t.Run("disabled", func(t *testing.T) { -// testDir := t.TempDir() -// -// vmAlert = mockVmAlert{} -// vmAlert.On("RequestConfigurationUpdate").Return() -// -// // Create test rule -// rules := NewRulesService(db, templates, &vmAlert, &alertManager) -// rules.rulesPath = testDir -// resp, err := rules.CreateAlertRule(context.Background(), &iav1beta1.CreateAlertRuleRequest{ -// TemplateName: "test_template", -// Disabled: true, -// Name: "some testing rule", -// Params: []*iav1beta1.ParamValue{ -// { -// Name: "param1", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 85}, -// }, -// { -// Name: "param2", -// Type: alerting.ParamType_FLOAT, -// Value: &iav1beta1.ParamValue_Float{Float: 1.22}, -// }, -// }, -// For: durationpb.New(2 * time.Second), -// Severity: managementpb.Severity_SEVERITY_INFO, -// CustomLabels: map[string]string{ -// "baz": "faz", -// }, -// Filters: []*iav1beta1.Filter{{ -// Type: iav1beta1.FilterType_EQUAL, -// Key: "some_key", -// Value: "60", -// }}, -// ChannelIds: []string{channelID}, -// }) -// require.NoError(t, err) -// ruleID := resp.RuleId -// -// // Write vmAlert rules files -// rules.WriteVMAlertRulesFiles() -// -// filename := ruleFileName(testDir, ruleID) -// _, err = os.Stat(filename) -// assert.EqualError(t, err, fmt.Sprintf("stat %s: no such file or directory", filename)) -// }) -// }. -*/ - -func ruleFileName(testDir, ruleID string) string { - return testDir + "/" + strings.TrimPrefix(ruleID, "/rule_id/") + ".yml" -} - -func TestTemplatesRuleExpr(t *testing.T) { - expr := "[[ .param1 ]] > [[ .param2 ]] and [[ .param2 ]] < [[ .param3 ]]" - - params := map[string]string{ - "param1": "5", - "param2": "2", - "param3": "4", - } - actual, err := fillExprWithParams(expr, params) - require.NoError(t, err) - - require.Equal(t, "5 > 2 and 2 < 4", actual) -} diff --git a/managed/services/server/deps.go b/managed/services/server/deps.go index d7c139830b..132c54c673 100644 --- a/managed/services/server/deps.go +++ b/managed/services/server/deps.go @@ -32,8 +32,6 @@ import ( //go:generate ../../../bin/mockery --name=supervisordService --case=snake --inpackage --testonly //go:generate ../../../bin/mockery --name=telemetryService --case=snake --inpackage --testonly //go:generate ../../../bin/mockery --name=agentsStateUpdater --case=snake --inpackage --testonly -//go:generate ../../../bin/mockery --name=rulesService --case=snake --inpackage --testonly -//go:generate ../../../bin/mockery --name=emailer --case=snake --inpackage --testonly //go:generate ../../../bin/mockery --name=templatesService --case=snake --inpackage --testonly // healthChecker interface wraps all services that implements the IsReady method to report the @@ -116,18 +114,7 @@ type agentsStateUpdater interface { UpdateAgentsState(ctx context.Context) error } -// rulesService is a subset of methods of ia.RulesService used by this package. -// We use it instead of real type for testing and to avoid dependency cycle. -type rulesService interface { - WriteVMAlertRulesFiles() - RemoveVMAlertRulesFiles() error -} - -type emailer interface { - Send(ctx context.Context, settings *models.EmailAlertingSettings, emailTo string) error -} - -// rulesService is a subset of methods of ia.TemplatesService used by this package. +// templatesService is a subset of methods of alerting.Service used by this package. // We use it instead of real type for testing and to avoid dependency cycle. type templatesService interface { CollectTemplates(ctx context.Context) diff --git a/managed/services/server/mock_emailer_test.go b/managed/services/server/mock_emailer_test.go deleted file mode 100644 index bc9005264f..0000000000 --- a/managed/services/server/mock_emailer_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by mockery v2.35.1. DO NOT EDIT. - -package server - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - models "github.com/percona/pmm/managed/models" -) - -// mockEmailer is an autogenerated mock type for the emailer type -type mockEmailer struct { - mock.Mock -} - -// Send provides a mock function with given fields: ctx, settings, emailTo -func (_m *mockEmailer) Send(ctx context.Context, settings *models.EmailAlertingSettings, emailTo string) error { - ret := _m.Called(ctx, settings, emailTo) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *models.EmailAlertingSettings, string) error); ok { - r0 = rf(ctx, settings, emailTo) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// newMockEmailer creates a new instance of mockEmailer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockEmailer(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockEmailer { - mock := &mockEmailer{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/managed/services/server/mock_rules_service_test.go b/managed/services/server/mock_rules_service_test.go deleted file mode 100644 index 6181e03e11..0000000000 --- a/managed/services/server/mock_rules_service_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by mockery v2.35.1. DO NOT EDIT. - -package server - -import mock "github.com/stretchr/testify/mock" - -// mockRulesService is an autogenerated mock type for the rulesService type -type mockRulesService struct { - mock.Mock -} - -// RemoveVMAlertRulesFiles provides a mock function with given fields: -func (_m *mockRulesService) RemoveVMAlertRulesFiles() error { - ret := _m.Called() - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// WriteVMAlertRulesFiles provides a mock function with given fields: -func (_m *mockRulesService) WriteVMAlertRulesFiles() { - _m.Called() -} - -// newMockRulesService creates a new instance of mockRulesService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockRulesService(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockRulesService { - mock := &mockRulesService{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/managed/services/server/server.go b/managed/services/server/server.go index f4747a7902..8f9558b400 100644 --- a/managed/services/server/server.go +++ b/managed/services/server/server.go @@ -30,7 +30,6 @@ import ( "sync" "time" - "github.com/asaskevich/govalidator" "github.com/google/uuid" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -61,8 +60,6 @@ type Server struct { telemetryService telemetryService awsInstanceChecker *AWSInstanceChecker grafanaClient grafanaClient - rulesService rulesService - emailer emailer l *logrus.Entry @@ -95,8 +92,6 @@ type Params struct { TelemetryService telemetryService AwsInstanceChecker *AWSInstanceChecker GrafanaClient grafanaClient - RulesService rulesService - Emailer emailer } // NewServer returns new server for Server service. @@ -120,8 +115,6 @@ func NewServer(params *Params) (*Server, error) { telemetryService: params.TelemetryService, awsInstanceChecker: params.AwsInstanceChecker, grafanaClient: params.GrafanaClient, - rulesService: params.RulesService, - emailer: params.Emailer, l: logrus.WithField("component", "server"), pmmUpdateAuthFile: path, envSettings: &models.ChangeSettingsParams{}, @@ -450,25 +443,6 @@ func (s *Server) convertSettings(settings *models.Settings, connectedToPlatform DefaultRoleId: uint32(settings.DefaultRoleID), } - if settings.Alerting.EmailAlertingSettings != nil { - res.EmailAlertingSettings = &serverpb.EmailAlertingSettings{ - From: settings.Alerting.EmailAlertingSettings.From, - Smarthost: settings.Alerting.EmailAlertingSettings.Smarthost, - Hello: settings.Alerting.EmailAlertingSettings.Hello, - Username: settings.Alerting.EmailAlertingSettings.Username, - Password: "", - Identity: settings.Alerting.EmailAlertingSettings.Identity, - Secret: settings.Alerting.EmailAlertingSettings.Secret, - RequireTls: settings.Alerting.EmailAlertingSettings.RequireTLS, - } - } - - if settings.Alerting.SlackAlertingSettings != nil { - res.SlackAlertingSettings = &serverpb.SlackAlertingSettings{ - Url: settings.Alerting.SlackAlertingSettings.URL, - } - } - b, err := s.vmalertExternalRules.ReadRules() if err != nil { s.l.Warnf("Cannot load Alert Manager rules: %s", err) @@ -602,38 +576,15 @@ func (s *Server) ChangeSettings(ctx context.Context, req *serverpb.ChangeSetting PMMPublicAddress: req.PmmPublicAddress, RemovePMMPublicAddress: req.RemovePmmPublicAddress, - EnableAlerting: req.EnableAlerting, - DisableAlerting: req.DisableAlerting, - RemoveEmailAlertingSettings: req.RemoveEmailAlertingSettings, - RemoveSlackAlertingSettings: req.RemoveSlackAlertingSettings, - EnableBackupManagement: req.EnableBackupManagement, - DisableBackupManagement: req.DisableBackupManagement, + EnableAlerting: req.EnableAlerting, + DisableAlerting: req.DisableAlerting, + EnableBackupManagement: req.EnableBackupManagement, + DisableBackupManagement: req.DisableBackupManagement, EnableAccessControl: req.EnableAccessControl, DisableAccessControl: req.DisableAccessControl, } - if req.EmailAlertingSettings != nil { - settingsParams.EmailAlertingSettings = &models.EmailAlertingSettings{ - From: req.EmailAlertingSettings.From, - Smarthost: req.EmailAlertingSettings.Smarthost, - Hello: req.EmailAlertingSettings.Hello, - Username: req.EmailAlertingSettings.Username, - Identity: req.EmailAlertingSettings.Identity, - Secret: req.EmailAlertingSettings.Secret, - RequireTLS: req.EmailAlertingSettings.RequireTls, - } - if req.EmailAlertingSettings.Password != "" { - settingsParams.EmailAlertingSettings.Password = req.EmailAlertingSettings.Password - } - } - - if req.SlackAlertingSettings != nil { - settingsParams.SlackAlertingSettings = &models.SlackAlertingSettings{ - URL: req.SlackAlertingSettings.Url, - } - } - var errInvalidArgument *models.InvalidArgumentError newSettings, err = models.UpdateSettings(tx, settingsParams) switch { @@ -672,18 +623,6 @@ func (s *Server) ChangeSettings(ctx context.Context, req *serverpb.ChangeSetting return nil, err } - // When IA moved from disabled state to enabled create rules files. - if oldSettings.Alerting.Disabled && req.EnableAlerting { - s.rulesService.WriteVMAlertRulesFiles() - } - - // When IA moved from enabled state to disabled cleanup rules files. - if !oldSettings.Alerting.Disabled && req.DisableAlerting { - if err := s.rulesService.RemoveVMAlertRulesFiles(); err != nil { - s.l.Errorf("Failed to clean old alert rule files: %+v", err) - } - } - // If STT intervals are changed reset timers. if oldSettings.SaaS.STTCheckIntervals != newSettings.SaaS.STTCheckIntervals { s.checksService.UpdateIntervals( @@ -728,44 +667,7 @@ func (s *Server) ChangeSettings(ctx context.Context, req *serverpb.ChangeSetting }, nil } -// TestEmailAlertingSettings tests email alerting SMTP settings by sending testing email. -func (s *Server) TestEmailAlertingSettings( - ctx context.Context, - req *serverpb.TestEmailAlertingSettingsRequest, -) (*serverpb.TestEmailAlertingSettingsResponse, error) { - eas := req.EmailAlertingSettings - settings := &models.EmailAlertingSettings{ - From: eas.From, - Smarthost: eas.Smarthost, - Hello: eas.Hello, - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTLS: eas.RequireTls, - } - - if err := settings.Validate(); err != nil { - return nil, status.Errorf(codes.InvalidArgument, "Invalid argument: %s.", err.Error()) - } - - if !govalidator.IsEmail(req.EmailTo) { - return nil, status.Errorf(codes.InvalidArgument, "invalid \"emailTo\" email %q", req.EmailTo) - } - - err := s.emailer.Send(ctx, settings, req.EmailTo) - if err != nil { - var errInvalidArgument *models.InvalidArgumentError - if errors.As(err, &errInvalidArgument) { - return nil, status.Errorf(codes.InvalidArgument, "Cannot send email: %s.", errInvalidArgument.Details) - } - return nil, status.Errorf(codes.Internal, "Cannot send email: %s.", err.Error()) - } - - return &serverpb.TestEmailAlertingSettingsResponse{}, nil -} - -// UpdateConfigurations updates supervisor config and requests configuration update for PMM components. +// UpdateConfigurations updates supervisor config and requests configuration update for VictoriaMetrics components. func (s *Server) UpdateConfigurations(ctx context.Context) error { settings, err := models.GetSettings(s.db) if err != nil { diff --git a/managed/services/server/server_test.go b/managed/services/server/server_test.go index 24c784b1e5..0ea7039b78 100644 --- a/managed/services/server/server_test.go +++ b/managed/services/server/server_test.go @@ -253,191 +253,21 @@ func TestServer(t *testing.T) { assert.True(t, settings.Settings.AzurediscoverEnabled) }) - t.Run("ChangeSettings IA", func(t *testing.T) { + t.Run("ChangeSettings Alerting", func(t *testing.T) { server := newServer(t) - var rs mockRulesService - server.rulesService = &rs server.UpdateSettingsFromEnv([]string{}) ctx := context.TODO() - rs.On("RemoveVMAlertRulesFiles").Return(nil) - defer rs.AssertExpectations(t) s, err := server.ChangeSettings(ctx, &serverpb.ChangeSettingsRequest{ DisableAlerting: true, }) require.NoError(t, err) require.NotNil(t, s) - rs.On("WriteVMAlertRulesFiles") s, err = server.ChangeSettings(ctx, &serverpb.ChangeSettingsRequest{ EnableAlerting: true, }) require.NoError(t, err) require.NotNil(t, s) - - rs.On("RemoveVMAlertRulesFiles").Return(nil) - s, err = server.ChangeSettings(ctx, &serverpb.ChangeSettingsRequest{ - DisableAlerting: true, - }) - require.NoError(t, err) - require.NotNil(t, s) }) } - -func TestServer_TestEmailAlertingSettings(t *testing.T) { //nolint:tparallel - t.Parallel() - - var server Server - - var e mockEmailer - server.emailer = &e - - ctx := context.TODO() - - normalRequest := &serverpb.TestEmailAlertingSettingsRequest{ - EmailAlertingSettings: &serverpb.EmailAlertingSettings{ - From: "me@example.com", - Smarthost: "example.com:465", - Hello: "example.com", - Username: "example-user", - Password: "some-password", - Identity: "example", - Secret: "example-secret", - RequireTls: true, - }, - EmailTo: "to@example.com", - } - eas := normalRequest.EmailAlertingSettings - - for _, tc := range []struct { - testName string - req *serverpb.TestEmailAlertingSettingsRequest - respErr string - mock func() - }{ - { - testName: "normal", - req: normalRequest, - respErr: "", - mock: func() { - s := &models.EmailAlertingSettings{ - From: eas.From, - Smarthost: eas.Smarthost, - Hello: eas.Hello, - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTLS: eas.RequireTls, - } - e.On("Send", mock.Anything, s, normalRequest.EmailTo).Return(nil).Once() - }, - }, - { - testName: "failed to send: invalid argument", - req: normalRequest, - respErr: "rpc error: code = InvalidArgument desc = Cannot send email: invalid argument.", - mock: func() { - s := &models.EmailAlertingSettings{ - From: eas.From, - Smarthost: eas.Smarthost, - Hello: eas.Hello, - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTLS: eas.RequireTls, - } - e.On("Send", mock.Anything, s, normalRequest.EmailTo). - Return(models.NewInvalidArgumentError("invalid argument")).Once() - }, - }, - { - testName: "invalid argument: from", - respErr: "rpc error: code = InvalidArgument desc = " + - "Invalid argument: invalid \"from\" email \"invalid-from\".", - req: &serverpb.TestEmailAlertingSettingsRequest{ - EmailAlertingSettings: &serverpb.EmailAlertingSettings{ - From: "invalid-from", - Smarthost: eas.Smarthost, - Hello: eas.Hello, - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTls: eas.RequireTls, - }, - EmailTo: normalRequest.EmailTo, - }, - }, - { - testName: "invalid argument: smarthost", - respErr: "rpc error: code = InvalidArgument desc = " + - "Invalid argument: invalid server address, expected format host:port.", - req: &serverpb.TestEmailAlertingSettingsRequest{ - EmailAlertingSettings: &serverpb.EmailAlertingSettings{ - From: eas.From, - Smarthost: "invalid-smart-host", - Hello: eas.Hello, - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTls: eas.RequireTls, - }, - EmailTo: normalRequest.EmailTo, - }, - }, - { - testName: "invalid argument: hello", - respErr: "rpc error: code = InvalidArgument desc = " + - "Invalid argument: invalid hello field, expected valid host.", - req: &serverpb.TestEmailAlertingSettingsRequest{ - EmailAlertingSettings: &serverpb.EmailAlertingSettings{ - From: eas.From, - Smarthost: eas.Smarthost, - Hello: "@invalid hello", - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTls: eas.RequireTls, - }, - EmailTo: normalRequest.EmailTo, - }, - }, - { - testName: "invalid argument: emailTo", - respErr: "rpc error: code = InvalidArgument desc = invalid \"emailTo\" email \"invalid email\"", - req: &serverpb.TestEmailAlertingSettingsRequest{ - EmailAlertingSettings: &serverpb.EmailAlertingSettings{ - From: eas.From, - Smarthost: eas.Smarthost, - Hello: eas.Hello, - Username: eas.Username, - Password: eas.Password, - Identity: eas.Identity, - Secret: eas.Secret, - RequireTls: eas.RequireTls, - }, - EmailTo: "invalid email", - }, - }, - } { - t.Run(tc.testName, func(t *testing.T) { - if tc.mock != nil { - tc.mock() - } - resp, err := server.TestEmailAlertingSettings(ctx, tc.req) - if tc.respErr != "" { - assert.Nil(t, resp) - assert.EqualError(t, err, tc.respErr) - } else { - assert.NoError(t, err) - assert.NotNil(t, resp) - } - }) - } - - mock.AssertExpectationsForObjects(t, &e) -} diff --git a/managed/services/supervisord/supervisord.go b/managed/services/supervisord/supervisord.go index 1dced16711..79cfede3c5 100644 --- a/managed/services/supervisord/supervisord.go +++ b/managed/services/supervisord/supervisord.go @@ -676,7 +676,6 @@ command = --remoteRead.ignoreRestoreErrors=false --remoteWrite.url={{ .VMURL }} --rule=/srv/prometheus/rules/*.yml - --rule=/etc/ia/rules/*.yml --httpListenAddr={{ .InterfaceToBind }}:8880 {{- range $index, $param := .VMAlertFlags }} {{ $param }} diff --git a/managed/services/types.go b/managed/services/types.go index 9573660b91..4cac2c40ed 100644 --- a/managed/services/types.go +++ b/managed/services/types.go @@ -87,8 +87,6 @@ type CheckResultSummary struct { // FilterParams provides fields needed to filter alerts from AlertManager. type FilterParams struct { - // IsIA specifies if only Integrated Alerts should be matched. - IsIA bool // IsCheck specifies if only Checks/Advisors alerts should be matched. IsCheck bool // AlertID is the ID of alert to be matched (if any). diff --git a/managed/testdata/supervisord.d/vmalert.ini b/managed/testdata/supervisord.d/vmalert.ini index 40f61b1d83..0d645ed111 100644 --- a/managed/testdata/supervisord.d/vmalert.ini +++ b/managed/testdata/supervisord.d/vmalert.ini @@ -13,7 +13,6 @@ command = --remoteRead.ignoreRestoreErrors=false --remoteWrite.url=http://127.0.0.1:9090/prometheus/ --rule=/srv/prometheus/rules/*.yml - --rule=/etc/ia/rules/*.yml --httpListenAddr=127.0.0.1:8880 user = pmm autorestart = true diff --git a/managed/utils/envvars/parser.go b/managed/utils/envvars/parser.go index 49bf15613e..9ed915b9fa 100644 --- a/managed/utils/envvars/parser.go +++ b/managed/utils/envvars/parser.go @@ -57,9 +57,9 @@ func (e InvalidDurationError) Error() string { return string(e) } // - PATH, HOSTNAME, TERM, HOME are default environment variables that will be ignored; // - DISABLE_UPDATES is a boolean flag to enable or disable pmm-server update; // - DISABLE_TELEMETRY is a boolean flag to enable or disable pmm telemetry (and disable STT if telemetry is disabled); +// - DISABLE_ALERTING disables Percona Alerting; // - METRICS_RESOLUTION, METRICS_RESOLUTION_MR, METRICS_RESOLUTION_HR, METRICS_RESOLUTION_LR are durations of metrics resolution; // - DATA_RETENTION is the duration of how long keep time-series data in ClickHouse; -// - ENABLE_ALERTING enables Integrated Alerting; // - ENABLE_AZUREDISCOVER enables Azure Discover; // - ENABLE_RBAC enables Access control; // - the environment variables prefixed with GF_ passed as related to Grafana.