From 5fbbd58ab1a77e38a53130a7a979840554b8beff Mon Sep 17 00:00:00 2001 From: nikki-dag <161385222+nikki-dag@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:08:48 -0500 Subject: [PATCH] Nexus Cloud API enum and oneof changes. (#384) --- app/nexus.go | 40 +- app/nexus_test.go | 97 ++--- protogen/api/cloud/nexus/v1/message.pb.go | 382 ++++++++++++++----- protogen/api/cloud/resource/v1/message.pb.go | 115 ++++++ 4 files changed, 480 insertions(+), 154 deletions(-) create mode 100644 protogen/api/cloud/resource/v1/message.pb.go diff --git a/app/nexus.go b/app/nexus.go index 706f818..52b1efc 100644 --- a/app/nexus.go +++ b/app/nexus.go @@ -73,8 +73,10 @@ func (c *NexusClient) createEndpoint( policySpecs := make([]*nexus.EndpointPolicySpec, len(allowedNamespaceIDs)) for i, ns := range allowedNamespaceIDs { policySpecs[i] = &nexus.EndpointPolicySpec{ - AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ - NamespaceId: ns, + Variant: &nexus.EndpointPolicySpec_AllowedCloudNamespacePolicySpec{ + AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ + NamespaceId: ns, + }, }, } } @@ -83,9 +85,11 @@ func (c *NexusClient) createEndpoint( Name: endpointName, Description: endpointDescription, TargetSpec: &nexus.EndpointTargetSpec{ - WorkerTargetSpec: &nexus.WorkerTargetSpec{ - NamespaceId: targetNamespaceID, - TaskQueue: targetTaskQueue, + Variant: &nexus.EndpointTargetSpec_WorkerTargetSpec{ + WorkerTargetSpec: &nexus.WorkerTargetSpec{ + NamespaceId: targetNamespaceID, + TaskQueue: targetTaskQueue, + }, }, }, PolicySpecs: policySpecs, @@ -116,12 +120,12 @@ func (c *NexusClient) patchEndpoint( existingEndpoint.Spec.Description = description hasChanges = true } - if targetNamespaceID != "" && targetNamespaceID != existingEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId { - existingEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId = targetNamespaceID + if targetNamespaceID != "" && targetNamespaceID != existingEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId { + existingEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId = targetNamespaceID hasChanges = true } - if targetTaskQueue != "" && targetTaskQueue != existingEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue { - existingEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue = targetTaskQueue + if targetTaskQueue != "" && targetTaskQueue != existingEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue { + existingEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue = targetTaskQueue hasChanges = true } @@ -158,7 +162,7 @@ func (c *NexusClient) addAllowedNamespaces( existingPolicySpecs := existingEndpoint.Spec.PolicySpecs existingAllowedNamespaceIDMap := make(map[string]struct{}, len(existingPolicySpecs)) for _, policySpec := range existingPolicySpecs { - existingAllowedNamespaceIDMap[policySpec.AllowedCloudNamespacePolicySpec.NamespaceId] = struct{}{} + existingAllowedNamespaceIDMap[policySpec.GetAllowedCloudNamespacePolicySpec().NamespaceId] = struct{}{} } updatedPolicySpecs := make([]*nexus.EndpointPolicySpec, len(existingPolicySpecs)) @@ -168,8 +172,10 @@ func (c *NexusClient) addAllowedNamespaces( if _, ok := existingAllowedNamespaceIDMap[namespaceID]; !ok { hasChange = true updatedPolicySpecs = append(updatedPolicySpecs, &nexus.EndpointPolicySpec{ - AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ - NamespaceId: namespaceID, + Variant: &nexus.EndpointPolicySpec_AllowedCloudNamespacePolicySpec{ + AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ + NamespaceId: namespaceID, + }, }, }) } @@ -191,8 +197,10 @@ func (c *NexusClient) setAllowedNamespaces( updatedPolicySpecs := make([]*nexus.EndpointPolicySpec, len(namespaceIDs)) for i, namespaceID := range namespaceIDs { updatedPolicySpecs[i] = &nexus.EndpointPolicySpec{ - AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ - NamespaceId: namespaceID, + Variant: &nexus.EndpointPolicySpec_AllowedCloudNamespacePolicySpec{ + AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ + NamespaceId: namespaceID, + }, }, } } @@ -215,7 +223,7 @@ func (c *NexusClient) removeAllowedNamespaces( var updatedPolicySpecs []*nexus.EndpointPolicySpec for _, existingPolicySpec := range existingPolicySpecs { - if _, ok := namespaceIDsToRemoveMap[existingPolicySpec.AllowedCloudNamespacePolicySpec.NamespaceId]; !ok { + if _, ok := namespaceIDsToRemoveMap[existingPolicySpec.GetAllowedCloudNamespacePolicySpec().NamespaceId]; !ok { updatedPolicySpecs = append(updatedPolicySpecs, existingPolicySpec) } } @@ -522,7 +530,7 @@ func NewNexusCommand(getNexusClientFn GetNexusClientFn) (CommandOut, error) { existingPolicySpecs := existingEndpoint.Spec.PolicySpecs existingAllowedNamespaceIDs := make([]string, len(existingPolicySpecs)) for i, policySpec := range existingPolicySpecs { - existingAllowedNamespaceIDs[i] = policySpec.AllowedCloudNamespacePolicySpec.NamespaceId + existingAllowedNamespaceIDs[i] = policySpec.GetAllowedCloudNamespacePolicySpec().NamespaceId } return PrintObj(existingAllowedNamespaceIDs) }, diff --git a/app/nexus_test.go b/app/nexus_test.go index 4921ebb..0b740ac 100644 --- a/app/nexus_test.go +++ b/app/nexus_test.go @@ -7,6 +7,7 @@ import ( "github.com/temporalio/tcld/protogen/api/cloud/cloudservice/v1" "github.com/temporalio/tcld/protogen/api/cloud/nexus/v1" "github.com/temporalio/tcld/protogen/api/cloud/operation/v1" + "github.com/temporalio/tcld/protogen/api/cloud/resource/v1" "os" "testing" "time" @@ -62,27 +63,33 @@ func getExampleNexusEndpoint() *nexus.Endpoint { ResourceVersion: "test-resource-version", Spec: &nexus.EndpointSpec{ TargetSpec: &nexus.EndpointTargetSpec{ - WorkerTargetSpec: &nexus.WorkerTargetSpec{ - NamespaceId: "test-namespace-name.test-account-id", - TaskQueue: "test-task-queue", + Variant: &nexus.EndpointTargetSpec_WorkerTargetSpec{ + WorkerTargetSpec: &nexus.WorkerTargetSpec{ + NamespaceId: "test-namespace-name.test-account-id", + TaskQueue: "test-task-queue", + }, }, }, Name: "test_name", Description: "test description", PolicySpecs: []*nexus.EndpointPolicySpec{ { - AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ - NamespaceId: "test-caller-namespace.test-account-id", + Variant: &nexus.EndpointPolicySpec_AllowedCloudNamespacePolicySpec{ + AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ + NamespaceId: "test-caller-namespace.test-account-id", + }, }, }, { - AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ - NamespaceId: "test-caller-namespace-2.test-account-id", + Variant: &nexus.EndpointPolicySpec_AllowedCloudNamespacePolicySpec{ + AllowedCloudNamespacePolicySpec: &nexus.AllowedCloudNamespacePolicySpec{ + NamespaceId: "test-caller-namespace-2.test-account-id", + }, }, }, }, }, - State: "activating", + State: resource.RESOURCE_STATE_ACTIVATING, AsyncOperationId: "test-request-id", CreatedTime: &types.Timestamp{Seconds: time.Date(time.Now().Year(), time.April, 12, 0, 0, 0, 0, time.UTC).Unix()}, LastModifiedTime: &types.Timestamp{Seconds: time.Date(time.Now().Year(), time.April, 14, 0, 0, 0, 0, time.UTC).Unix()}, @@ -119,10 +126,10 @@ func (s *NexusTestSuite) TestEndpointCreate() { s.EqualError(s.RunCmd("nexus", "endpoint", "create", "--name", exampleEndpoint.Spec.Name, "--description", exampleEndpoint.Spec.Description, - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].AllowedCloudNamespacePolicySpec.NamespaceId, + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId, + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "create error") @@ -136,10 +143,10 @@ func (s *NexusTestSuite) TestEndpointCreate() { s.NoError(s.RunCmd("nexus", "endpoint", "create", "--name", exampleEndpoint.Spec.Name, "--description-file", path, - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].AllowedCloudNamespacePolicySpec.NamespaceId, + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId, + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, )) @@ -150,10 +157,10 @@ func (s *NexusTestSuite) TestEndpointCreate() { s.NoError(s.RunCmd("nexus", "endpoint", "create", "--name", exampleEndpoint.Spec.Name, "--description", exampleEndpoint.Spec.Description, - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].AllowedCloudNamespacePolicySpec.NamespaceId, + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId, + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, )) @@ -163,10 +170,10 @@ func (s *NexusTestSuite) TestEndpointCreate() { }, nil).Times(1) s.NoError(s.RunCmd("nexus", "endpoint", "create", "--name", exampleEndpoint.Spec.Name, - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].AllowedCloudNamespacePolicySpec.NamespaceId, + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId, + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, )) @@ -175,10 +182,10 @@ func (s *NexusTestSuite) TestEndpointCreate() { "--name", exampleEndpoint.Spec.Name, "--description", exampleEndpoint.Spec.Description, "--description-file", "nexus_endpoint_description_test.md", - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].AllowedCloudNamespacePolicySpec.NamespaceId, + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId, + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "provided both --description and --description-file") @@ -189,10 +196,10 @@ func (s *NexusTestSuite) TestEndpointCreate() { s.EqualError(s.RunCmd("nexus", "endpoint", "create", "--name", exampleEndpoint.Spec.Name, "--description-file", path2, - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, - "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].AllowedCloudNamespacePolicySpec.NamespaceId, + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId, + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, + "--allow-namespace", exampleEndpoint.Spec.PolicySpecs[1].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "empty description file: \"nexus_endpoint_empty_description_test.md\"") } @@ -204,7 +211,7 @@ func (s *NexusTestSuite) TestEndpointUpdate() { s.mockCloudService.EXPECT().GetNexusEndpoints(gomock.Any(), gomock.Any()).Return(&cloudservice.GetNexusEndpointsResponse{Endpoints: []*nexus.Endpoint{}}, nil).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "update", "--name", exampleEndpoint.Spec.Name, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue+"-updated", + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue+"-updated", "--request-id", exampleEndpoint.AsyncOperationId, ), "endpoint not found") @@ -213,7 +220,7 @@ func (s *NexusTestSuite) TestEndpointUpdate() { s.mockCloudService.EXPECT().UpdateNexusEndpoint(gomock.Any(), gomock.Any()).Return(nil, errors.New("update error")).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "update", "--name", exampleEndpoint.Spec.Name, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue+"-updated", + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue+"-updated", "--request-id", exampleEndpoint.AsyncOperationId, ), "update error") @@ -226,7 +233,7 @@ func (s *NexusTestSuite) TestEndpointUpdate() { }, nil).Times(1) s.NoError(s.RunCmd("nexus", "endpoint", "update", "--name", exampleEndpoint.Spec.Name, - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue+"-updated", + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue+"-updated", "--request-id", exampleEndpoint.AsyncOperationId, )) @@ -239,7 +246,7 @@ func (s *NexusTestSuite) TestEndpointUpdate() { }, nil).Times(1) s.NoError(s.RunCmd("nexus", "endpoint", "update", "--name", exampleEndpoint.Spec.Name, - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId+"-updated", + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId+"-updated", "--request-id", exampleEndpoint.AsyncOperationId, )) @@ -295,8 +302,8 @@ func (s *NexusTestSuite) TestEndpointUpdate() { s.NoError(s.RunCmd("nexus", "endpoint", "update", "--name", exampleEndpoint.Spec.Name, "--description", exampleEndpoint.Spec.Description+"-updated", - "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId+"-updated", - "--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue+"-updated", + "--target-namespace", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().NamespaceId+"-updated", + "--target-task-queue", exampleEndpoint.Spec.TargetSpec.GetWorkerTargetSpec().TaskQueue+"-updated", "--request-id", exampleEndpoint.AsyncOperationId, )) @@ -365,7 +372,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceAdd() { s.mockCloudService.EXPECT().GetNexusEndpoints(gomock.Any(), gomock.Any()).Return(&cloudservice.GetNexusEndpointsResponse{Endpoints: []*nexus.Endpoint{getExampleNexusEndpoint()}}, nil).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "add", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "no updates to be made") } @@ -376,7 +383,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceSet() { s.mockCloudService.EXPECT().GetNexusEndpoints(gomock.Any(), gomock.Any()).Return(&cloudservice.GetNexusEndpointsResponse{Endpoints: []*nexus.Endpoint{}}, nil).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "set", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "endpoint not found") @@ -384,7 +391,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceSet() { s.mockCloudService.EXPECT().UpdateNexusEndpoint(gomock.Any(), gomock.Any()).Return(nil, errors.New("update error")).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "set", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "update error") @@ -396,7 +403,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceSet() { }, nil).Times(1) s.NoError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "set", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, )) } @@ -420,7 +427,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceRemove() { s.mockCloudService.EXPECT().GetNexusEndpoints(gomock.Any(), gomock.Any()).Return(&cloudservice.GetNexusEndpointsResponse{Endpoints: []*nexus.Endpoint{}}, nil).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "remove", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "endpoint not found") @@ -428,7 +435,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceRemove() { s.mockCloudService.EXPECT().UpdateNexusEndpoint(gomock.Any(), gomock.Any()).Return(nil, errors.New("update error")).Times(1) s.EqualError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "remove", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, ), "update error") @@ -440,7 +447,7 @@ func (s *NexusTestSuite) TestEndpointAllowedNamespaceRemove() { }, nil).Times(1) s.NoError(s.RunCmd("nexus", "endpoint", "allowed-namespace", "remove", "--name", exampleEndpoint.Spec.Name, - "--namespace", exampleEndpoint.Spec.PolicySpecs[0].AllowedCloudNamespacePolicySpec.NamespaceId, + "--namespace", exampleEndpoint.Spec.PolicySpecs[0].GetAllowedCloudNamespacePolicySpec().NamespaceId, "--request-id", exampleEndpoint.AsyncOperationId, )) diff --git a/protogen/api/cloud/nexus/v1/message.pb.go b/protogen/api/cloud/nexus/v1/message.pb.go index c4cf141..6a405ef 100644 --- a/protogen/api/cloud/nexus/v1/message.pb.go +++ b/protogen/api/cloud/nexus/v1/message.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" proto "github.com/gogo/protobuf/proto" types "github.com/gogo/protobuf/types" + v1 "github.com/temporalio/tcld/protogen/api/cloud/resource/v1" io "io" math "math" math_bits "math/bits" @@ -27,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type EndpointSpec struct { // The name of the endpoint. Must be unique within an account. - // The name must match `[a-zA-Z_][a-zA-Z0-9_]*`. + // The name must match `^[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9]$`. // This field is mutable. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Indicates where the endpoint should forward received nexus requests to. @@ -101,8 +102,10 @@ func (m *EndpointSpec) GetDescription() string { } type EndpointTargetSpec struct { - // A target spec for routing nexus requests to a specific cloud namespace worker. - WorkerTargetSpec *WorkerTargetSpec `protobuf:"bytes,1,opt,name=worker_target_spec,json=workerTargetSpec,proto3" json:"worker_target_spec,omitempty"` + // Types that are valid to be assigned to Variant: + // + // *EndpointTargetSpec_WorkerTargetSpec + Variant isEndpointTargetSpec_Variant `protobuf_oneof:"variant"` } func (m *EndpointTargetSpec) Reset() { *m = EndpointTargetSpec{} } @@ -137,13 +140,40 @@ func (m *EndpointTargetSpec) XXX_DiscardUnknown() { var xxx_messageInfo_EndpointTargetSpec proto.InternalMessageInfo -func (m *EndpointTargetSpec) GetWorkerTargetSpec() *WorkerTargetSpec { +type isEndpointTargetSpec_Variant interface { + isEndpointTargetSpec_Variant() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type EndpointTargetSpec_WorkerTargetSpec struct { + WorkerTargetSpec *WorkerTargetSpec `protobuf:"bytes,1,opt,name=worker_target_spec,json=workerTargetSpec,proto3,oneof" json:"worker_target_spec,omitempty"` +} + +func (*EndpointTargetSpec_WorkerTargetSpec) isEndpointTargetSpec_Variant() {} + +func (m *EndpointTargetSpec) GetVariant() isEndpointTargetSpec_Variant { if m != nil { - return m.WorkerTargetSpec + return m.Variant + } + return nil +} + +func (m *EndpointTargetSpec) GetWorkerTargetSpec() *WorkerTargetSpec { + if x, ok := m.GetVariant().(*EndpointTargetSpec_WorkerTargetSpec); ok { + return x.WorkerTargetSpec } return nil } +// XXX_OneofWrappers is for the internal use of the proto package. +func (*EndpointTargetSpec) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*EndpointTargetSpec_WorkerTargetSpec)(nil), + } +} + type WorkerTargetSpec struct { // The target cloud namespace to route requests to. Namespace must be in same account as the endpoint. This field is mutable. NamespaceId string `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` @@ -198,8 +228,10 @@ func (m *WorkerTargetSpec) GetTaskQueue() string { } type EndpointPolicySpec struct { - // A policy spec that allows one caller namespace to access the endpoint. - AllowedCloudNamespacePolicySpec *AllowedCloudNamespacePolicySpec `protobuf:"bytes,1,opt,name=allowed_cloud_namespace_policy_spec,json=allowedCloudNamespacePolicySpec,proto3" json:"allowed_cloud_namespace_policy_spec,omitempty"` + // Types that are valid to be assigned to Variant: + // + // *EndpointPolicySpec_AllowedCloudNamespacePolicySpec + Variant isEndpointPolicySpec_Variant `protobuf_oneof:"variant"` } func (m *EndpointPolicySpec) Reset() { *m = EndpointPolicySpec{} } @@ -234,13 +266,40 @@ func (m *EndpointPolicySpec) XXX_DiscardUnknown() { var xxx_messageInfo_EndpointPolicySpec proto.InternalMessageInfo -func (m *EndpointPolicySpec) GetAllowedCloudNamespacePolicySpec() *AllowedCloudNamespacePolicySpec { +type isEndpointPolicySpec_Variant interface { + isEndpointPolicySpec_Variant() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type EndpointPolicySpec_AllowedCloudNamespacePolicySpec struct { + AllowedCloudNamespacePolicySpec *AllowedCloudNamespacePolicySpec `protobuf:"bytes,1,opt,name=allowed_cloud_namespace_policy_spec,json=allowedCloudNamespacePolicySpec,proto3,oneof" json:"allowed_cloud_namespace_policy_spec,omitempty"` +} + +func (*EndpointPolicySpec_AllowedCloudNamespacePolicySpec) isEndpointPolicySpec_Variant() {} + +func (m *EndpointPolicySpec) GetVariant() isEndpointPolicySpec_Variant { if m != nil { - return m.AllowedCloudNamespacePolicySpec + return m.Variant } return nil } +func (m *EndpointPolicySpec) GetAllowedCloudNamespacePolicySpec() *AllowedCloudNamespacePolicySpec { + if x, ok := m.GetVariant().(*EndpointPolicySpec_AllowedCloudNamespacePolicySpec); ok { + return x.AllowedCloudNamespacePolicySpec + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*EndpointPolicySpec) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*EndpointPolicySpec_AllowedCloudNamespacePolicySpec)(nil), + } +} + type AllowedCloudNamespacePolicySpec struct { // The namespace that is allowed to call into this endpoint. Calling namespace must be in same account as the endpoint. NamespaceId string `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` @@ -295,9 +354,8 @@ type Endpoint struct { // The endpoint specification. Spec *EndpointSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` // The current state of the endpoint. - // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted // For any failed state, reach out to Temporal Cloud support for remediation. - State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"` + State v1.ResourceState `protobuf:"varint,4,opt,name=state,proto3,enum=temporal.api.cloud.resource.v1.ResourceState" json:"state,omitempty"` // The id of any ongoing async operation that is creating, updating, or deleting the endpoint, if any. AsyncOperationId string `protobuf:"bytes,5,opt,name=async_operation_id,json=asyncOperationId,proto3" json:"async_operation_id,omitempty"` // The date and time when the endpoint was created. @@ -359,11 +417,11 @@ func (m *Endpoint) GetSpec() *EndpointSpec { return nil } -func (m *Endpoint) GetState() string { +func (m *Endpoint) GetState() v1.ResourceState { if m != nil { return m.State } - return "" + return v1.RESOURCE_STATE_UNSPECIFIED } func (m *Endpoint) GetAsyncOperationId() string { @@ -401,44 +459,46 @@ func init() { } var fileDescriptor_799995496fe512b8 = []byte{ - // 584 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6f, 0xd3, 0x30, - 0x18, 0x8d, 0xdb, 0x6e, 0x50, 0xa7, 0x82, 0xca, 0xe2, 0x50, 0x0d, 0xe1, 0x96, 0x70, 0x60, 0x95, - 0x20, 0xd1, 0xe0, 0x08, 0x3b, 0xf0, 0x4b, 0x62, 0x07, 0x60, 0x94, 0x0a, 0x24, 0x10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 0xab, 0xc6, 0x7a, 0x77, 0xad, - 0x87, 0x66, 0x7c, 0x9a, 0x36, 0x74, 0x0d, 0x6e, 0x48, 0x45, 0x14, 0x9d, 0xbd, 0xaa, 0xe2, 0x07, - 0xba, 0x03, 0x11, 0x91, 0x27, 0x49, 0xe0, 0x73, 0x41, 0x53, 0xa2, 0x9f, 0x98, 0x76, 0xb1, 0x61, - 0x28, 0x4d, 0x73, 0xf2, 0xaa, 0x3c, 0xd8, 0x0b, 0xd1, 0x2e, 0x6c, 0x04, 0x29, 0x25, 0x8a, 0x86, - 0xbe, 0xde, 0xc2, 0xd6, 0xa6, 0x19, 0x65, 0xcb, 0x2d, 0x56, 0xd4, 0x2d, 0x57, 0xd4, 0xed, 0x97, - 0x2b, 0xda, 0xb3, 0x67, 0x7c, 0x8d, 0xa0, 0xe7, 0x10, 0x45, 0x44, 0x2a, 0x3f, 0xe6, 0x21, 0x3b, - 0x64, 0xa5, 0xc8, 0xa5, 0x0b, 0x45, 0x9a, 0xba, 0xeb, 0xc5, 0xac, 0x49, 0xc3, 0x8f, 0x3f, 0x8e, - 0x27, 0xd8, 0x3a, 0x9d, 0x60, 0xeb, 0x6c, 0x82, 0xc1, 0xe7, 0x1c, 0x83, 0xef, 0x39, 0x06, 0x3f, - 0x72, 0x0c, 0xc6, 0x39, 0x06, 0xbf, 0x72, 0x0c, 0x7e, 0xe7, 0xd8, 0x3a, 0xcb, 0x31, 0xf8, 0x3a, - 0xc5, 0xd6, 0x78, 0x8a, 0xad, 0xd3, 0x29, 0xb6, 0xde, 0xdf, 0x1e, 0xf0, 0x45, 0x6a, 0x8c, 0xff, - 0xe7, 0xc3, 0xf4, 0xc0, 0x14, 0x07, 0x9b, 0x66, 0x88, 0xfb, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x30, 0x52, 0x47, 0x23, 0xc4, 0x04, 0x00, 0x00, + // 622 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x4f, 0x13, 0x41, + 0x14, 0xde, 0xa1, 0xfc, 0xb0, 0xaf, 0x0d, 0x36, 0x73, 0x6a, 0x30, 0x0e, 0xb5, 0x1e, 0x84, 0x04, + 0x77, 0x83, 0x1e, 0x95, 0x83, 0xa0, 0x09, 0x1c, 0x54, 0x5c, 0x88, 0x26, 0x26, 0x64, 0x33, 0xec, + 0x0e, 0xcd, 0x84, 0xed, 0xce, 0x38, 0x33, 0x2d, 0x72, 0x31, 0xfc, 0x01, 0x1e, 0xfc, 0x33, 0x3c, + 0xf9, 0x77, 0x78, 0xe4, 0xc8, 0x51, 0x96, 0x8b, 0xf1, 0xc4, 0x9f, 0x60, 0x66, 0xda, 0xed, 0x36, + 0x40, 0x0a, 0xb7, 0xd7, 0x6f, 0xdf, 0xf7, 0xcd, 0xfb, 0xbe, 0xbc, 0x57, 0x58, 0x36, 0xac, 0x2b, + 0x85, 0xa2, 0x69, 0x40, 0x25, 0x0f, 0xe2, 0x54, 0xf4, 0x92, 0x20, 0x63, 0x5f, 0x7b, 0x3a, 0xe8, + 0xaf, 0x06, 0x5d, 0xa6, 0x35, 0xed, 0x30, 0x5f, 0x2a, 0x61, 0x04, 0x7e, 0x50, 0xb4, 0xfa, 0x54, + 0x72, 0xdf, 0xb5, 0xfa, 0xae, 0xd5, 0xef, 0xaf, 0x2e, 0xac, 0xdc, 0xa0, 0xa3, 0x98, 0x16, 0x3d, + 0x15, 0xb3, 0x6b, 0x52, 0x0b, 0x8b, 0x1d, 0x21, 0x3a, 0x29, 0x0b, 0xdc, 0xaf, 0xfd, 0xde, 0x41, + 0x60, 0x78, 0x97, 0x69, 0x43, 0xbb, 0x72, 0xd0, 0xd0, 0xfe, 0x87, 0xa0, 0xfe, 0x26, 0x4b, 0xa4, + 0xe0, 0x99, 0xd9, 0x91, 0x2c, 0xc6, 0x18, 0xa6, 0x33, 0xda, 0x65, 0x4d, 0xd4, 0x42, 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 0xe7, 0xc4, 0xbb, 0x3c, 0x27, 0xe8, 0x24, + 0x27, 0xe8, 0x67, 0x4e, 0xd0, 0xef, 0x9c, 0xa0, 0xd3, 0x9c, 0xa0, 0x3f, 0x39, 0x41, 0x7f, 0x73, + 0xe2, 0x5d, 0xe6, 0x04, 0xfd, 0xb8, 0x20, 0xde, 0xe9, 0x05, 0xf1, 0xce, 0x2e, 0x88, 0xf7, 0xf9, + 0x49, 0x47, 0x94, 0x21, 0x71, 0x71, 0xc3, 0xff, 0xe1, 0x0b, 0x57, 0xec, 0xcf, 0xba, 0x21, 0x9e, + 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x56, 0xfd, 0x3e, 0x3b, 0x05, 0x00, 0x00, } func (this *EndpointSpec) Equal(that interface{}) bool { @@ -498,6 +558,36 @@ func (this *EndpointTargetSpec) Equal(that interface{}) bool { } else if this == nil { return false } + if that1.Variant == nil { + if this.Variant != nil { + return false + } + } else if this.Variant == nil { + return false + } else if !this.Variant.Equal(that1.Variant) { + return false + } + return true +} +func (this *EndpointTargetSpec_WorkerTargetSpec) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*EndpointTargetSpec_WorkerTargetSpec) + if !ok { + that2, ok := that.(EndpointTargetSpec_WorkerTargetSpec) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } if !this.WorkerTargetSpec.Equal(that1.WorkerTargetSpec) { return false } @@ -549,6 +639,36 @@ func (this *EndpointPolicySpec) Equal(that interface{}) bool { } else if this == nil { return false } + if that1.Variant == nil { + if this.Variant != nil { + return false + } + } else if this.Variant == nil { + return false + } else if !this.Variant.Equal(that1.Variant) { + return false + } + return true +} +func (this *EndpointPolicySpec_AllowedCloudNamespacePolicySpec) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*EndpointPolicySpec_AllowedCloudNamespacePolicySpec) + if !ok { + that2, ok := that.(EndpointPolicySpec_AllowedCloudNamespacePolicySpec) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } if !this.AllowedCloudNamespacePolicySpec.Equal(that1.AllowedCloudNamespacePolicySpec) { return false } @@ -643,12 +763,20 @@ func (this *EndpointTargetSpec) GoString() string { } s := make([]string, 0, 5) s = append(s, "&nexus.EndpointTargetSpec{") - if this.WorkerTargetSpec != nil { - s = append(s, "WorkerTargetSpec: "+fmt.Sprintf("%#v", this.WorkerTargetSpec)+",\n") + if this.Variant != nil { + s = append(s, "Variant: "+fmt.Sprintf("%#v", this.Variant)+",\n") } s = append(s, "}") return strings.Join(s, "") } +func (this *EndpointTargetSpec_WorkerTargetSpec) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&nexus.EndpointTargetSpec_WorkerTargetSpec{` + + `WorkerTargetSpec:` + fmt.Sprintf("%#v", this.WorkerTargetSpec) + `}`}, ", ") + return s +} func (this *WorkerTargetSpec) GoString() string { if this == nil { return "nil" @@ -666,12 +794,20 @@ func (this *EndpointPolicySpec) GoString() string { } s := make([]string, 0, 5) s = append(s, "&nexus.EndpointPolicySpec{") - if this.AllowedCloudNamespacePolicySpec != nil { - s = append(s, "AllowedCloudNamespacePolicySpec: "+fmt.Sprintf("%#v", this.AllowedCloudNamespacePolicySpec)+",\n") + if this.Variant != nil { + s = append(s, "Variant: "+fmt.Sprintf("%#v", this.Variant)+",\n") } s = append(s, "}") return strings.Join(s, "") } +func (this *EndpointPolicySpec_AllowedCloudNamespacePolicySpec) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&nexus.EndpointPolicySpec_AllowedCloudNamespacePolicySpec{` + + `AllowedCloudNamespacePolicySpec:` + fmt.Sprintf("%#v", this.AllowedCloudNamespacePolicySpec) + `}`}, ", ") + return s +} func (this *AllowedCloudNamespacePolicySpec) GoString() string { if this == nil { return "nil" @@ -795,6 +931,25 @@ func (m *EndpointTargetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Variant != nil { + { + size := m.Variant.Size() + i -= size + if _, err := m.Variant.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *EndpointTargetSpec_WorkerTargetSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndpointTargetSpec_WorkerTargetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.WorkerTargetSpec != nil { { size, err := m.WorkerTargetSpec.MarshalToSizedBuffer(dAtA[:i]) @@ -809,7 +964,6 @@ func (m *EndpointTargetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } - func (m *WorkerTargetSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -867,6 +1021,25 @@ func (m *EndpointPolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Variant != nil { + { + size := m.Variant.Size() + i -= size + if _, err := m.Variant.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *EndpointPolicySpec_AllowedCloudNamespacePolicySpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndpointPolicySpec_AllowedCloudNamespacePolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.AllowedCloudNamespacePolicySpec != nil { { size, err := m.AllowedCloudNamespacePolicySpec.MarshalToSizedBuffer(dAtA[:i]) @@ -881,7 +1054,6 @@ func (m *EndpointPolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } - func (m *AllowedCloudNamespacePolicySpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -963,12 +1135,10 @@ func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if len(m.State) > 0 { - i -= len(m.State) - copy(dAtA[i:], m.State) - i = encodeVarintMessage(dAtA, i, uint64(len(m.State))) + if m.State != 0 { + i = encodeVarintMessage(dAtA, i, uint64(m.State)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x20 } if m.Spec != nil { { @@ -1038,6 +1208,18 @@ func (m *EndpointSpec) Size() (n int) { } func (m *EndpointTargetSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Variant != nil { + n += m.Variant.Size() + } + return n +} + +func (m *EndpointTargetSpec_WorkerTargetSpec) Size() (n int) { if m == nil { return 0 } @@ -1049,7 +1231,6 @@ func (m *EndpointTargetSpec) Size() (n int) { } return n } - func (m *WorkerTargetSpec) Size() (n int) { if m == nil { return 0 @@ -1068,6 +1249,18 @@ func (m *WorkerTargetSpec) Size() (n int) { } func (m *EndpointPolicySpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Variant != nil { + n += m.Variant.Size() + } + return n +} + +func (m *EndpointPolicySpec_AllowedCloudNamespacePolicySpec) Size() (n int) { if m == nil { return 0 } @@ -1079,7 +1272,6 @@ func (m *EndpointPolicySpec) Size() (n int) { } return n } - func (m *AllowedCloudNamespacePolicySpec) Size() (n int) { if m == nil { return 0 @@ -1111,9 +1303,8 @@ func (m *Endpoint) Size() (n int) { l = m.Spec.Size() n += 1 + l + sovMessage(uint64(l)) } - l = len(m.State) - if l > 0 { - n += 1 + l + sovMessage(uint64(l)) + if m.State != 0 { + n += 1 + sovMessage(uint64(m.State)) } l = len(m.AsyncOperationId) if l > 0 { @@ -1159,7 +1350,17 @@ func (this *EndpointTargetSpec) String() string { return "nil" } s := strings.Join([]string{`&EndpointTargetSpec{`, - `WorkerTargetSpec:` + strings.Replace(this.WorkerTargetSpec.String(), "WorkerTargetSpec", "WorkerTargetSpec", 1) + `,`, + `Variant:` + fmt.Sprintf("%v", this.Variant) + `,`, + `}`, + }, "") + return s +} +func (this *EndpointTargetSpec_WorkerTargetSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EndpointTargetSpec_WorkerTargetSpec{`, + `WorkerTargetSpec:` + strings.Replace(fmt.Sprintf("%v", this.WorkerTargetSpec), "WorkerTargetSpec", "WorkerTargetSpec", 1) + `,`, `}`, }, "") return s @@ -1180,7 +1381,17 @@ func (this *EndpointPolicySpec) String() string { return "nil" } s := strings.Join([]string{`&EndpointPolicySpec{`, - `AllowedCloudNamespacePolicySpec:` + strings.Replace(this.AllowedCloudNamespacePolicySpec.String(), "AllowedCloudNamespacePolicySpec", "AllowedCloudNamespacePolicySpec", 1) + `,`, + `Variant:` + fmt.Sprintf("%v", this.Variant) + `,`, + `}`, + }, "") + return s +} +func (this *EndpointPolicySpec_AllowedCloudNamespacePolicySpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EndpointPolicySpec_AllowedCloudNamespacePolicySpec{`, + `AllowedCloudNamespacePolicySpec:` + strings.Replace(fmt.Sprintf("%v", this.AllowedCloudNamespacePolicySpec), "AllowedCloudNamespacePolicySpec", "AllowedCloudNamespacePolicySpec", 1) + `,`, `}`, }, "") return s @@ -1464,12 +1675,11 @@ func (m *EndpointTargetSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.WorkerTargetSpec == nil { - m.WorkerTargetSpec = &WorkerTargetSpec{} - } - if err := m.WorkerTargetSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &WorkerTargetSpec{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Variant = &EndpointTargetSpec_WorkerTargetSpec{v} iNdEx = postIndex default: iNdEx = preIndex @@ -1670,12 +1880,11 @@ func (m *EndpointPolicySpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.AllowedCloudNamespacePolicySpec == nil { - m.AllowedCloudNamespacePolicySpec = &AllowedCloudNamespacePolicySpec{} - } - if err := m.AllowedCloudNamespacePolicySpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &AllowedCloudNamespacePolicySpec{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Variant = &EndpointPolicySpec_AllowedCloudNamespacePolicySpec{v} iNdEx = postIndex default: iNdEx = preIndex @@ -1916,10 +2125,10 @@ func (m *Endpoint) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } - var stringLen uint64 + m.State = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMessage @@ -1929,24 +2138,11 @@ func (m *Endpoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.State |= v1.ResourceState(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.State = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsyncOperationId", wireType) diff --git a/protogen/api/cloud/resource/v1/message.pb.go b/protogen/api/cloud/resource/v1/message.pb.go new file mode 100644 index 0000000..7d09596 --- /dev/null +++ b/protogen/api/cloud/resource/v1/message.pb.go @@ -0,0 +1,115 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: temporal/api/cloud/resource/v1/message.proto + +package resource + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" + strconv "strconv" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ResourceState int32 + +const ( + RESOURCE_STATE_UNSPECIFIED ResourceState = 0 + RESOURCE_STATE_ACTIVATING ResourceState = 1 + RESOURCE_STATE_ACTIVATION_FAILED ResourceState = 2 + RESOURCE_STATE_ACTIVE ResourceState = 3 + RESOURCE_STATE_UPDATING ResourceState = 4 + RESOURCE_STATE_UPDATE_FAILED ResourceState = 5 + RESOURCE_STATE_DELETING ResourceState = 6 + RESOURCE_STATE_DELETE_FAILED ResourceState = 7 + RESOURCE_STATE_DELETED ResourceState = 8 + RESOURCE_STATE_SUSPENDED ResourceState = 9 + RESOURCE_STATE_EXPIRED ResourceState = 10 +) + +var ResourceState_name = map[int32]string{ + 0: "Unspecified", + 1: "Activating", + 2: "ActivationFailed", + 3: "Active", + 4: "Updating", + 5: "UpdateFailed", + 6: "Deleting", + 7: "DeleteFailed", + 8: "Deleted", + 9: "Suspended", + 10: "Expired", +} + +var ResourceState_value = map[string]int32{ + "Unspecified": 0, + "Activating": 1, + "ActivationFailed": 2, + "Active": 3, + "Updating": 4, + "UpdateFailed": 5, + "Deleting": 6, + "DeleteFailed": 7, + "Deleted": 8, + "Suspended": 9, + "Expired": 10, +} + +func (ResourceState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1f9ad71e764361c3, []int{0} +} + +func init() { + proto.RegisterEnum("temporal.api.cloud.resource.v1.ResourceState", ResourceState_name, ResourceState_value) +} + +func init() { + proto.RegisterFile("temporal/api/cloud/resource/v1/message.proto", fileDescriptor_1f9ad71e764361c3) +} + +var fileDescriptor_1f9ad71e764361c3 = []byte{ + // 385 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x6b, 0xe2, 0x40, + 0x18, 0xc6, 0x33, 0xd9, 0x5d, 0x77, 0x77, 0xd8, 0x85, 0x30, 0xb0, 0x7f, 0x74, 0xdd, 0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, 0x66, 0xdb, 0xe9, 0x1f, 0x51, 0x03, 0xd6, 0xcb, 0x42, 0x5e, 0x4c, 0xfe, 0x54, 0xa2, + 0x33, 0xde, 0xe1, 0xb9, 0x5e, 0x29, 0xd1, 0xf3, 0xf0, 0x59, 0xff, 0x8c, 0x6a, 0xf0, 0x67, 0x29, + 0xc1, 0x94, 0x2f, 0xa8, 0x0e, 0x7f, 0xef, 0x65, 0x6e, 0xcf, 0xb5, 0xb9, 0xc5, 0x38, 0x53, 0xbe, + 0x96, 0x98, 0xfc, 0xcc, 0x36, 0x1d, 0xce, 0x14, 0xd8, 0x5a, 0x81, 0xc5, 0x1a, 0x4b, 0xcb, 0x35, + 0x96, 0x36, 0x6b, 0x0c, 0xae, 0x52, 0x0c, 0x6e, 0x52, 0x0c, 0xee, 0x52, 0x0c, 0x16, 0x29, 0x06, + 0xab, 0x14, 0x83, 0xfb, 0x14, 0x4b, 0x9b, 0x14, 0x83, 0xeb, 0x0c, 0x4b, 0x8b, 0x0c, 0x4b, 0xcb, + 0x0c, 0x4b, 0xf0, 0x5f, 0x28, 0xc8, 0xfb, 0xf7, 0x6b, 0x7d, 0x3b, 0xdd, 0x9e, 0xdb, 0x7e, 0xba, + 0xb6, 0x0d, 0xce, 0x0f, 0x47, 0xaf, 0x94, 0x50, 0x94, 0x77, 0xe4, 0xb8, 0x78, 0xdf, 0xca, 0x0d, + 0x6f, 0x07, 0x87, 0x82, 0xe8, 0x51, 0x48, 0x8c, 0x7c, 0x43, 0xd1, 0x08, 0xd2, 0xd7, 0x1e, 0xe4, + 0xe6, 0x0b, 0x42, 0xa9, 0x1e, 0x85, 0x94, 0xe6, 0x10, 0xa5, 0x05, 0x45, 0x69, 0x5f, 0xbb, 0xa8, + 0xe4, 0x7d, 0x3b, 0x7a, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x31, 0x5f, 0xa6, 0xe2, 0x9f, 0x02, 0x00, + 0x00, +} + +func (x ResourceState) String() string { + s, ok := ResourceState_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +}