Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: require workspace resource name in policy APIs (#19572)
ecmadao78dd5c953427
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 1baff32a28..a9dc98940b 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -8773,7 +8773,7 @@ components:title: parentdescription: |-The parent resource where this instance will be created.- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -9776,7 +9776,7 @@ components:description: |-The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -14110,7 +14110,7 @@ components:description: |-The name of the policy.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -18245,7 +18245,7 @@ components:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.goindex 44d4ca19f5..7379183b17 100644--- a/backend/api/v1/org_policy_service.go+++ b/backend/api/v1/org_policy_service.go@@ -358,7 +358,7 @@ func (s *OrgPolicyService) findPolicyMessage(ctx context.Context, policyName strif err != nil {return nil, policyParent, connect.NewError(connect.CodeInvalidArgument, err)}- if resource == nil && resourceType != storepb.Policy_WORKSPACE {+ if resource == nil {return nil, policyParent, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("resource for %s must be specific", resourceType))}diff --git a/backend/api/v1/workspace_service.go b/backend/api/v1/workspace_service.goindex 06fdae7157..bd68d00934 100644--- a/backend/api/v1/workspace_service.go+++ b/backend/api/v1/workspace_service.go@@ -73,9 +73,14 @@ func (s *WorkspaceService) SetIamPolicy(ctx context.Context, req *connect.Requesif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to marshal iam policy"))}+ workspaceResource, err := s.store.GetWorkspaceResourceName(ctx)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get workspace resource name"))+ }payloadStr := string(payloadBytes)patch := &store.UpdatePolicyMessage{ResourceType: storepb.Policy_WORKSPACE,+ Resource: workspaceResource,Type: storepb.Policy_IAM,Payload: &payloadStr,}diff --git a/backend/common/resource_name.go b/backend/common/resource_name.goindex 11b2b8f2f2..cfab4029a2 100644--- a/backend/common/resource_name.go+++ b/backend/common/resource_name.go@@ -640,7 +640,11 @@ func FormatSpec(projectID string, planUID int64, specID string) string {func GetPolicyResourceTypeAndResource(requestName string) (storepb.Policy_Resource, *string, error) {if requestName == "" {- return storepb.Policy_WORKSPACE, nil, nil+ return storepb.Policy_RESOURCE_UNSPECIFIED, nil, connect.NewError(connect.CodeInvalidArgument, errors.New("policy parent resource name must not be empty"))+ }++ if strings.HasPrefix(requestName, WorkspacePrefix) {+ return storepb.Policy_WORKSPACE, &requestName, nil}if strings.HasPrefix(requestName, ProjectNamePrefix) {diff --git a/backend/generated-go/v1/org_policy_service.pb.go b/backend/generated-go/v1/org_policy_service.pb.goindex fc2c131099..52db0aa612 100644--- a/backend/generated-go/v1/org_policy_service.pb.go+++ b/backend/generated-go/v1/org_policy_service.pb.go@@ -150,7 +150,7 @@ func (PolicyResourceType) EnumDescriptor() ([]byte, []int) {type CreatePolicyRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The parent resource where this instance will be created.- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -220,7 +220,7 @@ type UpdatePolicyRequest struct {//// The policy's `name` field is used to identify the instance to update.// Format: {resource name}/policies/{policy type}- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -289,7 +289,7 @@ type DeletePolicyRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The policy's `name` field is used to identify the instance to update.// Format: {resource name}/policies/{policy type}- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -494,7 +494,7 @@ type Policy struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the policy.// Format: {resource name}/policies/{policy type}- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -1133,7 +1133,7 @@ const file_v1_org_policy_service_proto_rawDesc = "" +"\fshow_deleted\x18\x03 \x01(\bR\vshowDeletedB\x0e\n" +"\f_policy_type\"G\n" +"\x14ListPoliciesResponse\x12/\n" +- "\bpolicies\x18\x01 \x03(\v2\x13.bytebase.v1.PolicyR\bpolicies\"\xcd\x06\n" ++ "\bpolicies\x18\x01 \x03(\v2\x13.bytebase.v1.PolicyR\bpolicies\"\xe4\x06\n" +"\x06Policy\x12\x12\n" +"\x04name\x18\x01 \x01(\tR\x04name\x12.\n" +"\x13inherit_from_parent\x18\x02 \x01(\bR\x11inheritFromParent\x12+\n" +@@ -1146,8 +1146,8 @@ const file_v1_org_policy_service_proto_rawDesc = "" +"\x11query_data_policy\x18\t \x01(\v2\x1c.bytebase.v1.QueryDataPolicyH\x00R\x0fqueryDataPolicy\x12\x18\n" +"\aenforce\x18\n" +" \x01(\bR\aenforce\x12I\n" +- "\rresource_type\x18\v \x01(\x0e2\x1f.bytebase.v1.PolicyResourceTypeB\x03\xe0A\x03R\fresourceType:\xe5\x01\xeaA\xe1\x01\n" +- "\x13bytebase.com/Policy\x12\x11policies/{policy}\x12$projects/{project}/policies/{policy}\x12,environments/{environment}/policies/{policy}\x12&instances/{instance}/policies/{policy}\x12;instances/{instance}/databases/{database}/policies/{policy}B\b\n" ++ "\rresource_type\x18\v \x01(\x0e2\x1f.bytebase.v1.PolicyResourceTypeB\x03\xe0A\x03R\fresourceType:\xfc\x01\xeaA\xf8\x01\n" ++ "\x13bytebase.com/Policy\x12(workspaces/{workspace}/policies/{policy}\x12$projects/{project}/policies/{policy}\x12,environments/{environment}/policies/{policy}\x12&instances/{instance}/policies/{policy}\x12;instances/{instance}/databases/{database}/policies/{policy}B\b\n" +"\x06policy\"C\n" +"\rRolloutPolicy\x12\x1c\n" +"\tautomatic\x18\x01 \x01(\bR\tautomatic\x12\x14\n" +@@ -1188,13 +1188,13 @@ const file_v1_org_policy_service_proto_rawDesc = "" +"\x19RESOURCE_TYPE_UNSPECIFIED\x10\x00\x12\r\n" +"\tWORKSPACE\x10\x01\x12\x0f\n" +"\vENVIRONMENT\x10\x02\x12\v\n" +- "\aPROJECT\x10\x032\xf4\f\n" +- "\x10OrgPolicyService\x12\xa0\x02\n" +- "\tGetPolicy\x12\x1d.bytebase.v1.GetPolicyRequest\x1a\x13.bytebase.v1.Policy\"\xde\x01\xdaA\x04name\x8a\xea0\x0fbb.policies.get\x90\xea0\x02\x82\xd3\xe4\x93\x02\xb9\x01Z\"\x12 /v1/{name=projects/*/policies/*}Z&\x12$/v1/{name=environments/*/policies/*}Z#\x12!/v1/{name=instances/*/policies/*}Z/\x12-/v1/{name=instances/*/databases/*/policies/*}\x12\x15/v1/{name=policies/*}\x12\xa8\x02\n" +- "\fListPolicies\x12 .bytebase.v1.ListPoliciesRequest\x1a!.bytebase.v1.ListPoliciesResponse\"\xd2\x01\xdaA\x00\x8a\xea0\x10bb.policies.list\x90\xea0\x01\x82\xd3\xe4\x93\x02\xb0\x01Z\"\x12 /v1/{parent=projects/*}/policiesZ&\x12$/v1/{parent=environments/*}/policiesZ#\x12!/v1/{parent=instances/*}/policiesZ/\x12-/v1/{parent=instances/*/databases/*}/policies\x12\f/v1/policies\x12\xd5\x02\n" +- "\fCreatePolicy\x12 .bytebase.v1.CreatePolicyRequest\x1a\x13.bytebase.v1.Policy\"\x8d\x02\xdaA\rparent,policy\x8a\xea0\x12bb.policies.create\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\xd8\x01:\x06policyZ*:\x06policy\" /v1/{parent=projects/*}/policiesZ.:\x06policy\"$/v1/{parent=environments/*}/policiesZ+:\x06policy\"!/v1/{parent=instances/*}/policiesZ7:\x06policy\"-/v1/{parent=instances/*/databases/*}/policies\"\f/v1/policies\x12\x86\x03\n" +- "\fUpdatePolicy\x12 .bytebase.v1.UpdatePolicyRequest\x1a\x13.bytebase.v1.Policy\"\xbe\x02\xdaA\x12policy,update_mask\x8a\xea0\x12bb.policies.update\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\x84\x02:\x06policyZ1:\x06policy2'/v1/{policy.name=projects/*/policies/*}Z5:\x06policy2+/v1/{policy.name=environments/*/policies/*}Z2:\x06policy2(/v1/{policy.name=instances/*/policies/*}Z>:\x06policy24/v1/{policy.name=instances/*/databases/*/policies/*}2\x1c/v1/{policy.name=policies/*}\x12\xb0\x02\n" +- "\fDeletePolicy\x12 .bytebase.v1.DeletePolicyRequest\x1a\x16.google.protobuf.Empty\"\xe5\x01\xdaA\x04name\x8a\xea0\x12bb.policies.delete\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\xb9\x01Z\"* /v1/{name=projects/*/policies/*}Z&*$/v1/{name=environments/*/policies/*}Z#*!/v1/{name=instances/*/policies/*}Z/*-/v1/{name=instances/*/databases/*/policies/*}*\x15/v1/{name=policies/*}B\xab\x01\n" ++ "\aPROJECT\x10\x032\xc7\r\n" ++ "\x10OrgPolicyService\x12\xad\x02\n" ++ "\tGetPolicy\x12\x1d.bytebase.v1.GetPolicyRequest\x1a\x13.bytebase.v1.Policy\"\xeb\x01\xdaA\x04name\x8a\xea0\x0fbb.policies.get\x90\xea0\x02\x82\xd3\xe4\x93\x02\xc6\x01Z\"\x12 /v1/{name=projects/*/policies/*}Z&\x12$/v1/{name=environments/*/policies/*}Z#\x12!/v1/{name=instances/*/policies/*}Z/\x12-/v1/{name=instances/*/databases/*/policies/*}\x12\"/v1/{name=workspaces/*/policies/*}\x12\xbe\x02\n" ++ "\fListPolicies\x12 .bytebase.v1.ListPoliciesRequest\x1a!.bytebase.v1.ListPoliciesResponse\"\xe8\x01\xdaA\x00\x8a\xea0\x10bb.policies.list\x90\xea0\x01\x82\xd3\xe4\x93\x02\xc6\x01Z\"\x12 /v1/{parent=projects/*}/policiesZ&\x12$/v1/{parent=environments/*}/policiesZ#\x12!/v1/{parent=instances/*}/policiesZ/\x12-/v1/{parent=instances/*/databases/*}/policies\x12\"/v1/{parent=workspaces/*}/policies\x12\xeb\x02\n" ++ "\fCreatePolicy\x12 .bytebase.v1.CreatePolicyRequest\x1a\x13.bytebase.v1.Policy\"\xa3\x02\xdaA\rparent,policy\x8a\xea0\x12bb.policies.create\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\xee\x01:\x06policyZ*:\x06policy\" /v1/{parent=projects/*}/policiesZ.:\x06policy\"$/v1/{parent=environments/*}/policiesZ+:\x06policy\"!/v1/{parent=instances/*}/policiesZ7:\x06policy\"-/v1/{parent=instances/*/databases/*}/policies\"\"/v1/{parent=workspaces/*}/policies\x12\x93\x03\n" ++ "\fUpdatePolicy\x12 .bytebase.v1.UpdatePolicyRequest\x1a\x13.bytebase.v1.Policy\"\xcb\x02\xdaA\x12policy,update_mask\x8a\xea0\x12bb.policies.update\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\x91\x02:\x06policyZ1:\x06policy2'/v1/{policy.name=projects/*/policies/*}Z5:\x06policy2+/v1/{policy.name=environments/*/policies/*}Z2:\x06policy2(/v1/{policy.name=instances/*/policies/*}Z>:\x06policy24/v1/{policy.name=instances/*/databases/*/policies/*}2)/v1/{policy.name=workspaces/*/policies/*}\x12\xbd\x02\n" ++ "\fDeletePolicy\x12 .bytebase.v1.DeletePolicyRequest\x1a\x16.google.protobuf.Empty\"\xf2\x01\xdaA\x04name\x8a\xea0\x12bb.policies.delete\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\xc6\x01Z\"* /v1/{name=projects/*/policies/*}Z&*$/v1/{name=environments/*/policies/*}Z#*!/v1/{name=instances/*/policies/*}Z/*-/v1/{name=instances/*/databases/*/policies/*}*\"/v1/{name=workspaces/*/policies/*}B\xab\x01\n" +"\x0fcom.bytebase.v1B\x15OrgPolicyServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"var (diff --git a/backend/generated-go/v1/org_policy_service.pb.gw.go b/backend/generated-go/v1/org_policy_service.pb.gw.goindex 344221c4d8..97554ba2e4 100644--- a/backend/generated-go/v1/org_policy_service.pb.gw.go+++ b/backend/generated-go/v1/org_policy_service.pb.gw.go@@ -230,16 +230,25 @@ func local_request_OrgPolicyService_GetPolicy_4(ctx context.Context, marshaler rreturn msg, metadata, err}-var filter_OrgPolicyService_ListPolicies_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}+var filter_OrgPolicyService_ListPolicies_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}func request_OrgPolicyService_ListPolicies_0(ctx context.Context, marshaler runtime.Marshaler, client OrgPolicyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var (protoReq ListPoliciesRequestmetadata runtime.ServerMetadata+ err error)if req.Body != nil {_, _ = io.Copy(io.Discard, req.Body)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }if err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}@@ -254,7 +263,16 @@ func local_request_OrgPolicyService_ListPolicies_0(ctx context.Context, marshalevar (protoReq ListPoliciesRequestmetadata runtime.ServerMetadata+ err error)+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }if err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}@@ -477,12 +495,13 @@ func local_request_OrgPolicyService_ListPolicies_4(ctx context.Context, marshalereturn msg, metadata, err}-var filter_OrgPolicyService_CreatePolicy_0 = &utilities.DoubleArray{Encoding: map[string]int{"policy": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}+var filter_OrgPolicyService_CreatePolicy_0 = &utilities.DoubleArray{Encoding: map[string]int{"policy": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}func request_OrgPolicyService_CreatePolicy_0(ctx context.Context, marshaler runtime.Marshaler, client OrgPolicyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var (protoReq CreatePolicyRequestmetadata runtime.ServerMetadata+ err error)if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Policy); err != nil && !errors.Is(err, io.EOF) {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)@@ -490,6 +509,14 @@ func request_OrgPolicyService_CreatePolicy_0(ctx context.Context, marshaler runtif req.Body != nil {_, _ = io.Copy(io.Discard, req.Body)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }if err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}@@ -504,10 +531,19 @@ func local_request_OrgPolicyService_CreatePolicy_0(ctx context.Context, marshalevar (protoReq CreatePolicyRequestmetadata runtime.ServerMetadata+ err error)if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Policy); err != nil && !errors.Is(err, io.EOF) {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }if err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}@@ -1366,7 +1402,7 @@ func RegisterOrgPolicyServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/GetPolicy", runtime.WithHTTPPathPattern("/v1/{name=policies/*}"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/GetPolicy", runtime.WithHTTPPathPattern("/v1/{name=workspaces/*/policies/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -1466,7 +1502,7 @@ func RegisterOrgPolicyServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/ListPolicies", runtime.WithHTTPPathPattern("/v1/policies"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/ListPolicies", runtime.WithHTTPPathPattern("/v1/{parent=workspaces/*}/policies"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -1566,7 +1602,7 @@ func RegisterOrgPolicyServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/CreatePolicy", runtime.WithHTTPPathPattern("/v1/policies"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/CreatePolicy", runtime.WithHTTPPathPattern("/v1/{parent=workspaces/*}/policies"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -1666,7 +1702,7 @@ func RegisterOrgPolicyServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/UpdatePolicy", runtime.WithHTTPPathPattern("/v1/{policy.name=policies/*}"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/UpdatePolicy", runtime.WithHTTPPathPattern("/v1/{policy.name=workspaces/*/policies/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -1766,7 +1802,7 @@ func RegisterOrgPolicyServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/DeletePolicy", runtime.WithHTTPPathPattern("/v1/{name=policies/*}"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/DeletePolicy", runtime.WithHTTPPathPattern("/v1/{name=workspaces/*/policies/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -1904,7 +1940,7 @@ func RegisterOrgPolicyServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/GetPolicy", runtime.WithHTTPPathPattern("/v1/{name=policies/*}"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/GetPolicy", runtime.WithHTTPPathPattern("/v1/{name=workspaces/*/policies/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -1989,7 +2025,7 @@ func RegisterOrgPolicyServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/ListPolicies", runtime.WithHTTPPathPattern("/v1/policies"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/ListPolicies", runtime.WithHTTPPathPattern("/v1/{parent=workspaces/*}/policies"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -2074,7 +2110,7 @@ func RegisterOrgPolicyServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/CreatePolicy", runtime.WithHTTPPathPattern("/v1/policies"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/CreatePolicy", runtime.WithHTTPPathPattern("/v1/{parent=workspaces/*}/policies"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -2159,7 +2195,7 @@ func RegisterOrgPolicyServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/UpdatePolicy", runtime.WithHTTPPathPattern("/v1/{policy.name=policies/*}"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/UpdatePolicy", runtime.WithHTTPPathPattern("/v1/{policy.name=workspaces/*/policies/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -2244,7 +2280,7 @@ func RegisterOrgPolicyServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/DeletePolicy", runtime.WithHTTPPathPattern("/v1/{name=policies/*}"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.OrgPolicyService/DeletePolicy", runtime.WithHTTPPathPattern("/v1/{name=workspaces/*/policies/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -2329,27 +2365,27 @@ func RegisterOrgPolicyServiceHandlerClient(ctx context.Context, mux *runtime.Ser}var (- pattern_OrgPolicyService_GetPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "policies", "name"}, ""))+ pattern_OrgPolicyService_GetPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "workspaces", "policies", "name"}, ""))pattern_OrgPolicyService_GetPolicy_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "policies", "name"}, ""))pattern_OrgPolicyService_GetPolicy_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "policies", "name"}, ""))pattern_OrgPolicyService_GetPolicy_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "policies", "name"}, ""))pattern_OrgPolicyService_GetPolicy_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4}, []string{"v1", "instances", "databases", "policies", "name"}, ""))- pattern_OrgPolicyService_ListPolicies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "policies"}, ""))+ pattern_OrgPolicyService_ListPolicies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "workspaces", "parent", "policies"}, ""))pattern_OrgPolicyService_ListPolicies_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "policies"}, ""))pattern_OrgPolicyService_ListPolicies_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "environments", "parent", "policies"}, ""))pattern_OrgPolicyService_ListPolicies_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "instances", "parent", "policies"}, ""))pattern_OrgPolicyService_ListPolicies_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "instances", "databases", "parent", "policies"}, ""))- pattern_OrgPolicyService_CreatePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "policies"}, ""))+ pattern_OrgPolicyService_CreatePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "workspaces", "parent", "policies"}, ""))pattern_OrgPolicyService_CreatePolicy_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "policies"}, ""))pattern_OrgPolicyService_CreatePolicy_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "environments", "parent", "policies"}, ""))pattern_OrgPolicyService_CreatePolicy_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "instances", "parent", "policies"}, ""))pattern_OrgPolicyService_CreatePolicy_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "instances", "databases", "parent", "policies"}, ""))- pattern_OrgPolicyService_UpdatePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "policies", "policy.name"}, ""))+ pattern_OrgPolicyService_UpdatePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "workspaces", "policies", "policy.name"}, ""))pattern_OrgPolicyService_UpdatePolicy_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "policies", "policy.name"}, ""))pattern_OrgPolicyService_UpdatePolicy_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "policies", "policy.name"}, ""))pattern_OrgPolicyService_UpdatePolicy_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "policies", "policy.name"}, ""))pattern_OrgPolicyService_UpdatePolicy_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4}, []string{"v1", "instances", "databases", "policies", "policy.name"}, ""))- pattern_OrgPolicyService_DeletePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "policies", "name"}, ""))+ pattern_OrgPolicyService_DeletePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "workspaces", "policies", "name"}, ""))pattern_OrgPolicyService_DeletePolicy_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "policies", "name"}, ""))pattern_OrgPolicyService_DeletePolicy_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "policies", "name"}, ""))pattern_OrgPolicyService_DeletePolicy_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "policies", "name"}, ""))diff --git a/backend/migrator/migration/3.16/0001##fix_workspace_policy_resource.sql b/backend/migrator/migration/3.16/0001##fix_workspace_policy_resource.sqlnew file mode 100644index 0000000000..e87b70e0ba--- /dev/null+++ b/backend/migrator/migration/3.16/0001##fix_workspace_policy_resource.sql@@ -0,0 +1,11 @@+-- Fix workspace IAM policy resource field.+-- Currently workspace-level policies have resource = '' (empty string).+-- Set resource = 'workspaces/{workspace_id}' for SaaS multi-tenancy support.++UPDATE policy+SET resource = 'workspaces/' || (+ SELECT value->>'workspaceId'+ FROM setting+ WHERE name = 'SYSTEM'+)+WHERE resource_type = 'WORKSPACE' AND resource = '';diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex 6858c8e74a..c0a2c958f2 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -637,4 +637,4 @@ VALUES (-- Initialize workspace IAM policy-- Grant workspace member role to allUsersINSERT INTO policy (resource_type, resource, type, payload, inherit_from_parent, enforce)-VALUES ('WORKSPACE', '', 'IAM', '{"bindings":[{"role":"roles/workspaceMember","members":["allUsers"]}]}', FALSE, TRUE);+VALUES ('WORKSPACE', 'workspaces/' || (SELECT value->>'workspaceId' FROM setting WHERE name = 'SYSTEM'), 'IAM', '{"bindings":[{"role":"roles/workspaceMember","members":["allUsers"]}]}', FALSE, TRUE);diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 3347e33d0c..03a4f5f63a 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -15,8 +15,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.16.0"), *files[len(files)-1].version)- require.Equal(t, "migration/3.16/0000##split_principal_table.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.16.1"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.16/0001##fix_workspace_policy_resource.sql", files[len(files)-1].path)}func TestVersionUnique(t *testing.T) {diff --git a/backend/store/policy.go b/backend/store/policy.goindex a99d31e8f1..411130c119 100644--- a/backend/store/policy.go+++ b/backend/store/policy.go@@ -32,15 +32,29 @@ func generateEtag(t time.Time) string {return fmt.Sprintf("%d", t.UnixMilli())}+// GetWorkspaceResourceName returns the workspace resource name "workspaces/{id}".+func (s *Store) GetWorkspaceResourceName(ctx context.Context) (string, error) {+ systemSetting, err := s.GetSystemSetting(ctx)+ if err != nil {+ return "", errors.Wrap(err, "failed to get system setting")+ }+ return common.FormatWorkspace(systemSetting.WorkspaceId), nil+}+func (s *Store) GetWorkspaceIamPolicy(ctx context.Context) (*IamPolicyMessage, error) {+ workspaceResource, err := s.GetWorkspaceResourceName(ctx)+ if err != nil {+ return nil, err+ }resourceType := storepb.Policy_WORKSPACEpolicy, err := s.getIamPolicy(ctx, &FindPolicyMessage{ResourceType: &resourceType,+ Resource: &workspaceResource,})if err != nil {return nil, err}- s.iamPolicyCache.Add(getIamPolicyCacheKey(storepb.Policy_WORKSPACE, ""), policy)+ s.iamPolicyCache.Add(getIamPolicyCacheKey(storepb.Policy_WORKSPACE, workspaceResource), policy)return policy, nil}@@ -51,6 +65,11 @@ type PatchIamPolicyMessage struct {// PatchWorkspaceIamPolicy will set or remove the member for the workspace role.func (s *Store) PatchWorkspaceIamPolicy(ctx context.Context, patch *PatchIamPolicyMessage) (*IamPolicyMessage, error) {+ workspaceResource, err := s.GetWorkspaceResourceName(ctx)+ if err != nil {+ return nil, err+ }+workspaceIamPolicy, err := s.GetWorkspaceIamPolicy(ctx)if err != nil {return nil, err@@ -92,6 +111,7 @@ func (s *Store) PatchWorkspaceIamPolicy(ctx context.Context, patch *PatchIamPoliif _, err := s.CreatePolicy(ctx, &PolicyMessage{ResourceType: storepb.Policy_WORKSPACE,+ Resource: workspaceResource,Payload: string(policyPayload),Type: storepb.Policy_IAM,InheritFromParent: false,@@ -102,7 +122,7 @@ func (s *Store) PatchWorkspaceIamPolicy(ctx context.Context, patch *PatchIamPoli}// Invalidate IAM policy cache after mutation.- s.iamPolicyCache.Remove(getIamPolicyCacheKey(storepb.Policy_WORKSPACE, ""))+ s.iamPolicyCache.Remove(getIamPolicyCacheKey(storepb.Policy_WORKSPACE, workspaceResource))return s.GetWorkspaceIamPolicy(ctx)}@@ -123,7 +143,11 @@ func (s *Store) GetProjectIamPolicy(ctx context.Context, projectID string) (*Iam// GetWorkspaceIamPolicySnapshot returns the workspace IAM policy with snapshot reads (with cache).func (s *Store) GetWorkspaceIamPolicySnapshot(ctx context.Context) (*IamPolicyMessage, error) {- key := getIamPolicyCacheKey(storepb.Policy_WORKSPACE, "")+ workspaceResource, err := s.GetWorkspaceResourceName(ctx)+ if err != nil {+ return nil, err+ }+ key := getIamPolicyCacheKey(storepb.Policy_WORKSPACE, workspaceResource)if v, ok := s.iamPolicyCache.Get(key); ok {return v, nil}@@ -225,7 +249,11 @@ func formatEffectiveQueryDataPolicy(policy *storepb.QueryDataPolicy) *EffectiveQ}func (s *Store) GetEffectiveQueryDataPolicy(ctx context.Context, projectFullName string) (*EffectiveQueryDataPolicy, error) {- workspacePolicy, err := s.getQueryDataPolicy(ctx, "")+ workspaceResource, err := s.GetWorkspaceResourceName(ctx)+ if err != nil {+ return nil, err+ }+ workspacePolicy, err := s.getQueryDataPolicy(ctx, workspaceResource)if err != nil {return nil, err}@@ -364,9 +392,16 @@ func (s *Store) getReviewConfigByResource(ctx context.Context, resourceType stor// GetMaskingRulePolicy will get the masking rule policy.func (s *Store) GetMaskingRulePolicy(ctx context.Context) (*storepb.MaskingRulePolicy, error) {+ workspaceResource, err := s.GetWorkspaceResourceName(ctx)+ if err != nil {+ return nil, err+ }+ resourceType := storepb.Policy_WORKSPACEpType := storepb.Policy_MASKING_RULEpolicy, err := s.GetPolicy(ctx, &FindPolicyMessage{- Type: &pType,+ ResourceType: &resourceType,+ Resource: &workspaceResource,+ Type: &pType,})if err != nil {return nil, errdiff --git a/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue b/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vueindex b65dbe62f7..b2563f2443 100644--- a/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue+++ b/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue@@ -103,6 +103,7 @@ import {usePolicyV1Store,useProjectV1Store,useSettingV1Store,+ workspaceNamePrefix,} from "@/store";import {PolicyResourceType,@@ -123,7 +124,9 @@ const policyV1Store = usePolicyV1Store();const settingV1Store = useSettingV1Store();const projectStore = useProjectV1Store();-const isWorkspace = computed(() => props.resource === "");+const isWorkspace = computed(() =>+ props.resource.startsWith(workspaceNamePrefix)+);const project = computed(() =>isWorkspace.value ? undefined : projectStore.getProjectByName(props.resource));@@ -165,7 +168,9 @@ const updateChange = async () => {parentPath: props.resource,policy: {type: PolicyType.DATA_QUERY,- resourceType: PolicyResourceType.WORKSPACE,+ resourceType: isWorkspace.value+ ? PolicyResourceType.WORKSPACE+ : PolicyResourceType.PROJECT,policy: {case: "queryDataPolicy",value: create(QueryDataPolicySchema, {diff --git a/frontend/src/components/GeneralSetting/SQLEditorSetting.vue b/frontend/src/components/GeneralSetting/SQLEditorSetting.vueindex efd3770c8b..820728afbc 100644--- a/frontend/src/components/GeneralSetting/SQLEditorSetting.vue+++ b/frontend/src/components/GeneralSetting/SQLEditorSetting.vue@@ -11,7 +11,7 @@<div class="flex-1 lg:px-4 flex flex-col gap-y-6"><QueryDataPolicySettingref="queryDataPolicySettingRef"- resource=""+ :resource="actuatorStore.workspaceResourceName"/></div></div>@@ -19,8 +19,11 @@<script lang="ts" setup>import { computed, ref } from "vue";+import { useActuatorV1Store } from "@/store";import QueryDataPolicySetting from "./QueryDataPolicySetting.vue";+const actuatorStore = useActuatorV1Store();+const props = defineProps<{title: string;}>();diff --git a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vueindex ed37a5ea30..fb7b024e34 100644--- a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue+++ b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue@@ -138,6 +138,7 @@ import type { Factor } from "@/plugins/cel";import {featureToRef,pushNotification,+ useActuatorV1Store,usePolicyV1Store,useSettingV1Store,} from "@/store";@@ -195,6 +196,7 @@ const state = reactive<LocalState>({});const policyStore = usePolicyV1Store();+const actuatorStore = useActuatorV1Store();const hasPermission = computed(() => {return hasWorkspacePermissionV2("bb.policies.updateMaskingRulePolicy");});@@ -207,7 +209,7 @@ layout.mainContainerRef = useBodyLayoutContext().mainContainerRef;const updateList = async () => {const policy = await policyStore.getOrFetchPolicyByParentAndType({- parentPath: "",+ parentPath: actuatorStore.workspaceResourceName,policyType: PolicyType.MASKING_RULE,});if (!policy) {@@ -354,7 +356,7 @@ const onPolicyUpsert = async () => {};await policyStore.upsertPolicy({- parentPath: "",+ parentPath: actuatorStore.workspaceResourceName,policy: patch,});};diff --git a/frontend/src/store/modules/v1/actuator.ts b/frontend/src/store/modules/v1/actuator.tsindex f43d9277e2..13cb8e6605 100644--- a/frontend/src/store/modules/v1/actuator.ts+++ b/frontend/src/store/modules/v1/actuator.ts@@ -19,6 +19,7 @@ import {STORAGE_KEY_RELEASE,semverCompare,} from "@/utils";+import { workspaceNamePrefix } from "./common";const EXTERNAL_URL_PLACEHOLDER ="https://docs.bytebase.com/get-started/self-host/external-url";@@ -80,6 +81,10 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {const isSaaSMode = computed(() => serverInfo.value?.saas || false);+ const workspaceResourceName = computed(+ () => `${workspaceNamePrefix}${serverInfo.value?.workspaceId ?? ""}`+ );+const needAdminSetup = computed(() => serverInfo.value?.needAdminSetup || false);@@ -245,6 +250,7 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {isDemo,isDocker,isSaaSMode,+ workspaceResourceName,needAdminSetup,needConfigureExternalUrl,hasNewRelease,diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.tsindex 3110521f8a..675946b86d 100644--- a/frontend/src/store/modules/v1/common.ts+++ b/frontend/src/store/modules/v1/common.ts@@ -249,7 +249,7 @@ export const getReviewConfigId = (name: string) => {// The name of the policy.// Format: {resource name}/policies/{policy type}-// Workspace resource name: "".+// Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.diff --git a/frontend/src/store/modules/v1/policy.ts b/frontend/src/store/modules/v1/policy.tsindex 8719f550ac..194dd9c789 100644--- a/frontend/src/store/modules/v1/policy.ts+++ b/frontend/src/store/modules/v1/policy.ts@@ -21,6 +21,7 @@ import {RolloutPolicySchema,UpdatePolicyRequestSchema,} from "@/types/proto-es/v1/org_policy_service_pb";+import { useActuatorV1Store } from "./actuator";import { useCurrentUserV1 } from "./auth";interface PolicyState {@@ -231,13 +232,14 @@ export const usePolicyByParentAndType = (export const useQueryDataPolicy = (project: MaybeRef<string>) => {const store = usePolicyV1Store();+ const actuatorStore = useActuatorV1Store();const ready = ref(false);watchEffect(() => {Promise.all([// Fetch workspace-level DATA_QUERY policiesstore.getOrFetchPolicyByParentAndType({- parentPath: "",+ parentPath: actuatorStore.workspaceResourceName,policyType: PolicyType.DATA_QUERY,}),// Fetch project-level DATA_QUERY policies@@ -250,7 +252,7 @@ export const useQueryDataPolicy = (project: MaybeRef<string>) => {const policy = computed(() => {const workspacePolicy = formatQueryDataPolicy(- store.getQueryDataPolicyByParent("")+ store.getQueryDataPolicyByParent(actuatorStore.workspaceResourceName));const projectPolicy = formatQueryDataPolicy(store.getQueryDataPolicyByParent(unref(project))diff --git a/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts b/frontend/src/types/proto-es/v1/org_policy_service_pb.d.tsindex 313252de53..2ff0506cea 100644--- a/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts@@ -18,7 +18,7 @@ export declare const file_v1_org_policy_service: GenFile;export declare type CreatePolicyRequest = Message<"bytebase.v1.CreatePolicyRequest"> & {/*** The parent resource where this instance will be created.- * Workspace resource name: "".+ * Workspace resource name: workspaces/{workspace-id}.* Environment resource name: environments/environment-id.* Instance resource name: instances/instance-id.* Database resource name: instances/instance-id/databases/database-name.@@ -57,7 +57,7 @@ export declare type UpdatePolicyRequest = Message<"bytebase.v1.UpdatePolicyReque** The policy's `name` field is used to identify the instance to update.* Format: {resource name}/policies/{policy type}- * Workspace resource name: "".+ * Workspace resource name: workspaces/{workspace-id}.* Environment resource name: environments/environment-id.* Instance resource name: instances/instance-id.* Database resource name: instances/instance-id/databases/database-name.@@ -95,7 +95,7 @@ export declare type DeletePolicyRequest = Message<"bytebase.v1.DeletePolicyReque/*** The policy's `name` field is used to identify the instance to update.* Format: {resource name}/policies/{policy type}- * Workspace resource name: "".+ * Workspace resource name: workspaces/{workspace-id}.* Environment resource name: environments/environment-id.* Instance resource name: instances/instance-id.* Database resource name: instances/instance-id/databases/database-name.@@ -188,7 +188,7 @@ export declare type Policy = Message<"bytebase.v1.Policy"> & {/*** The name of the policy.* Format: {resource name}/policies/{policy type}- * Workspace resource name: "".+ * Workspace resource name: workspaces/{workspace-id}.* Environment resource name: environments/environment-id.* Instance resource name: instances/instance-id.* Database resource name: instances/instance-id/databases/database-name.diff --git a/frontend/src/types/proto-es/v1/org_policy_service_pb.js b/frontend/src/types/proto-es/v1/org_policy_service_pb.jsindex a78f375afe..79785c8edb 100644--- a/frontend/src/types/proto-es/v1/org_policy_service_pb.js+++ b/frontend/src/types/proto-es/v1/org_policy_service_pb.js@@ -15,7 +15,7 @@ import { file_v1_annotation } from "./annotation_pb";* Describes the file v1/org_policy_service.proto.*/export const file_v1_org_policy_service = /*@__PURE__*/- fileDesc("Cht2MS9vcmdfcG9saWN5X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIpMBChNDcmVhdGVQb2xpY3lSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EigKBnBvbGljeRgCIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEiUKBHR5cGUYAyABKA4yFy5ieXRlYmFzZS52MS5Qb2xpY3lUeXBlIocBChNVcGRhdGVQb2xpY3lSZXF1ZXN0EigKBnBvbGljeRgBIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCg1hbGxvd19taXNzaW5nGAMgASgIIkAKE0RlbGV0ZVBvbGljeVJlcXVlc3QSKQoEbmFtZRgBIAEoCUIb4EEC+kEVChNieXRlYmFzZS5jb20vUG9saWN5Ij0KEEdldFBvbGljeVJlcXVlc3QSKQoEbmFtZRgBIAEoCUIb4EEC+kEVChNieXRlYmFzZS5jb20vUG9saWN5IpsBChNMaXN0UG9saWNpZXNSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EjEKC3BvbGljeV90eXBlGAIgASgOMhcuYnl0ZWJhc2UudjEuUG9saWN5VHlwZUgAiAEBEhQKDHNob3dfZGV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vKi9wb2xpY2llcy8qfSoVL3YxL3tuYW1lPXBvbGljaWVzLyp9QqsBCg9jb20uYnl0ZWJhc2UudjFCFU9yZ1BvbGljeVNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation]);+ fileDesc("Cht2MS9vcmdfcG9saWN5X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIpMBChNDcmVhdGVQb2xpY3lSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EigKBnBvbGljeRgCIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEiUKBHR5cGUYAyABKA4yFy5ieXRlYmFzZS52MS5Qb2xpY3lUeXBlIocBChNVcGRhdGVQb2xpY3lSZXF1ZXN0EigKBnBvbGljeRgBIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCg1hbGxvd19taXNzaW5nGAMgASgIIkAKE0RlbGV0ZVBvbGljeVJlcXVlc3QSKQoEbmFtZRgBIAEoCUIb4EEC+kEVChNieXRlYmFzZS5jb20vUG9saWN5Ij0KEEdldFBvbGljeVJlcXVlc3QSKQoEbmFtZRgBIAEoCUIb4EEC+kEVChNieXRlYmFzZS5jb20vUG9saWN5IpsBChNMaXN0UG9saWNpZXNSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmF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mJiLnBvbGljaWVzLmRlbGV0ZZDqMAKY6jABgtPkkwLGAVoiKiAvdjEve25hbWU9cHJvamVjdHMvKi9wb2xpY2llcy8qfVomKiQvdjEve25hbWU9ZW52aXJvbm1lbnRzLyovcG9saWNpZXMvKn1aIyohL3YxL3tuYW1lPWluc3RhbmNlcy8qL3BvbGljaWVzLyp9Wi8qLS92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKi9wb2xpY2llcy8qfSoiL3YxL3tuYW1lPXdvcmtzcGFjZXMvKi9wb2xpY2llcy8qfUKrAQoPY29tLmJ5dGViYXNlLnYxQhVPcmdQb2xpY3lTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation]);/*** Describes the message bytebase.v1.CreatePolicyRequest.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 1c4da4ed96..f427532860 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -618,7 +618,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -631,7 +631,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -3220,7 +3220,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -3233,7 +3233,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -5810,7 +5810,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -5823,7 +5823,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -6385,113 +6385,150 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.BatchUpdateInstancesResponse'- /v1/policies:+ /v1/projects:get:tags:- - OrgPolicyService- summary: ListPolicies+ - ProjectService+ summary: ListProjectsdescription: |-- Lists policies at a specified resource level.- Permissions required: bb.policies.list- operationId: OrgPolicyService_ListPolicies+ Lists all projects in the workspace with optional filtering.+ Permissions required: bb.projects.list+ operationId: ProjectService_ListProjectsparameters:- - name: parent+ - name: pageSizein: querydescription: |-- The parent, which owns this collection of policies.- Format: {resource type}/{resource id}- required: true+ The maximum number of projects to return. The service may return fewer than+ this value.+ If unspecified, at most 10 projects will be returned.+ The maximum value is 1000; values above 1000 will be coerced to 1000.schema:- type: string- title: parent+ type: integer+ title: page_size+ format: int32description: |-- The parent, which owns this collection of policies.- Format: {resource type}/{resource id}- - name: policyType+ The maximum number of projects to return. The service may return fewer than+ this value.+ If unspecified, at most 10 projects will be returned.+ The maximum value is 1000; values above 1000 will be coerced to 1000.+ - name: pageTokenin: query- description: Filter by specific policy type.+ description: |-+ A page token, received from a previous `ListProjects` call.+ Provide this to retrieve the subsequent page.++ When paginating, all other parameters provided to `ListProjects` must match+ the call that provided the page token.schema:- oneOf:- - $ref: '#/components/schemas/bytebase.v1.PolicyType'- - type: "null"- title: policy_type- description: Filter by specific policy type.+ type: string+ title: page_token+ description: |-+ A page token, received from a previous `ListProjects` call.+ Provide this to retrieve the subsequent page.++ When paginating, all other parameters provided to `ListProjects` must match+ the call that provided the page token.- name: showDeletedin: query- description: Show deleted policies if specified.+ description: Show deleted projects if specified.schema:type: booleantitle: show_deleted- description: Show deleted policies if specified.+ description: Show deleted projects if specified.+ - name: filter+ in: query+ description: |-+ Filter the project.+ Check filter for SearchProjectsRequest for details.+ Supports filtering by name, resource_id, state, and labels (e.g., labels.environment == "production").+ schema:+ type: string+ title: filter+ description: |-+ Filter the project.+ Check filter for SearchProjectsRequest for details.+ Supports filtering by name, resource_id, state, and labels (e.g., labels.environment == "production").+ - name: orderBy+ in: query+ description: |-+ The order by of projects.+ Support title. The default sorting order is ascending.+ For example:+ - order_by = "title"+ - order_by = "title desc"+ - order_by = "title asc"+ schema:+ type: string+ title: order_by+ description: |-+ The order by of projects.+ Support title. The default sorting order is ascending.+ For example:+ - order_by = "title"+ - order_by = "title desc"+ - order_by = "title asc"responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ListPoliciesResponse'+ $ref: '#/components/schemas/bytebase.v1.ListProjectsResponse'post:tags:- - OrgPolicyService- summary: CreatePolicy+ - ProjectService+ summary: CreateProjectdescription: |-- Creates a new organizational policy.- Permissions required: bb.policies.create- operationId: OrgPolicyService_CreatePolicy+ Creates a new project in the workspace.+ Permissions required: bb.projects.create+ operationId: ProjectService_CreateProjectparameters:- - name: parent+ - name: projectIdin: querydescription: |-- The parent resource where this instance will be created.- Workspace resource name: "".- Environment resource name: environments/environment-id.- Instance resource name: instances/instance-id.- Database resource name: instances/instance-id/databases/database-name.- required: true+ The ID to use for the project, which will become the final component of+ the project's resource name.++ This value should be 4-63 characters, and valid characters+ are /[a-z][0-9]-/.schema:type: string- title: parent+ title: project_iddescription: |-- The parent resource where this instance will be created.- Workspace resource name: "".- Environment resource name: environments/environment-id.- Instance resource name: instances/instance-id.- Database resource name: instances/instance-id/databases/database-name.- - name: type- in: query- description: The type of policy to create.- schema:- title: type- description: The type of policy to create.- $ref: '#/components/schemas/bytebase.v1.PolicyType'+ The ID to use for the project, which will become the final component of+ the project's resource name.++ This value should be 4-63 characters, and valid characters+ are /[a-z][0-9]-/.requestBody:- description: The policy to create.+ description: The project to create.content:application/json:schema:- title: policy- description: The policy to create.- $ref: '#/components/schemas/bytebase.v1.Policy'+ title: project+ description: The project to create.+ $ref: '#/components/schemas/bytebase.v1.Project'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Policy'- /v1/policies/{policy}:+ $ref: '#/components/schemas/bytebase.v1.Project'+ /v1/projects/{project}:get:tags:- - OrgPolicyService- summary: GetPolicy+ - ProjectService+ summary: GetProjectdescription: |-- Retrieves a policy by name.- Permissions required: bb.policies.get- operationId: OrgPolicyService_GetPolicy+ GetProject retrieves a project by name.+ Users with "bb.projects.get" permission on the workspace or the project owner can access this method.+ Permissions required: bb.projects.get+ operationId: ProjectService_GetProjectparameters:- - name: policy+ - name: projectin: path- description: The policy id.+ description: The project id.required: trueschema:type: string@@ -6501,22 +6538,41 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Policy'+ $ref: '#/components/schemas/bytebase.v1.Project'delete:tags:- - OrgPolicyService- summary: DeletePolicy+ - ProjectService+ summary: DeleteProjectdescription: |-- Deletes an organizational policy.- Permissions required: bb.policies.delete- operationId: OrgPolicyService_DeletePolicy+ Deletes (soft-delete or purge) a project.+ Permissions required: bb.projects.delete+ operationId: ProjectService_DeleteProjectparameters:- - name: policy+ - name: projectin: path- description: The policy id.+ description: The project id.required: trueschema:type: string+ - name: purge+ in: query+ description: |-+ If set to true, permanently purge the soft-deleted project and all related resources.+ This operation is irreversible. Following AIP-165, this should only be used for+ administrative cleanup of old soft-deleted projects.+ The project must already be soft-deleted for this to work.+ When purge=true, all databases will be moved to the default project before deletion.+ When purge=false (soft delete/archive), the project and its databases/issues remain unchanged.+ schema:+ type: boolean+ title: purge+ description: |-+ If set to true, permanently purge the soft-deleted project and all related resources.+ This operation is irreversible. Following AIP-165, this should only be used for+ administrative cleanup of old soft-deleted projects.+ The project must already be soft-deleted for this to work.+ When purge=true, all databases will be moved to the default project before deletion.+ When purge=false (soft delete/archive), the project and its databases/issues remain unchanged.responses:"200":description: Success@@ -6526,16 +6582,16 @@ paths:$ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - OrgPolicyService- summary: UpdatePolicy+ - ProjectService+ summary: UpdateProjectdescription: |-- Updates an existing organizational policy.- Permissions required: bb.policies.update- operationId: OrgPolicyService_UpdatePolicy+ Updates an existing project's properties.+ Permissions required: bb.projects.update+ operationId: ProjectService_UpdateProjectparameters:- - name: policy+ - name: projectin: path- description: The policy id.+ description: The project id.required: trueschema:type: string@@ -6747,185 +6803,172 @@ paths:- name: allowMissingin: querydescription: |-- If set to true, and the policy is not found, a new policy will be created.+ If set to true, and the project is not found, a new project will be created.In this situation, `update_mask` is ignored.schema:type: booleantitle: allow_missingdescription: |-- If set to true, and the policy is not found, a new policy will be created.+ If set to true, and the project is not found, a new project will be created.In this situation, `update_mask` is ignored.requestBody:description: |-- The policy to update.+ The project to update.- The policy's `name` field is used to identify the instance to update.- Format: {resource name}/policies/{policy type}- Workspace resource name: "".- Environment resource name: environments/environment-id.- Instance resource name: instances/instance-id.- Database resource name: instances/instance-id/databases/database-name.+ The project's `name` field is used to identify the project to update.+ Format: projects/{project}content:application/json:schema:- title: policy+ title: projectdescription: |-- The policy to update.+ The project to update.- The policy's `name` field is used to identify the instance to update.- Format: {resource name}/policies/{policy type}- Workspace resource name: "".- Environment resource name: environments/environment-id.- Instance resource name: instances/instance-id.- Database resource name: instances/instance-id/databases/database-name.- $ref: '#/components/schemas/bytebase.v1.Policy'+ The project's `name` field is used to identify the project to update.+ Format: projects/{project}+ $ref: '#/components/schemas/bytebase.v1.Project'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Policy'- /v1/projects:+ $ref: '#/components/schemas/bytebase.v1.Project'+ /v1/projects/{project}/accessGrants:get:tags:- - ProjectService- summary: ListProjects- description: |-- Lists all projects in the workspace with optional filtering.- Permissions required: bb.projects.list- operationId: ProjectService_ListProjects+ - AccessGrantService+ summary: ListAccessGrants+ description: Lists access grants in a project.+ operationId: AccessGrantService_ListAccessGrantsparameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string- name: pageSizein: query- description: |-- The maximum number of projects to return. The service may return fewer than- this value.- If unspecified, at most 10 projects will be returned.- The maximum value is 1000; values above 1000 will be coerced to 1000.+ description: The maximum number of access grants to return.schema:type: integertitle: page_sizeformat: int32- description: |-- The maximum number of projects to return. The service may return fewer than- this value.- If unspecified, at most 10 projects will be returned.- The maximum value is 1000; values above 1000 will be coerced to 1000.+ description: The maximum number of access grants to return.- name: pageTokenin: query- description: |-- A page token, received from a previous `ListProjects` call.- Provide this to retrieve the subsequent page.-- When paginating, all other parameters provided to `ListProjects` must match- the call that provided the page token.+ description: A page token from a previous ListAccessGrants call.schema:type: stringtitle: page_token- description: |-- A page token, received from a previous `ListProjects` call.- Provide this to retrieve the subsequent page.-- When paginating, all other parameters provided to `ListProjects` must match- the call that provided the page token.- - name: showDeleted- in: query- description: Show deleted projects if specified.- schema:- type: boolean- title: show_deleted- description: Show deleted projects if specified.+ description: A page token from a previous ListAccessGrants call.- name: filterin: querydescription: |-- Filter the project.- Check filter for SearchProjectsRequest for details.- Supports filtering by name, resource_id, state, and labels (e.g., labels.environment == "production").+ Filter expression using AIP-160 syntax.+ Supported fields:+ - name: the fullname in "projects/{project}/accessGrants/{access_grant}" format, support "==" operator.+ - creator: the creator name in "users/{email}" format, support "==" operator.+ - status: the access status, support "==" and "in" operator.+ - issue: the access issue fullname, support "==" operator.+ - expire_time: the access expire time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.+ - create_time: the access creation time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.+ - query: the access query, support "==" and ".contains(xx)" operator+ - target: the target database fullname, support "==" operator.++ Examples:+ - creator == "users/[email protected]"+ - status == "ACTIVE"+ - status in ["ACTIVE", "PENDING"]+ - creator == "users/[email protected]" && status == "ACTIVE"+ - issue == "projects/x/issues/123"+ - status == "ACTIVE" && expire_time > "2024-02-01T00:00:00Z"+ - target == "instances/sample/databases/employee"schema:type: stringtitle: filterdescription: |-- Filter the project.- Check filter for SearchProjectsRequest for details.- Supports filtering by name, resource_id, state, and labels (e.g., labels.environment == "production").+ Filter expression using AIP-160 syntax.+ Supported fields:+ - name: the fullname in "projects/{project}/accessGrants/{access_grant}" format, support "==" operator.+ - creator: the creator name in "users/{email}" format, support "==" operator.+ - status: the access status, support "==" and "in" operator.+ - issue: the access issue fullname, support "==" operator.+ - expire_time: the access expire time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.+ - create_time: the access creation time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.+ - query: the access query, support "==" and ".contains(xx)" operator+ - target: the target database fullname, support "==" operator.++ Examples:+ - creator == "users/[email protected]"+ - status == "ACTIVE"+ - status in ["ACTIVE", "PENDING"]+ - creator == "users/[email protected]" && status == "ACTIVE"+ - issue == "projects/x/issues/123"+ - status == "ACTIVE" && expire_time > "2024-02-01T00:00:00Z"+ - target == "instances/sample/databases/employee"- name: orderByin: querydescription: |-- The order by of projects.- Support title. The default sorting order is ascending.+ The order by of access grants.+ Support creator, expire_time, create_time. The default sorting order is ascending.For example:- - order_by = "title"- - order_by = "title desc"- - order_by = "title asc"+ - order_by = "creator"+ - order_by = "expire_time desc"+ - order_by = "expire_time asc, create_time desc"schema:type: stringtitle: order_bydescription: |-- The order by of projects.- Support title. The default sorting order is ascending.+ The order by of access grants.+ Support creator, expire_time, create_time. The default sorting order is ascending.For example:- - order_by = "title"- - order_by = "title desc"- - order_by = "title asc"+ - order_by = "creator"+ - order_by = "expire_time desc"+ - order_by = "expire_time asc, create_time desc"responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ListProjectsResponse'+ $ref: '#/components/schemas/bytebase.v1.ListAccessGrantsResponse'post:tags:- - ProjectService- summary: CreateProject- description: |-- Creates a new project in the workspace.- Permissions required: bb.projects.create- operationId: ProjectService_CreateProject+ - AccessGrantService+ summary: CreateAccessGrant+ description: Creates an access grant.+ operationId: AccessGrantService_CreateAccessGrantparameters:- - name: projectId- in: query- description: |-- The ID to use for the project, which will become the final component of- the project's resource name.-- This value should be 4-63 characters, and valid characters- are /[a-z][0-9]-/.+ - name: project+ in: path+ description: The project id.+ required: trueschema:type: string- title: project_id- description: |-- The ID to use for the project, which will become the final component of- the project's resource name.-- This value should be 4-63 characters, and valid characters- are /[a-z][0-9]-/.requestBody:- description: The project to create.+ description: The access grant to create.content:application/json:schema:- title: project- description: The project to create.- $ref: '#/components/schemas/bytebase.v1.Project'+ title: access_grant+ description: The access grant to create.+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Project'- /v1/projects/{project}:+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'+ /v1/projects/{project}/accessGrants/{accessGrant}:get:tags:- - ProjectService- summary: GetProject- description: |-- GetProject retrieves a project by name.- Users with "bb.projects.get" permission on the workspace or the project owner can access this method.- Permissions required: bb.projects.get- operationId: ProjectService_GetProject+ - AccessGrantService+ summary: GetAccessGrant+ description: Gets an access grant by name.+ operationId: AccessGrantService_GetAccessGrantparameters:- name: projectin: path@@ -6933,21 +6976,26 @@ paths:required: trueschema:type: string+ - name: accessGrant+ in: path+ description: The accessGrant id.+ required: true+ schema:+ type: stringresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Project'- delete:+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'+ /v1/projects/{project}/accessGrants/{accessGrant}:activate:+ post:tags:- - ProjectService- summary: DeleteProject- description: |-- Deletes (soft-delete or purge) a project.- Permissions required: bb.projects.delete- operationId: ProjectService_DeleteProject+ - AccessGrantService+ summary: ActivateAccessGrant+ description: Activates a pending access grant.+ operationId: AccessGrantService_ActivateAccessGrantparameters:- name: projectin: path@@ -6955,40 +7003,26 @@ paths:required: trueschema:type: string- - name: purge- in: query- description: |-- If set to true, permanently purge the soft-deleted project and all related resources.- This operation is irreversible. Following AIP-165, this should only be used for- administrative cleanup of old soft-deleted projects.- The project must already be soft-deleted for this to work.- When purge=true, all databases will be moved to the default project before deletion.- When purge=false (soft delete/archive), the project and its databases/issues remain unchanged.+ - name: accessGrant+ in: path+ description: The accessGrant id.+ required: trueschema:- type: boolean- title: purge- description: |-- If set to true, permanently purge the soft-deleted project and all related resources.- This operation is irreversible. Following AIP-165, this should only be used for- administrative cleanup of old soft-deleted projects.- The project must already be soft-deleted for this to work.- When purge=true, all databases will be moved to the default project before deletion.- When purge=false (soft delete/archive), the project and its databases/issues remain unchanged.+ type: stringresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/google.protobuf.Empty'- patch:+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'+ /v1/projects/{project}/accessGrants/{accessGrant}:revoke:+ post:tags:- - ProjectService- summary: UpdateProject- description: |-- Updates an existing project's properties.- Permissions required: bb.projects.update- operationId: ProjectService_UpdateProject+ - AccessGrantService+ summary: RevokeAccessGrant+ description: Revokes an active access grant.+ operationId: AccessGrantService_RevokeAccessGrantparameters:- name: projectin: path@@ -6996,510 +7030,75 @@ paths:required: trueschema:type: string- - name: updateMask- in: query- description: The list of fields to update.+ - name: accessGrant+ in: path+ description: The accessGrant id.+ required: trueschema:type: string- description: |-- `FieldMask` represents a set of symbolic field paths, for example:-- paths: "f.a"- paths: "f.b.d"-- Here `f` represents a field in some root message, `a` and `b`- fields in the message found in `f`, and `d` a field found in the- message in `f.b`.-- Field masks are used to specify a subset of fields that should be- returned by a get operation or modified by an update operation.- Field masks also have a custom JSON encoding (see below).-- # Field Masks in Projections-- When used in the context of a projection, a response message or- sub-message is filtered by the API to only contain those fields as- specified in the mask. For example, if the mask in the previous- example is applied to a response message as follows:-- f {- a : 22- b {- d : 1- x : 2- }- y : 13- }- z: 8-- The result will not contain specific values for fields x,y and z- (their value will be set to the default, and omitted in proto text- output):--- f {- a : 22- b {- d : 1- }- }-- A repeated field is not allowed except at the last position of a- paths string.-- If a FieldMask object is not present in a get operation, the- operation applies to all fields (as if a FieldMask of all fields- had been specified).-- Note that a field mask does not necessarily apply to the- top-level response message. In case of a REST get operation, the- field mask applies directly to the response, but in case of a REST- list operation, the mask instead applies to each individual message- in the returned resource list. In case of a REST custom method,- other definitions may be used. Where the mask applies will be- clearly documented together with its declaration in the API. In- any case, the effect on the returned resource/resources is required- behavior for APIs.-- # Field Masks in Update Operations-- A field mask in update operations specifies which fields of the- targeted resource are going to be updated. The API is required- to only change the values of the fields as specified in the mask- and leave the others untouched. If a resource is passed in to- describe the updated values, the API ignores the values of all- fields not covered by the mask.-- If a repeated field is specified for an update operation, new values will- be appended to the existing repeated field in the target resource. Note that- a repeated field is only allowed in the last position of a `paths` string.-- If a sub-message is specified in the last position of the field mask for an- update operation, then new value will be merged into the existing sub-message- in the target resource.-- For example, given the target message:-- f {- b {- d: 1- x: 2- }- c: [1]- }-- And an update message:-- f {- b {- d: 10- }- c: [2]- }-- then if the field mask is:-- paths: ["f.b", "f.c"]-- then the result will be:-- f {- b {- d: 10- x: 2- }- c: [1, 2]- }-- An implementation may provide options to override this default behavior for- repeated and message fields.-- In order to reset a field's value to the default, the field must- be in the mask and set to the default value in the provided resource.- Hence, in order to reset all fields of a resource, provide a default- instance of the resource and set all fields in the mask, or do- not provide a mask as described below.-- If a field mask is not present on update, the operation applies to- all fields (as if a field mask of all fields has been specified).- Note that in the presence of schema evolution, this may mean that- fields the client does not know and has therefore not filled into- the request will be reset to their default. If this is unwanted- behavior, a specific service may require a client to always specify- a field mask, producing an error if not.-- As with get operations, the location of the resource which- describes the updated values in the request message depends on the- operation kind. In any case, the effect of the field mask is- required to be honored by the API.-- ## Considerations for HTTP REST-- The HTTP kind of an update operation which uses a field mask must- be set to PATCH instead of PUT in order to satisfy HTTP semantics- (PUT must only be used for full updates).-- # JSON Encoding of Field Masks-- In JSON, a field mask is encoded as a single string where paths are- separated by a comma. Fields name in each path are converted- to/from lower-camel naming conventions.-- As an example, consider the following message declarations:-- message Profile {- User user = 1;- Photo photo = 2;- }- message User {- string display_name = 1;- string address = 2;- }-- In proto a field mask for `Profile` may look as such:-- mask {- paths: "user.display_name"- paths: "photo"- }-- In JSON, the same mask is represented as below:-- {- mask: "user.displayName,photo"- }-- # Field Masks and Oneof Fields-- Field masks treat fields in oneofs just as regular fields. Consider the- following message:-- message SampleMessage {- oneof test_oneof {- string name = 4;- SubMessage sub_message = 9;- }- }-- The field mask can be:-- mask {- paths: "name"- }-- Or:-- mask {- paths: "sub_message"- }-- Note that oneof type names ("test_oneof" in this case) cannot be used in- paths.-- ## Field Mask Verification-- The implementation of any API method which has a FieldMask type field in the- request should verify the included field paths, and return an- `INVALID_ARGUMENT` error if any path is unmappable.- - name: allowMissing- in: query- description: |-- If set to true, and the project is not found, a new project will be created.- In this situation, `update_mask` is ignored.+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'+ /v1/projects/{project}/accessGrants:searchMy:+ post:+ tags:+ - AccessGrantService+ summary: SearchMyAccessGrants+ description: Searches access grants created by the caller.+ operationId: AccessGrantService_SearchMyAccessGrants+ parameters:+ - name: project+ in: path+ description: The project id.+ required: trueschema:- type: boolean- title: allow_missing- description: |-- If set to true, and the project is not found, a new project will be created.- In this situation, `update_mask` is ignored.+ type: stringrequestBody:- description: |-- The project to update.-- The project's `name` field is used to identify the project to update.- Format: projects/{project}content:application/json:schema:- title: project- description: |-- The project to update.-- The project's `name` field is used to identify the project to update.- Format: projects/{project}- $ref: '#/components/schemas/bytebase.v1.Project'+ type: object+ properties:+ pageSize:+ type: integer+ title: page_size+ format: int32+ description: The maximum number of access grants to return.+ pageToken:+ type: string+ title: page_token+ description: A page token from a previous SearchMyAccessGrants call.+ filter:+ type: string+ title: filter+ description: Check the filter field in the ListAccessGrantsRequest message.+ orderBy:+ type: string+ title: order_by+ description: Check the order_by field in the ListAccessGrantsRequest message.+ title: SearchMyAccessGrantsRequest+ additionalProperties: false+ required: trueresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Project'- /v1/projects/{project}/accessGrants:- get:+ $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsResponse'+ /v1/projects/{project}/auditLogs:export:+ post:tags:- - AccessGrantService- summary: ListAccessGrants- description: Lists access grants in a project.- operationId: AccessGrantService_ListAccessGrants- parameters:- - name: project- in: path- description: The project id.- required: true- schema:- type: string- - name: pageSize- in: query- description: The maximum number of access grants to return.- schema:- type: integer- title: page_size- format: int32- description: The maximum number of access grants to return.- - name: pageToken- in: query- description: A page token from a previous ListAccessGrants call.- schema:- type: string- title: page_token- description: A page token from a previous ListAccessGrants call.- - name: filter- in: query- description: |-- Filter expression using AIP-160 syntax.- Supported fields:- - name: the fullname in "projects/{project}/accessGrants/{access_grant}" format, support "==" operator.- - creator: the creator name in "users/{email}" format, support "==" operator.- - status: the access status, support "==" and "in" operator.- - issue: the access issue fullname, support "==" operator.- - expire_time: the access expire time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.- - create_time: the access creation time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.- - query: the access query, support "==" and ".contains(xx)" operator- - target: the target database fullname, support "==" operator.-- Examples:- - creator == "users/[email protected]"- - status == "ACTIVE"- - status in ["ACTIVE", "PENDING"]- - creator == "users/[email protected]" && status == "ACTIVE"- - issue == "projects/x/issues/123"- - status == "ACTIVE" && expire_time > "2024-02-01T00:00:00Z"- - target == "instances/sample/databases/employee"- schema:- type: string- title: filter- description: |-- Filter expression using AIP-160 syntax.- Supported fields:- - name: the fullname in "projects/{project}/accessGrants/{access_grant}" format, support "==" operator.- - creator: the creator name in "users/{email}" format, support "==" operator.- - status: the access status, support "==" and "in" operator.- - issue: the access issue fullname, support "==" operator.- - expire_time: the access expire time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.- - create_time: the access creation time in "2006-01-02T15:04:05Z07:00" format, support ">=", ">", "<=" and "<" operator.- - query: the access query, support "==" and ".contains(xx)" operator- - target: the target database fullname, support "==" operator.-- Examples:- - creator == "users/[email protected]"- - status == "ACTIVE"- - status in ["ACTIVE", "PENDING"]- - creator == "users/[email protected]" && status == "ACTIVE"- - issue == "projects/x/issues/123"- - status == "ACTIVE" && expire_time > "2024-02-01T00:00:00Z"- - target == "instances/sample/databases/employee"- - name: orderBy- in: query- description: |-- The order by of access grants.- Support creator, expire_time, create_time. The default sorting order is ascending.- For example:- - order_by = "creator"- - order_by = "expire_time desc"- - order_by = "expire_time asc, create_time desc"- schema:- type: string- title: order_by- description: |-- The order by of access grants.- Support creator, expire_time, create_time. The default sorting order is ascending.- For example:- - order_by = "creator"- - order_by = "expire_time desc"- - order_by = "expire_time asc, create_time desc"- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.ListAccessGrantsResponse'- post:- tags:- - AccessGrantService- summary: CreateAccessGrant- description: Creates an access grant.- operationId: AccessGrantService_CreateAccessGrant- parameters:- - name: project- in: path- description: The project id.- required: true- schema:- type: string- requestBody:- description: The access grant to create.- content:- application/json:- schema:- title: access_grant- description: The access grant to create.- $ref: '#/components/schemas/bytebase.v1.AccessGrant'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.AccessGrant'- /v1/projects/{project}/accessGrants/{accessGrant}:- get:- tags:- - AccessGrantService- summary: GetAccessGrant- description: Gets an access grant by name.- operationId: AccessGrantService_GetAccessGrant- parameters:- - name: project- in: path- description: The project id.- required: true- schema:- type: string- - name: accessGrant- in: path- description: The accessGrant id.- required: true- schema:- type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.AccessGrant'- /v1/projects/{project}/accessGrants/{accessGrant}:activate:- post:- tags:- - AccessGrantService- summary: ActivateAccessGrant- description: Activates a pending access grant.- operationId: AccessGrantService_ActivateAccessGrant- parameters:- - name: project- in: path- description: The project id.- required: true- schema:- type: string- - name: accessGrant- in: path- description: The accessGrant id.- required: true- schema:- type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.AccessGrant'- /v1/projects/{project}/accessGrants/{accessGrant}:revoke:- post:- tags:- - AccessGrantService- summary: RevokeAccessGrant- description: Revokes an active access grant.- operationId: AccessGrantService_RevokeAccessGrant- parameters:- - name: project- in: path- description: The project id.- required: true- schema:- type: string- - name: accessGrant- in: path- description: The accessGrant id.- required: true- schema:- type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.AccessGrant'- /v1/projects/{project}/accessGrants:searchMy:- post:- tags:- - AccessGrantService- summary: SearchMyAccessGrants- description: Searches access grants created by the caller.- operationId: AccessGrantService_SearchMyAccessGrants- parameters:- - name: project- in: path- description: The project id.- required: true- schema:- type: string- requestBody:- content:- application/json:- schema:- type: object- properties:- pageSize:- type: integer- title: page_size- format: int32- description: The maximum number of access grants to return.- pageToken:- type: string- title: page_token- description: A page token from a previous SearchMyAccessGrants call.- filter:- type: string- title: filter- description: Check the filter field in the ListAccessGrantsRequest message.- orderBy:- type: string- title: order_by- description: Check the order_by field in the ListAccessGrantsRequest message.- title: SearchMyAccessGrantsRequest- additionalProperties: false- required: true- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsResponse'- /v1/projects/{project}/auditLogs:export:- post:- tags:- - AuditLogService- summary: ExportAuditLogs- description: |-- Exports audit logs in a specified format for external analysis.- Permissions required: bb.auditLogs.export- operationId: AuditLogService_ExportAuditLogs+ - AuditLogService+ summary: ExportAuditLogs+ description: |-+ Exports audit logs in a specified format for external analysis.+ Permissions required: bb.auditLogs.export+ operationId: AuditLogService_ExportAuditLogsparameters:- name: projectin: path@@ -10827,7 +10426,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -10840,7 +10439,7 @@ paths:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -15046,31 +14645,599 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Worksheet'- /v1/worksheets/{worksheet}/organizer:+ $ref: '#/components/schemas/bytebase.v1.Worksheet'+ /v1/worksheets/{worksheet}/organizer:+ patch:+ tags:+ - WorksheetService+ summary: UpdateWorksheetOrganizer+ description: |-+ Update the organizer of a worksheet.+ The access is the same as UpdateWorksheet method.+ Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)+ operationId: WorksheetService_UpdateWorksheetOrganizer+ parameters:+ - name: worksheet+ in: path+ description: The worksheet id.+ required: true+ schema:+ type: string+ - name: updateMask+ in: query+ description: |-+ The list of fields to be updated.+ Fields are specified relative to the worksheet organizer.+ Only support update the following fields for now:+ - `starred`+ schema:+ type: string+ description: |-+ `FieldMask` represents a set of symbolic field paths, for example:++ paths: "f.a"+ paths: "f.b.d"++ Here `f` represents a field in some root message, `a` and `b`+ fields in the message found in `f`, and `d` a field found in the+ message in `f.b`.++ Field masks are used to specify a subset of fields that should be+ returned by a get operation or modified by an update operation.+ Field masks also have a custom JSON encoding (see below).++ # Field Masks in Projections++ When used in the context of a projection, a response message or+ sub-message is filtered by the API to only contain those fields as+ specified in the mask. For example, if the mask in the previous+ example is applied to a response message as follows:++ f {+ a : 22+ b {+ d : 1+ x : 2+ }+ y : 13+ }+ z: 8++ The result will not contain specific values for fields x,y and z+ (their value will be set to the default, and omitted in proto text+ output):+++ f {+ a : 22+ b {+ d : 1+ }+ }++ A repeated field is not allowed except at the last position of a+ paths string.++ If a FieldMask object is not present in a get operation, the+ operation applies to all fields (as if a FieldMask of all fields+ had been specified).++ Note that a field mask does not necessarily apply to the+ top-level response message. In case of a REST get operation, the+ field mask applies directly to the response, but in case of a REST+ list operation, the mask instead applies to each individual message+ in the returned resource list. In case of a REST custom method,+ other definitions may be used. Where the mask applies will be+ clearly documented together with its declaration in the API. In+ any case, the effect on the returned resource/resources is required+ behavior for APIs.++ # Field Masks in Update Operations++ A field mask in update operations specifies which fields of the+ targeted resource are going to be updated. The API is required+ to only change the values of the fields as specified in the mask+ and leave the others untouched. If a resource is passed in to+ describe the updated values, the API ignores the values of all+ fields not covered by the mask.++ If a repeated field is specified for an update operation, new values will+ be appended to the existing repeated field in the target resource. Note that+ a repeated field is only allowed in the last position of a `paths` string.++ If a sub-message is specified in the last position of the field mask for an+ update operation, then new value will be merged into the existing sub-message+ in the target resource.++ For example, given the target message:++ f {+ b {+ d: 1+ x: 2+ }+ c: [1]+ }++ And an update message:++ f {+ b {+ d: 10+ }+ c: [2]+ }++ then if the field mask is:++ paths: ["f.b", "f.c"]++ then the result will be:++ f {+ b {+ d: 10+ x: 2+ }+ c: [1, 2]+ }++ An implementation may provide options to override this default behavior for+ repeated and message fields.++ In order to reset a field's value to the default, the field must+ be in the mask and set to the default value in the provided resource.+ Hence, in order to reset all fields of a resource, provide a default+ instance of the resource and set all fields in the mask, or do+ not provide a mask as described below.++ If a field mask is not present on update, the operation applies to+ all fields (as if a field mask of all fields has been specified).+ Note that in the presence of schema evolution, this may mean that+ fields the client does not know and has therefore not filled into+ the request will be reset to their default. If this is unwanted+ behavior, a specific service may require a client to always specify+ a field mask, producing an error if not.++ As with get operations, the location of the resource which+ describes the updated values in the request message depends on the+ operation kind. In any case, the effect of the field mask is+ required to be honored by the API.++ ## Considerations for HTTP REST++ The HTTP kind of an update operation which uses a field mask must+ be set to PATCH instead of PUT in order to satisfy HTTP semantics+ (PUT must only be used for full updates).++ # JSON Encoding of Field Masks++ In JSON, a field mask is encoded as a single string where paths are+ separated by a comma. Fields name in each path are converted+ to/from lower-camel naming conventions.++ As an example, consider the following message declarations:++ message Profile {+ User user = 1;+ Photo photo = 2;+ }+ message User {+ string display_name = 1;+ string address = 2;+ }++ In proto a field mask for `Profile` may look as such:++ mask {+ paths: "user.display_name"+ paths: "photo"+ }++ In JSON, the same mask is represented as below:++ {+ mask: "user.displayName,photo"+ }++ # Field Masks and Oneof Fields++ Field masks treat fields in oneofs just as regular fields. Consider the+ following message:++ message SampleMessage {+ oneof test_oneof {+ string name = 4;+ SubMessage sub_message = 9;+ }+ }++ The field mask can be:++ mask {+ paths: "name"+ }++ Or:++ mask {+ paths: "sub_message"+ }++ Note that oneof type names ("test_oneof" in this case) cannot be used in+ paths.++ ## Field Mask Verification++ The implementation of any API method which has a FieldMask type field in the+ request should verify the included field paths, and return an+ `INVALID_ARGUMENT` error if any path is unmappable.+ - name: allowMissing+ in: query+ description: |-+ If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.+ In this situation, `update_mask` is ignored.+ schema:+ type: boolean+ title: allow_missing+ description: |-+ If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.+ In this situation, `update_mask` is ignored.+ requestBody:+ description: |-+ The organizer to update.++ The organizer's `worksheet` field is used to identify the worksheet.+ Format: worksheets/{worksheet}+ content:+ application/json:+ schema:+ title: organizer+ description: |-+ The organizer to update.++ The organizer's `worksheet` field is used to identify the worksheet.+ Format: worksheets/{worksheet}+ $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'+ /v1/worksheets:search:+ post:+ tags:+ - WorksheetService+ summary: SearchWorksheets+ description: |-+ Search for worksheets.+ This is used for finding my worksheets or worksheets shared by other people.+ The sheet accessibility is the same as GetWorksheet().+ Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)+ operationId: WorksheetService_SearchWorksheets+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsRequest'+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsResponse'+ /v1/workspaces/{workspace}/databases:+ get:+ tags:+ - DatabaseService+ summary: ListDatabases+ description: |-+ Lists databases in a project, instance, or workspace.+ Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)+ operationId: DatabaseService_ListDatabases3+ parameters:+ - name: workspace+ in: path+ description: The workspace id.+ required: true+ schema:+ type: string+ - name: pageSize+ in: query+ description: |-+ The maximum number of databases to return. The service may return fewer+ than this value.+ If unspecified, at most 10 databases will be returned.+ The maximum value is 1000; values above 1000 will be coerced to 1000.+ schema:+ type: integer+ title: page_size+ format: int32+ description: |-+ The maximum number of databases to return. The service may return fewer+ than this value.+ If unspecified, at most 10 databases will be returned.+ The maximum value is 1000; values above 1000 will be coerced to 1000.+ - name: pageToken+ in: query+ description: |-+ A page token, received from a previous `ListDatabases` call.+ Provide this to retrieve the subsequent page.++ When paginating, all other parameters provided to `ListDatabases` must+ match the call that provided the page token.+ schema:+ type: string+ title: page_token+ description: |-+ A page token, received from a previous `ListDatabases` call.+ Provide this to retrieve the subsequent page.++ When paginating, all other parameters provided to `ListDatabases` must+ match the call that provided the page token.+ - name: filter+ in: query+ description: |-+ Filter is used to filter databases returned in the list.+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++ Supported filter:+ - environment: the environment full name in "environments/{id}" format, support "==" operator.+ - name: the database name, support ".matches()" operator.+ - project: the project full name in "projects/{id}" format, support "==" operator.+ - instance: the instance full name in "instances/{id}" format, support "==" operator.+ - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.+ - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.+ - table: filter by the database table, support "==" and ".matches()" operator.+ - labels.{key}: the database label, support "==" and "in" operators.++ For example:+ environment == "environments/{environment resource id}"+ environment == "" (find databases which environment is not set)+ project == "projects/{project resource id}"+ instance == "instances/{instance resource id}"+ name.matches("database name")+ engine == "MYSQL"+ engine in ["MYSQL", "POSTGRES"]+ !(engine in ["MYSQL", "POSTGRES"])+ exclude_unassigned == true+ table == "sample"+ table.matches("sam")+ labels.environment == "production"+ labels.region == "asia"+ labels.region in ["asia", "europe"]++ You can combine filter conditions like:+ environment == "environments/prod" && name.matches("employee")+ schema:+ type: string+ title: filter+ description: |-+ Filter is used to filter databases returned in the list.+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++ Supported filter:+ - environment: the environment full name in "environments/{id}" format, support "==" operator.+ - name: the database name, support ".matches()" operator.+ - project: the project full name in "projects/{id}" format, support "==" operator.+ - instance: the instance full name in "instances/{id}" format, support "==" operator.+ - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.+ - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.+ - table: filter by the database table, support "==" and ".matches()" operator.+ - labels.{key}: the database label, support "==" and "in" operators.++ For example:+ environment == "environments/{environment resource id}"+ environment == "" (find databases which environment is not set)+ project == "projects/{project resource id}"+ instance == "instances/{instance resource id}"+ name.matches("database name")+ engine == "MYSQL"+ engine in ["MYSQL", "POSTGRES"]+ !(engine in ["MYSQL", "POSTGRES"])+ exclude_unassigned == true+ table == "sample"+ table.matches("sam")+ labels.environment == "production"+ labels.region == "asia"+ labels.region in ["asia", "europe"]++ You can combine filter conditions like:+ environment == "environments/prod" && name.matches("employee")+ - name: showDeleted+ in: query+ description: Show deleted database if specified.+ schema:+ type: boolean+ title: show_deleted+ description: Show deleted database if specified.+ - name: orderBy+ in: query+ description: |-+ The order by of databases.+ Support name, project, instance. The default sorting order is ascending.+ For example:+ - order_by = "name" - order by name ascending+ - order_by = "name desc"+ - order_by = "name desc, project asc"+ schema:+ type: string+ title: order_by+ description: |-+ The order by of databases.+ Support name, project, instance. The default sorting order is ascending.+ For example:+ - order_by = "name" - order by name ascending+ - order_by = "name desc"+ - order_by = "name desc, project asc"+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListDatabasesResponse'+ /v1/workspaces/{workspace}/policies:+ get:+ tags:+ - OrgPolicyService+ summary: ListPolicies+ description: |-+ Lists policies at a specified resource level.+ Permissions required: bb.policies.list+ operationId: OrgPolicyService_ListPolicies+ parameters:+ - name: workspace+ in: path+ description: The workspace id.+ required: true+ schema:+ type: string+ - name: policyType+ in: query+ description: Filter by specific policy type.+ schema:+ oneOf:+ - $ref: '#/components/schemas/bytebase.v1.PolicyType'+ - type: "null"+ title: policy_type+ description: Filter by specific policy type.+ - name: showDeleted+ in: query+ description: Show deleted policies if specified.+ schema:+ type: boolean+ title: show_deleted+ description: Show deleted policies if specified.+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListPoliciesResponse'+ post:+ tags:+ - OrgPolicyService+ summary: CreatePolicy+ description: |-+ Creates a new organizational policy.+ Permissions required: bb.policies.create+ operationId: OrgPolicyService_CreatePolicy+ parameters:+ - name: workspace+ in: path+ description: The workspace id.+ required: true+ schema:+ type: string+ - name: type+ in: query+ description: The type of policy to create.+ schema:+ title: type+ description: The type of policy to create.+ $ref: '#/components/schemas/bytebase.v1.PolicyType'+ requestBody:+ description: The policy to create.+ content:+ application/json:+ schema:+ title: policy+ description: The policy to create.+ $ref: '#/components/schemas/bytebase.v1.Policy'+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.Policy'+ /v1/workspaces/{workspace}/policies/{policy}:+ get:+ tags:+ - OrgPolicyService+ summary: GetPolicy+ description: |-+ Retrieves a policy by name.+ Permissions required: bb.policies.get+ operationId: OrgPolicyService_GetPolicy+ parameters:+ - name: workspace+ in: path+ description: The workspace id.+ required: true+ schema:+ type: string+ - name: policy+ in: path+ description: The policy id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.Policy'+ delete:+ tags:+ - OrgPolicyService+ summary: DeletePolicy+ description: |-+ Deletes an organizational policy.+ Permissions required: bb.policies.delete+ operationId: OrgPolicyService_DeletePolicy+ parameters:+ - name: workspace+ in: path+ description: The workspace id.+ required: true+ schema:+ type: string+ - name: policy+ in: path+ description: The policy id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - WorksheetService- summary: UpdateWorksheetOrganizer+ - OrgPolicyService+ summary: UpdatePolicydescription: |-- Update the organizer of a worksheet.- The access is the same as UpdateWorksheet method.- Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)- operationId: WorksheetService_UpdateWorksheetOrganizer+ Updates an existing organizational policy.+ Permissions required: bb.policies.update+ operationId: OrgPolicyService_UpdatePolicyparameters:- - name: worksheet+ - name: workspacein: path- description: The worksheet id.+ description: The workspace id.+ required: true+ schema:+ type: string+ - name: policy+ in: path+ description: The policy id.required: trueschema:type: string- name: updateMaskin: query- description: |-- The list of fields to be updated.- Fields are specified relative to the worksheet organizer.- Only support update the following fields for now:- - `starred`+ description: The list of fields to update.schema:type: stringdescription: |-@@ -15276,212 +15443,45 @@ paths:- name: allowMissingin: querydescription: |-- If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.+ If set to true, and the policy is not found, a new policy will be created.In this situation, `update_mask` is ignored.schema:type: booleantitle: allow_missingdescription: |-- If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.+ If set to true, and the policy is not found, a new policy will be created.In this situation, `update_mask` is ignored.requestBody:description: |-- The organizer to update.+ The policy to update.- The organizer's `worksheet` field is used to identify the worksheet.- Format: worksheets/{worksheet}+ The policy's `name` field is used to identify the instance to update.+ Format: {resource name}/policies/{policy type}+ Workspace resource name: workspaces/{workspace-id}.+ Environment resource name: environments/environment-id.+ Instance resource name: instances/instance-id.+ Database resource name: instances/instance-id/databases/database-name.content:application/json:schema:- title: organizer+ title: policydescription: |-- The organizer to update.-- The organizer's `worksheet` field is used to identify the worksheet.- Format: worksheets/{worksheet}- $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'- /v1/worksheets:search:- post:- tags:- - WorksheetService- summary: SearchWorksheets- description: |-- Search for worksheets.- This is used for finding my worksheets or worksheets shared by other people.- The sheet accessibility is the same as GetWorksheet().- Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)- operationId: WorksheetService_SearchWorksheets- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsRequest'- required: true- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsResponse'- /v1/workspaces/{workspace}/databases:- get:- tags:- - DatabaseService- summary: ListDatabases- description: |-- Lists databases in a project, instance, or workspace.- Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)- operationId: DatabaseService_ListDatabases3- parameters:- - name: workspace- in: path- description: The workspace id.- required: true- schema:- type: string- - name: pageSize- in: query- description: |-- The maximum number of databases to return. The service may return fewer- than this value.- If unspecified, at most 10 databases will be returned.- The maximum value is 1000; values above 1000 will be coerced to 1000.- schema:- type: integer- title: page_size- format: int32- description: |-- The maximum number of databases to return. The service may return fewer- than this value.- If unspecified, at most 10 databases will be returned.- The maximum value is 1000; values above 1000 will be coerced to 1000.- - name: pageToken- in: query- description: |-- A page token, received from a previous `ListDatabases` call.- Provide this to retrieve the subsequent page.-- When paginating, all other parameters provided to `ListDatabases` must- match the call that provided the page token.- schema:- type: string- title: page_token- description: |-- A page token, received from a previous `ListDatabases` call.- Provide this to retrieve the subsequent page.-- When paginating, all other parameters provided to `ListDatabases` must- match the call that provided the page token.- - name: filter- in: query- description: |-- Filter is used to filter databases returned in the list.- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec-- Supported filter:- - environment: the environment full name in "environments/{id}" format, support "==" operator.- - name: the database name, support ".matches()" operator.- - project: the project full name in "projects/{id}" format, support "==" operator.- - instance: the instance full name in "instances/{id}" format, support "==" operator.- - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.- - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.- - table: filter by the database table, support "==" and ".matches()" operator.- - labels.{key}: the database label, support "==" and "in" operators.-- For example:- environment == "environments/{environment resource id}"- environment == "" (find databases which environment is not set)- project == "projects/{project resource id}"- instance == "instances/{instance resource id}"- name.matches("database name")- engine == "MYSQL"- engine in ["MYSQL", "POSTGRES"]- !(engine in ["MYSQL", "POSTGRES"])- exclude_unassigned == true- table == "sample"- table.matches("sam")- labels.environment == "production"- labels.region == "asia"- labels.region in ["asia", "europe"]-- You can combine filter conditions like:- environment == "environments/prod" && name.matches("employee")- schema:- type: string- title: filter- description: |-- Filter is used to filter databases returned in the list.- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec-- Supported filter:- - environment: the environment full name in "environments/{id}" format, support "==" operator.- - name: the database name, support ".matches()" operator.- - project: the project full name in "projects/{id}" format, support "==" operator.- - instance: the instance full name in "instances/{id}" format, support "==" operator.- - engine: the database engine, check Engine enum for values. Support "==", "in [xx]", "!(in [xx])" operator.- - exclude_unassigned: should be "true" or "false", will not show unassigned databases if it's true, support "==" operator.- - table: filter by the database table, support "==" and ".matches()" operator.- - labels.{key}: the database label, support "==" and "in" operators.-- For example:- environment == "environments/{environment resource id}"- environment == "" (find databases which environment is not set)- project == "projects/{project resource id}"- instance == "instances/{instance resource id}"- name.matches("database name")- engine == "MYSQL"- engine in ["MYSQL", "POSTGRES"]- !(engine in ["MYSQL", "POSTGRES"])- exclude_unassigned == true- table == "sample"- table.matches("sam")- labels.environment == "production"- labels.region == "asia"- labels.region in ["asia", "europe"]+ The policy to update.- You can combine filter conditions like:- environment == "environments/prod" && name.matches("employee")- - name: showDeleted- in: query- description: Show deleted database if specified.- schema:- type: boolean- title: show_deleted- description: Show deleted database if specified.- - name: orderBy- in: query- description: |-- The order by of databases.- Support name, project, instance. The default sorting order is ascending.- For example:- - order_by = "name" - order by name ascending- - order_by = "name desc"- - order_by = "name desc, project asc"- schema:- type: string- title: order_by- description: |-- The order by of databases.- Support name, project, instance. The default sorting order is ascending.- For example:- - order_by = "name" - order by name ascending- - order_by = "name desc"- - order_by = "name desc, project asc"+ The policy's `name` field is used to identify the instance to update.+ Format: {resource name}/policies/{policy type}+ Workspace resource name: workspaces/{workspace-id}.+ Environment resource name: environments/environment-id.+ Instance resource name: instances/instance-id.+ Database resource name: instances/instance-id/databases/database-name.+ $ref: '#/components/schemas/bytebase.v1.Policy'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ListDatabasesResponse'+ $ref: '#/components/schemas/bytebase.v1.Policy'/v1/workspaces/{workspace}/serviceAccounts:get:tags:@@ -17930,7 +17930,7 @@ components:title: parentdescription: |-The parent resource where this instance will be created.- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -19005,7 +19005,7 @@ components:description: |-The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -23489,7 +23489,7 @@ components:description: |-The name of the policy.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.@@ -27750,7 +27750,7 @@ components:The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}- Workspace resource name: "".+ Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name.diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex cac83de90d..0c785a0f2b 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -6621,7 +6621,7 @@ IdentityProviderService manages external identity providers for SSO authenticati| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource where this instance will be created. Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| parent | [string](#string) | | The parent resource where this instance will be created. Workspace resource name: workspaces/{workspace-id}. Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. || policy | [Policy](#bytebase-v1-Policy) | | The policy to create. || type | [PolicyType](#bytebase-v1-PolicyType) | | The type of policy to create. |@@ -6638,7 +6638,7 @@ IdentityProviderService manages external identity providers for SSO authenticati| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| name | [string](#string) | | The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: workspaces/{workspace-id}. Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |@@ -6773,7 +6773,7 @@ For example: resource.environment_id == "test" && resource.proje| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the policy. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+| name | [string](#string) | | The name of the policy. Format: {resource name}/policies/{policy type} Workspace resource name: workspaces/{workspace-id}. Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. || inherit_from_parent | [bool](#bool) | | Whether this policy inherits from its parent resource. || type | [PolicyType](#bytebase-v1-PolicyType) | | The type of policy. || rollout_policy | [RolloutPolicy](#bytebase-v1-RolloutPolicy) | | |@@ -6864,7 +6864,7 @@ Policy for tagging resources with metadata.| ----- | ---- | ----- | ----------- || policy | [Policy](#bytebase-v1-Policy) | | The policy to update.-The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: "". Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. |+The policy's `name` field is used to identify the instance to update. Format: {resource name}/policies/{policy type} Workspace resource name: workspaces/{workspace-id}. Environment resource name: environments/environment-id. Instance resource name: instances/instance-id. Database resource name: instances/instance-id/databases/database-name. || update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. || allow_missing | [bool](#bool) | | If set to true, and the policy is not found, a new policy will be created. In this situation, `update_mask` is ignored. |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex a5f0b494e4..85a3cd14f3 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -18939,7 +18939,7 @@ Permissions required: bb.identityProviders.update</p></td><td><a href="#string">string</a></td><td></td><td><p>The parent resource where this instance will be created.-Workspace resource name: "".+Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name. </p></td>@@ -18982,7 +18982,7 @@ Database resource name: instances/instance-id/databases/database-name. </p></td><td></td><td><p>The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}-Workspace resource name: "".+Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name. </p></td>@@ -19257,7 +19257,7 @@ resource.instance_id == "sample-instance" && (resource.database_<td></td><td><p>The name of the policy.Format: {resource name}/policies/{policy type}-Workspace resource name: "".+Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name. </p></td>@@ -19492,7 +19492,7 @@ for example, the environment resource can have the sql review config tag, like &The policy's `name` field is used to identify the instance to update.Format: {resource name}/policies/{policy type}-Workspace resource name: "".+Workspace resource name: workspaces/{workspace-id}.Environment resource name: environments/environment-id.Instance resource name: instances/instance-id.Database resource name: instances/instance-id/databases/database-name. </p></td>@@ -19679,7 +19679,7 @@ Permissions required: bb.policies.delete</p></td><tr><td>GetPolicy</td><td>GET</td>- <td>/v1/{name=policies/*}</td>+ <td>/v1/{name=workspaces/*/policies/*}</td><td></td></tr>@@ -19717,7 +19717,7 @@ Permissions required: bb.policies.delete</p></td><tr><td>ListPolicies</td><td>GET</td>- <td>/v1/policies</td>+ <td>/v1/{parent=workspaces/*}/policies</td><td></td></tr>@@ -19755,7 +19755,7 @@ Permissions required: bb.policies.delete</p></td><tr><td>CreatePolicy</td><td>POST</td>- <td>/v1/policies</td>+ <td>/v1/{parent=workspaces/*}/policies</td><td>policy</td></tr>@@ -19793,7 +19793,7 @@ Permissions required: bb.policies.delete</p></td><tr><td>UpdatePolicy</td><td>PATCH</td>- <td>/v1/{policy.name=policies/*}</td>+ <td>/v1/{policy.name=workspaces/*/policies/*}</td><td>policy</td></tr>@@ -19831,7 +19831,7 @@ Permissions required: bb.policies.delete</p></td><tr><td>DeletePolicy</td><td>DELETE</td>- <td>/v1/{name=policies/*}</td>+ <td>/v1/{name=workspaces/*/policies/*}</td><td></td></tr>diff --git a/proto/v1/v1/org_policy_service.proto b/proto/v1/v1/org_policy_service.protoindex 4c50c3f162..3511f8e6f8 100644--- a/proto/v1/v1/org_policy_service.proto+++ b/proto/v1/v1/org_policy_service.proto@@ -19,7 +19,7 @@ service OrgPolicyService {// Permissions required: bb.policies.getrpc GetPolicy(GetPolicyRequest) returns (Policy) {option (google.api.http) = {- get: "/v1/{name=policies/*}"+ get: "/v1/{name=workspaces/*/policies/*}"additional_bindings: {get: "/v1/{name=projects/*/policies/*}"}additional_bindings: {get: "/v1/{name=environments/*/policies/*}"}@@ -35,7 +35,7 @@ service OrgPolicyService {// Permissions required: bb.policies.listrpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse) {option (google.api.http) = {- get: "/v1/policies"+ get: "/v1/{parent=workspaces/*}/policies"additional_bindings: {get: "/v1/{parent=projects/*}/policies"}additional_bindings: {get: "/v1/{parent=environments/*}/policies"}@@ -51,7 +51,7 @@ service OrgPolicyService {// Permissions required: bb.policies.createrpc CreatePolicy(CreatePolicyRequest) returns (Policy) {option (google.api.http) = {- post: "/v1/policies"+ post: "/v1/{parent=workspaces/*}/policies"body: "policy"additional_bindings: {@@ -81,7 +81,7 @@ service OrgPolicyService {// Permissions required: bb.policies.updaterpc UpdatePolicy(UpdatePolicyRequest) returns (Policy) {option (google.api.http) = {- patch: "/v1/{policy.name=policies/*}"+ patch: "/v1/{policy.name=workspaces/*/policies/*}"body: "policy"additional_bindings: {@@ -111,7 +111,7 @@ service OrgPolicyService {// Permissions required: bb.policies.deleterpc DeletePolicy(DeletePolicyRequest) returns (google.protobuf.Empty) {option (google.api.http) = {- delete: "/v1/{name=policies/*}"+ delete: "/v1/{name=workspaces/*/policies/*}"additional_bindings: {delete: "/v1/{name=projects/*/policies/*}"}additional_bindings: {delete: "/v1/{name=environments/*/policies/*}"}@@ -127,7 +127,7 @@ service OrgPolicyService {message CreatePolicyRequest {// The parent resource where this instance will be created.- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -148,7 +148,7 @@ message UpdatePolicyRequest {//// The policy's `name` field is used to identify the instance to update.// Format: {resource name}/policies/{policy type}- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -165,7 +165,7 @@ message UpdatePolicyRequest {message DeletePolicyRequest {// The policy's `name` field is used to identify the instance to update.// Format: {resource name}/policies/{policy type}- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.@@ -207,7 +207,7 @@ message ListPoliciesResponse {message Policy {option (google.api.resource) = {type: "bytebase.com/Policy"- pattern: "policies/{policy}"+ pattern: "workspaces/{workspace}/policies/{policy}"pattern: "projects/{project}/policies/{policy}"pattern: "environments/{environment}/policies/{policy}"pattern: "instances/{instance}/policies/{policy}"@@ -216,7 +216,7 @@ message Policy {// The name of the policy.// Format: {resource name}/policies/{policy type}- // Workspace resource name: "".+ // Workspace resource name: workspaces/{workspace-id}.// Environment resource name: environments/environment-id.// Instance resource name: instances/instance-id.// Database resource name: instances/instance-id/databases/database-name.