From 0295b959c9eb22bb3a0a4df6a1957e0b2a26ff84 Mon Sep 17 00:00:00 2001 From: Ashesh Vidyut <134911583+absolutelightning@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:34:15 +0530 Subject: [PATCH] Net 5875 - Create the Exported Services Resources (#19117) * init * computed exported service * make proto * exported services resource * exported services test * added some tests and namespace exported service * partition exported services * computed service * computed services tests * register types * fix comment * make proto lint * fix proto format make proto * make codegen * Update proto-public/pbmulticluster/v1alpha1/computed_exported_services.proto Co-authored-by: Eric Haberkorn * Update internal/multicluster/internal/types/computed_exported_services.go Co-authored-by: Eric Haberkorn * using different way of resource creation in tests * make proto * fix computed exported services test * fix tests * differnet validation for computed services for ent and ce * Acls for exported services * added validations for enterprise features in ce * fix error * fix acls test * Update internal/multicluster/internal/types/validation_exported_services_ee.go Co-authored-by: Eric Haberkorn * removed the create method * update proto * removed namespace * created seperate function for ce and ent * test files updated and validations fixed * added nil checks * fix tests * added comments * removed tenancy check * added mutation function * fix mutation method * fix list permissions in test * fix pr comments * fix tests * lisence * busl license * Update internal/multicluster/internal/types/helpers_ce.go Co-authored-by: Eric Haberkorn * Update internal/multicluster/internal/types/helpers_ce.go Co-authored-by: Eric Haberkorn * Update internal/multicluster/internal/types/helpers_ce.go Co-authored-by: Eric Haberkorn * make proto * some pr comments addressed * some pr comments addressed * acls helper * some comment changes * removed unused files * fixes * fix function in file * caps * some positioing * added test for validation error * fix names * made valid a function * remvoed patch * removed mutations * v2 beta1 * v2beta1 * rmeoved v1alpha1 * validate error * merge ent * some nits * removed dup func * removed nil check --------- Co-authored-by: Eric Haberkorn --- agent/consul/type_registry.go | 2 + internal/multicluster/exports.go | 22 ++ .../types/computed_exported_services.go | 37 ++ .../types/computed_exported_services_test.go | 178 +++++++++ .../internal/types/exported_services.go | 59 +++ .../internal/types/exported_services_test.go | 218 ++++++++++ .../multicluster/internal/types/helpers.go | 135 +++++++ .../multicluster/internal/types/helpers_ce.go | 66 ++++ .../types/namespace_exported_services.go | 33 ++ .../types/namespace_exported_services_test.go | 184 +++++++++ .../types/partition_exported_services.go | 33 ++ .../types/partition_exported_services_test.go | 185 +++++++++ internal/multicluster/internal/types/types.go | 21 + .../computed_exported_services.pb.binary.go | 38 ++ .../v2beta1/computed_exported_services.pb.go | 373 ++++++++++++++++++ .../v2beta1/computed_exported_services.proto | 28 ++ ...computed_exported_services_deepcopy.gen.go | 69 ++++ .../computed_exported_services_json.gen.go | 44 +++ .../v2beta1/exported_services.pb.binary.go | 18 + .../v2beta1/exported_services.pb.go | 193 +++++++++ .../v2beta1/exported_services.proto | 16 + .../exported_services_consumer.pb.binary.go | 18 + .../v2beta1/exported_services_consumer.pb.go | 230 +++++++++++ .../v2beta1/exported_services_consumer.proto | 14 + ...exported_services_consumer_deepcopy.gen.go | 27 ++ .../exported_services_consumer_json.gen.go | 22 ++ .../v2beta1/exported_services_deepcopy.gen.go | 27 ++ .../v2beta1/exported_services_json.gen.go | 22 ++ .../namespace_exported_services.pb.binary.go | 18 + .../v2beta1/namespace_exported_services.pb.go | 185 +++++++++ .../v2beta1/namespace_exported_services.proto | 15 + ...amespace_exported_services_deepcopy.gen.go | 27 ++ .../namespace_exported_services_json.gen.go | 22 ++ .../partition_exported_services.pb.binary.go | 18 + .../v2beta1/partition_exported_services.pb.go | 185 +++++++++ .../v2beta1/partition_exported_services.proto | 15 + ...artition_exported_services_deepcopy.gen.go | 27 ++ .../partition_exported_services_json.gen.go | 22 ++ .../v2beta1/resource_types.gen.go | 43 ++ 39 files changed, 2889 insertions(+) create mode 100644 internal/multicluster/exports.go create mode 100644 internal/multicluster/internal/types/computed_exported_services.go create mode 100644 internal/multicluster/internal/types/computed_exported_services_test.go create mode 100644 internal/multicluster/internal/types/exported_services.go create mode 100644 internal/multicluster/internal/types/exported_services_test.go create mode 100644 internal/multicluster/internal/types/helpers.go create mode 100644 internal/multicluster/internal/types/helpers_ce.go create mode 100644 internal/multicluster/internal/types/namespace_exported_services.go create mode 100644 internal/multicluster/internal/types/namespace_exported_services_test.go create mode 100644 internal/multicluster/internal/types/partition_exported_services.go create mode 100644 internal/multicluster/internal/types/partition_exported_services_test.go create mode 100644 internal/multicluster/internal/types/types.go create mode 100644 proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.binary.go create mode 100644 proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.go create mode 100644 proto-public/pbmulticluster/v2beta1/computed_exported_services.proto create mode 100644 proto-public/pbmulticluster/v2beta1/computed_exported_services_deepcopy.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/computed_exported_services_json.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services.pb.binary.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services.pb.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services.proto create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.binary.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_consumer.proto create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_consumer_deepcopy.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_consumer_json.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_deepcopy.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/exported_services_json.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.binary.go create mode 100644 proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.go create mode 100644 proto-public/pbmulticluster/v2beta1/namespace_exported_services.proto create mode 100644 proto-public/pbmulticluster/v2beta1/namespace_exported_services_deepcopy.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/namespace_exported_services_json.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.binary.go create mode 100644 proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.go create mode 100644 proto-public/pbmulticluster/v2beta1/partition_exported_services.proto create mode 100644 proto-public/pbmulticluster/v2beta1/partition_exported_services_deepcopy.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/partition_exported_services_json.gen.go create mode 100644 proto-public/pbmulticluster/v2beta1/resource_types.gen.go diff --git a/agent/consul/type_registry.go b/agent/consul/type_registry.go index d93309159d..8bf093c41a 100644 --- a/agent/consul/type_registry.go +++ b/agent/consul/type_registry.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/consul/internal/auth" "github.com/hashicorp/consul/internal/catalog" "github.com/hashicorp/consul/internal/mesh" + "github.com/hashicorp/consul/internal/multicluster" "github.com/hashicorp/consul/internal/resource" "github.com/hashicorp/consul/internal/resource/demo" "github.com/hashicorp/consul/internal/tenancy" @@ -27,6 +28,7 @@ func NewTypeRegistry() resource.Registry { catalog.RegisterTypes(registry) auth.RegisterTypes(registry) tenancy.RegisterTypes(registry) + multicluster.RegisterTypes(registry) return registry } diff --git a/internal/multicluster/exports.go b/internal/multicluster/exports.go new file mode 100644 index 0000000000..fcf5873d81 --- /dev/null +++ b/internal/multicluster/exports.go @@ -0,0 +1,22 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package multicluster + +import ( + "github.com/hashicorp/consul/internal/multicluster/internal/types" + "github.com/hashicorp/consul/internal/resource" +) + +var ( + // API Group Information + APIGroup = types.GroupName + VersionV2Beta1 = types.VersionV2Beta1 + CurrentVersion = types.CurrentVersion +) + +// RegisterTypes adds all resource types within the "multicluster" API group +// to the given type registry +func RegisterTypes(r resource.Registry) { + types.Register(r) +} diff --git a/internal/multicluster/internal/types/computed_exported_services.go b/internal/multicluster/internal/types/computed_exported_services.go new file mode 100644 index 0000000000..70c900c9b8 --- /dev/null +++ b/internal/multicluster/internal/types/computed_exported_services.go @@ -0,0 +1,37 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/internal/resource" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" +) + +const ( + ComputedExportedServicesName = "global" +) + +func RegisterComputedExportedServices(r resource.Registry) { + r.Register(resource.Registration{ + Type: pbmulticluster.ComputedExportedServicesType, + Proto: &pbmulticluster.ComputedExportedServices{}, + Scope: resource.ScopePartition, + Validate: ValidateComputedExportedServices, + ACLs: &resource.ACLHooks{ + Read: aclReadHookComputedExportedServices, + Write: aclWriteHookComputedExportedServices, + List: resource.NoOpACLListHook, + }, + }) +} + +func aclReadHookComputedExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, _ *pbresource.ID, res *pbresource.Resource) error { + return authorizer.ToAllowAuthorizer().MeshReadAllowed(authzContext) +} + +func aclWriteHookComputedExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, _ *pbresource.Resource) error { + return authorizer.ToAllowAuthorizer().MeshWriteAllowed(authzContext) +} diff --git a/internal/multicluster/internal/types/computed_exported_services_test.go b/internal/multicluster/internal/types/computed_exported_services_test.go new file mode 100644 index 0000000000..79462c7088 --- /dev/null +++ b/internal/multicluster/internal/types/computed_exported_services_test.go @@ -0,0 +1,178 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "errors" + "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/consul/internal/resource" + "github.com/hashicorp/consul/internal/resource/resourcetest" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" + "github.com/stretchr/testify/require" + "testing" +) + +func computedExportedServicesWithPartition(partitionName string) *pbmulticluster.ComputedExportedServices { + consumers := []*pbmulticluster.ComputedExportedService{ + { + Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Partition{ + Partition: partitionName, + }, + }, + }, + }, + } + return &pbmulticluster.ComputedExportedServices{ + Consumers: consumers, + } +} + +func computedExportedServicesWithPeer(peerName string) *pbmulticluster.ComputedExportedServices { + consumers := []*pbmulticluster.ComputedExportedService{ + { + Consumers: []*pbmulticluster.ComputedExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ComputedExportedServicesConsumer_Peer{ + Peer: peerName, + }, + }, + }, + }, + } + return &pbmulticluster.ComputedExportedServices{ + Consumers: consumers, + } +} + +func TestComputedExportedServicesValidations_InvalidName(t *testing.T) { + res := resourcetest.Resource(pbmulticluster.ComputedExportedServicesType, "computed-exported-services"). + WithData(t, computedExportedServicesWithPeer("peer")). + Build() + + err := ValidateComputedExportedServices(res) + require.Error(t, err) + expectedError := errors.New("invalid \"name\" field: name can only be \"global\"") + require.ErrorAs(t, err, &expectedError) +} + +func TestComputedExportedServicesACLs(t *testing.T) { + // Wire up a registry to generically invoke hooks + registry := resource.NewRegistry() + Register(registry) + + type testcase struct { + rules string + readOK string + writeOK string + listOK string + } + + const ( + DENY = resourcetest.DENY + ALLOW = resourcetest.ALLOW + DEFAULT = resourcetest.DEFAULT + ) + + exportedServiceData := &pbmulticluster.ComputedExportedServices{} + res := resourcetest.Resource(pbmulticluster.ComputedExportedServicesType, "global"). + WithData(t, exportedServiceData). + Build() + resourcetest.ValidateAndNormalize(t, registry, res) + + cases := map[string]testcase{ + "no rules": { + rules: ``, + readOK: DENY, + writeOK: DENY, + listOK: DEFAULT, + }, + "mesh read policy": { + rules: `mesh = "read"`, + readOK: ALLOW, + writeOK: DENY, + listOK: DEFAULT, + }, + "mesh write policy": { + rules: `mesh = "write"`, + readOK: ALLOW, + writeOK: ALLOW, + listOK: DEFAULT, + }, + } + + for _, tc := range cases { + aclTestCase := resourcetest.ACLTestCase{ + Rules: tc.rules, + Res: res, + ReadOK: tc.readOK, + WriteOK: tc.writeOK, + ListOK: tc.listOK, + } + resourcetest.RunACLTestCase(t, aclTestCase, registry) + } +} + +func TestComputedExportedServicesValidations(t *testing.T) { + type testcase struct { + Resource *pbresource.Resource + expectErrorCE []string + expectErrorENT []string + } + + isEnterprise := structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty() == "default" + + run := func(t *testing.T, tc testcase) { + expectError := tc.expectErrorCE + if isEnterprise { + expectError = tc.expectErrorENT + } + err := ValidateComputedExportedServices(tc.Resource) + if len(expectError) == 0 { + require.NoError(t, err) + } else { + require.Error(t, err) + for _, er := range expectError { + require.ErrorContains(t, err, er) + } + } + } + + cases := map[string]testcase{ + "computed exported services with peer": { + Resource: resourcetest.Resource(pbmulticluster.ComputedExportedServicesType, ComputedExportedServicesName). + WithData(t, computedExportedServicesWithPeer("peer")). + Build(), + }, + "computed exported services with partition": { + Resource: resourcetest.Resource(pbmulticluster.ComputedExportedServicesType, ComputedExportedServicesName). + WithData(t, computedExportedServicesWithPartition("partition")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can only be set in Enterprise`}, + }, + "computed exported services with peer empty": { + Resource: resourcetest.Resource(pbmulticluster.ComputedExportedServicesType, ComputedExportedServicesName). + WithData(t, computedExportedServicesWithPeer("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "peer": can not be empty`}, + expectErrorENT: []string{`invalid element at index 0 of list "peer": can not be empty`}, + }, + "computed exported services with partition empty": { + Resource: resourcetest.Resource(pbmulticluster.ComputedExportedServicesType, ComputedExportedServicesName). + WithData(t, computedExportedServicesWithPartition("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can not be empty`, + `invalid element at index 0 of list "partition": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "partition": can not be empty`}, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + run(t, tc) + }) + } +} diff --git a/internal/multicluster/internal/types/exported_services.go b/internal/multicluster/internal/types/exported_services.go new file mode 100644 index 0000000000..87cebb244a --- /dev/null +++ b/internal/multicluster/internal/types/exported_services.go @@ -0,0 +1,59 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/internal/resource" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" +) + +func RegisterExportedServices(r resource.Registry) { + r.Register(resource.Registration{ + Type: pbmulticluster.ExportedServicesType, + Proto: &pbmulticluster.ExportedServices{}, + Scope: resource.ScopeNamespace, + Validate: ValidateExportedServices, + ACLs: &resource.ACLHooks{ + Read: aclReadHookExportedServices, + Write: aclWriteHookExportedServices, + List: resource.NoOpACLListHook, + }, + }) +} + +func aclReadHookExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, _ *pbresource.ID, res *pbresource.Resource) error { + if res == nil { + return resource.ErrNeedResource + } + + var exportedService pbmulticluster.ExportedServices + + if err := res.Data.UnmarshalTo(&exportedService); err != nil { + return resource.NewErrDataParse(&exportedService, err) + } + + for _, serviceName := range exportedService.Services { + if err := authorizer.ToAllowAuthorizer().ServiceReadAllowed(serviceName, authzContext); err != nil { + return err + } + } + return nil +} + +func aclWriteHookExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, res *pbresource.Resource) error { + var exportedService pbmulticluster.ExportedServices + + if err := res.Data.UnmarshalTo(&exportedService); err != nil { + return resource.NewErrDataParse(&exportedService, err) + } + + for _, serviceName := range exportedService.Services { + if err := authorizer.ToAllowAuthorizer().ServiceWriteAllowed(serviceName, authzContext); err != nil { + return err + } + } + return nil +} diff --git a/internal/multicluster/internal/types/exported_services_test.go b/internal/multicluster/internal/types/exported_services_test.go new file mode 100644 index 0000000000..ea80b16e43 --- /dev/null +++ b/internal/multicluster/internal/types/exported_services_test.go @@ -0,0 +1,218 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "errors" + "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/consul/internal/resource" + "github.com/hashicorp/consul/internal/resource/resourcetest" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" + "github.com/stretchr/testify/require" + "testing" +) + +func inValidExportedServices() *pbmulticluster.ExportedServices { + return &pbmulticluster.ExportedServices{} +} + +func exportedServicesWithPeer(peerName string) *pbmulticluster.ExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_Peer{ + Peer: peerName, + }, + }, + } + return &pbmulticluster.ExportedServices{ + Services: []string{"api", "frontend", "backend"}, + Consumers: consumers, + } +} + +func exportedServicesWithPartition(partitionName string) *pbmulticluster.ExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_Partition{ + Partition: partitionName, + }, + }, + } + return &pbmulticluster.ExportedServices{ + Services: []string{"api", "frontend", "backend"}, + Consumers: consumers, + } +} + +func exportedServicesWithSamenessGroup(samenessGroupName string) *pbmulticluster.ExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_SamenessGroup{ + SamenessGroup: samenessGroupName, + }, + }, + } + return &pbmulticluster.ExportedServices{ + Services: []string{"api", "frontend", "backend"}, + Consumers: consumers, + } +} + +func TestExportedServicesValidation_NoServices(t *testing.T) { + res := resourcetest.Resource(pbmulticluster.ExportedServicesType, "exportedservices1"). + WithData(t, inValidExportedServices()). + Build() + + err := ValidateExportedServices(res) + require.Error(t, err) + expectedError := errors.New("invalid \"services\" field: at least one service must be set") + require.ErrorAs(t, err, &expectedError) +} + +func TestExportedServicesACLs(t *testing.T) { + // Wire up a registry to generically invoke hooks + registry := resource.NewRegistry() + Register(registry) + + type testcase struct { + rules string + readOK string + writeOK string + listOK string + } + + const ( + DENY = resourcetest.DENY + ALLOW = resourcetest.ALLOW + DEFAULT = resourcetest.DEFAULT + ) + + exportedServiceData := &pbmulticluster.ExportedServices{ + Services: []string{"api", "backend"}, + } + res := resourcetest.Resource(pbmulticluster.ExportedServicesType, "exps"). + WithData(t, exportedServiceData). + Build() + resourcetest.ValidateAndNormalize(t, registry, res) + + cases := map[string]testcase{ + "no rules": { + rules: ``, + readOK: DENY, + writeOK: DENY, + listOK: DEFAULT, + }, + "all services has read policy": { + rules: `service "api" { policy = "read" } service "backend" {policy = "read"}`, + readOK: ALLOW, + writeOK: DENY, + listOK: DEFAULT, + }, + "all services has write policy": { + rules: `service "api" { policy = "write" } service "backend" {policy = "write"}`, + readOK: ALLOW, + writeOK: ALLOW, + listOK: DEFAULT, + }, + "only one services has read policy": { + rules: `service "api" { policy = "read" }`, + readOK: DENY, + writeOK: DENY, + listOK: DEFAULT, + }, + "only one services has write policy": { + rules: `service "api" { policy = "write" }`, + readOK: DENY, + writeOK: DENY, + listOK: DEFAULT, + }, + } + + for _, tc := range cases { + aclTestCase := resourcetest.ACLTestCase{ + Rules: tc.rules, + Res: res, + ReadOK: tc.readOK, + WriteOK: tc.writeOK, + ListOK: tc.listOK, + } + resourcetest.RunACLTestCase(t, aclTestCase, registry) + } +} + +func TestExportedServicesValidation(t *testing.T) { + type testcase struct { + Resource *pbresource.Resource + expectErrorCE []string + expectErrorENT []string + } + + isEnterprise := structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty() == "default" + + run := func(t *testing.T, tc testcase) { + expectError := tc.expectErrorCE + if isEnterprise { + expectError = tc.expectErrorENT + } + err := ValidateExportedServices(tc.Resource) + if len(expectError) == 0 { + require.NoError(t, err) + } else { + require.Error(t, err) + for _, er := range expectError { + require.ErrorContains(t, err, er) + } + } + } + + cases := map[string]testcase{ + "exported services with peer": { + Resource: resourcetest.Resource(pbmulticluster.ExportedServicesType, "exported-services"). + WithData(t, exportedServicesWithPeer("peer")). + Build(), + }, + "exported services with partition": { + Resource: resourcetest.Resource(pbmulticluster.ExportedServicesType, "exported-services"). + WithData(t, exportedServicesWithPartition("partition")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can only be set in Enterprise`}, + }, + "exported services with sameness_group": { + Resource: resourcetest.Resource(pbmulticluster.ExportedServicesType, "exported-services"). + WithData(t, exportedServicesWithSamenessGroup("sameness_group")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "sameness_group": can only be set in Enterprise`}, + }, + "exported services with peer empty": { + Resource: resourcetest.Resource(pbmulticluster.ExportedServicesType, "exported-services"). + WithData(t, exportedServicesWithPeer("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "peer": can not be empty or local`}, + expectErrorENT: []string{`invalid element at index 0 of list "peer": can not be empty or local`}, + }, + "exported services with partition empty": { + Resource: resourcetest.Resource(pbmulticluster.ExportedServicesType, "exported-services"). + WithData(t, exportedServicesWithPartition("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can not be empty`, + `invalid element at index 0 of list "partition": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "partition": can not be empty`}, + }, + "exported services with sameness_group empty": { + Resource: resourcetest.Resource(pbmulticluster.ExportedServicesType, "exported-services"). + WithData(t, exportedServicesWithSamenessGroup("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "sameness_group": can not be empty`, + `invalid element at index 0 of list "sameness_group": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "sameness_group": can not be empty`}, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + run(t, tc) + }) + } +} diff --git a/internal/multicluster/internal/types/helpers.go b/internal/multicluster/internal/types/helpers.go new file mode 100644 index 0000000000..5dac17f1e7 --- /dev/null +++ b/internal/multicluster/internal/types/helpers.go @@ -0,0 +1,135 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "fmt" + "github.com/hashicorp/consul/internal/resource" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" + "github.com/hashicorp/go-multierror" +) + +func validateExportedServiceConsumerCommon(consumer *pbmulticluster.ExportedServicesConsumer, indx int) error { + switch consumer.GetConsumerTenancy().(type) { + case *pbmulticluster.ExportedServicesConsumer_Peer: + { + if consumer.GetPeer() == "" || consumer.GetPeer() == "local" { + return resource.ErrInvalidListElement{ + Name: "peer", + Index: indx, + Wrapped: fmt.Errorf("can not be empty or local"), + } + } + } + case *pbmulticluster.ExportedServicesConsumer_Partition: + { + if consumer.GetPartition() == "" { + return resource.ErrInvalidListElement{ + Name: "partition", + Index: indx, + Wrapped: fmt.Errorf("can not be empty"), + } + } + } + case *pbmulticluster.ExportedServicesConsumer_SamenessGroup: + { + if consumer.GetSamenessGroup() == "" { + return resource.ErrInvalidListElement{ + Name: "sameness_group", + Index: indx, + Wrapped: fmt.Errorf("can not be empty"), + } + } + } + } + return nil +} + +func validateExportedServicesConsumersEnterprise(consumers []*pbmulticluster.ExportedServicesConsumer) error { + var merr error + + for indx, consumer := range consumers { + vmerr := validateExportedServiceConsumerCommon(consumer, indx) + if vmerr != nil { + merr = multierror.Append(merr, vmerr) + } + vmerr = validateExportedServicesConsumer(consumer, indx) + if vmerr != nil { + merr = multierror.Append(merr, vmerr) + } + } + + return merr +} + +func ValidateExportedServices(res *pbresource.Resource) error { + var exportedService pbmulticluster.ExportedServices + + if err := res.Data.UnmarshalTo(&exportedService); err != nil { + return resource.NewErrDataParse(&exportedService, err) + } + + var merr error + + if len(exportedService.Services) == 0 { + merr = multierror.Append(merr, resource.ErrInvalidField{ + Name: "services", + Wrapped: fmt.Errorf("at least one service must be set"), + }) + } + + vmerr := validateExportedServicesConsumersEnterprise(exportedService.Consumers) + + if vmerr != nil { + merr = multierror.Append(merr, vmerr) + } + + return merr +} + +func ValidateNamespaceExportedServices(res *pbresource.Resource) error { + var exportedService pbmulticluster.NamespaceExportedServices + + if err := res.Data.UnmarshalTo(&exportedService); err != nil { + return resource.NewErrDataParse(&exportedService, err) + } + + return validateExportedServicesConsumersEnterprise(exportedService.Consumers) +} + +func ValidatePartitionExportedServices(res *pbresource.Resource) error { + var exportedService pbmulticluster.PartitionExportedServices + + if err := res.Data.UnmarshalTo(&exportedService); err != nil { + return resource.NewErrDataParse(&exportedService, err) + } + + return validateExportedServicesConsumersEnterprise(exportedService.Consumers) +} + +func ValidateComputedExportedServices(res *pbresource.Resource) error { + var computedExportedServices pbmulticluster.ComputedExportedServices + + if err := res.Data.UnmarshalTo(&computedExportedServices); err != nil { + return resource.NewErrDataParse(&computedExportedServices, err) + } + + var merr error + + if res.Id.Name != ComputedExportedServicesName { + merr = multierror.Append(merr, resource.ErrInvalidField{ + Name: "name", + Wrapped: fmt.Errorf("name can only be \"global\""), + }) + } + + vmerr := ValidateComputedExportedServicesEnterprise(&computedExportedServices) + + if vmerr != nil { + merr = multierror.Append(merr, vmerr) + } + + return merr +} diff --git a/internal/multicluster/internal/types/helpers_ce.go b/internal/multicluster/internal/types/helpers_ce.go new file mode 100644 index 0000000000..b997b8671a --- /dev/null +++ b/internal/multicluster/internal/types/helpers_ce.go @@ -0,0 +1,66 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +//go:build !consulent + +package types + +import ( + "fmt" + "github.com/hashicorp/consul/internal/resource" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/go-multierror" +) + +func validateExportedServicesConsumer(consumer *pbmulticluster.ExportedServicesConsumer, indx int) error { + switch consumer.GetConsumerTenancy().(type) { + case *pbmulticluster.ExportedServicesConsumer_Partition: + return resource.ErrInvalidListElement{ + Name: "partition", + Index: indx, + Wrapped: fmt.Errorf("can only be set in Enterprise"), + } + case *pbmulticluster.ExportedServicesConsumer_SamenessGroup: + return resource.ErrInvalidListElement{ + Name: "sameness_group", + Index: indx, + Wrapped: fmt.Errorf("can only be set in Enterprise"), + } + } + return nil +} + +func ValidateComputedExportedServicesEnterprise(computedExportedServices *pbmulticluster.ComputedExportedServices) error { + + var merr error + + for indx, consumer := range computedExportedServices.GetConsumers() { + for _, computedExportedServiceConsumer := range consumer.GetConsumers() { + switch computedExportedServiceConsumer.GetConsumerTenancy().(type) { + case *pbmulticluster.ComputedExportedServicesConsumer_Partition: + merr = multierror.Append(merr, resource.ErrInvalidListElement{ + Name: "partition", + Index: indx, + Wrapped: fmt.Errorf("can only be set in Enterprise"), + }) + if computedExportedServiceConsumer.GetPartition() == "" { + merr = multierror.Append(merr, resource.ErrInvalidListElement{ + Name: "partition", + Index: indx, + Wrapped: fmt.Errorf("can not be empty"), + }) + } + case *pbmulticluster.ComputedExportedServicesConsumer_Peer: + if computedExportedServiceConsumer.GetPeer() == "" { + merr = multierror.Append(merr, resource.ErrInvalidListElement{ + Name: "peer", + Index: indx, + Wrapped: fmt.Errorf("can not be empty"), + }) + } + } + } + } + + return merr +} diff --git a/internal/multicluster/internal/types/namespace_exported_services.go b/internal/multicluster/internal/types/namespace_exported_services.go new file mode 100644 index 0000000000..857ea868b8 --- /dev/null +++ b/internal/multicluster/internal/types/namespace_exported_services.go @@ -0,0 +1,33 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/internal/resource" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" +) + +func RegisterNamespaceExportedServices(r resource.Registry) { + r.Register(resource.Registration{ + Type: pbmulticluster.NamespaceExportedServicesType, + Proto: &pbmulticluster.NamespaceExportedServices{}, + Scope: resource.ScopeNamespace, + Validate: ValidateNamespaceExportedServices, + ACLs: &resource.ACLHooks{ + Read: aclReadHookNamespaceExportedServices, + Write: aclWriteHookNamespaceExportedServices, + List: resource.NoOpACLListHook, + }, + }) +} + +func aclReadHookNamespaceExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, id *pbresource.ID, res *pbresource.Resource) error { + return authorizer.ToAllowAuthorizer().MeshReadAllowed(authzContext) +} + +func aclWriteHookNamespaceExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, res *pbresource.Resource) error { + return authorizer.ToAllowAuthorizer().MeshWriteAllowed(authzContext) +} diff --git a/internal/multicluster/internal/types/namespace_exported_services_test.go b/internal/multicluster/internal/types/namespace_exported_services_test.go new file mode 100644 index 0000000000..ab88a03767 --- /dev/null +++ b/internal/multicluster/internal/types/namespace_exported_services_test.go @@ -0,0 +1,184 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/consul/internal/resource" + "github.com/hashicorp/consul/internal/resource/resourcetest" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" + "github.com/stretchr/testify/require" + "testing" +) + +func validNamespaceExportedServicesWithPeer(peerName string) *pbmulticluster.NamespaceExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_Peer{ + Peer: peerName, + }, + }, + } + return &pbmulticluster.NamespaceExportedServices{ + Consumers: consumers, + } +} + +func validNamespaceExportedServicesWithPartition(partitionName string) *pbmulticluster.NamespaceExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_Partition{ + Partition: partitionName, + }, + }, + } + return &pbmulticluster.NamespaceExportedServices{ + Consumers: consumers, + } +} + +func validNamespaceExportedServicesWithSamenessGroup(samenessGroupName string) *pbmulticluster.NamespaceExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_SamenessGroup{ + SamenessGroup: samenessGroupName, + }, + }, + } + return &pbmulticluster.NamespaceExportedServices{ + Consumers: consumers, + } +} +func TestNamespaceExportedServicesACLs(t *testing.T) { + // Wire up a registry to generically invoke hooks + registry := resource.NewRegistry() + Register(registry) + + type testcase struct { + rules string + readOK string + writeOK string + listOK string + } + + const ( + DENY = resourcetest.DENY + ALLOW = resourcetest.ALLOW + DEFAULT = resourcetest.DEFAULT + ) + + cases := map[string]testcase{ + "no rules": { + rules: ``, + readOK: DENY, + writeOK: DENY, + listOK: DEFAULT, + }, + "mesh read policy": { + rules: `mesh = "read"`, + readOK: ALLOW, + writeOK: DENY, + listOK: DEFAULT, + }, + "mesh write policy": { + rules: `mesh = "write"`, + readOK: ALLOW, + writeOK: ALLOW, + listOK: DEFAULT, + }, + } + + exportedServiceData := &pbmulticluster.NamespaceExportedServices{} + res := resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, exportedServiceData). + Build() + resourcetest.ValidateAndNormalize(t, registry, res) + + for _, tc := range cases { + aclTestCase := resourcetest.ACLTestCase{ + Rules: tc.rules, + Res: res, + ReadOK: tc.readOK, + WriteOK: tc.writeOK, + ListOK: tc.listOK, + } + resourcetest.RunACLTestCase(t, aclTestCase, registry) + } +} + +func TestNamespaceExportedServicesValidations(t *testing.T) { + type testcase struct { + Resource *pbresource.Resource + expectErrorCE []string + expectErrorENT []string + } + + isEnterprise := structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty() == "default" + + run := func(t *testing.T, tc testcase) { + expectError := tc.expectErrorCE + if isEnterprise { + expectError = tc.expectErrorENT + } + err := ValidateNamespaceExportedServices(tc.Resource) + if len(expectError) == 0 { + require.NoError(t, err) + } else { + require.Error(t, err) + for _, er := range expectError { + require.ErrorContains(t, err, er) + } + } + } + + cases := map[string]testcase{ + "namespace exported services with peer": { + Resource: resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, validNamespaceExportedServicesWithPeer("peer")). + Build(), + }, + "namespace exported services with partition": { + Resource: resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, validNamespaceExportedServicesWithPartition("partition")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can only be set in Enterprise`}, + }, + "namespace exported services with sameness_group": { + Resource: resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, validNamespaceExportedServicesWithSamenessGroup("sameness_group")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "sameness_group": can only be set in Enterprise`}, + }, + "namespace exported services with peer empty": { + Resource: resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, validNamespaceExportedServicesWithPeer("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "peer": can not be empty or local`}, + expectErrorENT: []string{`invalid element at index 0 of list "peer": can not be empty or local`}, + }, + "namespace exported services with partition empty": { + Resource: resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, validNamespaceExportedServicesWithPartition("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can not be empty`, + `invalid element at index 0 of list "partition": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "partition": can not be empty`}, + }, + "namespace exported services with sameness_group empty": { + Resource: resourcetest.Resource(pbmulticluster.NamespaceExportedServicesType, "namespace-exported-services"). + WithData(t, validNamespaceExportedServicesWithSamenessGroup("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "sameness_group": can not be empty`, + `invalid element at index 0 of list "sameness_group": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "sameness_group": can not be empty`}, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + run(t, tc) + }) + } +} diff --git a/internal/multicluster/internal/types/partition_exported_services.go b/internal/multicluster/internal/types/partition_exported_services.go new file mode 100644 index 0000000000..110eb5d6ef --- /dev/null +++ b/internal/multicluster/internal/types/partition_exported_services.go @@ -0,0 +1,33 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/internal/resource" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" +) + +func RegisterPartitionExportedServices(r resource.Registry) { + r.Register(resource.Registration{ + Type: pbmulticluster.PartitionExportedServicesType, + Proto: &pbmulticluster.PartitionExportedServices{}, + Scope: resource.ScopePartition, + Validate: ValidatePartitionExportedServices, + ACLs: &resource.ACLHooks{ + Read: aclReadHookPartitionExportedServices, + Write: aclWriteHookPartitionExportedServices, + List: resource.NoOpACLListHook, + }, + }) +} + +func aclReadHookPartitionExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, id *pbresource.ID, res *pbresource.Resource) error { + return authorizer.ToAllowAuthorizer().MeshReadAllowed(authzContext) +} + +func aclWriteHookPartitionExportedServices(authorizer acl.Authorizer, authzContext *acl.AuthorizerContext, res *pbresource.Resource) error { + return authorizer.ToAllowAuthorizer().MeshWriteAllowed(authzContext) +} diff --git a/internal/multicluster/internal/types/partition_exported_services_test.go b/internal/multicluster/internal/types/partition_exported_services_test.go new file mode 100644 index 0000000000..fdd90ef11d --- /dev/null +++ b/internal/multicluster/internal/types/partition_exported_services_test.go @@ -0,0 +1,185 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/consul/internal/resource" + "github.com/hashicorp/consul/internal/resource/resourcetest" + pbmulticluster "github.com/hashicorp/consul/proto-public/pbmulticluster/v2beta1" + "github.com/hashicorp/consul/proto-public/pbresource" + "github.com/stretchr/testify/require" + "testing" +) + +func validPartitionExportedServicesWithPeer(peerName string) *pbmulticluster.PartitionExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_Peer{ + Peer: peerName, + }, + }, + } + return &pbmulticluster.PartitionExportedServices{ + Consumers: consumers, + } +} + +func validPartitionExportedServicesWithPartition(partitionName string) *pbmulticluster.PartitionExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_Partition{ + Partition: partitionName, + }, + }, + } + return &pbmulticluster.PartitionExportedServices{ + Consumers: consumers, + } +} + +func validPartitionExportedServicesWithSamenessGroup(samenessGroupName string) *pbmulticluster.PartitionExportedServices { + consumers := []*pbmulticluster.ExportedServicesConsumer{ + { + ConsumerTenancy: &pbmulticluster.ExportedServicesConsumer_SamenessGroup{ + SamenessGroup: samenessGroupName, + }, + }, + } + return &pbmulticluster.PartitionExportedServices{ + Consumers: consumers, + } +} + +func TestPartitionExportedServicesACLs(t *testing.T) { + // Wire up a registry to generically invoke hooks + registry := resource.NewRegistry() + Register(registry) + + type testcase struct { + rules string + readOK string + writeOK string + listOK string + } + + const ( + DENY = resourcetest.DENY + ALLOW = resourcetest.ALLOW + DEFAULT = resourcetest.DEFAULT + ) + + cases := map[string]testcase{ + "no rules": { + rules: ``, + readOK: DENY, + writeOK: DENY, + listOK: DEFAULT, + }, + "mesh read policy": { + rules: `mesh = "read"`, + readOK: ALLOW, + writeOK: DENY, + listOK: DEFAULT, + }, + "mesh write policy": { + rules: `mesh = "write"`, + readOK: ALLOW, + writeOK: ALLOW, + listOK: DEFAULT, + }, + } + + exportedServiceData := &pbmulticluster.PartitionExportedServices{} + res := resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, exportedServiceData). + Build() + resourcetest.ValidateAndNormalize(t, registry, res) + + for _, tc := range cases { + aclTestCase := resourcetest.ACLTestCase{ + Rules: tc.rules, + Res: res, + ReadOK: tc.readOK, + WriteOK: tc.writeOK, + ListOK: tc.listOK, + } + resourcetest.RunACLTestCase(t, aclTestCase, registry) + } +} + +func TestPartitionExportedServicesValidations(t *testing.T) { + type testcase struct { + Resource *pbresource.Resource + expectErrorCE []string + expectErrorENT []string + } + + isEnterprise := structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty() == "default" + + run := func(t *testing.T, tc testcase) { + expectError := tc.expectErrorCE + if isEnterprise { + expectError = tc.expectErrorENT + } + err := ValidatePartitionExportedServices(tc.Resource) + if len(expectError) == 0 { + require.NoError(t, err) + } else { + require.Error(t, err) + for _, er := range expectError { + require.ErrorContains(t, err, er) + } + } + } + + cases := map[string]testcase{ + "partition exported services with peer": { + Resource: resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, validPartitionExportedServicesWithPeer("peer")). + Build(), + }, + "partition exported services with partition": { + Resource: resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, validPartitionExportedServicesWithPartition("partition")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can only be set in Enterprise`}, + }, + "partition exported services with sameness_group": { + Resource: resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, validPartitionExportedServicesWithSamenessGroup("sameness_group")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "sameness_group": can only be set in Enterprise`}, + }, + "partition exported services with peer empty": { + Resource: resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, validPartitionExportedServicesWithPeer("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "peer": can not be empty or local`}, + expectErrorENT: []string{`invalid element at index 0 of list "peer": can not be empty or local`}, + }, + "partition exported services with partition empty": { + Resource: resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, validPartitionExportedServicesWithPartition("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "partition": can not be empty`, + `invalid element at index 0 of list "partition": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "partition": can not be empty`}, + }, + "partition exported services with sameness_group empty": { + Resource: resourcetest.Resource(pbmulticluster.PartitionExportedServicesType, "partition-exported-services"). + WithData(t, validPartitionExportedServicesWithSamenessGroup("")). + Build(), + expectErrorCE: []string{`invalid element at index 0 of list "sameness_group": can not be empty`, + `invalid element at index 0 of list "sameness_group": can only be set in Enterprise`}, + expectErrorENT: []string{`invalid element at index 0 of list "sameness_group": can not be empty`}, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + run(t, tc) + }) + } +} diff --git a/internal/multicluster/internal/types/types.go b/internal/multicluster/internal/types/types.go new file mode 100644 index 0000000000..9ee6691e19 --- /dev/null +++ b/internal/multicluster/internal/types/types.go @@ -0,0 +1,21 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package types + +import ( + "github.com/hashicorp/consul/internal/resource" +) + +const ( + GroupName = "multicluster" + VersionV2Beta1 = "v2beta1" + CurrentVersion = VersionV2Beta1 +) + +func Register(r resource.Registry) { + RegisterExportedServices(r) + RegisterNamespaceExportedServices(r) + RegisterPartitionExportedServices(r) + RegisterComputedExportedServices(r) +} diff --git a/proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.binary.go b/proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.binary.go new file mode 100644 index 0000000000..f5b389089f --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.binary.go @@ -0,0 +1,38 @@ +// Code generated by protoc-gen-go-binary. DO NOT EDIT. +// source: pbmulticluster/v2beta1/computed_exported_services.proto + +package multiclusterv2beta1 + +import ( + "google.golang.org/protobuf/proto" +) + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *ComputedExportedServices) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *ComputedExportedServices) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *ComputedExportedService) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *ComputedExportedService) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *ComputedExportedServicesConsumer) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *ComputedExportedServicesConsumer) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} diff --git a/proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.go b/proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.go new file mode 100644 index 0000000000..11ebe79f9d --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/computed_exported_services.pb.go @@ -0,0 +1,373 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: pbmulticluster/v2beta1/computed_exported_services.proto + +package multiclusterv2beta1 + +import ( + pbresource "github.com/hashicorp/consul/proto-public/pbresource" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type ComputedExportedServices struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Consumers []*ComputedExportedService `protobuf:"bytes,1,rep,name=consumers,proto3" json:"consumers,omitempty"` +} + +func (x *ComputedExportedServices) Reset() { + *x = ComputedExportedServices{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComputedExportedServices) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComputedExportedServices) ProtoMessage() {} + +func (x *ComputedExportedServices) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_computed_exported_services_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 ComputedExportedServices.ProtoReflect.Descriptor instead. +func (*ComputedExportedServices) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescGZIP(), []int{0} +} + +func (x *ComputedExportedServices) GetConsumers() []*ComputedExportedService { + if x != nil { + return x.Consumers + } + return nil +} + +type ComputedExportedService struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TargetRef *pbresource.Reference `protobuf:"bytes,1,opt,name=target_ref,json=targetRef,proto3" json:"target_ref,omitempty"` + Consumers []*ComputedExportedServicesConsumer `protobuf:"bytes,2,rep,name=consumers,proto3" json:"consumers,omitempty"` +} + +func (x *ComputedExportedService) Reset() { + *x = ComputedExportedService{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComputedExportedService) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComputedExportedService) ProtoMessage() {} + +func (x *ComputedExportedService) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_computed_exported_services_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 ComputedExportedService.ProtoReflect.Descriptor instead. +func (*ComputedExportedService) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescGZIP(), []int{1} +} + +func (x *ComputedExportedService) GetTargetRef() *pbresource.Reference { + if x != nil { + return x.TargetRef + } + return nil +} + +func (x *ComputedExportedService) GetConsumers() []*ComputedExportedServicesConsumer { + if x != nil { + return x.Consumers + } + return nil +} + +type ComputedExportedServicesConsumer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // no sameness group + // + // Types that are assignable to ConsumerTenancy: + // + // *ComputedExportedServicesConsumer_Peer + // *ComputedExportedServicesConsumer_Partition + ConsumerTenancy isComputedExportedServicesConsumer_ConsumerTenancy `protobuf_oneof:"consumer_tenancy"` +} + +func (x *ComputedExportedServicesConsumer) Reset() { + *x = ComputedExportedServicesConsumer{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComputedExportedServicesConsumer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComputedExportedServicesConsumer) ProtoMessage() {} + +func (x *ComputedExportedServicesConsumer) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_computed_exported_services_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 ComputedExportedServicesConsumer.ProtoReflect.Descriptor instead. +func (*ComputedExportedServicesConsumer) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescGZIP(), []int{2} +} + +func (m *ComputedExportedServicesConsumer) GetConsumerTenancy() isComputedExportedServicesConsumer_ConsumerTenancy { + if m != nil { + return m.ConsumerTenancy + } + return nil +} + +func (x *ComputedExportedServicesConsumer) GetPeer() string { + if x, ok := x.GetConsumerTenancy().(*ComputedExportedServicesConsumer_Peer); ok { + return x.Peer + } + return "" +} + +func (x *ComputedExportedServicesConsumer) GetPartition() string { + if x, ok := x.GetConsumerTenancy().(*ComputedExportedServicesConsumer_Partition); ok { + return x.Partition + } + return "" +} + +type isComputedExportedServicesConsumer_ConsumerTenancy interface { + isComputedExportedServicesConsumer_ConsumerTenancy() +} + +type ComputedExportedServicesConsumer_Peer struct { + Peer string `protobuf:"bytes,3,opt,name=peer,proto3,oneof"` +} + +type ComputedExportedServicesConsumer_Partition struct { + Partition string `protobuf:"bytes,4,opt,name=partition,proto3,oneof"` +} + +func (*ComputedExportedServicesConsumer_Peer) isComputedExportedServicesConsumer_ConsumerTenancy() {} + +func (*ComputedExportedServicesConsumer_Partition) isComputedExportedServicesConsumer_ConsumerTenancy() { +} + +var File_pbmulticluster_v2beta1_computed_exported_services_proto protoreflect.FileDescriptor + +var file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDesc = []byte{ + 0x0a, 0x37, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x64, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x25, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x18, 0x43, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x02, 0x22, 0xc5, 0x01, 0x0a, + 0x17, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x68, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x66, 0x12, 0x65, 0x0a, + 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x47, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, + 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x73, 0x22, 0x6c, 0x0a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, + 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x1e, + 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x12, + 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, + 0x63, 0x79, 0x42, 0xd6, 0x02, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x42, 0x1d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, + 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x6d, 0x75, + 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x76, + 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02, 0x25, 0x48, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, + 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x32, 0x62, + 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, + 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x31, 0x48, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, + 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x28, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, + 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescOnce sync.Once + file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescData = file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDesc +) + +func file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescGZIP() []byte { + file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescOnce.Do(func() { + file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescData = protoimpl.X.CompressGZIP(file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescData) + }) + return file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDescData +} + +var file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_pbmulticluster_v2beta1_computed_exported_services_proto_goTypes = []interface{}{ + (*ComputedExportedServices)(nil), // 0: hashicorp.consul.multicluster.v2beta1.ComputedExportedServices + (*ComputedExportedService)(nil), // 1: hashicorp.consul.multicluster.v2beta1.ComputedExportedService + (*ComputedExportedServicesConsumer)(nil), // 2: hashicorp.consul.multicluster.v2beta1.ComputedExportedServicesConsumer + (*pbresource.Reference)(nil), // 3: hashicorp.consul.resource.Reference +} +var file_pbmulticluster_v2beta1_computed_exported_services_proto_depIdxs = []int32{ + 1, // 0: hashicorp.consul.multicluster.v2beta1.ComputedExportedServices.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ComputedExportedService + 3, // 1: hashicorp.consul.multicluster.v2beta1.ComputedExportedService.target_ref:type_name -> hashicorp.consul.resource.Reference + 2, // 2: hashicorp.consul.multicluster.v2beta1.ComputedExportedService.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ComputedExportedServicesConsumer + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_pbmulticluster_v2beta1_computed_exported_services_proto_init() } +func file_pbmulticluster_v2beta1_computed_exported_services_proto_init() { + if File_pbmulticluster_v2beta1_computed_exported_services_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComputedExportedServices); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComputedExportedService); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComputedExportedServicesConsumer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*ComputedExportedServicesConsumer_Peer)(nil), + (*ComputedExportedServicesConsumer_Partition)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pbmulticluster_v2beta1_computed_exported_services_proto_goTypes, + DependencyIndexes: file_pbmulticluster_v2beta1_computed_exported_services_proto_depIdxs, + MessageInfos: file_pbmulticluster_v2beta1_computed_exported_services_proto_msgTypes, + }.Build() + File_pbmulticluster_v2beta1_computed_exported_services_proto = out.File + file_pbmulticluster_v2beta1_computed_exported_services_proto_rawDesc = nil + file_pbmulticluster_v2beta1_computed_exported_services_proto_goTypes = nil + file_pbmulticluster_v2beta1_computed_exported_services_proto_depIdxs = nil +} diff --git a/proto-public/pbmulticluster/v2beta1/computed_exported_services.proto b/proto-public/pbmulticluster/v2beta1/computed_exported_services.proto new file mode 100644 index 0000000000..b8a6195584 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/computed_exported_services.proto @@ -0,0 +1,28 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +syntax = "proto3"; + +package hashicorp.consul.multicluster.v2beta1; + +import "pbresource/annotations.proto"; +import "pbresource/resource.proto"; + +message ComputedExportedServices { + option (hashicorp.consul.resource.spec) = {scope: SCOPE_PARTITION}; + + repeated ComputedExportedService consumers = 1; +} + +message ComputedExportedService { + hashicorp.consul.resource.Reference target_ref = 1; + repeated ComputedExportedServicesConsumer consumers = 2; +} + +message ComputedExportedServicesConsumer { + // no sameness group + oneof consumer_tenancy { + string peer = 3; + string partition = 4; + } +} diff --git a/proto-public/pbmulticluster/v2beta1/computed_exported_services_deepcopy.gen.go b/proto-public/pbmulticluster/v2beta1/computed_exported_services_deepcopy.gen.go new file mode 100644 index 0000000000..b50f35a20b --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/computed_exported_services_deepcopy.gen.go @@ -0,0 +1,69 @@ +// Code generated by protoc-gen-deepcopy. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + proto "google.golang.org/protobuf/proto" +) + +// DeepCopyInto supports using ComputedExportedServices within kubernetes types, where deepcopy-gen is used. +func (in *ComputedExportedServices) DeepCopyInto(out *ComputedExportedServices) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServices. Required by controller-gen. +func (in *ComputedExportedServices) DeepCopy() *ComputedExportedServices { + if in == nil { + return nil + } + out := new(ComputedExportedServices) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServices. Required by controller-gen. +func (in *ComputedExportedServices) DeepCopyInterface() interface{} { + return in.DeepCopy() +} + +// DeepCopyInto supports using ComputedExportedService within kubernetes types, where deepcopy-gen is used. +func (in *ComputedExportedService) DeepCopyInto(out *ComputedExportedService) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedService. Required by controller-gen. +func (in *ComputedExportedService) DeepCopy() *ComputedExportedService { + if in == nil { + return nil + } + out := new(ComputedExportedService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedService. Required by controller-gen. +func (in *ComputedExportedService) DeepCopyInterface() interface{} { + return in.DeepCopy() +} + +// DeepCopyInto supports using ComputedExportedServicesConsumer within kubernetes types, where deepcopy-gen is used. +func (in *ComputedExportedServicesConsumer) DeepCopyInto(out *ComputedExportedServicesConsumer) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServicesConsumer. Required by controller-gen. +func (in *ComputedExportedServicesConsumer) DeepCopy() *ComputedExportedServicesConsumer { + if in == nil { + return nil + } + out := new(ComputedExportedServicesConsumer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ComputedExportedServicesConsumer. Required by controller-gen. +func (in *ComputedExportedServicesConsumer) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/proto-public/pbmulticluster/v2beta1/computed_exported_services_json.gen.go b/proto-public/pbmulticluster/v2beta1/computed_exported_services_json.gen.go new file mode 100644 index 0000000000..709a7e6ef6 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/computed_exported_services_json.gen.go @@ -0,0 +1,44 @@ +// Code generated by protoc-json-shim. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + protojson "google.golang.org/protobuf/encoding/protojson" +) + +// MarshalJSON is a custom marshaler for ComputedExportedServices +func (this *ComputedExportedServices) MarshalJSON() ([]byte, error) { + str, err := ComputedExportedServicesMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for ComputedExportedServices +func (this *ComputedExportedServices) UnmarshalJSON(b []byte) error { + return ComputedExportedServicesUnmarshaler.Unmarshal(b, this) +} + +// MarshalJSON is a custom marshaler for ComputedExportedService +func (this *ComputedExportedService) MarshalJSON() ([]byte, error) { + str, err := ComputedExportedServicesMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for ComputedExportedService +func (this *ComputedExportedService) UnmarshalJSON(b []byte) error { + return ComputedExportedServicesUnmarshaler.Unmarshal(b, this) +} + +// MarshalJSON is a custom marshaler for ComputedExportedServicesConsumer +func (this *ComputedExportedServicesConsumer) MarshalJSON() ([]byte, error) { + str, err := ComputedExportedServicesMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for ComputedExportedServicesConsumer +func (this *ComputedExportedServicesConsumer) UnmarshalJSON(b []byte) error { + return ComputedExportedServicesUnmarshaler.Unmarshal(b, this) +} + +var ( + ComputedExportedServicesMarshaler = &protojson.MarshalOptions{} + ComputedExportedServicesUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false} +) diff --git a/proto-public/pbmulticluster/v2beta1/exported_services.pb.binary.go b/proto-public/pbmulticluster/v2beta1/exported_services.pb.binary.go new file mode 100644 index 0000000000..1530294804 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services.pb.binary.go @@ -0,0 +1,18 @@ +// Code generated by protoc-gen-go-binary. DO NOT EDIT. +// source: pbmulticluster/v2beta1/exported_services.proto + +package multiclusterv2beta1 + +import ( + "google.golang.org/protobuf/proto" +) + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *ExportedServices) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *ExportedServices) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services.pb.go b/proto-public/pbmulticluster/v2beta1/exported_services.pb.go new file mode 100644 index 0000000000..7e776c3a94 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services.pb.go @@ -0,0 +1,193 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: pbmulticluster/v2beta1/exported_services.proto + +package multiclusterv2beta1 + +import ( + _ "github.com/hashicorp/consul/proto-public/pbresource" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type ExportedServices struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Services []string `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` + Consumers []*ExportedServicesConsumer `protobuf:"bytes,2,rep,name=consumers,proto3" json:"consumers,omitempty"` +} + +func (x *ExportedServices) Reset() { + *x = ExportedServices{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_exported_services_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExportedServices) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExportedServices) ProtoMessage() {} + +func (x *ExportedServices) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_exported_services_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 ExportedServices.ProtoReflect.Descriptor instead. +func (*ExportedServices) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_exported_services_proto_rawDescGZIP(), []int{0} +} + +func (x *ExportedServices) GetServices() []string { + if x != nil { + return x.Services + } + return nil +} + +func (x *ExportedServices) GetConsumers() []*ExportedServicesConsumer { + if x != nil { + return x.Consumers + } + return nil +} + +var File_pbmulticluster_v2beta1_exported_services_proto protoreflect.FileDescriptor + +var file_pbmulticluster_v2beta1_exported_services_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x25, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, + 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x37, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, + 0x01, 0x0a, 0x10, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, + 0x5d, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, + 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x3a, 0x06, + 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x42, 0xce, 0x02, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x42, 0x15, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, + 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x76, 0x32, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, + 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x31, 0x48, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x28, 0x48, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, + 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x3a, + 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pbmulticluster_v2beta1_exported_services_proto_rawDescOnce sync.Once + file_pbmulticluster_v2beta1_exported_services_proto_rawDescData = file_pbmulticluster_v2beta1_exported_services_proto_rawDesc +) + +func file_pbmulticluster_v2beta1_exported_services_proto_rawDescGZIP() []byte { + file_pbmulticluster_v2beta1_exported_services_proto_rawDescOnce.Do(func() { + file_pbmulticluster_v2beta1_exported_services_proto_rawDescData = protoimpl.X.CompressGZIP(file_pbmulticluster_v2beta1_exported_services_proto_rawDescData) + }) + return file_pbmulticluster_v2beta1_exported_services_proto_rawDescData +} + +var file_pbmulticluster_v2beta1_exported_services_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pbmulticluster_v2beta1_exported_services_proto_goTypes = []interface{}{ + (*ExportedServices)(nil), // 0: hashicorp.consul.multicluster.v2beta1.ExportedServices + (*ExportedServicesConsumer)(nil), // 1: hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer +} +var file_pbmulticluster_v2beta1_exported_services_proto_depIdxs = []int32{ + 1, // 0: hashicorp.consul.multicluster.v2beta1.ExportedServices.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pbmulticluster_v2beta1_exported_services_proto_init() } +func file_pbmulticluster_v2beta1_exported_services_proto_init() { + if File_pbmulticluster_v2beta1_exported_services_proto != nil { + return + } + file_pbmulticluster_v2beta1_exported_services_consumer_proto_init() + if !protoimpl.UnsafeEnabled { + file_pbmulticluster_v2beta1_exported_services_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExportedServices); 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_pbmulticluster_v2beta1_exported_services_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pbmulticluster_v2beta1_exported_services_proto_goTypes, + DependencyIndexes: file_pbmulticluster_v2beta1_exported_services_proto_depIdxs, + MessageInfos: file_pbmulticluster_v2beta1_exported_services_proto_msgTypes, + }.Build() + File_pbmulticluster_v2beta1_exported_services_proto = out.File + file_pbmulticluster_v2beta1_exported_services_proto_rawDesc = nil + file_pbmulticluster_v2beta1_exported_services_proto_goTypes = nil + file_pbmulticluster_v2beta1_exported_services_proto_depIdxs = nil +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services.proto b/proto-public/pbmulticluster/v2beta1/exported_services.proto new file mode 100644 index 0000000000..76cd98ad7a --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services.proto @@ -0,0 +1,16 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +syntax = "proto3"; + +package hashicorp.consul.multicluster.v2beta1; + +import "pbmulticluster/v2beta1/exported_services_consumer.proto"; +import "pbresource/annotations.proto"; + +message ExportedServices { + option (hashicorp.consul.resource.spec) = {scope: SCOPE_NAMESPACE}; + + repeated string services = 1; + repeated ExportedServicesConsumer consumers = 2; +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.binary.go b/proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.binary.go new file mode 100644 index 0000000000..5f8eecd751 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.binary.go @@ -0,0 +1,18 @@ +// Code generated by protoc-gen-go-binary. DO NOT EDIT. +// source: pbmulticluster/v2beta1/exported_services_consumer.proto + +package multiclusterv2beta1 + +import ( + "google.golang.org/protobuf/proto" +) + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *ExportedServicesConsumer) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *ExportedServicesConsumer) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.go b/proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.go new file mode 100644 index 0000000000..a254b81af0 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_consumer.pb.go @@ -0,0 +1,230 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: pbmulticluster/v2beta1/exported_services_consumer.proto + +package multiclusterv2beta1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type ExportedServicesConsumer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to ConsumerTenancy: + // + // *ExportedServicesConsumer_Peer + // *ExportedServicesConsumer_Partition + // *ExportedServicesConsumer_SamenessGroup + ConsumerTenancy isExportedServicesConsumer_ConsumerTenancy `protobuf_oneof:"consumer_tenancy"` +} + +func (x *ExportedServicesConsumer) Reset() { + *x = ExportedServicesConsumer{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_exported_services_consumer_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExportedServicesConsumer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExportedServicesConsumer) ProtoMessage() {} + +func (x *ExportedServicesConsumer) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_exported_services_consumer_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 ExportedServicesConsumer.ProtoReflect.Descriptor instead. +func (*ExportedServicesConsumer) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescGZIP(), []int{0} +} + +func (m *ExportedServicesConsumer) GetConsumerTenancy() isExportedServicesConsumer_ConsumerTenancy { + if m != nil { + return m.ConsumerTenancy + } + return nil +} + +func (x *ExportedServicesConsumer) GetPeer() string { + if x, ok := x.GetConsumerTenancy().(*ExportedServicesConsumer_Peer); ok { + return x.Peer + } + return "" +} + +func (x *ExportedServicesConsumer) GetPartition() string { + if x, ok := x.GetConsumerTenancy().(*ExportedServicesConsumer_Partition); ok { + return x.Partition + } + return "" +} + +func (x *ExportedServicesConsumer) GetSamenessGroup() string { + if x, ok := x.GetConsumerTenancy().(*ExportedServicesConsumer_SamenessGroup); ok { + return x.SamenessGroup + } + return "" +} + +type isExportedServicesConsumer_ConsumerTenancy interface { + isExportedServicesConsumer_ConsumerTenancy() +} + +type ExportedServicesConsumer_Peer struct { + Peer string `protobuf:"bytes,1,opt,name=peer,proto3,oneof"` +} + +type ExportedServicesConsumer_Partition struct { + Partition string `protobuf:"bytes,2,opt,name=partition,proto3,oneof"` +} + +type ExportedServicesConsumer_SamenessGroup struct { + SamenessGroup string `protobuf:"bytes,3,opt,name=sameness_group,json=samenessGroup,proto3,oneof"` +} + +func (*ExportedServicesConsumer_Peer) isExportedServicesConsumer_ConsumerTenancy() {} + +func (*ExportedServicesConsumer_Partition) isExportedServicesConsumer_ConsumerTenancy() {} + +func (*ExportedServicesConsumer_SamenessGroup) isExportedServicesConsumer_ConsumerTenancy() {} + +var File_pbmulticluster_v2beta1_exported_services_consumer_proto protoreflect.FileDescriptor + +var file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDesc = []byte{ + 0x0a, 0x37, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x25, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x22, 0x8d, 0x01, 0x0a, 0x18, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x14, 0x0a, + 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x70, + 0x65, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0e, 0x73, 0x61, 0x6d, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x5f, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x73, + 0x61, 0x6d, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x12, 0x0a, 0x10, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x63, 0x79, + 0x42, 0xd6, 0x02, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, + 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x1d, + 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x3b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x76, 0x32, 0x62, + 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02, 0x25, 0x48, 0x61, 0x73, + 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x4d, 0x75, + 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x32, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, + 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x31, 0x48, 0x61, 0x73, + 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, + 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x28, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, + 0x75, 0x6c, 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescOnce sync.Once + file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescData = file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDesc +) + +func file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescGZIP() []byte { + file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescOnce.Do(func() { + file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescData = protoimpl.X.CompressGZIP(file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescData) + }) + return file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDescData +} + +var file_pbmulticluster_v2beta1_exported_services_consumer_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pbmulticluster_v2beta1_exported_services_consumer_proto_goTypes = []interface{}{ + (*ExportedServicesConsumer)(nil), // 0: hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer +} +var file_pbmulticluster_v2beta1_exported_services_consumer_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_pbmulticluster_v2beta1_exported_services_consumer_proto_init() } +func file_pbmulticluster_v2beta1_exported_services_consumer_proto_init() { + if File_pbmulticluster_v2beta1_exported_services_consumer_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pbmulticluster_v2beta1_exported_services_consumer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExportedServicesConsumer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_pbmulticluster_v2beta1_exported_services_consumer_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*ExportedServicesConsumer_Peer)(nil), + (*ExportedServicesConsumer_Partition)(nil), + (*ExportedServicesConsumer_SamenessGroup)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pbmulticluster_v2beta1_exported_services_consumer_proto_goTypes, + DependencyIndexes: file_pbmulticluster_v2beta1_exported_services_consumer_proto_depIdxs, + MessageInfos: file_pbmulticluster_v2beta1_exported_services_consumer_proto_msgTypes, + }.Build() + File_pbmulticluster_v2beta1_exported_services_consumer_proto = out.File + file_pbmulticluster_v2beta1_exported_services_consumer_proto_rawDesc = nil + file_pbmulticluster_v2beta1_exported_services_consumer_proto_goTypes = nil + file_pbmulticluster_v2beta1_exported_services_consumer_proto_depIdxs = nil +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_consumer.proto b/proto-public/pbmulticluster/v2beta1/exported_services_consumer.proto new file mode 100644 index 0000000000..1a110099dc --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_consumer.proto @@ -0,0 +1,14 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +syntax = "proto3"; + +package hashicorp.consul.multicluster.v2beta1; + +message ExportedServicesConsumer { + oneof consumer_tenancy { + string peer = 1; + string partition = 2; + string sameness_group = 3; + } +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_consumer_deepcopy.gen.go b/proto-public/pbmulticluster/v2beta1/exported_services_consumer_deepcopy.gen.go new file mode 100644 index 0000000000..847fe0ec3e --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_consumer_deepcopy.gen.go @@ -0,0 +1,27 @@ +// Code generated by protoc-gen-deepcopy. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + proto "google.golang.org/protobuf/proto" +) + +// DeepCopyInto supports using ExportedServicesConsumer within kubernetes types, where deepcopy-gen is used. +func (in *ExportedServicesConsumer) DeepCopyInto(out *ExportedServicesConsumer) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportedServicesConsumer. Required by controller-gen. +func (in *ExportedServicesConsumer) DeepCopy() *ExportedServicesConsumer { + if in == nil { + return nil + } + out := new(ExportedServicesConsumer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ExportedServicesConsumer. Required by controller-gen. +func (in *ExportedServicesConsumer) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_consumer_json.gen.go b/proto-public/pbmulticluster/v2beta1/exported_services_consumer_json.gen.go new file mode 100644 index 0000000000..3f43f69932 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_consumer_json.gen.go @@ -0,0 +1,22 @@ +// Code generated by protoc-json-shim. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + protojson "google.golang.org/protobuf/encoding/protojson" +) + +// MarshalJSON is a custom marshaler for ExportedServicesConsumer +func (this *ExportedServicesConsumer) MarshalJSON() ([]byte, error) { + str, err := ExportedServicesConsumerMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for ExportedServicesConsumer +func (this *ExportedServicesConsumer) UnmarshalJSON(b []byte) error { + return ExportedServicesConsumerUnmarshaler.Unmarshal(b, this) +} + +var ( + ExportedServicesConsumerMarshaler = &protojson.MarshalOptions{} + ExportedServicesConsumerUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false} +) diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_deepcopy.gen.go b/proto-public/pbmulticluster/v2beta1/exported_services_deepcopy.gen.go new file mode 100644 index 0000000000..f5897233ef --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_deepcopy.gen.go @@ -0,0 +1,27 @@ +// Code generated by protoc-gen-deepcopy. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + proto "google.golang.org/protobuf/proto" +) + +// DeepCopyInto supports using ExportedServices within kubernetes types, where deepcopy-gen is used. +func (in *ExportedServices) DeepCopyInto(out *ExportedServices) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportedServices. Required by controller-gen. +func (in *ExportedServices) DeepCopy() *ExportedServices { + if in == nil { + return nil + } + out := new(ExportedServices) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ExportedServices. Required by controller-gen. +func (in *ExportedServices) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/proto-public/pbmulticluster/v2beta1/exported_services_json.gen.go b/proto-public/pbmulticluster/v2beta1/exported_services_json.gen.go new file mode 100644 index 0000000000..40a7cdc38b --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/exported_services_json.gen.go @@ -0,0 +1,22 @@ +// Code generated by protoc-json-shim. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + protojson "google.golang.org/protobuf/encoding/protojson" +) + +// MarshalJSON is a custom marshaler for ExportedServices +func (this *ExportedServices) MarshalJSON() ([]byte, error) { + str, err := ExportedServicesMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for ExportedServices +func (this *ExportedServices) UnmarshalJSON(b []byte) error { + return ExportedServicesUnmarshaler.Unmarshal(b, this) +} + +var ( + ExportedServicesMarshaler = &protojson.MarshalOptions{} + ExportedServicesUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false} +) diff --git a/proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.binary.go b/proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.binary.go new file mode 100644 index 0000000000..eb00038107 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.binary.go @@ -0,0 +1,18 @@ +// Code generated by protoc-gen-go-binary. DO NOT EDIT. +// source: pbmulticluster/v2beta1/namespace_exported_services.proto + +package multiclusterv2beta1 + +import ( + "google.golang.org/protobuf/proto" +) + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *NamespaceExportedServices) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *NamespaceExportedServices) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} diff --git a/proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.go b/proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.go new file mode 100644 index 0000000000..5936f86fda --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/namespace_exported_services.pb.go @@ -0,0 +1,185 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: pbmulticluster/v2beta1/namespace_exported_services.proto + +package multiclusterv2beta1 + +import ( + _ "github.com/hashicorp/consul/proto-public/pbresource" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type NamespaceExportedServices struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Consumers []*ExportedServicesConsumer `protobuf:"bytes,1,rep,name=consumers,proto3" json:"consumers,omitempty"` +} + +func (x *NamespaceExportedServices) Reset() { + *x = NamespaceExportedServices{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_namespace_exported_services_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NamespaceExportedServices) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NamespaceExportedServices) ProtoMessage() {} + +func (x *NamespaceExportedServices) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_namespace_exported_services_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 NamespaceExportedServices.ProtoReflect.Descriptor instead. +func (*NamespaceExportedServices) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescGZIP(), []int{0} +} + +func (x *NamespaceExportedServices) GetConsumers() []*ExportedServicesConsumer { + if x != nil { + return x.Consumers + } + return nil +} + +var File_pbmulticluster_v2beta1_namespace_exported_services_proto protoreflect.FileDescriptor + +var file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDesc = []byte{ + 0x0a, 0x38, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x25, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x1a, 0x37, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82, 0x01, 0x0a, 0x19, 0x4e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x42, 0xd7, 0x02, + 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x1e, 0x4e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, + 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x76, 0x32, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, + 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x31, 0x48, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x28, 0x48, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, + 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x3a, + 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescOnce sync.Once + file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescData = file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDesc +) + +func file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescGZIP() []byte { + file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescOnce.Do(func() { + file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescData = protoimpl.X.CompressGZIP(file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescData) + }) + return file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDescData +} + +var file_pbmulticluster_v2beta1_namespace_exported_services_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pbmulticluster_v2beta1_namespace_exported_services_proto_goTypes = []interface{}{ + (*NamespaceExportedServices)(nil), // 0: hashicorp.consul.multicluster.v2beta1.NamespaceExportedServices + (*ExportedServicesConsumer)(nil), // 1: hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer +} +var file_pbmulticluster_v2beta1_namespace_exported_services_proto_depIdxs = []int32{ + 1, // 0: hashicorp.consul.multicluster.v2beta1.NamespaceExportedServices.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pbmulticluster_v2beta1_namespace_exported_services_proto_init() } +func file_pbmulticluster_v2beta1_namespace_exported_services_proto_init() { + if File_pbmulticluster_v2beta1_namespace_exported_services_proto != nil { + return + } + file_pbmulticluster_v2beta1_exported_services_consumer_proto_init() + if !protoimpl.UnsafeEnabled { + file_pbmulticluster_v2beta1_namespace_exported_services_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NamespaceExportedServices); 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_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pbmulticluster_v2beta1_namespace_exported_services_proto_goTypes, + DependencyIndexes: file_pbmulticluster_v2beta1_namespace_exported_services_proto_depIdxs, + MessageInfos: file_pbmulticluster_v2beta1_namespace_exported_services_proto_msgTypes, + }.Build() + File_pbmulticluster_v2beta1_namespace_exported_services_proto = out.File + file_pbmulticluster_v2beta1_namespace_exported_services_proto_rawDesc = nil + file_pbmulticluster_v2beta1_namespace_exported_services_proto_goTypes = nil + file_pbmulticluster_v2beta1_namespace_exported_services_proto_depIdxs = nil +} diff --git a/proto-public/pbmulticluster/v2beta1/namespace_exported_services.proto b/proto-public/pbmulticluster/v2beta1/namespace_exported_services.proto new file mode 100644 index 0000000000..074d44d360 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/namespace_exported_services.proto @@ -0,0 +1,15 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +syntax = "proto3"; + +package hashicorp.consul.multicluster.v2beta1; + +import "pbmulticluster/v2beta1/exported_services_consumer.proto"; +import "pbresource/annotations.proto"; + +message NamespaceExportedServices { + option (hashicorp.consul.resource.spec) = {scope: SCOPE_NAMESPACE}; + + repeated ExportedServicesConsumer consumers = 1; +} diff --git a/proto-public/pbmulticluster/v2beta1/namespace_exported_services_deepcopy.gen.go b/proto-public/pbmulticluster/v2beta1/namespace_exported_services_deepcopy.gen.go new file mode 100644 index 0000000000..9d061a755b --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/namespace_exported_services_deepcopy.gen.go @@ -0,0 +1,27 @@ +// Code generated by protoc-gen-deepcopy. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + proto "google.golang.org/protobuf/proto" +) + +// DeepCopyInto supports using NamespaceExportedServices within kubernetes types, where deepcopy-gen is used. +func (in *NamespaceExportedServices) DeepCopyInto(out *NamespaceExportedServices) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceExportedServices. Required by controller-gen. +func (in *NamespaceExportedServices) DeepCopy() *NamespaceExportedServices { + if in == nil { + return nil + } + out := new(NamespaceExportedServices) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceExportedServices. Required by controller-gen. +func (in *NamespaceExportedServices) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/proto-public/pbmulticluster/v2beta1/namespace_exported_services_json.gen.go b/proto-public/pbmulticluster/v2beta1/namespace_exported_services_json.gen.go new file mode 100644 index 0000000000..5d4ee1e42c --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/namespace_exported_services_json.gen.go @@ -0,0 +1,22 @@ +// Code generated by protoc-json-shim. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + protojson "google.golang.org/protobuf/encoding/protojson" +) + +// MarshalJSON is a custom marshaler for NamespaceExportedServices +func (this *NamespaceExportedServices) MarshalJSON() ([]byte, error) { + str, err := NamespaceExportedServicesMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for NamespaceExportedServices +func (this *NamespaceExportedServices) UnmarshalJSON(b []byte) error { + return NamespaceExportedServicesUnmarshaler.Unmarshal(b, this) +} + +var ( + NamespaceExportedServicesMarshaler = &protojson.MarshalOptions{} + NamespaceExportedServicesUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false} +) diff --git a/proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.binary.go b/proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.binary.go new file mode 100644 index 0000000000..5518b8a004 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.binary.go @@ -0,0 +1,18 @@ +// Code generated by protoc-gen-go-binary. DO NOT EDIT. +// source: pbmulticluster/v2beta1/partition_exported_services.proto + +package multiclusterv2beta1 + +import ( + "google.golang.org/protobuf/proto" +) + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *PartitionExportedServices) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *PartitionExportedServices) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} diff --git a/proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.go b/proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.go new file mode 100644 index 0000000000..116e4784e6 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/partition_exported_services.pb.go @@ -0,0 +1,185 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: pbmulticluster/v2beta1/partition_exported_services.proto + +package multiclusterv2beta1 + +import ( + _ "github.com/hashicorp/consul/proto-public/pbresource" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type PartitionExportedServices struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Consumers []*ExportedServicesConsumer `protobuf:"bytes,1,rep,name=consumers,proto3" json:"consumers,omitempty"` +} + +func (x *PartitionExportedServices) Reset() { + *x = PartitionExportedServices{} + if protoimpl.UnsafeEnabled { + mi := &file_pbmulticluster_v2beta1_partition_exported_services_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PartitionExportedServices) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartitionExportedServices) ProtoMessage() {} + +func (x *PartitionExportedServices) ProtoReflect() protoreflect.Message { + mi := &file_pbmulticluster_v2beta1_partition_exported_services_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 PartitionExportedServices.ProtoReflect.Descriptor instead. +func (*PartitionExportedServices) Descriptor() ([]byte, []int) { + return file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescGZIP(), []int{0} +} + +func (x *PartitionExportedServices) GetConsumers() []*ExportedServicesConsumer { + if x != nil { + return x.Consumers + } + return nil +} + +var File_pbmulticluster_v2beta1_partition_exported_services_proto protoreflect.FileDescriptor + +var file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDesc = []byte{ + 0x0a, 0x38, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x25, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x1a, 0x37, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x02, 0x42, 0xd7, 0x02, + 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x1e, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, + 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x76, 0x32, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x4d, 0xaa, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xca, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, + 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x31, 0x48, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x28, 0x48, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, + 0x3a, 0x3a, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x3a, + 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescOnce sync.Once + file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescData = file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDesc +) + +func file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescGZIP() []byte { + file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescOnce.Do(func() { + file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescData = protoimpl.X.CompressGZIP(file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescData) + }) + return file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDescData +} + +var file_pbmulticluster_v2beta1_partition_exported_services_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pbmulticluster_v2beta1_partition_exported_services_proto_goTypes = []interface{}{ + (*PartitionExportedServices)(nil), // 0: hashicorp.consul.multicluster.v2beta1.PartitionExportedServices + (*ExportedServicesConsumer)(nil), // 1: hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer +} +var file_pbmulticluster_v2beta1_partition_exported_services_proto_depIdxs = []int32{ + 1, // 0: hashicorp.consul.multicluster.v2beta1.PartitionExportedServices.consumers:type_name -> hashicorp.consul.multicluster.v2beta1.ExportedServicesConsumer + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pbmulticluster_v2beta1_partition_exported_services_proto_init() } +func file_pbmulticluster_v2beta1_partition_exported_services_proto_init() { + if File_pbmulticluster_v2beta1_partition_exported_services_proto != nil { + return + } + file_pbmulticluster_v2beta1_exported_services_consumer_proto_init() + if !protoimpl.UnsafeEnabled { + file_pbmulticluster_v2beta1_partition_exported_services_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PartitionExportedServices); 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_pbmulticluster_v2beta1_partition_exported_services_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pbmulticluster_v2beta1_partition_exported_services_proto_goTypes, + DependencyIndexes: file_pbmulticluster_v2beta1_partition_exported_services_proto_depIdxs, + MessageInfos: file_pbmulticluster_v2beta1_partition_exported_services_proto_msgTypes, + }.Build() + File_pbmulticluster_v2beta1_partition_exported_services_proto = out.File + file_pbmulticluster_v2beta1_partition_exported_services_proto_rawDesc = nil + file_pbmulticluster_v2beta1_partition_exported_services_proto_goTypes = nil + file_pbmulticluster_v2beta1_partition_exported_services_proto_depIdxs = nil +} diff --git a/proto-public/pbmulticluster/v2beta1/partition_exported_services.proto b/proto-public/pbmulticluster/v2beta1/partition_exported_services.proto new file mode 100644 index 0000000000..b3cf249a0c --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/partition_exported_services.proto @@ -0,0 +1,15 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +syntax = "proto3"; + +package hashicorp.consul.multicluster.v2beta1; + +import "pbmulticluster/v2beta1/exported_services_consumer.proto"; +import "pbresource/annotations.proto"; + +message PartitionExportedServices { + option (hashicorp.consul.resource.spec) = {scope: SCOPE_PARTITION}; + + repeated ExportedServicesConsumer consumers = 1; +} diff --git a/proto-public/pbmulticluster/v2beta1/partition_exported_services_deepcopy.gen.go b/proto-public/pbmulticluster/v2beta1/partition_exported_services_deepcopy.gen.go new file mode 100644 index 0000000000..9f048e16d2 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/partition_exported_services_deepcopy.gen.go @@ -0,0 +1,27 @@ +// Code generated by protoc-gen-deepcopy. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + proto "google.golang.org/protobuf/proto" +) + +// DeepCopyInto supports using PartitionExportedServices within kubernetes types, where deepcopy-gen is used. +func (in *PartitionExportedServices) DeepCopyInto(out *PartitionExportedServices) { + proto.Reset(out) + proto.Merge(out, proto.Clone(in)) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionExportedServices. Required by controller-gen. +func (in *PartitionExportedServices) DeepCopy() *PartitionExportedServices { + if in == nil { + return nil + } + out := new(PartitionExportedServices) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new PartitionExportedServices. Required by controller-gen. +func (in *PartitionExportedServices) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/proto-public/pbmulticluster/v2beta1/partition_exported_services_json.gen.go b/proto-public/pbmulticluster/v2beta1/partition_exported_services_json.gen.go new file mode 100644 index 0000000000..e9dfafd702 --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/partition_exported_services_json.gen.go @@ -0,0 +1,22 @@ +// Code generated by protoc-json-shim. DO NOT EDIT. +package multiclusterv2beta1 + +import ( + protojson "google.golang.org/protobuf/encoding/protojson" +) + +// MarshalJSON is a custom marshaler for PartitionExportedServices +func (this *PartitionExportedServices) MarshalJSON() ([]byte, error) { + str, err := PartitionExportedServicesMarshaler.Marshal(this) + return []byte(str), err +} + +// UnmarshalJSON is a custom unmarshaler for PartitionExportedServices +func (this *PartitionExportedServices) UnmarshalJSON(b []byte) error { + return PartitionExportedServicesUnmarshaler.Unmarshal(b, this) +} + +var ( + PartitionExportedServicesMarshaler = &protojson.MarshalOptions{} + PartitionExportedServicesUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false} +) diff --git a/proto-public/pbmulticluster/v2beta1/resource_types.gen.go b/proto-public/pbmulticluster/v2beta1/resource_types.gen.go new file mode 100644 index 0000000000..910811b98f --- /dev/null +++ b/proto-public/pbmulticluster/v2beta1/resource_types.gen.go @@ -0,0 +1,43 @@ +// Code generated by protoc-gen-resource-types. DO NOT EDIT. + +package multiclusterv2beta1 + +import ( + "github.com/hashicorp/consul/proto-public/pbresource" +) + +const ( + GroupName = "multicluster" + Version = "v2beta1" + + ComputedExportedServicesKind = "ComputedExportedServices" + ExportedServicesKind = "ExportedServices" + NamespaceExportedServicesKind = "NamespaceExportedServices" + PartitionExportedServicesKind = "PartitionExportedServices" +) + +var ( + ComputedExportedServicesType = &pbresource.Type{ + Group: GroupName, + GroupVersion: Version, + Kind: ComputedExportedServicesKind, + } + + ExportedServicesType = &pbresource.Type{ + Group: GroupName, + GroupVersion: Version, + Kind: ExportedServicesKind, + } + + NamespaceExportedServicesType = &pbresource.Type{ + Group: GroupName, + GroupVersion: Version, + Kind: NamespaceExportedServicesKind, + } + + PartitionExportedServicesType = &pbresource.Type{ + Group: GroupName, + GroupVersion: Version, + Kind: PartitionExportedServicesKind, + } +)