Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: proto policy resource type (#16420)
Danny Xu33187bc80d75
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.goindex e126172686..bca302c3f6 100644--- a/backend/api/v1/org_policy_service.go+++ b/backend/api/v1/org_policy_service.go@@ -22,17 +22,17 @@ import (var (// allowedResourceTypes includes allowed resource types for each policy type.- allowedResourceTypes = map[storepb.PolicyType][]base.PolicyResourceType{- storepb.PolicyType_ROLLOUT: {base.PolicyResourceTypeEnvironment},- storepb.PolicyType_TAG: {base.PolicyResourceTypeEnvironment, base.PolicyResourceTypeProject},- storepb.PolicyType_DISABLE_COPY_DATA: {base.PolicyResourceTypeEnvironment, base.PolicyResourceTypeProject},- storepb.PolicyType_EXPORT_DATA: {base.PolicyResourceTypeWorkspace},- storepb.PolicyType_QUERY_DATA: {base.PolicyResourceTypeWorkspace},- storepb.PolicyType_MASKING_RULE: {base.PolicyResourceTypeWorkspace},- storepb.PolicyType_MASKING_EXCEPTION: {base.PolicyResourceTypeProject},- storepb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW: {base.PolicyResourceTypeWorkspace, base.PolicyResourceTypeProject},- storepb.PolicyType_IAM: {base.PolicyResourceTypeWorkspace},- storepb.PolicyType_DATA_SOURCE_QUERY: {base.PolicyResourceTypeEnvironment, base.PolicyResourceTypeProject},+ allowedResourceTypes = map[storepb.Policy_Type][]storepb.Policy_Resource{+ storepb.Policy_ROLLOUT: {storepb.Policy_ENVIRONMENT},+ storepb.Policy_TAG: {storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},+ storepb.Policy_DISABLE_COPY_DATA: {storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},+ storepb.Policy_EXPORT_DATA: {storepb.Policy_WORKSPACE},+ storepb.Policy_QUERY_DATA: {storepb.Policy_WORKSPACE},+ storepb.Policy_MASKING_RULE: {storepb.Policy_WORKSPACE},+ storepb.Policy_MASKING_EXCEPTION: {storepb.Policy_PROJECT},+ storepb.Policy_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW: {storepb.Policy_WORKSPACE, storepb.Policy_PROJECT},+ storepb.Policy_IAM: {storepb.Policy_WORKSPACE},+ storepb.Policy_DATA_SOURCE_QUERY: {storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},})@@ -201,7 +201,7 @@ func (s *OrgPolicyService) findPolicyMessage(ctx context.Context, policyName strif err != nil {return nil, policyParent, err}- if resource == nil && resourceType != base.PolicyResourceTypeWorkspace {+ if resource == nil && resourceType != storepb.Policy_WORKSPACE {return nil, policyParent, status.Errorf(codes.InvalidArgument, "resource for %s must be specific", resourceType)}@@ -231,35 +231,35 @@ func (s *OrgPolicyService) findPolicyMessage(ctx context.Context, policyName strreturn policy, policyParent, nil}-func getPolicyResourceTypeAndResource(requestName string) (base.PolicyResourceType, *string, error) {+func getPolicyResourceTypeAndResource(requestName string) (storepb.Policy_Resource, *string, error) {if requestName == "" {- return base.PolicyResourceTypeWorkspace, nil, nil+ return storepb.Policy_WORKSPACE, nil, nil}if strings.HasPrefix(requestName, common.ProjectNamePrefix) {projectID, err := common.GetProjectID(requestName)if err != nil {- return base.PolicyResourceTypeUnknown, nil, status.Error(codes.InvalidArgument, err.Error())+ return storepb.Policy_RESOURCE_UNSPECIFIED, nil, status.Error(codes.InvalidArgument, err.Error())}if projectID == "-" {- return base.PolicyResourceTypeProject, nil, nil+ return storepb.Policy_PROJECT, nil, nil}- return base.PolicyResourceTypeProject, &requestName, nil+ return storepb.Policy_PROJECT, &requestName, nil}if strings.HasPrefix(requestName, common.EnvironmentNamePrefix) {// environment policy request name should be environments/{environment id}environmentID, err := common.GetEnvironmentID(requestName)if err != nil {- return base.PolicyResourceTypeUnknown, nil, status.Error(codes.InvalidArgument, err.Error())+ return storepb.Policy_RESOURCE_UNSPECIFIED, nil, status.Error(codes.InvalidArgument, err.Error())}if environmentID == "-" {- return base.PolicyResourceTypeEnvironment, nil, nil+ return storepb.Policy_ENVIRONMENT, nil, nil}- return base.PolicyResourceTypeEnvironment, &requestName, nil+ return storepb.Policy_ENVIRONMENT, &requestName, nil}- return base.PolicyResourceTypeUnknown, nil, status.Errorf(codes.InvalidArgument, "unknown request name %s", requestName)+ return storepb.Policy_RESOURCE_UNSPECIFIED, nil, status.Errorf(codes.InvalidArgument, "unknown request name %s", requestName)}func (s *OrgPolicyService) createPolicyMessage(ctx context.Context, parent string, policy *v1pb.Policy) (*v1pb.Policy, error) {@@ -309,7 +309,7 @@ func (s *OrgPolicyService) createPolicyMessage(ctx context.Context, parent strinreturn response, nil}-func validatePolicyType(policyType storepb.PolicyType, policyResourceType base.PolicyResourceType) error {+func validatePolicyType(policyType storepb.Policy_Type, policyResourceType storepb.Policy_Resource) error {allowedTypes, ok := allowedResourceTypes[policyType]if !ok {return status.Errorf(codes.InvalidArgument, "unknown policy type %v", policyType)@@ -322,9 +322,9 @@ func validatePolicyType(policyType storepb.PolicyType, policyResourceType base.Preturn status.Errorf(codes.InvalidArgument, "policy %v is not allowed in resource %v", policyType, policyResourceType)}-func validatePolicyPayload(policyType storepb.PolicyType, policy *v1pb.Policy) error {+func validatePolicyPayload(policyType storepb.Policy_Type, policy *v1pb.Policy) error {switch policyType {- case storepb.PolicyType_MASKING_RULE:+ case storepb.Policy_MASKING_RULE:maskingRulePolicy, ok := policy.Policy.(*v1pb.Policy_MaskingRulePolicy)if !ok {return status.Errorf(codes.InvalidArgument, "unmatched policy type %v and policy %v", policyType, policy.Policy)@@ -340,7 +340,7 @@ func validatePolicyPayload(policyType storepb.PolicyType, policy *v1pb.Policy) ereturn status.Errorf(codes.InvalidArgument, "invalid masking rule expression: %v", err)}}- case storepb.PolicyType_MASKING_EXCEPTION:+ case storepb.Policy_MASKING_EXCEPTION:maskingExceptionPolicy, ok := policy.Policy.(*v1pb.Policy_MaskingExceptionPolicy)if !ok {return status.Errorf(codes.InvalidArgument, "unmatched policy type %v and policy %v", policyType, policy.Policy)@@ -483,11 +483,11 @@ func (s *OrgPolicyService) convertPolicyPayloadToString(ctx context.Context, polfunc (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *store.PolicyMessage) (*v1pb.Policy, error) {resourceType := v1pb.PolicyResourceType_RESOURCE_TYPE_UNSPECIFIEDswitch policyMessage.ResourceType {- case base.PolicyResourceTypeWorkspace:+ case storepb.Policy_WORKSPACE:resourceType = v1pb.PolicyResourceType_WORKSPACE- case base.PolicyResourceTypeEnvironment:+ case storepb.Policy_ENVIRONMENT:resourceType = v1pb.PolicyResourceType_ENVIRONMENT- case base.PolicyResourceTypeProject:+ case storepb.Policy_PROJECT:resourceType = v1pb.PolicyResourceType_PROJECT}policy := &v1pb.Policy{@@ -498,13 +498,13 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *spType := convertStorePBToV1PBPolicyType(policyMessage.Type)switch policyMessage.Type {- case storepb.PolicyType_ROLLOUT:+ case storepb.Policy_ROLLOUT:payload, err := convertToV1RolloutPolicyPayload(policyMessage.Payload)if err != nil {return nil, err}policy.Policy = payload- case storepb.PolicyType_TAG:+ case storepb.Policy_TAG:p := &v1pb.TagPolicy{}if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policyMessage.Payload), p); err != nil {return nil, errors.Wrapf(err, "failed to unmarshal rollout policy payload")@@ -512,25 +512,25 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *spolicy.Policy = &v1pb.Policy_TagPolicy{TagPolicy: p,}- case storepb.PolicyType_DISABLE_COPY_DATA:+ case storepb.Policy_DISABLE_COPY_DATA:payload, err := convertToV1PBDisableCopyDataPolicy(policyMessage.Payload)if err != nil {return nil, err}policy.Policy = payload- case storepb.PolicyType_EXPORT_DATA:+ case storepb.Policy_EXPORT_DATA:payload, err := convertToV1PBExportDataPolicy(policyMessage.Payload)if err != nil {return nil, err}policy.Policy = payload- case storepb.PolicyType_QUERY_DATA:+ case storepb.Policy_QUERY_DATA:payload, err := convertToV1PBQueryDataPolicy(policyMessage.Payload)if err != nil {return nil, err}policy.Policy = payload- case storepb.PolicyType_MASKING_RULE:+ case storepb.Policy_MASKING_RULE:maskingRulePolicy := &storepb.MaskingRulePolicy{}if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policyMessage.Payload), maskingRulePolicy); err != nil {return nil, errors.Wrap(err, "failed to unmarshal masking rule policy")@@ -542,7 +542,7 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *spolicy.Policy = &v1pb.Policy_MaskingRulePolicy{MaskingRulePolicy: payload,}- case storepb.PolicyType_MASKING_EXCEPTION:+ case storepb.Policy_MASKING_EXCEPTION:maskingRulePolicy := &storepb.MaskingExceptionPolicy{}if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policyMessage.Payload), maskingRulePolicy); err != nil {return nil, errors.Wrap(err, "failed to unmarshal masking exception policy")@@ -554,13 +554,13 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *spolicy.Policy = &v1pb.Policy_MaskingExceptionPolicy{MaskingExceptionPolicy: payload,}- case storepb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW:+ case storepb.Policy_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW:payload, err := convertToV1PBRestrictIssueCreationForSQLReviewPolicy(policyMessage.Payload)if err != nil {return nil, err}policy.Policy = payload- case storepb.PolicyType_DATA_SOURCE_QUERY:+ case storepb.Policy_DATA_SOURCE_QUERY:payload, err := convertToV1PBDataSourceQueryPolicy(policyMessage.Payload)if err != nil {return nil, err@@ -853,49 +853,49 @@ func convertToDataSourceQueryPayload(policy *v1pb.DataSourceQueryPolicy) (*store}, nil}-func convertV1PBToStorePBPolicyType(pType v1pb.PolicyType) (storepb.PolicyType, error) {+func convertV1PBToStorePBPolicyType(pType v1pb.PolicyType) (storepb.Policy_Type, error) {switch pType {case v1pb.PolicyType_ROLLOUT_POLICY:- return storepb.PolicyType_ROLLOUT, nil+ return storepb.Policy_ROLLOUT, nilcase v1pb.PolicyType_TAG:- return storepb.PolicyType_TAG, nil+ return storepb.Policy_TAG, nilcase v1pb.PolicyType_MASKING_RULE:- return storepb.PolicyType_MASKING_RULE, nil+ return storepb.Policy_MASKING_RULE, nilcase v1pb.PolicyType_MASKING_EXCEPTION:- return storepb.PolicyType_MASKING_EXCEPTION, nil+ return storepb.Policy_MASKING_EXCEPTION, nilcase v1pb.PolicyType_DISABLE_COPY_DATA:- return storepb.PolicyType_DISABLE_COPY_DATA, nil+ return storepb.Policy_DISABLE_COPY_DATA, nilcase v1pb.PolicyType_DATA_EXPORT:- return storepb.PolicyType_EXPORT_DATA, nil+ return storepb.Policy_EXPORT_DATA, nilcase v1pb.PolicyType_DATA_QUERY:- return storepb.PolicyType_QUERY_DATA, nil+ return storepb.Policy_QUERY_DATA, nilcase v1pb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW:- return storepb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW, nil+ return storepb.Policy_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW, nilcase v1pb.PolicyType_DATA_SOURCE_QUERY:- return storepb.PolicyType_DATA_SOURCE_QUERY, nil+ return storepb.Policy_DATA_SOURCE_QUERY, nil}- return storepb.PolicyType_POLICY_TYPE_UNSPECIFIED, errors.Errorf("invalid policy type %v", pType)+ return storepb.Policy_TYPE_UNSPECIFIED, errors.Errorf("invalid policy type %v", pType)}-func convertStorePBToV1PBPolicyType(pType storepb.PolicyType) v1pb.PolicyType {+func convertStorePBToV1PBPolicyType(pType storepb.Policy_Type) v1pb.PolicyType {switch pType {- case storepb.PolicyType_ROLLOUT:+ case storepb.Policy_ROLLOUT:return v1pb.PolicyType_ROLLOUT_POLICY- case storepb.PolicyType_TAG:+ case storepb.Policy_TAG:return v1pb.PolicyType_TAG- case storepb.PolicyType_MASKING_RULE:+ case storepb.Policy_MASKING_RULE:return v1pb.PolicyType_MASKING_RULE- case storepb.PolicyType_MASKING_EXCEPTION:+ case storepb.Policy_MASKING_EXCEPTION:return v1pb.PolicyType_MASKING_EXCEPTION- case storepb.PolicyType_DISABLE_COPY_DATA:+ case storepb.Policy_DISABLE_COPY_DATA:return v1pb.PolicyType_DISABLE_COPY_DATA- case storepb.PolicyType_EXPORT_DATA:+ case storepb.Policy_EXPORT_DATA:return v1pb.PolicyType_DATA_EXPORT- case storepb.PolicyType_QUERY_DATA:+ case storepb.Policy_QUERY_DATA:return v1pb.PolicyType_DATA_QUERY- case storepb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW:+ case storepb.Policy_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW:return v1pb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW- case storepb.PolicyType_DATA_SOURCE_QUERY:+ case storepb.Policy_DATA_SOURCE_QUERY:return v1pb.PolicyType_DATA_SOURCE_QUERY}return v1pb.PolicyType_POLICY_TYPE_UNSPECIFIEDdiff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex 75183dc2dd..a0f71c819a 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -613,9 +613,9 @@ func (s *ProjectService) SetIamPolicy(ctx context.Context, request *v1pb.SetIamP}if _, err := s.store.CreatePolicyV2(ctx, &store.PolicyMessage{Resource: common.FormatProject(project.ResourceID),- ResourceType: base.PolicyResourceTypeProject,+ ResourceType: storepb.Policy_PROJECT,Payload: string(policyPayload),- Type: storepb.PolicyType_IAM,+ Type: storepb.Policy_IAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,diff --git a/backend/api/v1/review_config_service.go b/backend/api/v1/review_config_service.goindex 2b978a4ca8..6b91cf4995 100644--- a/backend/api/v1/review_config_service.go+++ b/backend/api/v1/review_config_service.go@@ -181,7 +181,7 @@ func convertToReviewConfigMessage(reviewConfig *v1pb.ReviewConfig) (*store.Revie}func (s *ReviewConfigService) convertToV1ReviewConfig(ctx context.Context, reviewConfigMessage *store.ReviewConfigMessage) (*v1pb.ReviewConfig, error) {- policyType := storepb.PolicyType_TAG+ policyType := storepb.Policy_TAGtagPolicies, err := s.store.ListPoliciesV2(ctx, &store.FindPolicyMessage{Type: &policyType,ShowAll: false,@@ -207,7 +207,7 @@ func (s *ReviewConfigService) convertToV1ReviewConfig(ctx context.Context, revie}switch policy.ResourceType {- case base.PolicyResourceTypeEnvironment:+ case storepb.Policy_ENVIRONMENT:environmentID, err := common.GetEnvironmentID(policy.Resource)if err != nil {return nil, err@@ -220,7 +220,7 @@ func (s *ReviewConfigService) convertToV1ReviewConfig(ctx context.Context, reviecontinue}config.Resources = append(config.Resources, common.FormatEnvironment(environment.Id))- case base.PolicyResourceTypeProject:+ case storepb.Policy_PROJECT:projectID, err := common.GetProjectID(policy.Resource)if err != nil {return nil, errdiff --git a/backend/api/v1/role_service.go b/backend/api/v1/role_service.goindex 12068ecd02..fb7c9dd7b2 100644--- a/backend/api/v1/role_service.go+++ b/backend/api/v1/role_service.go@@ -14,6 +14,7 @@ import ("github.com/bytebase/bytebase/backend/component/iam"enterprise "github.com/bytebase/bytebase/backend/enterprise/api""github.com/bytebase/bytebase/backend/store"+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")@@ -220,7 +221,7 @@ func (s *RoleService) DeleteRole(ctx context.Context, request *v1pb.DeleteRoleRe}if usedResource.Resource != "" {usedBy = append(usedBy, usedResource.Resource)- } else if usedResource.ResourceType == base.PolicyResourceTypeWorkspace {+ } else if usedResource.ResourceType == storepb.Policy_WORKSPACE {usedBy = append(usedBy, "workspace")}}diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex fe5338bc5b..31b01d29e2 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -1958,8 +1958,8 @@ func checkAndGetDataSourceQueriable(if environment == nil {return nil, status.Errorf(codes.NotFound, "environment %q not found", database.EffectiveEnvironmentID)}- dataSourceQueryPolicyType := storepb.PolicyType_DATA_SOURCE_QUERY- environmentResourceType := base.PolicyResourceTypeEnvironment+ dataSourceQueryPolicyType := storepb.Policy_DATA_SOURCE_QUERY+ environmentResourceType := storepb.Policy_ENVIRONMENTenvironmentResource := common.FormatEnvironment(environment.Id)environmentPolicy, err := storeInstance.GetPolicyV2(ctx, &store.FindPolicyMessage{ResourceType: &environmentResourceType,@@ -1977,7 +1977,7 @@ func checkAndGetDataSourceQueriable(envAdminDataSourceRestriction = envPayload.DataSourceQueryPolicy.GetAdminDataSourceRestriction()}- projectResourceType := base.PolicyResourceTypeProject+ projectResourceType := storepb.Policy_PROJECTprojectResource := common.FormatProject(database.ProjectID)projectPolicy, err := storeInstance.GetPolicyV2(ctx, &store.FindPolicyMessage{ResourceType: &projectResourceType,@@ -2016,9 +2016,9 @@ func checkDataSourceQueryPolicy(ctx context.Context, storeInstance *store.Store,if environment == nil {return status.Errorf(codes.NotFound, "environment %q not found", database.EffectiveEnvironmentID)}- resourceType := base.PolicyResourceTypeEnvironment+ resourceType := storepb.Policy_ENVIRONMENTenvironmentResource := common.FormatEnvironment(environment.Id)- policyType := storepb.PolicyType_DATA_SOURCE_QUERY+ policyType := storepb.Policy_DATA_SOURCE_QUERYdataSourceQueryPolicy, err := storeInstance.GetPolicyV2(ctx, &store.FindPolicyMessage{ResourceType: &resourceType,Resource: &environmentResource,diff --git a/backend/api/v1/workspace_service.go b/backend/api/v1/workspace_service.goindex 12f6760842..d7c61e485d 100644--- a/backend/api/v1/workspace_service.go+++ b/backend/api/v1/workspace_service.go@@ -67,8 +67,8 @@ func (s *WorkspaceService) SetIamPolicy(ctx context.Context, request *v1pb.SetIa}payloadStr := string(payloadBytes)patch := &store.UpdatePolicyMessage{- ResourceType: base.PolicyResourceTypeWorkspace,- Type: storepb.PolicyType_IAM,+ ResourceType: storepb.Policy_WORKSPACE,+ Type: storepb.Policy_IAM,Payload: &payloadStr,}diff --git a/backend/base/policy.go b/backend/base/policy.goindex d47da2430d..624cebc938 100644--- a/backend/base/policy.go+++ b/backend/base/policy.go@@ -1,18 +1,6 @@package base-// PolicyResourceType is the resource type for a policy.-type PolicyResourceType string-const (- // PolicyResourceTypeUnknown is the unknown resource type.- PolicyResourceTypeUnknown PolicyResourceType = ""- // PolicyResourceTypeWorkspace is the resource type for workspaces.- PolicyResourceTypeWorkspace PolicyResourceType = "WORKSPACE"- // PolicyResourceTypeEnvironment is the resource type for environments.- PolicyResourceTypeEnvironment PolicyResourceType = "ENVIRONMENT"- // PolicyResourceTypeProject is the resource type for projects.- PolicyResourceTypeProject PolicyResourceType = "PROJECT"-// ReservedTagReviewConfig is the tag for review config.ReservedTagReviewConfig string = "bb.tag.review_config")diff --git a/backend/migrator/migration/3.7/0022##policy_resource_type_check_drop.sql b/backend/migrator/migration/3.7/0022##policy_resource_type_check_drop.sqlnew file mode 100644index 0000000000..6d1dd760cb--- /dev/null+++ b/backend/migrator/migration/3.7/0022##policy_resource_type_check_drop.sql@@ -0,0 +1 @@+ALTER TABLE policy DROP CONSTRAINT IF EXISTS policy_resource_type_check;\ No newline at end of filediff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex 76403039e0..94460b30d0 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -58,7 +58,7 @@ CREATE TABLE policy (id serial PRIMARY KEY,enforce boolean NOT NULL DEFAULT TRUE,updated_at timestamptz NOT NULL DEFAULT now(),- resource_type text NOT NULL CHECK (resource_type IN ('WORKSPACE', 'ENVIRONMENT', 'PROJECT', 'INSTANCE')),+ resource_type text NOT NULL,resource TEXT NOT NULL,type text NOT NULL,payload jsonb NOT NULL DEFAULT '{}',diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex eb481de160..1c7299a70a 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -12,7 +12,7 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.7.21"), *files[len(files)-1].version)+ require.Equal(t, semver.MustParse("3.7.22"), *files[len(files)-1].version)}func TestVersionUnique(t *testing.T) {diff --git a/backend/store/policy.go b/backend/store/policy.goindex a9f0a4c38e..9d30752eab 100644--- a/backend/store/policy.go+++ b/backend/store/policy.go@@ -30,7 +30,7 @@ func generateEtag(t time.Time) string {}func (s *Store) GetWorkspaceIamPolicy(ctx context.Context) (*IamPolicyMessage, error) {- resourceType := base.PolicyResourceTypeWorkspace+ resourceType := storepb.Policy_WORKSPACEreturn s.getIamPolicy(ctx, &FindPolicyMessage{ResourceType: &resourceType,})@@ -83,9 +83,9 @@ func (s *Store) PatchWorkspaceIamPolicy(ctx context.Context, patch *PatchIamPoli}if _, err := s.CreatePolicyV2(ctx, &PolicyMessage{- ResourceType: base.PolicyResourceTypeWorkspace,+ ResourceType: storepb.Policy_WORKSPACE,Payload: string(policyPayload),- Type: storepb.PolicyType_IAM,+ Type: storepb.Policy_IAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,@@ -97,7 +97,7 @@ func (s *Store) PatchWorkspaceIamPolicy(ctx context.Context, patch *PatchIamPoli}func (s *Store) GetProjectIamPolicy(ctx context.Context, projectID string) (*IamPolicyMessage, error) {- resourceType := base.PolicyResourceTypeProject+ resourceType := storepb.Policy_PROJECTresource := common.FormatProject(projectID)return s.getIamPolicy(ctx, &FindPolicyMessage{ResourceType: &resourceType,@@ -106,7 +106,7 @@ func (s *Store) GetProjectIamPolicy(ctx context.Context, projectID string) (*Iam}func (s *Store) getIamPolicy(ctx context.Context, find *FindPolicyMessage) (*IamPolicyMessage, error) {- pType := storepb.PolicyType_IAM+ pType := storepb.Policy_IAMfind.Type = &pTypepolicy, err := s.GetPolicyV2(ctx, find)if err != nil {@@ -131,8 +131,8 @@ func (s *Store) getIamPolicy(ctx context.Context, find *FindPolicyMessage) (*Iamfunc (s *Store) GetRolloutPolicy(ctx context.Context, environment string) (*storepb.RolloutPolicy, error) {resource := common.FormatEnvironment(environment)- resourceType := base.PolicyResourceTypeEnvironment- pType := storepb.PolicyType_ROLLOUT+ resourceType := storepb.Policy_ENVIRONMENT+ pType := storepb.Policy_ROLLOUTpolicy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{ResourceType: &resourceType,Resource: &resource,@@ -154,9 +154,9 @@ func (s *Store) GetRolloutPolicy(ctx context.Context, environment string) (*stor}func (s *Store) GetExportDataPolicy(ctx context.Context) (*storepb.ExportDataPolicy, error) {- resourceType := base.PolicyResourceTypeWorkspace+ resourceType := storepb.Policy_WORKSPACEresource := ""- pType := storepb.PolicyType_EXPORT_DATA+ pType := storepb.Policy_EXPORT_DATApolicy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{ResourceType: &resourceType,Resource: &resource,@@ -180,9 +180,9 @@ func (s *Store) GetExportDataPolicy(ctx context.Context) (*storepb.ExportDataPol}func (s *Store) GetQueryDataPolicy(ctx context.Context) (*storepb.QueryDataPolicy, error) {- resourceType := base.PolicyResourceTypeWorkspace+ resourceType := storepb.Policy_WORKSPACEresource := ""- pType := storepb.PolicyType_QUERY_DATA+ pType := storepb.Policy_QUERY_DATApolicy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{ResourceType: &resourceType,Resource: &resource,@@ -207,15 +207,15 @@ func (s *Store) GetQueryDataPolicy(ctx context.Context) (*storepb.QueryDataPolic// GetReviewConfigForDatabase will get the review config for a database.func (s *Store) GetReviewConfigForDatabase(ctx context.Context, database *DatabaseMessage) (*storepb.ReviewConfigPayload, error) {for _, v := range []struct {- resourceType base.PolicyResourceType+ resourceType storepb.Policy_Resourceresource string}{{- resourceType: base.PolicyResourceTypeEnvironment,+ resourceType: storepb.Policy_ENVIRONMENT,resource: common.FormatEnvironment(database.EffectiveEnvironmentID),},{- resourceType: base.PolicyResourceTypeProject,+ resourceType: storepb.Policy_PROJECT,resource: common.FormatProject(database.ProjectID),},} {@@ -234,8 +234,8 @@ func (s *Store) GetReviewConfigForDatabase(ctx context.Context, database *Databareturn nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("SQL review policy for database %s not found", database.DatabaseName)}}-func (s *Store) getReviewConfigByResource(ctx context.Context, resourceType base.PolicyResourceType, resource string) (*storepb.ReviewConfigPayload, error) {- pType := storepb.PolicyType_TAG+func (s *Store) getReviewConfigByResource(ctx context.Context, resourceType storepb.Policy_Resource, resource string) (*storepb.ReviewConfigPayload, error) {+ pType := storepb.Policy_TAGpolicy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{ResourceType: &resourceType,@@ -282,7 +282,7 @@ func (s *Store) getReviewConfigByResource(ctx context.Context, resourceType base// GetMaskingRulePolicy will get the masking rule policy.func (s *Store) GetMaskingRulePolicy(ctx context.Context) (*storepb.MaskingRulePolicy, error) {- pType := storepb.PolicyType_MASKING_RULE+ pType := storepb.Policy_MASKING_RULEpolicy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{Type: &pType,})@@ -304,9 +304,9 @@ func (s *Store) GetMaskingRulePolicy(ctx context.Context) (*storepb.MaskingRuleP// GetMaskingExceptionPolicyByProject gets the masking exception policy for a project.func (s *Store) GetMaskingExceptionPolicyByProject(ctx context.Context, projectID string) (*storepb.MaskingExceptionPolicy, error) {- resourceType := base.PolicyResourceTypeProject+ resourceType := storepb.Policy_PROJECTresource := common.FormatProject(projectID)- pType := storepb.PolicyType_MASKING_EXCEPTION+ pType := storepb.Policy_MASKING_EXCEPTIONpolicy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{ResourceType: &resourceType,Resource: &resource,@@ -331,10 +331,10 @@ func (s *Store) GetMaskingExceptionPolicyByProject(ctx context.Context, projectI// PolicyMessage is the mssage for policy.type PolicyMessage struct {Resource string- ResourceType base.PolicyResourceType+ ResourceType storepb.Policy_ResourcePayload stringInheritFromParent bool- Type storepb.PolicyType+ Type storepb.Policy_TypeEnforce boolUpdatedAt time.Time@@ -342,18 +342,18 @@ type PolicyMessage struct {// FindPolicyMessage is the message for finding policies.type FindPolicyMessage struct {- ResourceType *base.PolicyResourceType+ ResourceType *storepb.Policy_ResourceResource *string- Type *storepb.PolicyType+ Type *storepb.Policy_Type// ShowAll will show all policies regardless of the enforce status.ShowAll bool}// UpdatePolicyMessage is the message for updating a policy.type UpdatePolicyMessage struct {- ResourceType base.PolicyResourceType+ ResourceType storepb.Policy_ResourceResource string- Type storepb.PolicyType+ Type storepb.Policy_TypeInheritFromParent *boolPayload *stringEnforce *bool@@ -548,7 +548,7 @@ func upsertPolicyV2Impl(ctx context.Context, txn *sql.Tx, create *PolicyMessage)enforce = EXCLUDED.enforce,updated_at = EXCLUDED.updated_at`,- create.ResourceType,+ create.ResourceType.String(),create.Resource,create.InheritFromParent,create.Type.String(),@@ -564,7 +564,7 @@ func upsertPolicyV2Impl(ctx context.Context, txn *sql.Tx, create *PolicyMessage)func (*Store) listPolicyImplV2(ctx context.Context, txn *sql.Tx, find *FindPolicyMessage) ([]*PolicyMessage, error) {where, args := []string{"TRUE"}, []any{}if v := find.ResourceType; v != nil {- where, args = append(where, fmt.Sprintf("resource_type = $%d", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("resource_type = $%d", len(args)+1)), append(args, v.String())}if v := find.Resource; v != nil {where, args = append(where, fmt.Sprintf("resource = $%d", len(args)+1)), append(args, *v)@@ -597,10 +597,10 @@ func (*Store) listPolicyImplV2(ctx context.Context, txn *sql.Tx, find *FindPolicvar policyList []*PolicyMessagefor rows.Next() {var policyMessage PolicyMessage- var typeString string+ var resourceTypeString, typeString stringif err := rows.Scan(&policyMessage.UpdatedAt,- &policyMessage.ResourceType,+ &resourceTypeString,&policyMessage.Resource,&policyMessage.InheritFromParent,&typeString,@@ -609,11 +609,16 @@ func (*Store) listPolicyImplV2(ctx context.Context, txn *sql.Tx, find *FindPolic); err != nil {return nil, err}- value, ok := storepb.PolicyType_value[typeString]+ resourceTypeValue, ok := storepb.Policy_Resource_value[resourceTypeString]+ if !ok {+ return nil, errors.Errorf("invalid policy resource type string: %s", resourceTypeString)+ }+ policyMessage.ResourceType = storepb.Policy_Resource(resourceTypeValue)+ value, ok := storepb.Policy_Type_value[typeString]if !ok {return nil, errors.Errorf("invalid policy type string: %s", typeString)}- policyMessage.Type = storepb.PolicyType(value)+ policyMessage.Type = storepb.Policy_Type(value)policyList = append(policyList, &policyMessage)}if err := rows.Err(); err != nil {diff --git a/backend/store/principal.go b/backend/store/principal.goindex a0381ed78a..c5e74342d2 100644--- a/backend/store/principal.go+++ b/backend/store/principal.go@@ -229,7 +229,7 @@ func listUserImpl(ctx context.Context, txn *sql.Tx, find *FindUserMessage) ([]*Ujsonb_array_elements_text(jsonb_array_elements(policy.payload->'bindings')->'members') AS member,jsonb_array_elements(policy.payload->'bindings')->>'role' AS roleFROM policy- WHERE ((resource_type = '` + string(base.PolicyResourceTypeProject) + `' AND resource = 'projects/` + *v + `') OR resource_type = '` + string(base.PolicyResourceTypeWorkspace) + `') AND type = '` + storepb.PolicyType_IAM.String() + `'+ WHERE ((resource_type = '` + storepb.Policy_PROJECT.String() + `' AND resource = 'projects/` + *v + `') OR resource_type = '` + storepb.Policy_WORKSPACE.String() + `') AND type = '` + storepb.Policy_IAM.String() + `'),project_members AS (SELECT ARRAY_AGG(member) AS members FROM all_members WHERE role LIKE 'roles/project%'diff --git a/backend/store/project.go b/backend/store/project.goindex 5777c42ea2..ffe5bd737c 100644--- a/backend/store/project.go+++ b/backend/store/project.go@@ -167,10 +167,10 @@ func (s *Store) CreateProjectV2(ctx context.Context, create *ProjectMessage, crereturn nil, err}if _, err := s.CreatePolicyV2(ctx, &PolicyMessage{- ResourceType: base.PolicyResourceTypeProject,+ ResourceType: storepb.Policy_PROJECT,Resource: common.FormatProject(project.ResourceID),Payload: string(policyPayload),- Type: storepb.PolicyType_IAM,+ Type: storepb.Policy_IAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,diff --git a/backend/store/role.go b/backend/store/role.goindex 46f4e0c339..7472356036 100644--- a/backend/store/role.go+++ b/backend/store/role.go@@ -8,7 +8,6 @@ import ("google.golang.org/protobuf/encoding/protojson"- "github.com/bytebase/bytebase/backend/base""github.com/bytebase/bytebase/backend/common"storepb "github.com/bytebase/bytebase/proto/generated-go/store")@@ -31,7 +30,7 @@ type UpdateRoleMessage struct {}type RoleUsedByResource struct {- ResourceType base.PolicyResourceType+ ResourceType storepb.Policy_ResourceResource string}@@ -45,7 +44,7 @@ func (s *Store) GetResourcesUsedByRole(ctx context.Context, role string) ([]*Rolbinding->>'role' = $2GROUP BY resource, resource_type;`- rows, err := s.db.QueryContext(ctx, query, storepb.PolicyType_IAM.String(), role)+ rows, err := s.db.QueryContext(ctx, query, storepb.Policy_IAM.String(), role)if err != nil {return nil, err}diff --git a/backend/store/store.go b/backend/store/store.goindex 928aeb2f70..46b9640dd8 100644--- a/backend/store/store.go+++ b/backend/store/store.go@@ -10,7 +10,6 @@ import (lru "github.com/hashicorp/golang-lru/v2""github.com/pkg/errors"- "github.com/bytebase/bytebase/backend/base""github.com/bytebase/bytebase/backend/store/model"storepb "github.com/bytebase/bytebase/proto/generated-go/store")@@ -179,7 +178,7 @@ func getInstanceCacheKey(instanceID string) string {return instanceID}-func getPolicyCacheKey(resourceType base.PolicyResourceType, resource string, policyType storepb.PolicyType) string {+func getPolicyCacheKey(resourceType storepb.Policy_Resource, resource string, policyType storepb.Policy_Type) string {return fmt.Sprintf("policies/%s/%s/%s", resourceType, resource, policyType)}diff --git a/backend/utils/utils.go b/backend/utils/utils.goindex d601a81269..2d0e05dc49 100644--- a/backend/utils/utils.go+++ b/backend/utils/utils.go@@ -16,7 +16,6 @@ import ("google.golang.org/grpc/status""google.golang.org/protobuf/encoding/protojson"- "github.com/bytebase/bytebase/backend/base""github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/store"storepb "github.com/bytebase/bytebase/proto/generated-go/store"@@ -160,9 +159,9 @@ func UpdateProjectPolicyFromGrantIssue(ctx context.Context, stores *store.Store,}if _, err := stores.CreatePolicyV2(ctx, &store.PolicyMessage{Resource: common.FormatProject(issue.Project.ResourceID),- ResourceType: base.PolicyResourceTypeProject,+ ResourceType: storepb.Policy_PROJECT,Payload: string(policyPayload),- Type: storepb.PolicyType_IAM,+ Type: storepb.Policy_IAM,InheritFromParent: false,// Enforce cannot be false while creating a policy.Enforce: true,diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 7f62884563..61212b1be9 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -9362,23 +9362,6 @@ components:mountPath:type: stringdescription: The path where the approle auth method is mounted.- DataSourceQueryPolicy:- type: object- properties:- adminDataSourceRestriction:- enum:- - RESTRICTION_UNSPECIFIED- - FALLBACK- - DISALLOW- type: string- format: enum- disallowDdl:- type: boolean- description: Disallow running DDL statements in the SQL editor.- disallowDml:- type: boolean- description: Disallow running DML statements in the SQL editor.- description: DataSourceQueryPolicy is the policy configuration for running statements in the SQL editor.DataSource_Address:type: objectproperties:@@ -9651,11 +9634,6 @@ components:properties:diff:type: string- DisableCopyDataPolicy:- type: object- properties:- active:- type: booleanEnvironmentSetting:type: objectproperties:@@ -9736,11 +9714,6 @@ components:A token to retrieve next page of log entities.Pass this value in the page_token field in the subsequent callto retrieve the next page of log entities.- ExportDataPolicy:- type: object- properties:- disable:- type: booleanExportRequest:required:- name@@ -11067,52 +11040,6 @@ components:LogoutRequest:type: objectproperties: {}- MaskingExceptionPolicy:- type: object- properties:- maskingExceptions:- type: array- items:- $ref: '#/components/schemas/MaskingExceptionPolicy_MaskingException'- description: MaskingExceptionPolicy is the allowlist of users who can access sensitive data.- MaskingExceptionPolicy_MaskingException:- type: object- properties:- action:- enum:- - ACTION_UNSPECIFIED- - QUERY- - EXPORT- type: string- description: action is the action that the user can access sensitive data.- format: enum- member:- type: string- description: |-- Member is the principal who bind to this exception policy instance.-- Format: users/{userUID} or groups/{group email}- condition:- allOf:- - $ref: '#/components/schemas/Expr'- description: The condition that is associated with this exception policy instance.- MaskingRulePolicy:- type: object- properties:- rules:- type: array- items:- $ref: '#/components/schemas/MaskingRulePolicy_MaskingRule'- MaskingRulePolicy_MaskingRule:- type: object- properties:- id:- type: string- description: A unique identifier for a node in UUID format.- condition:- $ref: '#/components/schemas/Expr'- semanticType:- type: stringMaximumSQLResultSizeSetting:type: objectproperties:@@ -11517,62 +11444,7 @@ components:$ref: '#/components/schemas/Plan_ExportDataConfig'Policy:type: object- properties:- name:- type: string- description: |-- 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.- inheritFromParent:- type: boolean- type:- enum:- - POLICY_TYPE_UNSPECIFIED- - ROLLOUT_POLICY- - DISABLE_COPY_DATA- - MASKING_RULE- - MASKING_EXCEPTION- - RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW- - TAG- - DATA_SOURCE_QUERY- - DATA_EXPORT- - DATA_QUERY- type: string- format: enum- rolloutPolicy:- $ref: '#/components/schemas/RolloutPolicy'- disableCopyDataPolicy:- $ref: '#/components/schemas/DisableCopyDataPolicy'- maskingRulePolicy:- $ref: '#/components/schemas/MaskingRulePolicy'- maskingExceptionPolicy:- $ref: '#/components/schemas/MaskingExceptionPolicy'- restrictIssueCreationForSqlReviewPolicy:- $ref: '#/components/schemas/RestrictIssueCreationForSQLReviewPolicy'- tagPolicy:- $ref: '#/components/schemas/TagPolicy'- dataSourceQueryPolicy:- $ref: '#/components/schemas/DataSourceQueryPolicy'- exportDataPolicy:- $ref: '#/components/schemas/ExportDataPolicy'- queryDataPolicy:- $ref: '#/components/schemas/QueryDataPolicy'- enforce:- type: boolean- resourceType:- readOnly: true- enum:- - RESOURCE_TYPE_UNSPECIFIED- - WORKSPACE- - ENVIRONMENT- - PROJECT- type: string- description: The resource type for the policy.- format: enum+ properties: {}Position:type: objectproperties:@@ -11783,14 +11655,6 @@ components:type: integerdescription: The maximum number of retries for the lock timeout issue.format: int32- QueryDataPolicy:- type: object- properties:- timeout:- pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$- type: string- description: The query timeout duration.- description: QueryDataPolicy is the policy configuration for querying data.QueryHistory:type: objectproperties:@@ -12189,11 +12053,6 @@ components:description: The branding logo.format: bytesdescription: The theme resources.- RestrictIssueCreationForSQLReviewPolicy:- type: object- properties:- disallow:- type: booleanResult_SqlReviewReport:type: objectproperties:@@ -12463,22 +12322,6 @@ components:description: |-The issue associated with the rollout. Could be empty.Format: projects/{project}/issues/{issue}- RolloutPolicy:- type: object- properties:- automatic:- type: boolean- roles:- type: array- items:- type: string- issueRoles:- type: array- items:- type: string- description: |-- roles/LAST_APPROVER- roles/CREATORRowValue:type: objectproperties:@@ -13596,16 +13439,6 @@ components:items:$ref: '#/components/schemas/CheckConstraintMetadata'description: TablePartitionMetadata is the metadata for table partitions.- TagPolicy:- type: object- properties:- tags:- type: object- additionalProperties:- type: string- description: |-- tags is the key - value map for resources.- for example, the environment resource can have the sql review config tag, like "bb.tag.review_config": "reviewConfigs/{review config resource id}"Task:type: objectproperties:diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 9fac5c7a9e..d724f3b886 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -201,6 +201,7 @@- [MaskingExceptionPolicy.MaskingException](#bytebase-store-MaskingExceptionPolicy-MaskingException)- [MaskingRulePolicy](#bytebase-store-MaskingRulePolicy)- [MaskingRulePolicy.MaskingRule](#bytebase-store-MaskingRulePolicy-MaskingRule)+ - [Policy](#bytebase-store-Policy)- [QueryDataPolicy](#bytebase-store-QueryDataPolicy)- [RestrictIssueCreationForSQLReviewPolicy](#bytebase-store-RestrictIssueCreationForSQLReviewPolicy)- [RolloutPolicy](#bytebase-store-RolloutPolicy)@@ -211,7 +212,8 @@- [DataSourceQueryPolicy.Restriction](#bytebase-store-DataSourceQueryPolicy-Restriction)- [EnvironmentTierPolicy.EnvironmentTier](#bytebase-store-EnvironmentTierPolicy-EnvironmentTier)- [MaskingExceptionPolicy.MaskingException.Action](#bytebase-store-MaskingExceptionPolicy-MaskingException-Action)- - [PolicyType](#bytebase-store-PolicyType)+ - [Policy.Resource](#bytebase-store-Policy-Resource)+ - [Policy.Type](#bytebase-store-Policy-Type)- [SQLReviewRuleLevel](#bytebase-store-SQLReviewRuleLevel)- [store/project.proto](#store_project-proto)@@ -3315,6 +3317,16 @@ Format: users/{userUID} or groups/{group email} |+<a name="bytebase-store-Policy"></a>++### Policy+++++++<a name="bytebase-store-QueryDataPolicy"></a>### QueryDataPolicy@@ -3453,14 +3465,28 @@ RestrictIssueCreationForSQLReviewPolicy is the policy configuration for restrict-<a name="bytebase-store-PolicyType"></a>+<a name="bytebase-store-Policy-Resource"></a>++### Policy.Resource+++| Name | Number | Description |+| ---- | ------ | ----------- |+| RESOURCE_UNSPECIFIED | 0 | |+| WORKSPACE | 1 | |+| ENVIRONMENT | 2 | |+| PROJECT | 3 | |-### PolicyType+++<a name="bytebase-store-Policy-Type"></a>++### Policy.Type| Name | Number | Description || ---- | ------ | ----------- |-| POLICY_TYPE_UNSPECIFIED | 0 | |+| TYPE_UNSPECIFIED | 0 | || ROLLOUT | 1 | || MASKING_EXCEPTION | 2 | || DISABLE_COPY_DATA | 3 | |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 72cfbb0c8c..e6aa731955 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -972,6 +972,10 @@<a href="#bytebase.store.MaskingRulePolicy.MaskingRule"><span class="badge">M</span>MaskingRulePolicy.MaskingRule</a></li>+ <li>+ <a href="#bytebase.store.Policy"><span class="badge">M</span>Policy</a>+ </li>+<li><a href="#bytebase.store.QueryDataPolicy"><span class="badge">M</span>QueryDataPolicy</a></li>@@ -1010,7 +1014,11 @@</li><li>- <a href="#bytebase.store.PolicyType"><span class="badge">E</span>PolicyType</a>+ <a href="#bytebase.store.Policy.Resource"><span class="badge">E</span>Policy.Resource</a>+ </li>++ <li>+ <a href="#bytebase.store.Policy.Type"><span class="badge">E</span>Policy.Type</a></li><li>@@ -9080,6 +9088,13 @@ Format: users/{userUID} or groups/{group email} </p></td>+ <h3 id="bytebase.store.Policy">Policy</h3>+ <p></p>+++++<h3 id="bytebase.store.QueryDataPolicy">QueryDataPolicy</h3><p>QueryDataPolicy is the policy configuration for querying data.</p>@@ -9364,7 +9379,42 @@ for example, the environment resource can have the sql review config tag, like &</tbody></table>- <h3 id="bytebase.store.PolicyType">PolicyType</h3>+ <h3 id="bytebase.store.Policy.Resource">Policy.Resource</h3>+ <p></p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>RESOURCE_UNSPECIFIED</td>+ <td>0</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>WORKSPACE</td>+ <td>1</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>ENVIRONMENT</td>+ <td>2</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>PROJECT</td>+ <td>3</td>+ <td><p></p></td>+ </tr>++ </tbody>+ </table>++ <h3 id="bytebase.store.Policy.Type">Policy.Type</h3><p></p><table class="enum-table"><thead>@@ -9373,7 +9423,7 @@ for example, the environment resource can have the sql review config tag, like &<tbody><tr>- <td>POLICY_TYPE_UNSPECIFIED</td>+ <td>TYPE_UNSPECIFIED</td><td>0</td><td><p></p></td></tr>diff --git a/proto/generated-go/store/policy.pb.go b/proto/generated-go/store/policy.pb.goindex 0cc850dc39..bf269e794e 100644--- a/proto/generated-go/store/policy.pb.go+++ b/proto/generated-go/store/policy.pb.go@@ -23,26 +23,78 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-type PolicyType int32+type SQLReviewRuleLevel int32++const (+ SQLReviewRuleLevel_LEVEL_UNSPECIFIED SQLReviewRuleLevel = 0+ SQLReviewRuleLevel_ERROR SQLReviewRuleLevel = 1+ SQLReviewRuleLevel_WARNING SQLReviewRuleLevel = 2+ SQLReviewRuleLevel_DISABLED SQLReviewRuleLevel = 3+)++// Enum value maps for SQLReviewRuleLevel.+var (+ SQLReviewRuleLevel_name = map[int32]string{+ 0: "LEVEL_UNSPECIFIED",+ 1: "ERROR",+ 2: "WARNING",+ 3: "DISABLED",+ }+ SQLReviewRuleLevel_value = map[string]int32{+ "LEVEL_UNSPECIFIED": 0,+ "ERROR": 1,+ "WARNING": 2,+ "DISABLED": 3,+ }+)++func (x SQLReviewRuleLevel) Enum() *SQLReviewRuleLevel {+ p := new(SQLReviewRuleLevel)+ *p = x+ return p+}++func (x SQLReviewRuleLevel) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (SQLReviewRuleLevel) Descriptor() protoreflect.EnumDescriptor {+ return file_store_policy_proto_enumTypes[0].Descriptor()+}++func (SQLReviewRuleLevel) Type() protoreflect.EnumType {+ return &file_store_policy_proto_enumTypes[0]+}++func (x SQLReviewRuleLevel) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use SQLReviewRuleLevel.Descriptor instead.+func (SQLReviewRuleLevel) EnumDescriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{0}+}++type Policy_Type int32const (- PolicyType_POLICY_TYPE_UNSPECIFIED PolicyType = 0- PolicyType_ROLLOUT PolicyType = 1- PolicyType_MASKING_EXCEPTION PolicyType = 2- PolicyType_DISABLE_COPY_DATA PolicyType = 3- PolicyType_EXPORT_DATA PolicyType = 4- PolicyType_QUERY_DATA PolicyType = 5- PolicyType_MASKING_RULE PolicyType = 6- PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW PolicyType = 7- PolicyType_IAM PolicyType = 8- PolicyType_TAG PolicyType = 9- PolicyType_DATA_SOURCE_QUERY PolicyType = 10+ Policy_TYPE_UNSPECIFIED Policy_Type = 0+ Policy_ROLLOUT Policy_Type = 1+ Policy_MASKING_EXCEPTION Policy_Type = 2+ Policy_DISABLE_COPY_DATA Policy_Type = 3+ Policy_EXPORT_DATA Policy_Type = 4+ Policy_QUERY_DATA Policy_Type = 5+ Policy_MASKING_RULE Policy_Type = 6+ Policy_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW Policy_Type = 7+ Policy_IAM Policy_Type = 8+ Policy_TAG Policy_Type = 9+ Policy_DATA_SOURCE_QUERY Policy_Type = 10)-// Enum value maps for PolicyType.+// Enum value maps for Policy_Type.var (- PolicyType_name = map[int32]string{- 0: "POLICY_TYPE_UNSPECIFIED",+ Policy_Type_name = map[int32]string{+ 0: "TYPE_UNSPECIFIED",1: "ROLLOUT",2: "MASKING_EXCEPTION",3: "DISABLE_COPY_DATA",@@ -54,8 +106,8 @@ var (9: "TAG",10: "DATA_SOURCE_QUERY",}- PolicyType_value = map[string]int32{- "POLICY_TYPE_UNSPECIFIED": 0,+ Policy_Type_value = map[string]int32{+ "TYPE_UNSPECIFIED": 0,"ROLLOUT": 1,"MASKING_EXCEPTION": 2,"DISABLE_COPY_DATA": 3,@@ -69,83 +121,83 @@ var (})-func (x PolicyType) Enum() *PolicyType {- p := new(PolicyType)+func (x Policy_Type) Enum() *Policy_Type {+ p := new(Policy_Type)*p = xreturn p}-func (x PolicyType) String() string {+func (x Policy_Type) String() string {return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))}-func (PolicyType) Descriptor() protoreflect.EnumDescriptor {- return file_store_policy_proto_enumTypes[0].Descriptor()+func (Policy_Type) Descriptor() protoreflect.EnumDescriptor {+ return file_store_policy_proto_enumTypes[1].Descriptor()}-func (PolicyType) Type() protoreflect.EnumType {- return &file_store_policy_proto_enumTypes[0]+func (Policy_Type) Type() protoreflect.EnumType {+ return &file_store_policy_proto_enumTypes[1]}-func (x PolicyType) Number() protoreflect.EnumNumber {+func (x Policy_Type) Number() protoreflect.EnumNumber {return protoreflect.EnumNumber(x)}-// Deprecated: Use PolicyType.Descriptor instead.-func (PolicyType) EnumDescriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{0}+// Deprecated: Use Policy_Type.Descriptor instead.+func (Policy_Type) EnumDescriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{0, 0}}-type SQLReviewRuleLevel int32+type Policy_Resource int32const (- SQLReviewRuleLevel_LEVEL_UNSPECIFIED SQLReviewRuleLevel = 0- SQLReviewRuleLevel_ERROR SQLReviewRuleLevel = 1- SQLReviewRuleLevel_WARNING SQLReviewRuleLevel = 2- SQLReviewRuleLevel_DISABLED SQLReviewRuleLevel = 3+ Policy_RESOURCE_UNSPECIFIED Policy_Resource = 0+ Policy_WORKSPACE Policy_Resource = 1+ Policy_ENVIRONMENT Policy_Resource = 2+ Policy_PROJECT Policy_Resource = 3)-// Enum value maps for SQLReviewRuleLevel.+// Enum value maps for Policy_Resource.var (- SQLReviewRuleLevel_name = map[int32]string{- 0: "LEVEL_UNSPECIFIED",- 1: "ERROR",- 2: "WARNING",- 3: "DISABLED",+ Policy_Resource_name = map[int32]string{+ 0: "RESOURCE_UNSPECIFIED",+ 1: "WORKSPACE",+ 2: "ENVIRONMENT",+ 3: "PROJECT",}- SQLReviewRuleLevel_value = map[string]int32{- "LEVEL_UNSPECIFIED": 0,- "ERROR": 1,- "WARNING": 2,- "DISABLED": 3,+ Policy_Resource_value = map[string]int32{+ "RESOURCE_UNSPECIFIED": 0,+ "WORKSPACE": 1,+ "ENVIRONMENT": 2,+ "PROJECT": 3,})-func (x SQLReviewRuleLevel) Enum() *SQLReviewRuleLevel {- p := new(SQLReviewRuleLevel)+func (x Policy_Resource) Enum() *Policy_Resource {+ p := new(Policy_Resource)*p = xreturn p}-func (x SQLReviewRuleLevel) String() string {+func (x Policy_Resource) String() string {return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))}-func (SQLReviewRuleLevel) Descriptor() protoreflect.EnumDescriptor {- return file_store_policy_proto_enumTypes[1].Descriptor()+func (Policy_Resource) Descriptor() protoreflect.EnumDescriptor {+ return file_store_policy_proto_enumTypes[2].Descriptor()}-func (SQLReviewRuleLevel) Type() protoreflect.EnumType {- return &file_store_policy_proto_enumTypes[1]+func (Policy_Resource) Type() protoreflect.EnumType {+ return &file_store_policy_proto_enumTypes[2]}-func (x SQLReviewRuleLevel) Number() protoreflect.EnumNumber {+func (x Policy_Resource) Number() protoreflect.EnumNumber {return protoreflect.EnumNumber(x)}-// Deprecated: Use SQLReviewRuleLevel.Descriptor instead.-func (SQLReviewRuleLevel) EnumDescriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{1}+// Deprecated: Use Policy_Resource.Descriptor instead.+func (Policy_Resource) EnumDescriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{0, 1}}type MaskingExceptionPolicy_MaskingException_Action int32@@ -181,11 +233,11 @@ func (x MaskingExceptionPolicy_MaskingException_Action) String() string {}func (MaskingExceptionPolicy_MaskingException_Action) Descriptor() protoreflect.EnumDescriptor {- return file_store_policy_proto_enumTypes[2].Descriptor()+ return file_store_policy_proto_enumTypes[3].Descriptor()}func (MaskingExceptionPolicy_MaskingException_Action) Type() protoreflect.EnumType {- return &file_store_policy_proto_enumTypes[2]+ return &file_store_policy_proto_enumTypes[3]}func (x MaskingExceptionPolicy_MaskingException_Action) Number() protoreflect.EnumNumber {@@ -194,7 +246,7 @@ func (x MaskingExceptionPolicy_MaskingException_Action) Number() protoreflect.En// Deprecated: Use MaskingExceptionPolicy_MaskingException_Action.Descriptor instead.func (MaskingExceptionPolicy_MaskingException_Action) EnumDescriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{1, 0, 0}+ return file_store_policy_proto_rawDescGZIP(), []int{2, 0, 0}}type EnvironmentTierPolicy_EnvironmentTier int32@@ -230,11 +282,11 @@ func (x EnvironmentTierPolicy_EnvironmentTier) String() string {}func (EnvironmentTierPolicy_EnvironmentTier) Descriptor() protoreflect.EnumDescriptor {- return file_store_policy_proto_enumTypes[3].Descriptor()+ return file_store_policy_proto_enumTypes[4].Descriptor()}func (EnvironmentTierPolicy_EnvironmentTier) Type() protoreflect.EnumType {- return &file_store_policy_proto_enumTypes[3]+ return &file_store_policy_proto_enumTypes[4]}func (x EnvironmentTierPolicy_EnvironmentTier) Number() protoreflect.EnumNumber {@@ -243,7 +295,7 @@ func (x EnvironmentTierPolicy_EnvironmentTier) Number() protoreflect.EnumNumber// Deprecated: Use EnvironmentTierPolicy_EnvironmentTier.Descriptor instead.func (EnvironmentTierPolicy_EnvironmentTier) EnumDescriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{7, 0}+ return file_store_policy_proto_rawDescGZIP(), []int{8, 0}}type DataSourceQueryPolicy_Restriction int32@@ -281,11 +333,11 @@ func (x DataSourceQueryPolicy_Restriction) String() string {}func (DataSourceQueryPolicy_Restriction) Descriptor() protoreflect.EnumDescriptor {- return file_store_policy_proto_enumTypes[4].Descriptor()+ return file_store_policy_proto_enumTypes[5].Descriptor()}func (DataSourceQueryPolicy_Restriction) Type() protoreflect.EnumType {- return &file_store_policy_proto_enumTypes[4]+ return &file_store_policy_proto_enumTypes[5]}func (x DataSourceQueryPolicy_Restriction) Number() protoreflect.EnumNumber {@@ -294,7 +346,43 @@ func (x DataSourceQueryPolicy_Restriction) Number() protoreflect.EnumNumber {// Deprecated: Use DataSourceQueryPolicy_Restriction.Descriptor instead.func (DataSourceQueryPolicy_Restriction) EnumDescriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{12, 0}+ return file_store_policy_proto_rawDescGZIP(), []int{13, 0}+}++type Policy struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *Policy) Reset() {+ *x = Policy{}+ mi := &file_store_policy_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *Policy) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Policy) ProtoMessage() {}++func (x *Policy) ProtoReflect() protoreflect.Message {+ mi := &file_store_policy_proto_msgTypes[0]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use Policy.ProtoReflect.Descriptor instead.+func (*Policy) Descriptor() ([]byte, []int) {+ return file_store_policy_proto_rawDescGZIP(), []int{0}}type RolloutPolicy struct {@@ -310,7 +398,7 @@ type RolloutPolicy struct {func (x *RolloutPolicy) Reset() {*x = RolloutPolicy{}- mi := &file_store_policy_proto_msgTypes[0]+ mi := &file_store_policy_proto_msgTypes[1]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -322,7 +410,7 @@ func (x *RolloutPolicy) String() string {func (*RolloutPolicy) ProtoMessage() {}func (x *RolloutPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[0]+ mi := &file_store_policy_proto_msgTypes[1]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -335,7 +423,7 @@ func (x *RolloutPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use RolloutPolicy.ProtoReflect.Descriptor instead.func (*RolloutPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{0}+ return file_store_policy_proto_rawDescGZIP(), []int{1}}func (x *RolloutPolicy) GetAutomatic() bool {@@ -369,7 +457,7 @@ type MaskingExceptionPolicy struct {func (x *MaskingExceptionPolicy) Reset() {*x = MaskingExceptionPolicy{}- mi := &file_store_policy_proto_msgTypes[1]+ mi := &file_store_policy_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -381,7 +469,7 @@ func (x *MaskingExceptionPolicy) String() string {func (*MaskingExceptionPolicy) ProtoMessage() {}func (x *MaskingExceptionPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[1]+ mi := &file_store_policy_proto_msgTypes[2]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -394,7 +482,7 @@ func (x *MaskingExceptionPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use MaskingExceptionPolicy.ProtoReflect.Descriptor instead.func (*MaskingExceptionPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{1}+ return file_store_policy_proto_rawDescGZIP(), []int{2}}func (x *MaskingExceptionPolicy) GetMaskingExceptions() []*MaskingExceptionPolicy_MaskingException {@@ -413,7 +501,7 @@ type MaskingRulePolicy struct {func (x *MaskingRulePolicy) Reset() {*x = MaskingRulePolicy{}- mi := &file_store_policy_proto_msgTypes[2]+ mi := &file_store_policy_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -425,7 +513,7 @@ func (x *MaskingRulePolicy) String() string {func (*MaskingRulePolicy) ProtoMessage() {}func (x *MaskingRulePolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[2]+ mi := &file_store_policy_proto_msgTypes[3]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -438,7 +526,7 @@ func (x *MaskingRulePolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use MaskingRulePolicy.ProtoReflect.Descriptor instead.func (*MaskingRulePolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{2}+ return file_store_policy_proto_rawDescGZIP(), []int{3}}func (x *MaskingRulePolicy) GetRules() []*MaskingRulePolicy_MaskingRule {@@ -461,7 +549,7 @@ type SQLReviewRule struct {func (x *SQLReviewRule) Reset() {*x = SQLReviewRule{}- mi := &file_store_policy_proto_msgTypes[3]+ mi := &file_store_policy_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -473,7 +561,7 @@ func (x *SQLReviewRule) String() string {func (*SQLReviewRule) ProtoMessage() {}func (x *SQLReviewRule) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[3]+ mi := &file_store_policy_proto_msgTypes[4]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -486,7 +574,7 @@ func (x *SQLReviewRule) ProtoReflect() protoreflect.Message {// Deprecated: Use SQLReviewRule.ProtoReflect.Descriptor instead.func (*SQLReviewRule) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{3}+ return file_store_policy_proto_rawDescGZIP(), []int{4}}func (x *SQLReviewRule) GetType() string {@@ -535,7 +623,7 @@ type TagPolicy struct {func (x *TagPolicy) Reset() {*x = TagPolicy{}- mi := &file_store_policy_proto_msgTypes[4]+ mi := &file_store_policy_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -547,7 +635,7 @@ func (x *TagPolicy) String() string {func (*TagPolicy) ProtoMessage() {}func (x *TagPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[4]+ mi := &file_store_policy_proto_msgTypes[5]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -560,7 +648,7 @@ func (x *TagPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use TagPolicy.ProtoReflect.Descriptor instead.func (*TagPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{4}+ return file_store_policy_proto_rawDescGZIP(), []int{5}}func (x *TagPolicy) GetTags() map[string]string {@@ -589,7 +677,7 @@ type Binding struct {func (x *Binding) Reset() {*x = Binding{}- mi := &file_store_policy_proto_msgTypes[5]+ mi := &file_store_policy_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -601,7 +689,7 @@ func (x *Binding) String() string {func (*Binding) ProtoMessage() {}func (x *Binding) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[5]+ mi := &file_store_policy_proto_msgTypes[6]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -614,7 +702,7 @@ func (x *Binding) ProtoReflect() protoreflect.Message {// Deprecated: Use Binding.ProtoReflect.Descriptor instead.func (*Binding) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{5}+ return file_store_policy_proto_rawDescGZIP(), []int{6}}func (x *Binding) GetRole() string {@@ -649,7 +737,7 @@ type IamPolicy struct {func (x *IamPolicy) Reset() {*x = IamPolicy{}- mi := &file_store_policy_proto_msgTypes[6]+ mi := &file_store_policy_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -661,7 +749,7 @@ func (x *IamPolicy) String() string {func (*IamPolicy) ProtoMessage() {}func (x *IamPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[6]+ mi := &file_store_policy_proto_msgTypes[7]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -674,7 +762,7 @@ func (x *IamPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use IamPolicy.ProtoReflect.Descriptor instead.func (*IamPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{6}+ return file_store_policy_proto_rawDescGZIP(), []int{7}}func (x *IamPolicy) GetBindings() []*Binding {@@ -695,7 +783,7 @@ type EnvironmentTierPolicy struct {func (x *EnvironmentTierPolicy) Reset() {*x = EnvironmentTierPolicy{}- mi := &file_store_policy_proto_msgTypes[7]+ mi := &file_store_policy_proto_msgTypes[8]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -707,7 +795,7 @@ func (x *EnvironmentTierPolicy) String() string {func (*EnvironmentTierPolicy) ProtoMessage() {}func (x *EnvironmentTierPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[7]+ mi := &file_store_policy_proto_msgTypes[8]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -720,7 +808,7 @@ func (x *EnvironmentTierPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use EnvironmentTierPolicy.ProtoReflect.Descriptor instead.func (*EnvironmentTierPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{7}+ return file_store_policy_proto_rawDescGZIP(), []int{8}}func (x *EnvironmentTierPolicy) GetEnvironmentTier() EnvironmentTierPolicy_EnvironmentTier {@@ -747,7 +835,7 @@ type DisableCopyDataPolicy struct {func (x *DisableCopyDataPolicy) Reset() {*x = DisableCopyDataPolicy{}- mi := &file_store_policy_proto_msgTypes[8]+ mi := &file_store_policy_proto_msgTypes[9]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -759,7 +847,7 @@ func (x *DisableCopyDataPolicy) String() string {func (*DisableCopyDataPolicy) ProtoMessage() {}func (x *DisableCopyDataPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[8]+ mi := &file_store_policy_proto_msgTypes[9]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -772,7 +860,7 @@ func (x *DisableCopyDataPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use DisableCopyDataPolicy.ProtoReflect.Descriptor instead.func (*DisableCopyDataPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{8}+ return file_store_policy_proto_rawDescGZIP(), []int{9}}func (x *DisableCopyDataPolicy) GetActive() bool {@@ -792,7 +880,7 @@ type ExportDataPolicy struct {func (x *ExportDataPolicy) Reset() {*x = ExportDataPolicy{}- mi := &file_store_policy_proto_msgTypes[9]+ mi := &file_store_policy_proto_msgTypes[10]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -804,7 +892,7 @@ func (x *ExportDataPolicy) String() string {func (*ExportDataPolicy) ProtoMessage() {}func (x *ExportDataPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[9]+ mi := &file_store_policy_proto_msgTypes[10]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -817,7 +905,7 @@ func (x *ExportDataPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use ExportDataPolicy.ProtoReflect.Descriptor instead.func (*ExportDataPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{9}+ return file_store_policy_proto_rawDescGZIP(), []int{10}}func (x *ExportDataPolicy) GetDisable() bool {@@ -838,7 +926,7 @@ type QueryDataPolicy struct {func (x *QueryDataPolicy) Reset() {*x = QueryDataPolicy{}- mi := &file_store_policy_proto_msgTypes[10]+ mi := &file_store_policy_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -850,7 +938,7 @@ func (x *QueryDataPolicy) String() string {func (*QueryDataPolicy) ProtoMessage() {}func (x *QueryDataPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[10]+ mi := &file_store_policy_proto_msgTypes[11]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -863,7 +951,7 @@ func (x *QueryDataPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use QueryDataPolicy.ProtoReflect.Descriptor instead.func (*QueryDataPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{10}+ return file_store_policy_proto_rawDescGZIP(), []int{11}}func (x *QueryDataPolicy) GetTimeout() *durationpb.Duration {@@ -883,7 +971,7 @@ type RestrictIssueCreationForSQLReviewPolicy struct {func (x *RestrictIssueCreationForSQLReviewPolicy) Reset() {*x = RestrictIssueCreationForSQLReviewPolicy{}- mi := &file_store_policy_proto_msgTypes[11]+ mi := &file_store_policy_proto_msgTypes[12]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -895,7 +983,7 @@ func (x *RestrictIssueCreationForSQLReviewPolicy) String() string {func (*RestrictIssueCreationForSQLReviewPolicy) ProtoMessage() {}func (x *RestrictIssueCreationForSQLReviewPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[11]+ mi := &file_store_policy_proto_msgTypes[12]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -908,7 +996,7 @@ func (x *RestrictIssueCreationForSQLReviewPolicy) ProtoReflect() protoreflect.Me// Deprecated: Use RestrictIssueCreationForSQLReviewPolicy.ProtoReflect.Descriptor instead.func (*RestrictIssueCreationForSQLReviewPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{11}+ return file_store_policy_proto_rawDescGZIP(), []int{12}}func (x *RestrictIssueCreationForSQLReviewPolicy) GetDisallow() bool {@@ -932,7 +1020,7 @@ type DataSourceQueryPolicy struct {func (x *DataSourceQueryPolicy) Reset() {*x = DataSourceQueryPolicy{}- mi := &file_store_policy_proto_msgTypes[12]+ mi := &file_store_policy_proto_msgTypes[13]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -944,7 +1032,7 @@ func (x *DataSourceQueryPolicy) String() string {func (*DataSourceQueryPolicy) ProtoMessage() {}func (x *DataSourceQueryPolicy) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[12]+ mi := &file_store_policy_proto_msgTypes[13]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -957,7 +1045,7 @@ func (x *DataSourceQueryPolicy) ProtoReflect() protoreflect.Message {// Deprecated: Use DataSourceQueryPolicy.ProtoReflect.Descriptor instead.func (*DataSourceQueryPolicy) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{12}+ return file_store_policy_proto_rawDescGZIP(), []int{13}}func (x *DataSourceQueryPolicy) GetAdminDataSourceRestriction() DataSourceQueryPolicy_Restriction {@@ -997,7 +1085,7 @@ type MaskingExceptionPolicy_MaskingException struct {func (x *MaskingExceptionPolicy_MaskingException) Reset() {*x = MaskingExceptionPolicy_MaskingException{}- mi := &file_store_policy_proto_msgTypes[13]+ mi := &file_store_policy_proto_msgTypes[14]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1009,7 +1097,7 @@ func (x *MaskingExceptionPolicy_MaskingException) String() string {func (*MaskingExceptionPolicy_MaskingException) ProtoMessage() {}func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[13]+ mi := &file_store_policy_proto_msgTypes[14]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1022,7 +1110,7 @@ func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Me// Deprecated: Use MaskingExceptionPolicy_MaskingException.ProtoReflect.Descriptor instead.func (*MaskingExceptionPolicy_MaskingException) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{1, 0}+ return file_store_policy_proto_rawDescGZIP(), []int{2, 0}}func (x *MaskingExceptionPolicy_MaskingException) GetAction() MaskingExceptionPolicy_MaskingException_Action {@@ -1058,7 +1146,7 @@ type MaskingRulePolicy_MaskingRule struct {func (x *MaskingRulePolicy_MaskingRule) Reset() {*x = MaskingRulePolicy_MaskingRule{}- mi := &file_store_policy_proto_msgTypes[14]+ mi := &file_store_policy_proto_msgTypes[15]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1070,7 +1158,7 @@ func (x *MaskingRulePolicy_MaskingRule) String() string {func (*MaskingRulePolicy_MaskingRule) ProtoMessage() {}func (x *MaskingRulePolicy_MaskingRule) ProtoReflect() protoreflect.Message {- mi := &file_store_policy_proto_msgTypes[14]+ mi := &file_store_policy_proto_msgTypes[15]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1083,7 +1171,7 @@ func (x *MaskingRulePolicy_MaskingRule) ProtoReflect() protoreflect.Message {// Deprecated: Use MaskingRulePolicy_MaskingRule.ProtoReflect.Descriptor instead.func (*MaskingRulePolicy_MaskingRule) Descriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{2, 0}+ return file_store_policy_proto_rawDescGZIP(), []int{3, 0}}func (x *MaskingRulePolicy_MaskingRule) GetId() string {@@ -1111,7 +1199,27 @@ var File_store_policy_proto protoreflect.FileDescriptorconst file_store_policy_proto_rawDesc = "" +"\n" +- "\x12store/policy.proto\x12\x0ebytebase.store\x1a\x1egoogle/protobuf/duration.proto\x1a\x16google/type/expr.proto\x1a\x12store/common.proto\"d\n" ++ "\x12store/policy.proto\x12\x0ebytebase.store\x1a\x1egoogle/protobuf/duration.proto\x1a\x16google/type/expr.proto\x1a\x12store/common.proto\"\xbd\x02\n" ++ "\x06Policy\"\xdf\x01\n" ++ "\x04Type\x12\x14\n" ++ "\x10TYPE_UNSPECIFIED\x10\x00\x12\v\n" ++ "\aROLLOUT\x10\x01\x12\x15\n" ++ "\x11MASKING_EXCEPTION\x10\x02\x12\x15\n" ++ "\x11DISABLE_COPY_DATA\x10\x03\x12\x0f\n" ++ "\vEXPORT_DATA\x10\x04\x12\x0e\n" ++ "\n" ++ "QUERY_DATA\x10\x05\x12\x10\n" ++ "\fMASKING_RULE\x10\x06\x12*\n" ++ "&RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW\x10\a\x12\a\n" ++ "\x03IAM\x10\b\x12\a\n" ++ "\x03TAG\x10\t\x12\x15\n" ++ "\x11DATA_SOURCE_QUERY\x10\n" ++ "\"Q\n" ++ "\bResource\x12\x18\n" ++ "\x14RESOURCE_UNSPECIFIED\x10\x00\x12\r\n" ++ "\tWORKSPACE\x10\x01\x12\x0f\n" ++ "\vENVIRONMENT\x10\x02\x12\v\n" ++ "\aPROJECT\x10\x03\"d\n" +"\rRolloutPolicy\x12\x1c\n" +"\tautomatic\x18\x01 \x01(\bR\tautomatic\x12\x14\n" +"\x05roles\x18\x02 \x03(\tR\x05roles\x12\x1f\n" +@@ -1173,22 +1281,7 @@ const file_store_policy_proto_rawDesc = "" +"\vRestriction\x12\x1b\n" +"\x17RESTRICTION_UNSPECIFIED\x10\x00\x12\f\n" +"\bFALLBACK\x10\x01\x12\f\n" +- "\bDISALLOW\x10\x02*\xec\x01\n" +- "\n" +- "PolicyType\x12\x1b\n" +- "\x17POLICY_TYPE_UNSPECIFIED\x10\x00\x12\v\n" +- "\aROLLOUT\x10\x01\x12\x15\n" +- "\x11MASKING_EXCEPTION\x10\x02\x12\x15\n" +- "\x11DISABLE_COPY_DATA\x10\x03\x12\x0f\n" +- "\vEXPORT_DATA\x10\x04\x12\x0e\n" +- "\n" +- "QUERY_DATA\x10\x05\x12\x10\n" +- "\fMASKING_RULE\x10\x06\x12*\n" +- "&RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW\x10\a\x12\a\n" +- "\x03IAM\x10\b\x12\a\n" +- "\x03TAG\x10\t\x12\x15\n" +- "\x11DATA_SOURCE_QUERY\x10\n" +- "*Q\n" ++ "\bDISALLOW\x10\x02*Q\n" +"\x12SQLReviewRuleLevel\x12\x15\n" +"\x11LEVEL_UNSPECIFIED\x10\x00\x12\t\n" +"\x05ERROR\x10\x01\x12\v\n" +@@ -1207,48 +1300,50 @@ func file_store_policy_proto_rawDescGZIP() []byte {return file_store_policy_proto_rawDescData}-var file_store_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 5)-var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 16)+var file_store_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 6)+var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 17)var file_store_policy_proto_goTypes = []any{- (PolicyType)(0), // 0: bytebase.store.PolicyType- (SQLReviewRuleLevel)(0), // 1: bytebase.store.SQLReviewRuleLevel- (MaskingExceptionPolicy_MaskingException_Action)(0), // 2: bytebase.store.MaskingExceptionPolicy.MaskingException.Action- (EnvironmentTierPolicy_EnvironmentTier)(0), // 3: bytebase.store.EnvironmentTierPolicy.EnvironmentTier- (DataSourceQueryPolicy_Restriction)(0), // 4: bytebase.store.DataSourceQueryPolicy.Restriction- (*RolloutPolicy)(nil), // 5: bytebase.store.RolloutPolicy- (*MaskingExceptionPolicy)(nil), // 6: bytebase.store.MaskingExceptionPolicy- (*MaskingRulePolicy)(nil), // 7: bytebase.store.MaskingRulePolicy- (*SQLReviewRule)(nil), // 8: bytebase.store.SQLReviewRule- (*TagPolicy)(nil), // 9: bytebase.store.TagPolicy- (*Binding)(nil), // 10: bytebase.store.Binding- (*IamPolicy)(nil), // 11: bytebase.store.IamPolicy- (*EnvironmentTierPolicy)(nil), // 12: bytebase.store.EnvironmentTierPolicy- (*DisableCopyDataPolicy)(nil), // 13: bytebase.store.DisableCopyDataPolicy- (*ExportDataPolicy)(nil), // 14: bytebase.store.ExportDataPolicy- (*QueryDataPolicy)(nil), // 15: bytebase.store.QueryDataPolicy- (*RestrictIssueCreationForSQLReviewPolicy)(nil), // 16: bytebase.store.RestrictIssueCreationForSQLReviewPolicy- (*DataSourceQueryPolicy)(nil), // 17: bytebase.store.DataSourceQueryPolicy- (*MaskingExceptionPolicy_MaskingException)(nil), // 18: bytebase.store.MaskingExceptionPolicy.MaskingException- (*MaskingRulePolicy_MaskingRule)(nil), // 19: bytebase.store.MaskingRulePolicy.MaskingRule- nil, // 20: bytebase.store.TagPolicy.TagsEntry- (Engine)(0), // 21: bytebase.store.Engine- (*expr.Expr)(nil), // 22: google.type.Expr- (*durationpb.Duration)(nil), // 23: google.protobuf.Duration+ (SQLReviewRuleLevel)(0), // 0: bytebase.store.SQLReviewRuleLevel+ (Policy_Type)(0), // 1: bytebase.store.Policy.Type+ (Policy_Resource)(0), // 2: bytebase.store.Policy.Resource+ (MaskingExceptionPolicy_MaskingException_Action)(0), // 3: bytebase.store.MaskingExceptionPolicy.MaskingException.Action+ (EnvironmentTierPolicy_EnvironmentTier)(0), // 4: bytebase.store.EnvironmentTierPolicy.EnvironmentTier+ (DataSourceQueryPolicy_Restriction)(0), // 5: bytebase.store.DataSourceQueryPolicy.Restriction+ (*Policy)(nil), // 6: bytebase.store.Policy+ (*RolloutPolicy)(nil), // 7: bytebase.store.RolloutPolicy+ (*MaskingExceptionPolicy)(nil), // 8: bytebase.store.MaskingExceptionPolicy+ (*MaskingRulePolicy)(nil), // 9: bytebase.store.MaskingRulePolicy+ (*SQLReviewRule)(nil), // 10: bytebase.store.SQLReviewRule+ (*TagPolicy)(nil), // 11: bytebase.store.TagPolicy+ (*Binding)(nil), // 12: bytebase.store.Binding+ (*IamPolicy)(nil), // 13: bytebase.store.IamPolicy+ (*EnvironmentTierPolicy)(nil), // 14: bytebase.store.EnvironmentTierPolicy+ (*DisableCopyDataPolicy)(nil), // 15: bytebase.store.DisableCopyDataPolicy+ (*ExportDataPolicy)(nil), // 16: bytebase.store.ExportDataPolicy+ (*QueryDataPolicy)(nil), // 17: bytebase.store.QueryDataPolicy+ (*RestrictIssueCreationForSQLReviewPolicy)(nil), // 18: bytebase.store.RestrictIssueCreationForSQLReviewPolicy+ (*DataSourceQueryPolicy)(nil), // 19: bytebase.store.DataSourceQueryPolicy+ (*MaskingExceptionPolicy_MaskingException)(nil), // 20: bytebase.store.MaskingExceptionPolicy.MaskingException+ (*MaskingRulePolicy_MaskingRule)(nil), // 21: bytebase.store.MaskingRulePolicy.MaskingRule+ nil, // 22: bytebase.store.TagPolicy.TagsEntry+ (Engine)(0), // 23: bytebase.store.Engine+ (*expr.Expr)(nil), // 24: google.type.Expr+ (*durationpb.Duration)(nil), // 25: google.protobuf.Duration}var file_store_policy_proto_depIdxs = []int32{- 18, // 0: bytebase.store.MaskingExceptionPolicy.masking_exceptions:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException- 19, // 1: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule- 1, // 2: bytebase.store.SQLReviewRule.level:type_name -> bytebase.store.SQLReviewRuleLevel- 21, // 3: bytebase.store.SQLReviewRule.engine:type_name -> bytebase.store.Engine- 20, // 4: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry- 22, // 5: bytebase.store.Binding.condition:type_name -> google.type.Expr- 10, // 6: bytebase.store.IamPolicy.bindings:type_name -> bytebase.store.Binding- 3, // 7: bytebase.store.EnvironmentTierPolicy.environment_tier:type_name -> bytebase.store.EnvironmentTierPolicy.EnvironmentTier- 23, // 8: bytebase.store.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration- 4, // 9: bytebase.store.DataSourceQueryPolicy.admin_data_source_restriction:type_name -> bytebase.store.DataSourceQueryPolicy.Restriction- 2, // 10: bytebase.store.MaskingExceptionPolicy.MaskingException.action:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException.Action- 22, // 11: bytebase.store.MaskingExceptionPolicy.MaskingException.condition:type_name -> google.type.Expr- 22, // 12: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr+ 20, // 0: bytebase.store.MaskingExceptionPolicy.masking_exceptions:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException+ 21, // 1: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule+ 0, // 2: bytebase.store.SQLReviewRule.level:type_name -> bytebase.store.SQLReviewRuleLevel+ 23, // 3: bytebase.store.SQLReviewRule.engine:type_name -> bytebase.store.Engine+ 22, // 4: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry+ 24, // 5: bytebase.store.Binding.condition:type_name -> google.type.Expr+ 12, // 6: bytebase.store.IamPolicy.bindings:type_name -> bytebase.store.Binding+ 4, // 7: bytebase.store.EnvironmentTierPolicy.environment_tier:type_name -> bytebase.store.EnvironmentTierPolicy.EnvironmentTier+ 25, // 8: bytebase.store.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration+ 5, // 9: bytebase.store.DataSourceQueryPolicy.admin_data_source_restriction:type_name -> bytebase.store.DataSourceQueryPolicy.Restriction+ 3, // 10: bytebase.store.MaskingExceptionPolicy.MaskingException.action:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException.Action+ 24, // 11: bytebase.store.MaskingExceptionPolicy.MaskingException.condition:type_name -> google.type.Expr+ 24, // 12: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr13, // [13:13] is the sub-list for method output_type13, // [13:13] is the sub-list for method input_type13, // [13:13] is the sub-list for extension type_name@@ -1267,8 +1362,8 @@ func file_store_policy_proto_init() {File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_policy_proto_rawDesc), len(file_store_policy_proto_rawDesc)),- NumEnums: 5,- NumMessages: 16,+ NumEnums: 6,+ NumMessages: 17,NumExtensions: 0,NumServices: 0,},diff --git a/proto/store/store/policy.proto b/proto/store/store/policy.protoindex 7feddc7b24..b62512a70b 100644--- a/proto/store/store/policy.proto+++ b/proto/store/store/policy.proto@@ -8,18 +8,27 @@ import "store/common.proto";option go_package = "generated-go/store";-enum PolicyType {- POLICY_TYPE_UNSPECIFIED = 0;- ROLLOUT = 1;- MASKING_EXCEPTION = 2;- DISABLE_COPY_DATA = 3;- EXPORT_DATA = 4;- QUERY_DATA = 5;- MASKING_RULE = 6;- RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW = 7;- IAM = 8;- TAG = 9;- DATA_SOURCE_QUERY = 10;+message Policy {+ enum Type {+ TYPE_UNSPECIFIED = 0;+ ROLLOUT = 1;+ MASKING_EXCEPTION = 2;+ DISABLE_COPY_DATA = 3;+ EXPORT_DATA = 4;+ QUERY_DATA = 5;+ MASKING_RULE = 6;+ RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW = 7;+ IAM = 8;+ TAG = 9;+ DATA_SOURCE_QUERY = 10;+ }++ enum Resource {+ RESOURCE_UNSPECIFIED = 0;+ WORKSPACE = 1;+ ENVIRONMENT = 2;+ PROJECT = 3;+ }}message RolloutPolicy {