diff --git a/Makefile b/Makefile index d38e887b..6dcea870 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ NAME="github.com/goto/siren" LAST_COMMIT := $(shell git rev-parse --short HEAD) LAST_TAG := "$(shell git rev-list --tags --max-count=1)" APP_VERSION := "$(shell git describe --tags ${LAST_TAG})-next" -PROTON_COMMIT := "534a703026bd70fa464c3bedc6a9aef3f8fcdd19" +PROTON_COMMIT := "f210b5a6d036c9c8288dc52af65ba4a09d88ee4d" .PHONY: all build test clean dist vet proto install diff --git a/core/namespace/mocks/config_syncer.go b/core/namespace/mocks/config_syncer.go index 46c141c2..f7aa518e 100644 --- a/core/namespace/mocks/config_syncer.go +++ b/core/namespace/mocks/config_syncer.go @@ -23,18 +23,30 @@ func (_m *ConfigSyncer) EXPECT() *ConfigSyncer_Expecter { return &ConfigSyncer_Expecter{mock: &_m.Mock} } -// SyncRuntimeConfig provides a mock function with given fields: ctx, namespaceID, namespaceURN, prov -func (_m *ConfigSyncer) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, prov provider.Provider) error { - ret := _m.Called(ctx, namespaceID, namespaceURN, prov) +// SyncRuntimeConfig provides a mock function with given fields: ctx, namespaceID, namespaceURN, namespaceLabels, prov +func (_m *ConfigSyncer) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error) { + ret := _m.Called(ctx, namespaceID, namespaceURN, namespaceLabels, prov) + + var r0 map[string]string + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, string, map[string]string, provider.Provider) (map[string]string, error)); ok { + return rf(ctx, namespaceID, namespaceURN, namespaceLabels, prov) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, string, map[string]string, provider.Provider) map[string]string); ok { + r0 = rf(ctx, namespaceID, namespaceURN, namespaceLabels, prov) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]string) + } + } - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, uint64, string, provider.Provider) error); ok { - r0 = rf(ctx, namespaceID, namespaceURN, prov) + if rf, ok := ret.Get(1).(func(context.Context, uint64, string, map[string]string, provider.Provider) error); ok { + r1 = rf(ctx, namespaceID, namespaceURN, namespaceLabels, prov) } else { - r0 = ret.Error(0) + r1 = ret.Error(1) } - return r0 + return r0, r1 } // ConfigSyncer_SyncRuntimeConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncRuntimeConfig' @@ -46,24 +58,25 @@ type ConfigSyncer_SyncRuntimeConfig_Call struct { // - ctx context.Context // - namespaceID uint64 // - namespaceURN string +// - namespaceLabels map[string]string // - prov provider.Provider -func (_e *ConfigSyncer_Expecter) SyncRuntimeConfig(ctx interface{}, namespaceID interface{}, namespaceURN interface{}, prov interface{}) *ConfigSyncer_SyncRuntimeConfig_Call { - return &ConfigSyncer_SyncRuntimeConfig_Call{Call: _e.mock.On("SyncRuntimeConfig", ctx, namespaceID, namespaceURN, prov)} +func (_e *ConfigSyncer_Expecter) SyncRuntimeConfig(ctx interface{}, namespaceID interface{}, namespaceURN interface{}, namespaceLabels interface{}, prov interface{}) *ConfigSyncer_SyncRuntimeConfig_Call { + return &ConfigSyncer_SyncRuntimeConfig_Call{Call: _e.mock.On("SyncRuntimeConfig", ctx, namespaceID, namespaceURN, namespaceLabels, prov)} } -func (_c *ConfigSyncer_SyncRuntimeConfig_Call) Run(run func(ctx context.Context, namespaceID uint64, namespaceURN string, prov provider.Provider)) *ConfigSyncer_SyncRuntimeConfig_Call { +func (_c *ConfigSyncer_SyncRuntimeConfig_Call) Run(run func(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider)) *ConfigSyncer_SyncRuntimeConfig_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(uint64), args[2].(string), args[3].(provider.Provider)) + run(args[0].(context.Context), args[1].(uint64), args[2].(string), args[3].(map[string]string), args[4].(provider.Provider)) }) return _c } -func (_c *ConfigSyncer_SyncRuntimeConfig_Call) Return(_a0 error) *ConfigSyncer_SyncRuntimeConfig_Call { - _c.Call.Return(_a0) +func (_c *ConfigSyncer_SyncRuntimeConfig_Call) Return(_a0 map[string]string, _a1 error) *ConfigSyncer_SyncRuntimeConfig_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ConfigSyncer_SyncRuntimeConfig_Call) RunAndReturn(run func(context.Context, uint64, string, provider.Provider) error) *ConfigSyncer_SyncRuntimeConfig_Call { +func (_c *ConfigSyncer_SyncRuntimeConfig_Call) RunAndReturn(run func(context.Context, uint64, string, map[string]string, provider.Provider) (map[string]string, error)) *ConfigSyncer_SyncRuntimeConfig_Call { _c.Call.Return(run) return _c } diff --git a/core/namespace/mocks/namespace_repository.go b/core/namespace/mocks/namespace_repository.go index c6cf144f..66e1bddd 100644 --- a/core/namespace/mocks/namespace_repository.go +++ b/core/namespace/mocks/namespace_repository.go @@ -345,6 +345,50 @@ func (_c *NamespaceRepository_Update_Call) RunAndReturn(run func(context.Context return _c } +// UpdateLabels provides a mock function with given fields: _a0, _a1, _a2 +func (_m *NamespaceRepository) UpdateLabels(_a0 context.Context, _a1 uint64, _a2 map[string]string) error { + ret := _m.Called(_a0, _a1, _a2) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, map[string]string) error); ok { + r0 = rf(_a0, _a1, _a2) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// NamespaceRepository_UpdateLabels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateLabels' +type NamespaceRepository_UpdateLabels_Call struct { + *mock.Call +} + +// UpdateLabels is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 uint64 +// - _a2 map[string]string +func (_e *NamespaceRepository_Expecter) UpdateLabels(_a0 interface{}, _a1 interface{}, _a2 interface{}) *NamespaceRepository_UpdateLabels_Call { + return &NamespaceRepository_UpdateLabels_Call{Call: _e.mock.On("UpdateLabels", _a0, _a1, _a2)} +} + +func (_c *NamespaceRepository_UpdateLabels_Call) Run(run func(_a0 context.Context, _a1 uint64, _a2 map[string]string)) *NamespaceRepository_UpdateLabels_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(map[string]string)) + }) + return _c +} + +func (_c *NamespaceRepository_UpdateLabels_Call) Return(_a0 error) *NamespaceRepository_UpdateLabels_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *NamespaceRepository_UpdateLabels_Call) RunAndReturn(run func(context.Context, uint64, map[string]string) error) *NamespaceRepository_UpdateLabels_Call { + _c.Call.Return(run) + return _c +} + // WithTransaction provides a mock function with given fields: ctx func (_m *NamespaceRepository) WithTransaction(ctx context.Context) context.Context { ret := _m.Called(ctx) diff --git a/core/namespace/namespace.go b/core/namespace/namespace.go index 38c9adec..3231ef2c 100644 --- a/core/namespace/namespace.go +++ b/core/namespace/namespace.go @@ -14,6 +14,7 @@ type Repository interface { Create(context.Context, *EncryptedNamespace) error Get(context.Context, uint64) (*EncryptedNamespace, error) Update(context.Context, *EncryptedNamespace) error + UpdateLabels(context.Context, uint64, map[string]string) error Delete(context.Context, uint64) error } diff --git a/core/namespace/provider_plugin.go b/core/namespace/provider_plugin.go index 37213e6d..2c7c3dd9 100644 --- a/core/namespace/provider_plugin.go +++ b/core/namespace/provider_plugin.go @@ -8,5 +8,5 @@ import ( //go:generate mockery --name=ConfigSyncer -r --case underscore --with-expecter --structname ConfigSyncer --filename config_syncer.go --output=./mocks type ConfigSyncer interface { - SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, prov provider.Provider) error + SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error) } diff --git a/core/namespace/service.go b/core/namespace/service.go index 4df0971a..7d40518a 100644 --- a/core/namespace/service.go +++ b/core/namespace/service.go @@ -84,13 +84,32 @@ func (s *Service) Create(ctx context.Context, ns *Namespace) error { return err } - if err := pluginService.SyncRuntimeConfig(ctx, encryptedNamespace.ID, ns.URN, *prov); err != nil { + labels, err := pluginService.SyncRuntimeConfig(ctx, encryptedNamespace.ID, ns.URN, ns.Labels, ns.Provider) + if err != nil { if err := s.repository.Rollback(ctx, err); err != nil { return err } return err } + if encryptedNamespace.Labels == nil { + encryptedNamespace.Labels = make(map[string]string) + } + + for k, v := range labels { + encryptedNamespace.Labels[k] = v + } + + if err = s.repository.UpdateLabels(ctx, encryptedNamespace.ID, encryptedNamespace.Labels); err != nil { + if err := s.repository.Rollback(ctx, err); err != nil { + return err + } + if errors.As(err, new(NotFoundError)) { + return errors.ErrNotFound.WithMsgf(err.Error()) + } + return err + } + if err := s.repository.Commit(ctx); err != nil { return err } @@ -142,8 +161,7 @@ func (s *Service) Update(ctx context.Context, ns *Namespace) error { } ctx = s.repository.WithTransaction(ctx) - err = s.repository.Update(ctx, encryptedNamespace) - if err != nil { + if err = s.repository.Update(ctx, encryptedNamespace); err != nil { if err := s.repository.Rollback(ctx, err); err != nil { return err } @@ -159,10 +177,29 @@ func (s *Service) Update(ctx context.Context, ns *Namespace) error { return err } - if err := pluginService.SyncRuntimeConfig(ctx, encryptedNamespace.ID, ns.URN, ns.Provider); err != nil { + labels, err := pluginService.SyncRuntimeConfig(ctx, encryptedNamespace.ID, ns.URN, ns.Labels, ns.Provider) + if err != nil { + if err := s.repository.Rollback(ctx, err); err != nil { + return err + } + return err + } + + if encryptedNamespace.Labels == nil { + encryptedNamespace.Labels = make(map[string]string) + } + + for k, v := range labels { + encryptedNamespace.Labels[k] = v + } + + if err = s.repository.UpdateLabels(ctx, encryptedNamespace.ID, encryptedNamespace.Labels); err != nil { if err := s.repository.Rollback(ctx, err); err != nil { return err } + if errors.As(err, new(NotFoundError)) { + return errors.ErrNotFound.WithMsgf(err.Error()) + } return err } diff --git a/core/namespace/service_test.go b/core/namespace/service_test.go index 9e57511a..e7585497 100644 --- a/core/namespace/service_test.go +++ b/core/namespace/service_test.go @@ -313,7 +313,7 @@ func TestService_CreateNamespace(t *testing.T) { Namespace: tc.NSpace, CredentialString: "some-ciphertext", }).Return(nil) - cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("provider.Provider")).Return(errors.New("some error")) + cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("map[string]string"), mock.AnythingOfType("provider.Provider")).Return(nil, errors.New("some error")) rr.EXPECT().Rollback(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("*errors.errorString")).Return(nil) }, NSpace: &namespace.Namespace{ @@ -324,7 +324,7 @@ func TestService_CreateNamespace(t *testing.T) { Err: errors.New("some error"), }, { - Description: "should return nil error if create repository success & sync config success", + Description: "should return error if create repository success & sync config success & update labels error", Setup: func(rr *mocks.NamespaceRepository, e *mocks.Encryptor, ps *mocks.ProviderService, cs *mocks.ConfigSyncer, tc testCase) { ps.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64")).Return(&provider.Provider{Type: testProviderType}, nil) e.EXPECT().Encrypt(mock.AnythingOfType("secret.MaskableString")).Return("some-ciphertext", nil) @@ -333,7 +333,29 @@ func TestService_CreateNamespace(t *testing.T) { Namespace: tc.NSpace, CredentialString: "some-ciphertext", }).Return(nil) - cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("provider.Provider")).Return(nil) + cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("map[string]string"), mock.AnythingOfType("provider.Provider")).Return(map[string]string{"k": "v"}, nil) + rr.EXPECT().UpdateLabels(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("map[string]string")).Return(errors.New("some error")) + rr.EXPECT().Rollback(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("*errors.errorString")).Return(nil) + }, + NSpace: &namespace.Namespace{ + Credentials: map[string]any{ + "credential": "value", + }, + }, + Err: errors.New("some error"), + }, + { + Description: "should return nil error if create repository success & sync config success & update labels success", + Setup: func(rr *mocks.NamespaceRepository, e *mocks.Encryptor, ps *mocks.ProviderService, cs *mocks.ConfigSyncer, tc testCase) { + ps.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64")).Return(&provider.Provider{Type: testProviderType}, nil) + e.EXPECT().Encrypt(mock.AnythingOfType("secret.MaskableString")).Return("some-ciphertext", nil) + rr.EXPECT().WithTransaction(mock.AnythingOfType("context.todoCtx")).Return(ctx) + rr.EXPECT().Create(mock.AnythingOfType("context.todoCtx"), &namespace.EncryptedNamespace{ + Namespace: tc.NSpace, + CredentialString: "some-ciphertext", + }).Return(nil) + cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("map[string]string"), mock.AnythingOfType("provider.Provider")).Return(map[string]string{"k": "v"}, nil) + rr.EXPECT().UpdateLabels(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("map[string]string")).Return(nil) rr.EXPECT().Commit(mock.AnythingOfType("context.todoCtx")).Return(nil) }, NSpace: &namespace.Namespace{ @@ -620,7 +642,29 @@ func TestService_UpdateNamespace(t *testing.T) { Namespace: tc.NSpace, CredentialString: "some-ciphertext", }).Return(nil) - cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("provider.Provider")).Return(errors.New("some error")) + cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("map[string]string"), mock.AnythingOfType("provider.Provider")).Return(nil, errors.New("some error")) + rr.EXPECT().Rollback(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("*errors.errorString")).Return(nil) + }, + NSpace: &namespace.Namespace{ + Credentials: map[string]any{ + "credential": "value", + }, + }, + Err: errors.New("some error"), + }, + { + Description: "should return error if update repository success, sync success, and update labels return error", + Setup: func(rr *mocks.NamespaceRepository, e *mocks.Encryptor, cs *mocks.ConfigSyncer, tc testCase) { + rr.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64")).Return(&namespace.EncryptedNamespace{Namespace: &namespace.Namespace{Provider: provider.Provider{Type: testProviderType}}}, nil) + e.EXPECT().Decrypt(mock.AnythingOfType("secret.MaskableString")).Return("{ \"key\": \"value\" }", nil) + e.EXPECT().Encrypt(mock.AnythingOfType("secret.MaskableString")).Return("some-ciphertext", nil) + rr.EXPECT().WithTransaction(mock.AnythingOfType("context.todoCtx")).Return(ctx) + rr.EXPECT().Update(mock.AnythingOfType("context.todoCtx"), &namespace.EncryptedNamespace{ + Namespace: tc.NSpace, + CredentialString: "some-ciphertext", + }).Return(nil) + cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("map[string]string"), mock.AnythingOfType("provider.Provider")).Return(map[string]string{"k": "v"}, nil) + rr.EXPECT().UpdateLabels(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("map[string]string")).Return(errors.New("some error")) rr.EXPECT().Rollback(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("*errors.errorString")).Return(nil) }, NSpace: &namespace.Namespace{ @@ -631,7 +675,7 @@ func TestService_UpdateNamespace(t *testing.T) { Err: errors.New("some error"), }, { - Description: "should return nil error if update repository success", + Description: "should return nil error if update repository success, sync, and update labels success", Setup: func(rr *mocks.NamespaceRepository, e *mocks.Encryptor, cs *mocks.ConfigSyncer, tc testCase) { rr.EXPECT().Get(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64")).Return(&namespace.EncryptedNamespace{Namespace: &namespace.Namespace{Provider: provider.Provider{Type: testProviderType}}}, nil) e.EXPECT().Decrypt(mock.AnythingOfType("secret.MaskableString")).Return("{ \"key\": \"value\" }", nil) @@ -641,7 +685,8 @@ func TestService_UpdateNamespace(t *testing.T) { Namespace: tc.NSpace, CredentialString: "some-ciphertext", }).Return(nil) - cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("provider.Provider")).Return(nil) + cs.EXPECT().SyncRuntimeConfig(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("string"), mock.AnythingOfType("map[string]string"), mock.AnythingOfType("provider.Provider")).Return(map[string]string{"k": "v"}, nil) + rr.EXPECT().UpdateLabels(mock.AnythingOfType("context.todoCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("map[string]string")).Return(nil) rr.EXPECT().Commit(mock.AnythingOfType("context.todoCtx")).Return(nil) }, NSpace: &namespace.Namespace{ diff --git a/internal/store/postgres/namespace.go b/internal/store/postgres/namespace.go index cb8b872c..87d2a683 100644 --- a/internal/store/postgres/namespace.go +++ b/internal/store/postgres/namespace.go @@ -25,6 +25,12 @@ WHERE id = $1 RETURNING * ` +const namespaceUpdateLabelQuery = ` +UPDATE namespaces SET labels=$2, updated_at=now() +WHERE id = $1 +RETURNING * +` + var namespaceListQueryBuilder = sq.Select(` n.id as id, n.urn as urn, @@ -168,12 +174,28 @@ func (r NamespaceRepository) Update(ctx context.Context, ns *namespace.Encrypted return nil } +func (r NamespaceRepository) UpdateLabels(ctx context.Context, id uint64, labels map[string]string) error { + if len(labels) == 0 { + return nil + } + rows, err := r.client.QueryxContext(ctx, pgc.OpUpdate, r.tableName, namespaceUpdateLabelQuery, id, labels) + if err != nil { + err = pgc.CheckError(err) + if errors.Is(err, sql.ErrNoRows) { + return namespace.NotFoundError{ID: id} + } + return err + } + defer rows.Close() + return nil +} + func (r NamespaceRepository) Delete(ctx context.Context, id uint64) error { rows, err := r.client.QueryxContext(ctx, pgc.OpDelete, r.tableName, namespaceDeleteQuery, id) if err != nil { return err } - rows.Close() + defer rows.Close() return nil } diff --git a/internal/store/postgres/namespace_test.go b/internal/store/postgres/namespace_test.go index 48e8d65f..719fda7b 100644 --- a/internal/store/postgres/namespace_test.go +++ b/internal/store/postgres/namespace_test.go @@ -2,6 +2,7 @@ package postgres_test import ( "context" + "errors" "testing" "github.com/google/go-cmp/cmp" @@ -401,6 +402,45 @@ func (s *NamespaceRepositoryTestSuite) TestUpdate() { } } +func (s *NamespaceRepositoryTestSuite) TestUpdateLabels() { + type testCase struct { + Description string + ID uint64 + Labels map[string]string + ExpectedLabels map[string]string + Err error + } + + var testCases = []testCase{ + { + Description: "should update existing namespace label", + ID: 1, + Labels: map[string]string{ + "k": "v", + }, + Err: nil, + }, + { + Description: "should return error not found if id not found", + ID: 1000, + Labels: map[string]string{}, + Err: errors.New("namespace with id 1000 not found"), + }, + { + ID: 1, + Description: "should return nil if label is empty", + Err: nil, + }, + } + + for _, tc := range testCases { + s.Run(tc.Description, func() { + err := s.repository.UpdateLabels(s.ctx, tc.ID, tc.Labels) + s.Assert().Equal(tc.Err, err) + }) + } +} + func (s *NamespaceRepositoryTestSuite) TestDelete() { type testCase struct { Description string diff --git a/plugins/providers/cortex/v1/service.go b/plugins/providers/cortex/v1/service.go index 90f79fc8..46f43229 100644 --- a/plugins/providers/cortex/v1/service.go +++ b/plugins/providers/cortex/v1/service.go @@ -155,7 +155,7 @@ func (s *PluginService) TransformToAlerts(ctx context.Context, providerID uint64 } // SyncRuntimeConfig synchronizes runtime configuration of provider -func (s *PluginService) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, prov provider.Provider) error { +func (s *PluginService) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error) { webhookURL := fmt.Sprintf("%s/%d/%d", s.cfg.WebhookBaseAPI, prov.ID, namespaceID) tmplConfig := TemplateConfig{ @@ -167,7 +167,7 @@ func (s *PluginService) SyncRuntimeConfig(ctx context.Context, namespaceID uint6 cfg, err := s.generateAlertmanagerConfig(tmplConfig) if err != nil { - return err + return nil, err } templates := map[string]string{ "helper.tmpl": s.helperTemplate, @@ -175,13 +175,13 @@ func (s *PluginService) SyncRuntimeConfig(ctx context.Context, namespaceID uint6 cortexClient, err := s.getCortexClient(prov.Host, namespaceURN) if err != nil { - return err + return nil, err } if err = cortexClient.CreateAlertmanagerConfig(ctx, cfg, templates); err != nil { - return err + return nil, err } - return nil + return make(map[string]string), nil } // UpsertRule manages upsert logic to cortex ruler. Cortex client API granularity is on the rule-group. diff --git a/plugins/providerv1beta1.go b/plugins/providerv1beta1.go index c4cad09f..bebc4686 100644 --- a/plugins/providerv1beta1.go +++ b/plugins/providerv1beta1.go @@ -19,7 +19,7 @@ import ( ) type ProviderV1beta1 interface { - SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, prov provider.Provider) error + SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error) UpsertRule(ctx context.Context, ns namespace.Namespace, prov provider.Provider, rl *rule.Rule, templateToUpdate *template.Template) error SetConfig(ctx context.Context, configRaw string) error TransformToAlerts(ctx context.Context, providerID uint64, namespaceID uint64, body map[string]any) ([]alert.Alert, int, error) @@ -35,19 +35,21 @@ func NewProviderClient(c sirenproviderv1beta1.ProviderServiceClient) *GRPCClient } } -func (c *GRPCClient) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, prov provider.Provider) error { +func (c *GRPCClient) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error) { protoProv, err := prov.ToV1beta1Proto() if err != nil { - return err + return nil, err } - if _, err := c.client.SyncRuntimeConfig(ctx, &sirenproviderv1beta1.SyncRuntimeConfigRequest{ + resp, err := c.client.SyncRuntimeConfig(ctx, &sirenproviderv1beta1.SyncRuntimeConfigRequest{ NamespaceId: fmt.Sprintf("%d", namespaceID), NamespaceUrn: namespaceURN, Provider: protoProv, - }); err != nil { - return err + Labels: namespaceLabels, + }) + if err != nil { + return nil, err } - return nil + return resp.GetLabels(), nil } func (c *GRPCClient) UpsertRule(ctx context.Context, ns namespace.Namespace, prov provider.Provider, rl *rule.Rule, templateToUpdate *template.Template) error { @@ -132,7 +134,14 @@ func (s *GRPCServer) SyncRuntimeConfig(ctx context.Context, req *sirenproviderv1 return nil, errors.New("error parsing namespace ID") } - return &sirenproviderv1beta1.SyncRuntimeConfigResponse{}, s.service.SyncRuntimeConfig(ctx, namespaceIDUint64, req.GetNamespaceUrn(), prov) + encrichedLabels, err := s.service.SyncRuntimeConfig(ctx, namespaceIDUint64, req.GetNamespaceUrn(), req.GetLabels(), prov) + if err != nil { + return nil, err + } + + return &sirenproviderv1beta1.SyncRuntimeConfigResponse{ + Labels: encrichedLabels, + }, nil } func (s *GRPCServer) UpsertRule(ctx context.Context, req *sirenproviderv1beta1.UpsertRuleRequest) (*sirenproviderv1beta1.UpsertRuleResponse, error) { diff --git a/proto/gotocompany/siren/provider/v1beta1/provider.pb.go b/proto/gotocompany/siren/provider/v1beta1/provider.pb.go index e38ef9ef..6d6ed1d6 100644 --- a/proto/gotocompany/siren/provider/v1beta1/provider.pb.go +++ b/proto/gotocompany/siren/provider/v1beta1/provider.pb.go @@ -30,6 +30,7 @@ type SyncRuntimeConfigRequest struct { NamespaceId string `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` NamespaceUrn string `protobuf:"bytes,2,opt,name=namespace_urn,json=namespaceUrn,proto3" json:"namespace_urn,omitempty"` Provider *v1beta1.Provider `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` + Labels map[string]string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *SyncRuntimeConfigRequest) Reset() { @@ -85,10 +86,19 @@ func (x *SyncRuntimeConfigRequest) GetProvider() *v1beta1.Provider { return nil } +func (x *SyncRuntimeConfigRequest) GetLabels() map[string]string { + if x != nil { + return x.Labels + } + return nil +} + type SyncRuntimeConfigResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Labels map[string]string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *SyncRuntimeConfigResponse) Reset() { @@ -123,6 +133,13 @@ func (*SyncRuntimeConfigResponse) Descriptor() ([]byte, []int) { return file_gotocompany_siren_provider_v1beta1_provider_proto_rawDescGZIP(), []int{1} } +func (x *SyncRuntimeConfigResponse) GetLabels() map[string]string { + if x != nil { + return x.Labels + } + return nil +} + type UpsertRuleRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -447,7 +464,7 @@ var file_gotocompany_siren_provider_v1beta1_provider_proto_rawDesc = []byte{ 0x70, 0x61, 0x6e, 0x79, 0x2f, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x02, 0x0a, 0x18, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, @@ -458,92 +475,112 @@ var file_gotocompany_siren_provider_v1beta1_provider_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x22, 0x1b, 0x0a, 0x19, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, - 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x8e, 0x02, 0x0a, 0x11, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x04, 0x72, 0x75, - 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, - 0x3f, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, - 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x22, 0x14, 0x0a, 0x12, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x61, 0x77, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x65, 0x74, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8b, - 0x01, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, - 0x2b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x74, 0x0a, 0x19, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x06, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x75, - 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x66, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4e, - 0x75, 0x6d, 0x32, 0xae, 0x04, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x90, 0x01, 0x0a, 0x11, 0x53, 0x79, 0x6e, 0x63, 0x52, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3c, 0x2e, 0x67, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d, 0x2e, 0x67, 0x6f, 0x74, + 0x65, 0x72, 0x12, 0x60, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, + 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, + 0x62, 0x65, 0x6c, 0x73, 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, 0x22, + 0xb9, 0x01, 0x0a, 0x19, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, + 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x49, 0x2e, + 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 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, 0x22, 0x8e, 0x02, 0x0a, 0x11, + 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x42, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, + 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, + 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, + 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, + 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x14, 0x0a, 0x12, + 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x31, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x5f, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x61, 0x77, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x18, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x74, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, + 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x06, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x09, 0x66, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4e, 0x75, 0x6d, 0x32, 0xae, + 0x04, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x90, 0x01, 0x0a, 0x11, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3c, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x79, + 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, + 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, + 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x0a, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, + 0x75, 0x6c, 0x65, 0x12, 0x35, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, + 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, + 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x53, 0x79, 0x6e, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x0a, 0x55, 0x70, 0x73, - 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x35, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x73, - 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, - 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, - 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x78, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x34, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, - 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x67, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, - 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x90, 0x01, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x12, 0x3c, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, - 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, - 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, - 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0x8e, 0x01, 0x0a, 0x25, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x2e, 0x73, - 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x42, 0x0e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x50, 0x01, 0x5a, - 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x74, 0x6f, - 0x2f, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2f, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2f, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, - 0x73, 0x69, 0x72, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x78, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x34, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, + 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, + 0x61, 0x6e, 0x79, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x90, 0x01, 0x0a, + 0x11, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, + 0x74, 0x73, 0x12, 0x3c, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, + 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, + 0x6d, 0x54, 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x3d, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x2e, 0x73, + 0x69, 0x72, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, + 0x6f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x8e, 0x01, 0x0a, 0x25, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, 0x70, + 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x2e, 0x73, 0x69, 0x72, 0x65, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x42, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x69, 0x72, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6d, + 0x70, 0x61, 0x6e, 0x79, 0x2f, 0x73, 0x69, 0x72, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x69, 0x72, 0x65, + 0x6e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -558,7 +595,7 @@ func file_gotocompany_siren_provider_v1beta1_provider_proto_rawDescGZIP() []byte return file_gotocompany_siren_provider_v1beta1_provider_proto_rawDescData } -var file_gotocompany_siren_provider_v1beta1_provider_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_gotocompany_siren_provider_v1beta1_provider_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_gotocompany_siren_provider_v1beta1_provider_proto_goTypes = []interface{}{ (*SyncRuntimeConfigRequest)(nil), // 0: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest (*SyncRuntimeConfigResponse)(nil), // 1: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigResponse @@ -568,34 +605,38 @@ var file_gotocompany_siren_provider_v1beta1_provider_proto_goTypes = []interface (*SetConfigResponse)(nil), // 5: gotocompany.siren.provider.v1beta1.SetConfigResponse (*TransformToAlertsRequest)(nil), // 6: gotocompany.siren.provider.v1beta1.TransformToAlertsRequest (*TransformToAlertsResponse)(nil), // 7: gotocompany.siren.provider.v1beta1.TransformToAlertsResponse - (*v1beta1.Provider)(nil), // 8: gotocompany.siren.v1beta1.Provider - (*v1beta1.Namespace)(nil), // 9: gotocompany.siren.v1beta1.Namespace - (*v1beta1.Rule)(nil), // 10: gotocompany.siren.v1beta1.Rule - (*v1beta1.Template)(nil), // 11: gotocompany.siren.v1beta1.Template - (*structpb.Struct)(nil), // 12: google.protobuf.Struct - (*v1beta1.Alert)(nil), // 13: gotocompany.siren.v1beta1.Alert + nil, // 8: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest.LabelsEntry + nil, // 9: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigResponse.LabelsEntry + (*v1beta1.Provider)(nil), // 10: gotocompany.siren.v1beta1.Provider + (*v1beta1.Namespace)(nil), // 11: gotocompany.siren.v1beta1.Namespace + (*v1beta1.Rule)(nil), // 12: gotocompany.siren.v1beta1.Rule + (*v1beta1.Template)(nil), // 13: gotocompany.siren.v1beta1.Template + (*structpb.Struct)(nil), // 14: google.protobuf.Struct + (*v1beta1.Alert)(nil), // 15: gotocompany.siren.v1beta1.Alert } var file_gotocompany_siren_provider_v1beta1_provider_proto_depIdxs = []int32{ - 8, // 0: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest.provider:type_name -> gotocompany.siren.v1beta1.Provider - 9, // 1: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.namespace:type_name -> gotocompany.siren.v1beta1.Namespace - 8, // 2: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.provider:type_name -> gotocompany.siren.v1beta1.Provider - 10, // 3: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.rule:type_name -> gotocompany.siren.v1beta1.Rule - 11, // 4: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.template:type_name -> gotocompany.siren.v1beta1.Template - 12, // 5: gotocompany.siren.provider.v1beta1.TransformToAlertsRequest.body:type_name -> google.protobuf.Struct - 13, // 6: gotocompany.siren.provider.v1beta1.TransformToAlertsResponse.alerts:type_name -> gotocompany.siren.v1beta1.Alert - 0, // 7: gotocompany.siren.provider.v1beta1.ProviderService.SyncRuntimeConfig:input_type -> gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest - 2, // 8: gotocompany.siren.provider.v1beta1.ProviderService.UpsertRule:input_type -> gotocompany.siren.provider.v1beta1.UpsertRuleRequest - 4, // 9: gotocompany.siren.provider.v1beta1.ProviderService.SetConfig:input_type -> gotocompany.siren.provider.v1beta1.SetConfigRequest - 6, // 10: gotocompany.siren.provider.v1beta1.ProviderService.TransformToAlerts:input_type -> gotocompany.siren.provider.v1beta1.TransformToAlertsRequest - 1, // 11: gotocompany.siren.provider.v1beta1.ProviderService.SyncRuntimeConfig:output_type -> gotocompany.siren.provider.v1beta1.SyncRuntimeConfigResponse - 3, // 12: gotocompany.siren.provider.v1beta1.ProviderService.UpsertRule:output_type -> gotocompany.siren.provider.v1beta1.UpsertRuleResponse - 5, // 13: gotocompany.siren.provider.v1beta1.ProviderService.SetConfig:output_type -> gotocompany.siren.provider.v1beta1.SetConfigResponse - 7, // 14: gotocompany.siren.provider.v1beta1.ProviderService.TransformToAlerts:output_type -> gotocompany.siren.provider.v1beta1.TransformToAlertsResponse - 11, // [11:15] is the sub-list for method output_type - 7, // [7:11] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 10, // 0: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest.provider:type_name -> gotocompany.siren.v1beta1.Provider + 8, // 1: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest.labels:type_name -> gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest.LabelsEntry + 9, // 2: gotocompany.siren.provider.v1beta1.SyncRuntimeConfigResponse.labels:type_name -> gotocompany.siren.provider.v1beta1.SyncRuntimeConfigResponse.LabelsEntry + 11, // 3: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.namespace:type_name -> gotocompany.siren.v1beta1.Namespace + 10, // 4: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.provider:type_name -> gotocompany.siren.v1beta1.Provider + 12, // 5: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.rule:type_name -> gotocompany.siren.v1beta1.Rule + 13, // 6: gotocompany.siren.provider.v1beta1.UpsertRuleRequest.template:type_name -> gotocompany.siren.v1beta1.Template + 14, // 7: gotocompany.siren.provider.v1beta1.TransformToAlertsRequest.body:type_name -> google.protobuf.Struct + 15, // 8: gotocompany.siren.provider.v1beta1.TransformToAlertsResponse.alerts:type_name -> gotocompany.siren.v1beta1.Alert + 0, // 9: gotocompany.siren.provider.v1beta1.ProviderService.SyncRuntimeConfig:input_type -> gotocompany.siren.provider.v1beta1.SyncRuntimeConfigRequest + 2, // 10: gotocompany.siren.provider.v1beta1.ProviderService.UpsertRule:input_type -> gotocompany.siren.provider.v1beta1.UpsertRuleRequest + 4, // 11: gotocompany.siren.provider.v1beta1.ProviderService.SetConfig:input_type -> gotocompany.siren.provider.v1beta1.SetConfigRequest + 6, // 12: gotocompany.siren.provider.v1beta1.ProviderService.TransformToAlerts:input_type -> gotocompany.siren.provider.v1beta1.TransformToAlertsRequest + 1, // 13: gotocompany.siren.provider.v1beta1.ProviderService.SyncRuntimeConfig:output_type -> gotocompany.siren.provider.v1beta1.SyncRuntimeConfigResponse + 3, // 14: gotocompany.siren.provider.v1beta1.ProviderService.UpsertRule:output_type -> gotocompany.siren.provider.v1beta1.UpsertRuleResponse + 5, // 15: gotocompany.siren.provider.v1beta1.ProviderService.SetConfig:output_type -> gotocompany.siren.provider.v1beta1.SetConfigResponse + 7, // 16: gotocompany.siren.provider.v1beta1.ProviderService.TransformToAlerts:output_type -> gotocompany.siren.provider.v1beta1.TransformToAlertsResponse + 13, // [13:17] is the sub-list for method output_type + 9, // [9:13] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_gotocompany_siren_provider_v1beta1_provider_proto_init() } @@ -707,7 +748,7 @@ func file_gotocompany_siren_provider_v1beta1_provider_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gotocompany_siren_provider_v1beta1_provider_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gotocompany/siren/provider/v1beta1/provider.pb.validate.go b/proto/gotocompany/siren/provider/v1beta1/provider.pb.validate.go index 96a8e05f..5b324a0f 100644 --- a/proto/gotocompany/siren/provider/v1beta1/provider.pb.validate.go +++ b/proto/gotocompany/siren/provider/v1beta1/provider.pb.validate.go @@ -90,6 +90,8 @@ func (m *SyncRuntimeConfigRequest) validate(all bool) error { } } + // no validation rules for Labels + if len(errors) > 0 { return SyncRuntimeConfigRequestMultiError(errors) } @@ -192,6 +194,8 @@ func (m *SyncRuntimeConfigResponse) validate(all bool) error { var errors []error + // no validation rules for Labels + if len(errors) > 0 { return SyncRuntimeConfigResponseMultiError(errors) } diff --git a/proto/siren.swagger.yaml b/proto/siren.swagger.yaml index bf72070f..932f631b 100644 --- a/proto/siren.swagger.yaml +++ b/proto/siren.swagger.yaml @@ -1390,6 +1390,11 @@ definitions: type: string SyncRuntimeConfigResponse: type: object + properties: + labels: + type: object + additionalProperties: + type: string Template: type: object properties: