Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: migrate policy to v1 store (#4388)

Danny Xu31884c765858
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.go
index 066a0d7252..b6367e88ac 100644
--- a/backend/api/v1/org_policy_service.go
+++ b/backend/api/v1/org_policy_service.go
@@ -87,6 +87,7 @@ func (s *OrgPolicyService) CreatePolicy(ctx context.Context, request *v1pb.Creat
return nil, status.Errorf(codes.InvalidArgument, "policy must be set")
}
+ // TODO(d): validate policy.
return s.createPolicyMessage(ctx, principalID, request.Parent, request.Policy)
}
@@ -126,6 +127,8 @@ func (s *OrgPolicyService) UpdatePolicy(ctx context.Context, request *v1pb.Updat
return nil, status.Errorf(codes.InvalidArgument, "invalid policy %v", err.Error())
}
patch.Payload = &payloadStr
+ case "policy.enforce":
+ patch.Enforce = &request.Policy.Enforce
}
}
@@ -317,6 +320,8 @@ func (s *OrgPolicyService) createPolicyMessage(ctx context.Context, creatorID in
Payload: payloadStr,
Type: policyType,
InheritFromParent: policy.InheritFromParent,
+ // Enforce cannot be false while creating a policy.
+ Enforce: true,
}, creatorID)
if err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
@@ -371,6 +376,7 @@ func convertToPolicy(prefix string, policyMessage *store.PolicyMessage) (*v1pb.P
policy := &v1pb.Policy{
Uid: fmt.Sprintf("%d", policyMessage.UID),
InheritFromParent: policyMessage.InheritFromParent,
+ Enforce: policyMessage.Enforce,
}
pType := v1pb.PolicyType_POLICY_TYPE_UNSPECIFIED
diff --git a/backend/legacyapi/policy.go b/backend/legacyapi/policy.go
index 85ff55b364..25370e482b 100644
--- a/backend/legacyapi/policy.go
+++ b/backend/legacyapi/policy.go
@@ -97,12 +97,6 @@ type Policy struct {
// Standard fields
RowStatus RowStatus `jsonapi:"attr,rowStatus"`
- CreatorID int
- Creator *Principal `jsonapi:"relation,creator"`
- CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterID int
- Updater *Principal `jsonapi:"relation,updater"`
- UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
ResourceType PolicyResourceType
@@ -130,38 +124,11 @@ type PolicyFind struct {
// PolicyUpsert is the message to upsert a policy.
// NOTE: We use PATCH for Upsert, this is inspired by https://google.aip.dev/134#patch-and-put
type PolicyUpsert struct {
- // Standard fields
- // Value is assigned from the jwt subject field passed by the client.
- // CreatorID is the ID of the creator.
- UpdaterID int
- RowStatus *string `jsonapi:"attr,rowStatus"`
-
- // Related fields
- ResourceType PolicyResourceType
- ResourceID int
-
- // Domain specific fields
- InheritFromParent *bool
- Type PolicyType
+ RowStatus *string `jsonapi:"attr,rowStatus"`
+ InheritFromParent *bool `jsonapi:"attr,inheritFromParent"`
Payload *string `jsonapi:"attr,payload"`
}
-// PolicyDelete is the message to delete a policy.
-type PolicyDelete struct {
- // Standard fields
- // Value is assigned from the jwt subject field passed by the client.
- DeleterID int
-
- // Related fields
- ResourceType PolicyResourceType
- ResourceID int
-
- // Domain specific fields
- // Type is the policy type.
- // Currently we only support delete operation for "bb.policy.sql-review", need it here for validation and update query.
- Type PolicyType
-}
-
// PipelineApprovalPolicy is the policy configuration for pipeline approval.
type PipelineApprovalPolicy struct {
Value PipelineApprovalValue `json:"value"`
diff --git a/backend/legacyapi/task_check_run.go b/backend/legacyapi/task_check_run.go
index 070a23a5fe..b818577f69 100644
--- a/backend/legacyapi/task_check_run.go
+++ b/backend/legacyapi/task_check_run.go
@@ -92,9 +92,6 @@ type TaskCheckDatabaseStatementAdvisePayload struct {
DbType db.Type `json:"dbType,omitempty"`
Charset string `json:"charset,omitempty"`
Collation string `json:"collation,omitempty"`
-
- // SQL review special fields.
- PolicyID int `json:"policyID,omitempty"`
}
// TaskCheckDatabaseStatementTypePayload is the task check payload for SQL type.
diff --git a/backend/metric/collector/policy_count.go b/backend/metric/collector/policy_count.go
index 77d983ec5e..1ed7ff4378 100644
--- a/backend/metric/collector/policy_count.go
+++ b/backend/metric/collector/policy_count.go
@@ -28,16 +28,26 @@ func NewPolicyCountCollector(store *store.Store) metric.Collector {
func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {
var res []*metric.Metric
- policyList, err := c.store.ListPolicy(ctx, &api.PolicyFind{})
+ policies, err := c.store.ListPoliciesV2(ctx, &store.FindPolicyMessage{})
if err != nil {
return nil, err
}
policyCountMap := make(map[string]*metricAPI.PolicyCountMetric)
- for _, policy := range policyList {
+ for _, policy := range policies {
var key string
var value string
+ if policy.ResourceType != api.PolicyResourceTypeEnvironment {
+ continue
+ }
+ environment, err := c.store.GetEnvironmentV2(ctx, &store.FindEnvironmentMessage{UID: &policy.ResourceUID})
+ if err != nil {
+ continue
+ }
+ if environment == nil {
+ continue
+ }
switch policy.Type {
case api.PolicyTypePipelineApproval:
@@ -46,16 +56,16 @@ func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, e
continue
}
value = string(payload.Value)
- key = fmt.Sprintf("%s_%s_%s", policy.Type, policy.Environment.Name, value)
+ key = fmt.Sprintf("%s_%s_%s", policy.Type, environment.Title, value)
case api.PolicyTypeBackupPlan:
payload, err := api.UnmarshalBackupPlanPolicy(policy.Payload)
if err != nil {
continue
}
value = string(payload.Schedule)
- key = fmt.Sprintf("%s_%s_%s", policy.Type, policy.Environment.Name, value)
+ key = fmt.Sprintf("%s_%s_%s", policy.Type, environment.Title, value)
case api.PolicyTypeSQLReview:
- key = fmt.Sprintf("%s_%s", policy.Type, policy.Environment.Name)
+ key = fmt.Sprintf("%s_%s", policy.Type, environment.Title)
// SQL review policy don't need to set the value.
value = ""
}
@@ -68,7 +78,7 @@ func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, e
policyCountMap[key] = &metricAPI.PolicyCountMetric{
Type: policy.Type,
Value: value,
- EnvironmentName: policy.Environment.Name,
+ EnvironmentName: environment.Title,
Count: 0,
}
}
diff --git a/backend/runner/taskcheck/scheduler.go b/backend/runner/taskcheck/scheduler.go
index 2fb37d8185..987fb319a8 100644
--- a/backend/runner/taskcheck/scheduler.go
+++ b/backend/runner/taskcheck/scheduler.go
@@ -280,7 +280,7 @@ func (s *Scheduler) getTaskCheck(ctx context.Context, task *api.Task, creatorID
}
createList = append(createList, create...)
- create, err = s.getSQLReviewTaskCheck(ctx, task, instance, dbSchema, statement)
+ create, err = s.getSQLReviewTaskCheck(task, instance, dbSchema, statement)
if err != nil {
return nil, errors.Wrap(err, "failed to schedule SQL review task check")
}
@@ -332,20 +332,15 @@ func getStmtTypeTaskCheck(task *api.Task, instance *store.InstanceMessage, dbSch
}, nil
}
-func (s *Scheduler) getSQLReviewTaskCheck(ctx context.Context, task *api.Task, instance *store.InstanceMessage, dbSchema *store.DBSchema, statement string) ([]*api.TaskCheckRunCreate, error) {
+func (*Scheduler) getSQLReviewTaskCheck(task *api.Task, instance *store.InstanceMessage, dbSchema *store.DBSchema, statement string) ([]*api.TaskCheckRunCreate, error) {
if !api.IsSQLReviewSupported(instance.Engine) {
return nil, nil
}
- policyID, err := s.store.GetSQLReviewPolicyIDByEnvID(ctx, task.Instance.EnvironmentID)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to get SQL review policy ID for task: %v, in environment: %v", task.Name, task.Instance.EnvironmentID)
- }
payload, err := json.Marshal(api.TaskCheckDatabaseStatementAdvisePayload{
Statement: statement,
DbType: instance.Engine,
Charset: dbSchema.Metadata.CharacterSet,
Collation: dbSchema.Metadata.Collation,
- PolicyID: policyID,
})
if err != nil {
return nil, errors.Wrapf(err, "failed to marshal statement advise payload: %v", task.Name)
diff --git a/backend/runner/taskcheck/statement_advisor_composite_executor.go b/backend/runner/taskcheck/statement_advisor_composite_executor.go
index 83f128a7d8..0e2709a78f 100644
--- a/backend/runner/taskcheck/statement_advisor_composite_executor.go
+++ b/backend/runner/taskcheck/statement_advisor_composite_executor.go
@@ -43,7 +43,7 @@ func (e *StatementAdvisorCompositeExecutor) Run(ctx context.Context, taskCheckRu
return nil, common.Wrapf(err, common.Invalid, "invalid check statement advise payload")
}
- policy, err := e.store.GetNormalSQLReviewPolicy(ctx, &api.PolicyFind{ID: &payload.PolicyID})
+ policy, err := e.store.GetSQLReviewPolicy(ctx, task.Instance.EnvironmentID)
if err != nil {
if e, ok := err.(*common.Error); ok && e.Code == common.NotFound {
return []api.TaskCheckResult{
diff --git a/backend/runner/taskrun/scheduler.go b/backend/runner/taskrun/scheduler.go
index f7858346fb..834dc67a3e 100644
--- a/backend/runner/taskrun/scheduler.go
+++ b/backend/runner/taskrun/scheduler.go
@@ -526,17 +526,6 @@ func (s *Scheduler) PatchTaskStatement(ctx context.Context, task *api.Task, task
}
func (s *Scheduler) triggerDatabaseStatementAdviseTask(ctx context.Context, statement string, task *api.Task) error {
- policyID, err := s.store.GetSQLReviewPolicyIDByEnvID(ctx, task.Instance.EnvironmentID)
- if err != nil {
- // It's OK if we failed to find the SQL review policy, just emit an error log
- log.Error("Failed to found SQL review policy id for task",
- zap.Int("task_id", task.ID),
- zap.String("task_name", task.Name),
- zap.Int("environment_id", task.Instance.EnvironmentID),
- zap.Error(err),
- )
- return nil
- }
dbSchema, err := s.store.GetDBSchema(ctx, *task.DatabaseID)
if err != nil {
return err
@@ -550,7 +539,6 @@ func (s *Scheduler) triggerDatabaseStatementAdviseTask(ctx context.Context, stat
DbType: task.Database.Instance.Engine,
Charset: dbSchema.Metadata.CharacterSet,
Collation: dbSchema.Metadata.Collation,
- PolicyID: policyID,
})
if err != nil {
return errors.Wrapf(err, "failed to marshal statement advise payload: %v", task.Name)
diff --git a/backend/server/policy.go b/backend/server/policy.go
index dcde29e8fd..661f5083d1 100644
--- a/backend/server/policy.go
+++ b/backend/server/policy.go
@@ -9,49 +9,10 @@ import (
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
- "github.com/bytebase/bytebase/backend/common"
api "github.com/bytebase/bytebase/backend/legacyapi"
+ "github.com/bytebase/bytebase/backend/store"
)
-// hasAccessToUpdatePolicy checks if user can access to policy control feature.
-// return nil if user has access.
-func (s *Server) hasAccessToUpsertPolicy(policyUpsert *api.PolicyUpsert) error {
- // nil payload means user doesn't update the payload field
- if policyUpsert.Payload == nil {
- return nil
- }
-
- defaultPolicy, err := api.GetDefaultPolicy(policyUpsert.Type)
- if err != nil {
- return err
- }
-
- if defaultPolicy == *policyUpsert.Payload {
- return nil
- }
- switch policyUpsert.Type {
- case api.PolicyTypePipelineApproval:
- if !s.licenseService.IsFeatureEnabled(api.FeatureApprovalPolicy) {
- return errors.Errorf(api.FeatureApprovalPolicy.AccessErrorMessage())
- }
- case api.PolicyTypeBackupPlan:
- if !s.licenseService.IsFeatureEnabled(api.FeatureBackupPolicy) {
- return errors.Errorf(api.FeatureBackupPolicy.AccessErrorMessage())
- }
- case api.PolicyTypeSQLReview:
- return nil
- case api.PolicyTypeEnvironmentTier:
- if !s.licenseService.IsFeatureEnabled(api.FeatureEnvironmentTierPolicy) {
- return errors.Errorf(api.FeatureEnvironmentTierPolicy.AccessErrorMessage())
- }
- case api.PolicyTypeSensitiveData:
- if !s.licenseService.IsFeatureEnabled(api.FeatureSensitiveData) {
- return errors.Errorf(api.FeatureSensitiveData.AccessErrorMessage())
- }
- }
- return nil
-}
-
func (s *Server) registerPolicyRoutes(g *echo.Group) {
g.PATCH("/policy/:resourceType/:resourceID", func(c echo.Context) error {
ctx := c.Request().Context()
@@ -67,35 +28,136 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
if err := api.ValidatePolicyType(pType); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
- policyUpsert := &api.PolicyUpsert{
- ResourceType: resourceType,
- ResourceID: resourceID,
- Type: pType,
- UpdaterID: c.Get(getPrincipalIDContextKey()).(int),
- }
+ updaterID := c.Get(getPrincipalIDContextKey()).(int)
+
+ policyUpsert := &api.PolicyUpsert{}
if err := jsonapi.UnmarshalPayload(c.Request().Body, policyUpsert); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformed set policy request").SetInternal(err)
}
- if err := s.hasAccessToUpsertPolicy(policyUpsert); err != nil {
+ if err := s.hasAccessToUpsertPolicy(pType, policyUpsert); err != nil {
return echo.NewHTTPError(http.StatusForbidden, err.Error()).SetInternal(err)
}
-
// Validate policy.
- if err := api.ValidatePolicy(policyUpsert.ResourceType, policyUpsert.Type, policyUpsert.Payload); err != nil {
+ if err := api.ValidatePolicy(resourceType, pType, policyUpsert.Payload); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid policy payload %s", err.Error())).SetInternal(err)
}
+ var composedEnvironment *api.Environment
+ if resourceType == api.PolicyResourceTypeEnvironment {
+ composedEnvironment, err = s.store.GetEnvironmentByID(ctx, resourceID)
+ if err != nil {
+ return err
+ }
+ }
- policy, err := s.store.UpsertPolicy(ctx, policyUpsert)
+ if pType == api.PolicyTypeEnvironmentTier {
+ environment, err := s.store.GetEnvironmentV2(ctx, &store.FindEnvironmentMessage{UID: &resourceID})
+ if err != nil {
+ return err
+ }
+ if environment == nil {
+ return echo.NewHTTPError(http.StatusBadRequest, "environment not found")
+ }
+ if policyUpsert.Payload == nil {
+ return echo.NewHTTPError(http.StatusBadRequest, "empty payload")
+ }
+ tierPolicy, err := api.UnmarshalEnvironmentTierPolicy(*policyUpsert.Payload)
+ if err != nil {
+ return err
+ }
+ protected := false
+ if tierPolicy.EnvironmentTier == api.EnvironmentTierValueProtected {
+ protected = true
+ }
+ if _, err := s.store.UpdateEnvironmentV2(ctx, environment.ResourceID, &store.UpdateEnvironmentMessage{Protected: &protected}, updaterID); err != nil {
+ return err
+ }
+ composedPolicy := &api.Policy{
+ ID: resourceID,
+ RowStatus: api.Normal,
+ ResourceType: resourceType,
+ ResourceID: resourceID,
+ Type: pType,
+ InheritFromParent: true,
+ Payload: *policyUpsert.Payload,
+ Environment: composedEnvironment,
+ }
+ c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
+ if err := jsonapi.MarshalPayload(c.Response().Writer, composedPolicy); err != nil {
+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create set policy response").SetInternal(err)
+ }
+ return nil
+ }
+
+ policy, err := s.store.GetPolicyV2(ctx, &store.FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &resourceID,
+ Type: &pType,
+ })
if err != nil {
- if common.ErrorCode(err) == common.Invalid {
- return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
+ return err
+ }
+ if policy == nil {
+ payload := ""
+ if policyUpsert.Payload != nil {
+ payload = *policyUpsert.Payload
+ }
+ inheritFromParent := true
+ if policyUpsert.InheritFromParent != nil {
+ inheritFromParent = *policyUpsert.InheritFromParent
+ }
+ policy, err = s.store.CreatePolicyV2(ctx, &store.PolicyMessage{
+ ResourceType: resourceType,
+ ResourceUID: resourceID,
+ Type: pType,
+ Payload: payload,
+ InheritFromParent: inheritFromParent,
+ // Enforce cannot be force while creating a policy.
+ Enforce: true,
+ }, updaterID)
+ if err != nil {
+ return err
+ }
+ } else {
+ var enforce *bool
+ if policyUpsert.RowStatus != nil {
+ if *policyUpsert.RowStatus == string(api.Normal) {
+ t := true
+ enforce = &t
+ } else {
+ f := false
+ enforce = &f
+ }
+ }
+ policy, err = s.store.UpdatePolicyV2(ctx, &store.UpdatePolicyMessage{
+ UpdaterID: updaterID,
+ ResourceType: resourceType,
+ ResourceUID: resourceID,
+ Type: pType,
+ InheritFromParent: policyUpsert.InheritFromParent,
+ Payload: policyUpsert.Payload,
+ Enforce: enforce,
+ })
+ if err != nil {
+ return err
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to set policy for type %q", pType)).SetInternal(err)
}
+ composedPolicy := &api.Policy{
+ ID: policy.UID,
+ RowStatus: api.Normal,
+ ResourceType: resourceType,
+ ResourceID: resourceID,
+ Type: pType,
+ InheritFromParent: policy.InheritFromParent,
+ Payload: policy.Payload,
+ Environment: composedEnvironment,
+ }
+ if !policy.Enforce {
+ composedPolicy.RowStatus = api.Archived
+ }
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
- if err := jsonapi.MarshalPayload(c.Response().Writer, policy); err != nil {
+ if err := jsonapi.MarshalPayload(c.Response().Writer, composedPolicy); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create set policy response").SetInternal(err)
}
return nil
@@ -115,17 +177,21 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
if err := api.ValidatePolicyType(pType); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
- policyDelete := &api.PolicyDelete{
- ResourceType: resourceType,
- ResourceID: resourceID,
- Type: pType,
- DeleterID: c.Get(getPrincipalIDContextKey()).(int),
+
+ policy, err := s.store.GetPolicyV2(ctx, &store.FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &resourceID,
+ Type: &pType,
+ })
+ if err != nil {
+ return err
}
- if err := s.store.DeletePolicy(ctx, policyDelete); err != nil {
- if common.ErrorCode(err) == common.Invalid {
- return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
- }
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete policy by resource type %q id %q", c.Param("resourceType"), c.Param("resourceID"))).SetInternal(err)
+ if policy == nil {
+ return echo.NewHTTPError(http.StatusNotFound, "policy not found")
+ }
+
+ if err := s.store.DeletePolicyV2(ctx, policy); err != nil {
+ return err
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
@@ -147,18 +213,86 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
if err := api.ValidatePolicyType(pType); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
- policyFind := &api.PolicyFind{
- ResourceType: &resourceType,
- ResourceID: &resourceID,
- Type: pType,
+ var composedEnvironment *api.Environment
+ if resourceType == api.PolicyResourceTypeEnvironment {
+ composedEnvironment, err = s.store.GetEnvironmentByID(ctx, resourceID)
+ if err != nil {
+ return err
+ }
+ }
+ if pType == api.PolicyTypeEnvironmentTier {
+ environment, err := s.store.GetEnvironmentV2(ctx, &store.FindEnvironmentMessage{UID: &resourceID})
+ if err != nil {
+ return err
+ }
+ tierPolicy := api.EnvironmentTierPolicy{
+ EnvironmentTier: api.EnvironmentTierValueUnprotected,
+ }
+ if environment.Protected {
+ tierPolicy.EnvironmentTier = api.EnvironmentTierValueProtected
+ }
+ payload, err := tierPolicy.String()
+ if err != nil {
+ return err
+ }
+ composedPolicy := &api.Policy{
+ ID: resourceID,
+ RowStatus: api.Normal,
+ ResourceType: resourceType,
+ ResourceID: resourceID,
+ Type: pType,
+ InheritFromParent: true,
+ Payload: payload,
+ Environment: composedEnvironment,
+ }
+ c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
+ if err := jsonapi.MarshalPayload(c.Response().Writer, composedPolicy); err != nil {
+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal policy response").SetInternal(err)
+ }
+ return nil
}
- policy, err := s.store.GetPolicy(ctx, policyFind)
+
+ policy, err := s.store.GetPolicyV2(ctx, &store.FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &resourceID,
+ Type: &pType,
+ })
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to get policy for type %q", pType)).SetInternal(err)
+ return err
+ }
+ if policy == nil {
+ // Return the default policy when there is no stored policy.
+ payload, err := api.GetDefaultPolicy(pType)
+ if err != nil {
+ return err
+ }
+ policy = &store.PolicyMessage{
+ UID: api.DefaultPolicyID,
+ ResourceType: resourceType,
+ ResourceUID: resourceID,
+ Type: pType,
+ InheritFromParent: true,
+ Payload: payload,
+ Enforce: true,
+ }
+ }
+
+ composedPolicy := &api.Policy{
+ ID: policy.UID,
+ ResourceType: policy.ResourceType,
+ ResourceID: policy.ResourceUID,
+ Type: policy.Type,
+ InheritFromParent: policy.InheritFromParent,
+ Payload: policy.Payload,
+ RowStatus: api.Normal,
+ Environment: composedEnvironment,
+ }
+ if !policy.Enforce {
+ composedPolicy.RowStatus = api.Archived
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
- if err := jsonapi.MarshalPayload(c.Response().Writer, policy); err != nil {
+ if err := jsonapi.MarshalPayload(c.Response().Writer, composedPolicy); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal get policy response: %v", pType)).SetInternal(err)
}
return nil
@@ -186,20 +320,44 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
- policyFind := &api.PolicyFind{
- ResourceType: resourceType,
- ResourceID: resourceID,
- Type: pType,
- }
-
ctx := c.Request().Context()
- policyList, err := s.store.ListPolicy(ctx, policyFind)
+ policies, err := s.store.ListPoliciesV2(ctx, &store.FindPolicyMessage{
+ ResourceType: resourceType,
+ ResourceUID: resourceID,
+ Type: &pType,
+ })
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to list policy for type %q", pType)).SetInternal(err)
+ return err
+ }
+ var composedPolicies []*api.Policy
+ for _, policy := range policies {
+ composedPolicy := &api.Policy{
+ ID: policy.UID,
+ ResourceType: policy.ResourceType,
+ ResourceID: policy.ResourceUID,
+ Type: policy.Type,
+ InheritFromParent: policy.InheritFromParent,
+ Payload: policy.Payload,
+ RowStatus: api.Normal,
+ }
+ if !policy.Enforce {
+ composedPolicy.RowStatus = api.Archived
+ }
+ if policy.ResourceType == api.PolicyResourceTypeEnvironment {
+ composedEnvironment, err := s.store.GetEnvironmentByID(ctx, policy.ResourceUID)
+ if err != nil {
+ return err
+ }
+ if composedEnvironment == nil {
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("environment %v not found", policy.ResourceUID))
+ }
+ composedPolicy.Environment = composedEnvironment
+ }
+ composedPolicies = append(composedPolicies, composedPolicy)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
- if err := jsonapi.MarshalPayload(c.Response().Writer, policyList); err != nil {
+ if err := jsonapi.MarshalPayload(c.Response().Writer, composedPolicies); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal list policy response: %v", pType)).SetInternal(err)
}
return nil
@@ -213,3 +371,42 @@ func getPolicyResourceID(resourceID string) (int, error) {
}
return id, nil
}
+
+// hasAccessToUpdatePolicy checks if user can access to policy control feature.
+// return nil if user has access.
+func (s *Server) hasAccessToUpsertPolicy(pType api.PolicyType, policyUpsert *api.PolicyUpsert) error {
+ // nil payload means user doesn't update the payload field
+ if policyUpsert.Payload == nil {
+ return nil
+ }
+
+ defaultPolicy, err := api.GetDefaultPolicy(pType)
+ if err != nil {
+ return err
+ }
+
+ if defaultPolicy == *policyUpsert.Payload {
+ return nil
+ }
+ switch pType {
+ case api.PolicyTypePipelineApproval:
+ if !s.licenseService.IsFeatureEnabled(api.FeatureApprovalPolicy) {
+ return errors.Errorf(api.FeatureApprovalPolicy.AccessErrorMessage())
+ }
+ case api.PolicyTypeBackupPlan:
+ if !s.licenseService.IsFeatureEnabled(api.FeatureBackupPolicy) {
+ return errors.Errorf(api.FeatureBackupPolicy.AccessErrorMessage())
+ }
+ case api.PolicyTypeSQLReview:
+ return nil
+ case api.PolicyTypeEnvironmentTier:
+ if !s.licenseService.IsFeatureEnabled(api.FeatureEnvironmentTierPolicy) {
+ return errors.Errorf(api.FeatureEnvironmentTierPolicy.AccessErrorMessage())
+ }
+ case api.PolicyTypeSensitiveData:
+ if !s.licenseService.IsFeatureEnabled(api.FeatureSensitiveData) {
+ return errors.Errorf(api.FeatureSensitiveData.AccessErrorMessage())
+ }
+ }
+ return nil
+}
diff --git a/backend/server/sql.go b/backend/server/sql.go
index 70608b3cd9..ed3468df29 100644
--- a/backend/server/sql.go
+++ b/backend/server/sql.go
@@ -667,8 +667,7 @@ func (s *Server) sqlCheck(
driver *sql.DB,
) (advisor.Status, []advisor.Advice, error) {
var adviceList []advisor.Advice
- environmentResourceType := api.PolicyResourceTypeEnvironment
- policy, err := s.store.GetNormalSQLReviewPolicy(ctx, &api.PolicyFind{ResourceType: &environmentResourceType, ResourceID: &environmentID})
+ policy, err := s.store.GetSQLReviewPolicy(ctx, environmentID)
if err != nil {
if e, ok := err.(*common.Error); ok && e.Code == common.NotFound {
return advisor.Success, nil, nil
@@ -869,12 +868,12 @@ func (s *Server) hasDatabaseAccessRights(ctx context.Context, principalID int, r
}
// calculate the effective policy.
- databasePolicy, inheritFromEnvironment, err := s.store.GetNormalAccessControlPolicy(ctx, api.PolicyResourceTypeDatabase, database.UID)
+ databasePolicy, inheritFromEnvironment, err := s.store.GetAccessControlPolicy(ctx, api.PolicyResourceTypeDatabase, database.UID)
if err != nil {
return false, err
}
- environmentPolicy, _, err := s.store.GetNormalAccessControlPolicy(ctx, api.PolicyResourceTypeEnvironment, environment.UID)
+ environmentPolicy, _, err := s.store.GetAccessControlPolicy(ctx, api.PolicyResourceTypeEnvironment, environment.UID)
if err != nil {
return false, err
}
diff --git a/backend/server/webhook.go b/backend/server/webhook.go
index 87cf942978..83fa7001a3 100644
--- a/backend/server/webhook.go
+++ b/backend/server/webhook.go
@@ -342,14 +342,12 @@ func (s *Server) sqlAdviceForFile(
if err != nil {
return nil, err
}
- environmentResourceType := api.PolicyResourceTypeEnvironment
- policy, err := s.store.GetNormalSQLReviewPolicy(ctx, &api.PolicyFind{ResourceType: &environmentResourceType, ResourceID: &environment.UID})
+ policy, err := s.store.GetSQLReviewPolicy(ctx, environment.UID)
if err != nil {
if e, ok := err.(*common.Error); ok && e.Code == common.NotFound {
log.Debug("Cannot found SQL review policy in environment", zap.String("Environment", database.EnvironmentID), zap.Error(err))
continue
}
-
return nil, errors.Errorf("Failed to get SQL review policy in environment %v with error: %v", instance.EnvironmentID, err)
}
diff --git a/backend/store/cache.go b/backend/store/cache.go
index 1c37f216b8..f290db9fbd 100644
--- a/backend/store/cache.go
+++ b/backend/store/cache.go
@@ -17,8 +17,6 @@ const (
pipelineCacheNamespace cacheNamespace = "pl"
// issueCacheNamespace is the cache type of issues.
issueCacheNamespace cacheNamespace = "is"
- // approvalPolicyCacheNamespace is the cache type of approval policy.
- approvalPolicyCacheNamespace cacheNamespace = "app"
)
// CacheService implements a cache.
diff --git a/backend/store/environment.go b/backend/store/environment.go
index b41ae376a9..8c8f532ad3 100644
--- a/backend/store/environment.go
+++ b/backend/store/environment.go
@@ -274,13 +274,14 @@ func (s *Store) CreateEnvironmentV2(ctx context.Context, create *EnvironmentMess
if err != nil {
return nil, err
}
- if _, err := upsertPolicyImpl(ctx, tx, &api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: uid,
- Type: api.PolicyTypeEnvironmentTier,
- Payload: &payload,
- UpdaterID: creatorID,
- }); err != nil {
+ if _, err := upsertPolicyV2Impl(ctx, tx, &PolicyMessage{
+ ResourceType: api.PolicyResourceTypeEnvironment,
+ ResourceUID: uid,
+ Type: api.PolicyTypeEnvironmentTier,
+ InheritFromParent: true,
+ Payload: payload,
+ Enforce: true,
+ }, creatorID); err != nil {
return nil, err
}
@@ -343,7 +344,6 @@ func (s *Store) UpdateEnvironmentV2(ctx context.Context, environmentID string, p
}
// TODO(d): consider moving tier to environment table to simplify things.
- // TODO(d): move policy interface to store v2.
if patch.Protected != nil {
value := api.EnvironmentTierValueUnprotected
if *patch.Protected {
@@ -353,13 +353,14 @@ func (s *Store) UpdateEnvironmentV2(ctx context.Context, environmentID string, p
if err != nil {
return nil, err
}
- if _, err := upsertPolicyImpl(ctx, tx, &api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: environmentUID,
- Type: api.PolicyTypeEnvironmentTier,
- Payload: &payload,
- UpdaterID: updaterID,
- }); err != nil {
+ if _, err := upsertPolicyV2Impl(ctx, tx, &PolicyMessage{
+ ResourceType: api.PolicyResourceTypeEnvironment,
+ ResourceUID: environmentUID,
+ Type: api.PolicyTypeEnvironmentTier,
+ InheritFromParent: true,
+ Payload: payload,
+ Enforce: true,
+ }, updaterID); err != nil {
return nil, err
}
}
diff --git a/backend/store/policy.go b/backend/store/policy.go
index 9b57b46e8c..0f1a908f18 100644
--- a/backend/store/policy.go
+++ b/backend/store/policy.go
@@ -13,256 +13,100 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
)
-// policyRaw is the store model for an Policy.
-// Fields have exactly the same meanings as Policy.
-type policyRaw struct {
- ID int
-
- // Standard fields
- RowStatus api.RowStatus
- CreatorID int
- CreatedTs int64
- UpdaterID int
- UpdatedTs int64
-
- // Related fields
- ResourceType api.PolicyResourceType
- ResourceID int
-
- // Domain specific fields
- InheritFromParent bool
- Type api.PolicyType
- Payload string
-}
-
-// toPolicy creates an instance of Policy based on the PolicyRaw.
-// This is intended to be called when we need to compose an Policy relationship.
-func (raw *policyRaw) toPolicy() *api.Policy {
- return &api.Policy{
- ID: raw.ID,
-
- // Standard fields
- RowStatus: raw.RowStatus,
- CreatorID: raw.CreatorID,
- CreatedTs: raw.CreatedTs,
- UpdaterID: raw.UpdaterID,
- UpdatedTs: raw.UpdatedTs,
-
- // Related fields
- ResourceType: raw.ResourceType,
- ResourceID: raw.ResourceID,
-
- // Domain specific fields
- InheritFromParent: raw.InheritFromParent,
- Type: raw.Type,
- Payload: raw.Payload,
- }
-}
-
-// UpsertPolicy upserts an instance of Policy.
-func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*api.Policy, error) {
- policyRaw, err := s.upsertPolicyRaw(ctx, upsert)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to upsert policy with PolicyUpsert[%+v]", upsert)
- }
- policy, err := s.composePolicy(ctx, policyRaw)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to compose policy with policyRaw[%+v]", policyRaw)
- }
-
- if err := s.upsertPolicyCache(upsert.Type, upsert.ResourceID, policy.Payload); err != nil {
- return nil, err
- }
-
- return policy, nil
-}
-
-// GetPolicy gets a policy.
-func (s *Store) GetPolicy(ctx context.Context, find *api.PolicyFind) (*api.Policy, error) {
- policyRaw, err := s.getPolicyRaw(ctx, find)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to get policy with PolicyFind[%+v]", find)
- }
- policy, err := s.composePolicy(ctx, policyRaw)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to compose policy with policyRaw[%+v]", policyRaw)
- }
- return policy, nil
-}
-
-// DeletePolicy deletes an existing ARCHIVED policy by PolicyDelete.
-func (s *Store) DeletePolicy(ctx context.Context, policyDelete *api.PolicyDelete) error {
- // Validate policy.
- switch policyDelete.Type {
- case api.PolicyTypeSQLReview:
- case api.PolicyTypeAccessControl:
- default:
- return &common.Error{Code: common.Invalid, Err: errors.Errorf("disallow to delete policy type: %s", policyDelete.Type)}
- }
-
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return FormatError(err)
- }
- defer tx.Rollback()
-
- find := &api.PolicyFind{
- ResourceType: &policyDelete.ResourceType,
- ResourceID: &policyDelete.ResourceID,
- Type: policyDelete.Type,
- }
- policyRawList, err := findPolicyImpl(ctx, tx, find)
- if err != nil {
- return errors.Wrapf(err, "failed to list policy with PolicyFind[%+v]", find)
- }
- if len(policyRawList) != 1 {
- return &common.Error{Code: common.NotFound, Err: errors.Errorf("failed to found policy with filter %+v, expect 1. ", find)}
- }
- policyRaw := policyRawList[0]
- if policyRaw.RowStatus != api.Archived && policyDelete.Type == api.PolicyTypeSQLReview {
- return &common.Error{Code: common.Invalid, Err: errors.Errorf("failed to delete policy with PolicyDelete[%+v], expect 'ARCHIVED' row_status", policyDelete)}
- }
-
- if err := s.deletePolicyImpl(ctx, tx, policyDelete); err != nil {
- return FormatError(err)
- }
-
- if err := tx.Commit(); err != nil {
- return FormatError(err)
- }
-
- if policyDelete.Type == api.PolicyTypePipelineApproval {
- s.cache.DeleteCache(approvalPolicyCacheNamespace, policyDelete.ResourceID)
- }
- return nil
-}
-
-// ListPolicy gets a list of policy by PolicyFind.
-func (s *Store) ListPolicy(ctx context.Context, find *api.PolicyFind) ([]*api.Policy, error) {
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return nil, FormatError(err)
- }
- defer tx.Rollback()
-
- policyRawList, err := findPolicyImpl(ctx, tx, find)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to list policy with PolicyFind[%+v]", find)
- }
-
- policyList := []*api.Policy{}
- for _, raw := range policyRawList {
- policy, err := s.composePolicy(ctx, raw)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to compose policy with policyRaw[%+v]", raw)
- }
- policyList = append(policyList, policy)
- }
-
- return policyList, nil
-}
-
// GetBackupPlanPolicyByEnvID will get the backup plan policy for an environment.
func (s *Store) GetBackupPlanPolicyByEnvID(ctx context.Context, environmentID int) (*api.BackupPlanPolicy, error) {
- environmentResourceType := api.PolicyResourceTypeEnvironment
- policy, err := s.getPolicyRaw(ctx, &api.PolicyFind{
- ResourceType: &environmentResourceType,
- ResourceID: &environmentID,
- Type: api.PolicyTypeBackupPlan,
+ resourceType := api.PolicyResourceTypeEnvironment
+ pType := api.PolicyTypeBackupPlan
+ policy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &environmentID,
+ Type: &pType,
})
if err != nil {
return nil, err
}
+ if policy == nil {
+ return &api.BackupPlanPolicy{
+ Schedule: api.BackupPlanPolicyScheduleUnset,
+ }, nil
+ }
return api.UnmarshalBackupPlanPolicy(policy.Payload)
}
// GetPipelineApprovalPolicy will get the pipeline approval policy for an environment.
func (s *Store) GetPipelineApprovalPolicy(ctx context.Context, environmentID int) (*api.PipelineApprovalPolicy, error) {
- var payload *string
- ok, err := s.cache.FindCache(approvalPolicyCacheNamespace, environmentID, &payload)
+ resourceType := api.PolicyResourceTypeEnvironment
+ pType := api.PolicyTypePipelineApproval
+ policy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &environmentID,
+ Type: &pType,
+ })
if err != nil {
return nil, err
}
- if !ok {
- environmentResourceType := api.PolicyResourceTypeEnvironment
- p, err := s.getPolicyRaw(ctx, &api.PolicyFind{
- ResourceType: &environmentResourceType,
- ResourceID: &environmentID,
- Type: api.PolicyTypePipelineApproval,
- })
- if err != nil {
- return nil, err
- }
- payload = &p.Payload
- if err := s.cache.UpsertCache(approvalPolicyCacheNamespace, environmentID, payload); err != nil {
- return nil, err
- }
+ if policy == nil {
+ return &api.PipelineApprovalPolicy{
+ Value: api.PipelineApprovalValueManualAlways,
+ }, nil
}
- return api.UnmarshalPipelineApprovalPolicy(*payload)
-}
-// GetNormalSQLReviewPolicy will get the normal SQL review policy for an environment.
-func (s *Store) GetNormalSQLReviewPolicy(ctx context.Context, find *api.PolicyFind) (*advisor.SQLReviewPolicy, error) {
- if find.ID != nil && *find.ID == api.DefaultPolicyID {
- return nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("SQL review policy not found with ID %d", *find.ID)}
- }
+ return api.UnmarshalPipelineApprovalPolicy(policy.Payload)
+}
- environmentResourceType := api.PolicyResourceTypeEnvironment
- find.ResourceType = &environmentResourceType
- find.Type = api.PolicyTypeSQLReview
- policy, err := s.getPolicyRaw(ctx, find)
+// GetSQLReviewPolicy will get the SQL review policy for an environment.
+func (s *Store) GetSQLReviewPolicy(ctx context.Context, environmentID int) (*advisor.SQLReviewPolicy, error) {
+ resourceType := api.PolicyResourceTypeEnvironment
+ pType := api.PolicyTypeSQLReview
+ policy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &environmentID,
+ Type: &pType,
+ })
if err != nil {
return nil, err
}
- if policy.RowStatus == api.Archived {
- return nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("SQL review policy ID: %d for environment %d is archived", policy.ID, policy.ResourceID)}
+ if policy == nil {
+ return nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("SQL review policy for environment %d not found", environmentID)}
}
- if policy.ID == api.DefaultPolicyID {
- return nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("SQL review policy ID: %d for environment %d not found", policy.ID, policy.ResourceID)}
+ if !policy.Enforce {
+ return nil, &common.Error{Code: common.NotFound, Err: errors.Errorf("SQL review policy is not enforced for environment %d", environmentID)}
}
return api.UnmarshalSQLReviewPolicy(policy.Payload)
}
-// GetSQLReviewPolicyIDByEnvID will get the SQL review policy ID for an environment.
-func (s *Store) GetSQLReviewPolicyIDByEnvID(ctx context.Context, environmentID int) (int, error) {
- environmentResourceType := api.PolicyResourceTypeEnvironment
- policy, err := s.getPolicyRaw(ctx, &api.PolicyFind{
- ResourceType: &environmentResourceType,
- ResourceID: &environmentID,
- Type: api.PolicyTypeSQLReview,
- })
- if err != nil {
- return 0, err
- }
- return policy.ID, nil
-}
-
// GetSensitiveDataPolicy will get the sensitive data policy for database ID.
func (s *Store) GetSensitiveDataPolicy(ctx context.Context, databaseID int) (*api.SensitiveDataPolicy, error) {
- databaseResourceType := api.PolicyResourceTypeDatabase
- policy, err := s.getPolicyRaw(ctx, &api.PolicyFind{
- ResourceType: &databaseResourceType,
- ResourceID: &databaseID,
- Type: api.PolicyTypeSensitiveData,
+ resourceType := api.PolicyResourceTypeDatabase
+ pType := api.PolicyTypeSensitiveData
+ policy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{
+ ResourceType: &resourceType,
+ ResourceUID: &databaseID,
+ Type: &pType,
})
if err != nil {
return nil, err
}
+ if policy == nil {
+ return &api.SensitiveDataPolicy{}, nil
+ }
+
return api.UnmarshalSensitiveDataPolicy(policy.Payload)
}
-// GetNormalAccessControlPolicy will get the normal access control polciy. Return nil if InheritFromParent is true.
-func (s *Store) GetNormalAccessControlPolicy(ctx context.Context, resourceType api.PolicyResourceType, resourceID int) (*api.AccessControlPolicy, bool, error) {
- policy, err := s.getPolicyRaw(ctx, &api.PolicyFind{
+// GetAccessControlPolicy will get the normal access control polciy. Return nil if InheritFromParent is true.
+func (s *Store) GetAccessControlPolicy(ctx context.Context, resourceType api.PolicyResourceType, resourceID int) (*api.AccessControlPolicy, bool, error) {
+ pType := api.PolicyTypeAccessControl
+ policy, err := s.GetPolicyV2(ctx, &FindPolicyMessage{
ResourceType: &resourceType,
- ResourceID: &resourceID,
- Type: api.PolicyTypeAccessControl,
+ ResourceUID: &resourceID,
+ Type: &pType,
})
if err != nil {
- // For access constrol policy, the default value for InheritFromParent is true.
- return nil, true, err
+ return nil, false, err
}
- if policy == nil || policy.RowStatus != api.Normal {
+
+ if policy == nil || !policy.Enforce {
// For access constrol policy, the default value for InheritFromParent is true.
return nil, true, nil
}
@@ -275,279 +119,17 @@ func (s *Store) GetNormalAccessControlPolicy(ctx context.Context, resourceType a
return accessControlPolicy, policy.InheritFromParent, nil
}
-//
-// private functions
-//
-
-func (s *Store) composePolicy(ctx context.Context, raw *policyRaw) (*api.Policy, error) {
- policy := raw.toPolicy()
-
- creator, err := s.GetPrincipalByID(ctx, policy.CreatorID)
- if err != nil {
- return nil, err
- }
- policy.Creator = creator
-
- updater, err := s.GetPrincipalByID(ctx, policy.UpdaterID)
- if err != nil {
- return nil, err
- }
- policy.Updater = updater
-
- if policy.ResourceType == api.PolicyResourceTypeEnvironment {
- env, err := s.GetEnvironmentByID(ctx, policy.ResourceID)
- if err != nil {
- return nil, err
- }
- policy.Environment = env
- }
-
- return policy, nil
-}
-
-// getPolicyRaw finds the policy for an environment.
-// Returns ECONFLICT if finding more than 1 matching records.
-func (s *Store) getPolicyRaw(ctx context.Context, find *api.PolicyFind) (*policyRaw, error) {
- tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
- if err != nil {
- return nil, FormatError(err)
- }
- defer tx.Rollback()
-
- policyRawList, err := findPolicyImpl(ctx, tx, find)
- var ret *policyRaw
- if err != nil {
- return nil, err
- }
-
- if err := tx.Commit(); err != nil {
- return nil, FormatError(err)
- }
-
- if len(policyRawList) == 0 {
- ret = &policyRaw{
- CreatorID: api.SystemBotID,
- UpdaterID: api.SystemBotID,
- Type: find.Type,
- }
- if find.ResourceType != nil {
- ret.ResourceType = *find.ResourceType
- }
- if find.ResourceID != nil {
- ret.ResourceID = *find.ResourceID
- }
- if find.Type == api.PolicyTypeAccessControl {
- // For access constrol policy, the default value for InheritFromParent is true.
- ret.InheritFromParent = true
- }
- } else if len(policyRawList) > 1 {
- return nil, &common.Error{Code: common.Conflict, Err: errors.Errorf("found %d policy with filter %+v, expect 1. ", len(policyRawList), find)}
- } else {
- ret = policyRawList[0]
- }
-
- if ret.Payload == "" {
- // Return the default policy when there is no stored policy.
- payload, err := api.GetDefaultPolicy(find.Type)
- if err != nil {
- return nil, &common.Error{Code: common.Internal, Err: err}
- }
- ret.Payload = payload
- ret.ID = api.DefaultPolicyID
- }
- return ret, nil
-}
-
-func findPolicyImpl(ctx context.Context, tx *Tx, find *api.PolicyFind) ([]*policyRaw, error) {
- where, args := []string{"TRUE"}, []interface{}{}
- if v := find.ID; v != nil {
- where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)
- }
- if v := find.ResourceType; v != nil {
- where, args = append(where, fmt.Sprintf("resource_type = $%d", len(args)+1)), append(args, *v)
- }
- if v := find.ResourceID; v != nil {
- where, args = append(where, fmt.Sprintf("resource_id = $%d", len(args)+1)), append(args, *v)
- }
- where, args = append(where, fmt.Sprintf("type = $%d", len(args)+1)), append(args, find.Type)
-
- rows, err := tx.QueryContext(ctx, `
- SELECT
- id,
- creator_id,
- created_ts,
- updater_id,
- updated_ts,
- row_status,
- resource_type,
- resource_id,
- inherit_from_parent,
- type,
- payload
- FROM policy
- WHERE `+strings.Join(where, " AND "),
- args...,
- )
- if err != nil {
- return nil, FormatError(err)
- }
- defer rows.Close()
-
- // Iterate over result set and deserialize rows into policyRawList.
- var policyRawList []*policyRaw
- for rows.Next() {
- var policyRaw policyRaw
- if err := rows.Scan(
- &policyRaw.ID,
- &policyRaw.CreatorID,
- &policyRaw.CreatedTs,
- &policyRaw.UpdaterID,
- &policyRaw.UpdatedTs,
- &policyRaw.RowStatus,
- &policyRaw.ResourceType,
- &policyRaw.ResourceID,
- &policyRaw.InheritFromParent,
- &policyRaw.Type,
- &policyRaw.Payload,
- ); err != nil {
- return nil, FormatError(err)
- }
-
- policyRawList = append(policyRawList, &policyRaw)
- }
- if err := rows.Err(); err != nil {
- return nil, FormatError(err)
- }
- return policyRawList, nil
-}
-
-// upsertPolicyRaw sets a policy for an environment.
-func (s *Store) upsertPolicyRaw(ctx context.Context, upsert *api.PolicyUpsert) (*policyRaw, error) {
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return nil, FormatError(err)
- }
- defer tx.Rollback()
-
- policy, err := upsertPolicyImpl(ctx, tx, upsert)
- if err != nil {
- return nil, err
- }
-
- if err := tx.Commit(); err != nil {
- return nil, FormatError(err)
- }
-
- return policy, nil
-}
-
-// upsertPolicyImpl updates an existing policy by environment id and type.
-func upsertPolicyImpl(ctx context.Context, tx *Tx, upsert *api.PolicyUpsert) (*policyRaw, error) {
- var set []string
- if v := upsert.Payload; v != nil {
- set = append(set, "payload = EXCLUDED.payload")
- }
- if v := upsert.RowStatus; v != nil {
- set = append(set, "row_status = EXCLUDED.row_status")
- }
-
- if len(set) == 0 {
- return nil, &common.Error{Code: common.Invalid, Err: errors.Errorf("invalid policy upsert %+v", upsert)}
- }
-
- if upsert.Payload == nil || *upsert.Payload == "" {
- emptyPayload := "{}"
- upsert.Payload = &emptyPayload
- }
- if upsert.RowStatus == nil {
- rowStatus := string(api.Normal)
- upsert.RowStatus = &rowStatus
- }
- inheritFromParent := true
- if upsert.InheritFromParent != nil {
- inheritFromParent = *upsert.InheritFromParent
- }
-
- query := fmt.Sprintf(`
- INSERT INTO policy (
- creator_id,
- updater_id,
- resource_type,
- resource_id,
- inherit_from_parent,
- type,
- payload,
- row_status
- )
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
- ON CONFLICT(resource_type, resource_id, type) DO UPDATE SET
- %s
- RETURNING id, creator_id, created_ts, updater_id, updated_ts, row_status, resource_type, resource_id, inherit_from_parent, type, payload
- `, strings.Join(set, ","))
- var policyRaw policyRaw
- if err := tx.QueryRowContext(ctx, query,
- upsert.UpdaterID,
- upsert.UpdaterID,
- upsert.ResourceType,
- upsert.ResourceID,
- inheritFromParent,
- upsert.Type,
- upsert.Payload,
- upsert.RowStatus,
- ).Scan(
- &policyRaw.ID,
- &policyRaw.CreatorID,
- &policyRaw.CreatedTs,
- &policyRaw.UpdaterID,
- &policyRaw.UpdatedTs,
- &policyRaw.RowStatus,
- &policyRaw.ResourceType,
- &policyRaw.ResourceID,
- &policyRaw.InheritFromParent,
- &policyRaw.Type,
- &policyRaw.Payload,
- ); err != nil {
- if err == sql.ErrNoRows {
- return nil, common.FormatDBErrorEmptyRowWithQuery(query)
- }
- return nil, FormatError(err)
- }
- return &policyRaw, nil
-}
-
-// deletePolicyImpl deletes an existing ARCHIVED policy by id and type.
-func (*Store) deletePolicyImpl(ctx context.Context, tx *Tx, delete *api.PolicyDelete) error {
- if _, err := tx.ExecContext(ctx, `
- DELETE FROM policy
- WHERE resource_type = $1 AND resource_id = $2 AND type = $3
- `,
- delete.ResourceType,
- delete.ResourceID,
- delete.Type,
- ); err != nil {
- return FormatError(err)
- }
- return nil
-}
-
-// Cache environment policy and pipeline approval policy as it is used widely.
-func (s *Store) upsertPolicyCache(policyType api.PolicyType, resourceID int, payload string) error {
- if policyType == api.PolicyTypePipelineApproval {
- if err := s.cache.UpsertCache(approvalPolicyCacheNamespace, resourceID, &payload); err != nil {
- return err
- }
- }
- return nil
-}
-
// PolicyMessage is the mssage for policy.
type PolicyMessage struct {
- UID int
ResourceUID int
ResourceType api.PolicyResourceType
Payload string
InheritFromParent bool
Type api.PolicyType
+ Enforce bool
+
+ // Output only.
+ UID int
}
// FindPolicyMessage is the message for finding policies.
@@ -565,12 +147,16 @@ type UpdatePolicyMessage struct {
Type api.PolicyType
InheritFromParent *bool
Payload *string
+ Enforce *bool
}
// GetPolicyV2 gets a policy.
func (s *Store) GetPolicyV2(ctx context.Context, find *FindPolicyMessage) (*PolicyMessage, error) {
if find.ResourceType != nil && find.ResourceUID != nil && find.Type != nil {
if policy, ok := s.policyCache.Load(getPolicyCacheKey(*find.ResourceType, *find.ResourceUID, *find.Type)); ok {
+ if policy == nil {
+ return nil, nil
+ }
return policy.(*PolicyMessage), nil
}
}
@@ -586,6 +172,10 @@ func (s *Store) GetPolicyV2(ctx context.Context, find *FindPolicyMessage) (*Poli
return nil, err
}
if len(policies) == 0 {
+ // Cache the policy for not found as well to reduce the look up latency.
+ if find.ResourceType != nil && find.ResourceUID != nil && find.Type != nil {
+ s.policyCache.Store(getPolicyCacheKey(*find.ResourceType, *find.ResourceUID, *find.Type), nil)
+ }
return nil, nil
}
if len(policies) > 1 {
@@ -597,7 +187,7 @@ func (s *Store) GetPolicyV2(ctx context.Context, find *FindPolicyMessage) (*Poli
return nil, FormatError(err)
}
- s.storePolicyIntoCache(policy)
+ s.policyCache.Store(getPolicyCacheKey(policy.ResourceType, policy.ResourceUID, policy.Type), policy)
return policy, nil
}
@@ -620,7 +210,7 @@ func (s *Store) ListPoliciesV2(ctx context.Context, find *FindPolicyMessage) ([]
}
for _, policy := range policies {
- s.storePolicyIntoCache(policy)
+ s.policyCache.Store(getPolicyCacheKey(policy.ResourceType, policy.ResourceUID, policy.Type), policy)
}
return policies, nil
@@ -634,42 +224,18 @@ func (s *Store) CreatePolicyV2(ctx context.Context, create *PolicyMessage, creat
}
defer tx.Rollback()
- var uid int
- if err := tx.QueryRowContext(ctx, `
- INSERT INTO policy (
- creator_id,
- updater_id,
- resource_type,
- resource_id,
- inherit_from_parent,
- type,
- payload
- )
- VALUES ($1, $2, $3, $4, $5, $6, $7)
- RETURNING id
- `,
- creatorID,
- creatorID,
- create.ResourceType,
- create.ResourceUID,
- create.InheritFromParent,
- create.Type,
- create.Payload,
- ).Scan(
- &uid,
- ); err != nil {
- return nil, FormatError(err)
+ policy, err := upsertPolicyV2Impl(ctx, tx, create, creatorID)
+ if err != nil {
+ return nil, err
}
if err := tx.Commit(); err != nil {
return nil, FormatError(err)
}
- create.UID = uid
-
- s.storePolicyIntoCache(create)
+ s.policyCache.Store(getPolicyCacheKey(policy.ResourceType, policy.ResourceUID, policy.Type), policy)
- return create, nil
+ return policy, nil
}
// UpdatePolicyV2 updates the policy.
@@ -681,6 +247,13 @@ func (s *Store) UpdatePolicyV2(ctx context.Context, patch *UpdatePolicyMessage)
if v := patch.Payload; v != nil {
set, args = append(set, fmt.Sprintf("payload = $%d", len(args)+1)), append(args, *v)
}
+ if v := patch.Enforce; v != nil {
+ rowStatus := api.Normal
+ if !*patch.Enforce {
+ rowStatus = api.Archived
+ }
+ set, args = append(set, fmt.Sprintf(`"row_status" = $%d`, len(args)+1)), append(args, rowStatus)
+ }
args = append(args, patch.ResourceType, patch.ResourceUID, patch.Type)
tx, err := s.db.BeginTx(ctx, nil)
@@ -715,12 +288,15 @@ func (s *Store) UpdatePolicyV2(ctx context.Context, patch *UpdatePolicyMessage)
}
return nil, FormatError(err)
}
+ if rowStatus == string(api.Normal) {
+ policy.Enforce = true
+ }
if err := tx.Commit(); err != nil {
return nil, FormatError(err)
}
- s.storePolicyIntoCache(policy)
+ s.policyCache.Store(getPolicyCacheKey(policy.ResourceType, policy.ResourceUID, policy.Type), policy)
return policy, nil
}
@@ -742,7 +318,53 @@ func (s *Store) DeletePolicyV2(ctx context.Context, policy *PolicyMessage) error
return FormatError(err)
}
- return tx.Commit()
+ if err := tx.Commit(); err != nil {
+ return err
+ }
+
+ s.policyCache.Delete(getPolicyCacheKey(policy.ResourceType, policy.ResourceUID, policy.Type))
+ return nil
+}
+
+func upsertPolicyV2Impl(ctx context.Context, tx *Tx, create *PolicyMessage, creatorID int) (*PolicyMessage, error) {
+ var uid int
+ rowStatus := api.Normal
+ if !create.Enforce {
+ rowStatus = api.Archived
+ }
+ if err := tx.QueryRowContext(ctx, `
+ INSERT INTO policy (
+ creator_id,
+ updater_id,
+ resource_type,
+ resource_id,
+ inherit_from_parent,
+ type,
+ payload,
+ row_status
+ )
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
+ ON CONFLICT(resource_type, resource_id, type) DO UPDATE SET
+ inherit_from_parent = EXCLUDED.inherit_from_parent,
+ payload = EXCLUDED.payload,
+ row_status = EXCLUDED.row_status
+ RETURNING id
+ `,
+ creatorID,
+ creatorID,
+ create.ResourceType,
+ create.ResourceUID,
+ create.InheritFromParent,
+ create.Type,
+ create.Payload,
+ rowStatus,
+ ).Scan(
+ &uid,
+ ); err != nil {
+ return nil, FormatError(err)
+ }
+ create.UID = uid
+ return create, nil
}
func (*Store) listPolicyImplV2(ctx context.Context, tx *Tx, find *FindPolicyMessage) ([]*PolicyMessage, error) {
@@ -764,7 +386,8 @@ func (*Store) listPolicyImplV2(ctx context.Context, tx *Tx, find *FindPolicyMess
resource_id,
inherit_from_parent,
type,
- payload
+ payload,
+ row_status
FROM policy
WHERE `+strings.Join(where, " AND "),
args...,
@@ -777,6 +400,7 @@ func (*Store) listPolicyImplV2(ctx context.Context, tx *Tx, find *FindPolicyMess
var policyList []*PolicyMessage
for rows.Next() {
var policyMessage PolicyMessage
+ var rowStatus api.RowStatus
if err := rows.Scan(
&policyMessage.UID,
&policyMessage.ResourceType,
@@ -784,9 +408,13 @@ func (*Store) listPolicyImplV2(ctx context.Context, tx *Tx, find *FindPolicyMess
&policyMessage.InheritFromParent,
&policyMessage.Type,
&policyMessage.Payload,
+ &rowStatus,
); err != nil {
return nil, FormatError(err)
}
+ if rowStatus == api.Normal {
+ policyMessage.Enforce = true
+ }
policyList = append(policyList, &policyMessage)
}
if err := rows.Err(); err != nil {
@@ -794,11 +422,3 @@ func (*Store) listPolicyImplV2(ctx context.Context, tx *Tx, find *FindPolicyMess
}
return policyList, nil
}
-
-func (s *Store) storePolicyIntoCache(policy *PolicyMessage) {
- if policy.Type != api.PolicyTypePipelineApproval {
- return
- }
-
- s.policyCache.Store(getPolicyCacheKey(policy.ResourceType, policy.ResourceUID, policy.Type), policy)
-}
diff --git a/backend/tests/backup_restore_test.go b/backend/tests/backup_restore_test.go
index f468729bee..530da5171c 100644
--- a/backend/tests/backup_restore_test.go
+++ b/backend/tests/backup_restore_test.go
@@ -433,11 +433,8 @@ func setUpForPITRTest(ctx context.Context, t *testing.T, ctl *controller) (*api.
buf, err := json.Marshal(policy)
a.NoError(err)
str := string(buf)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeBackupPlan,
- Payload: &str,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeBackupPlan, api.PolicyUpsert{
+ Payload: &str,
})
a.NoError(err)
diff --git a/backend/tests/policy.go b/backend/tests/policy.go
index 9671a51a08..9bbf2efe9c 100644
--- a/backend/tests/policy.go
+++ b/backend/tests/policy.go
@@ -12,13 +12,17 @@ import (
)
// upsertPolicy upserts the policy.
-func (ctl *controller) upsertPolicy(policyUpsert api.PolicyUpsert) (*api.Policy, error) {
+// ResourceType: api.PolicyResourceTypeEnvironment,
+//
+// ResourceID: prodEnvironment.ID,
+// Type
+func (ctl *controller) upsertPolicy(resourceType api.PolicyResourceType, resourceID int, pType api.PolicyType, policyUpsert api.PolicyUpsert) (*api.Policy, error) {
buf := new(bytes.Buffer)
if err := jsonapi.MarshalPayload(buf, &policyUpsert); err != nil {
return nil, errors.Wrap(err, "failed to marshal policyUpsert")
}
- body, err := ctl.patch(fmt.Sprintf("/policy/%s/%d?type=%s", strings.ToLower(string(policyUpsert.ResourceType)), policyUpsert.ResourceID, policyUpsert.Type), buf)
+ body, err := ctl.patch(fmt.Sprintf("/policy/%s/%d?type=%s", strings.ToLower(string(resourceType)), resourceID, pType), buf)
if err != nil {
return nil, err
}
@@ -31,8 +35,8 @@ func (ctl *controller) upsertPolicy(policyUpsert api.PolicyUpsert) (*api.Policy,
}
// deletePolicy deletes the archived policy.
-func (ctl *controller) deletePolicy(policyDelete api.PolicyDelete) error {
- _, err := ctl.delete(fmt.Sprintf("/policy/environment/%d?type=%s", policyDelete.ResourceID, policyDelete.Type), new(bytes.Buffer))
+func (ctl *controller) deletePolicy(resourceID int, pType api.PolicyType) error {
+ _, err := ctl.delete(fmt.Sprintf("/policy/environment/%d?type=%s", resourceID, pType), new(bytes.Buffer))
if err != nil {
return err
}
diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.go
index 0d7887e333..9b5ec94a3a 100644
--- a/backend/tests/schema_update_test.go
+++ b/backend/tests/schema_update_test.go
@@ -1601,11 +1601,8 @@ func TestVCS_SQL_Review(t *testing.T) {
policyPayload, err := prodTemplateSQLReviewPolicyForPostgreSQL()
a.NoError(err)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
})
a.NoError(err)
diff --git a/backend/tests/sensitive_data_test.go b/backend/tests/sensitive_data_test.go
index 64b895f43a..137a2c2824 100644
--- a/backend/tests/sensitive_data_test.go
+++ b/backend/tests/sensitive_data_test.go
@@ -160,11 +160,8 @@ func TestSensitiveData(t *testing.T) {
a.NoError(err)
payloadString := string(policyPayload)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeDatabase,
- ResourceID: database.ID,
- Type: api.PolicyTypeSensitiveData,
- Payload: &payloadString,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeDatabase, database.ID, api.PolicyTypeSensitiveData, api.PolicyUpsert{
+ Payload: &payloadString,
})
a.NoError(err)
diff --git a/backend/tests/sql_review_test.go b/backend/tests/sql_review_test.go
index 205697ba72..eab3b699e0 100644
--- a/backend/tests/sql_review_test.go
+++ b/backend/tests/sql_review_test.go
@@ -121,19 +121,13 @@ func TestSQLReviewForPostgreSQL(t *testing.T) {
policyPayload, err := prodTemplateSQLReviewPolicyForPostgreSQL()
a.NoError(err)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
})
a.NoError(err)
- policy, err := ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
+ policy, err := ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
})
a.NoError(err)
a.NotNil(policy.Environment)
@@ -195,12 +189,9 @@ func TestSQLReviewForPostgreSQL(t *testing.T) {
// disable the SQL review policy
disable := string(api.Archived)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
- RowStatus: &disable,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
+ RowStatus: &disable,
})
a.NoError(err)
@@ -208,11 +199,7 @@ func TestSQLReviewForPostgreSQL(t *testing.T) {
a.Equal(noSQLReviewPolicy, result)
// delete the SQL review policy
- err = ctl.deletePolicy(api.PolicyDelete{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- })
+ err = ctl.deletePolicy(prodEnvironment.ID, api.PolicyTypeSQLReview)
a.NoError(err)
result = createIssueAndReturnSQLReviewResult(a, ctl, database.ID, project.ID, statements[0], false)
@@ -311,19 +298,13 @@ func TestSQLReviewForMySQL(t *testing.T) {
policyPayload, err := prodTemplateSQLReviewPolicyForMySQL()
a.NoError(err)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
})
a.NoError(err)
- policy, err := ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
+ policy, err := ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
})
a.NoError(err)
a.NotNil(policy.Environment)
@@ -418,27 +399,17 @@ func TestSQLReviewForMySQL(t *testing.T) {
// disable the SQL review policy
disable := string(api.Archived)
- _, err = ctl.upsertPolicy(api.PolicyUpsert{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- Payload: &policyPayload,
- RowStatus: &disable,
+ _, err = ctl.upsertPolicy(api.PolicyResourceTypeEnvironment, prodEnvironment.ID, api.PolicyTypeSQLReview, api.PolicyUpsert{
+ Payload: &policyPayload,
+ RowStatus: &disable,
})
a.NoError(err)
- result := createIssueAndReturnSQLReviewResult(a, ctl, database.ID, project.ID, statements[0], false)
- a.Equal(noSQLReviewPolicy, result)
-
// delete the SQL review policy
- err = ctl.deletePolicy(api.PolicyDelete{
- ResourceType: api.PolicyResourceTypeEnvironment,
- ResourceID: prodEnvironment.ID,
- Type: api.PolicyTypeSQLReview,
- })
+ err = ctl.deletePolicy(prodEnvironment.ID, api.PolicyTypeSQLReview)
a.NoError(err)
- result = createIssueAndReturnSQLReviewResult(a, ctl, database.ID, project.ID, statements[0], false)
+ result := createIssueAndReturnSQLReviewResult(a, ctl, database.ID, project.ID, statements[0], false)
a.Equal(noSQLReviewPolicy, result)
}
diff --git a/frontend/src/components/SQLReview/components/SQLReviewCard.vue b/frontend/src/components/SQLReview/components/SQLReviewCard.vue
index 3315d94526..4c4eb788f3 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewCard.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewCard.vue
@@ -51,30 +51,6 @@
</span>
</dd>
</div>
- <div class="grid grid-cols-4 gap-4 px-4 py-2 items-center">
- <dt class="text-sm font-medium text-control-light">
- {{ $t("common.created-at") }}
- </dt>
- <dd class="mt-1 flex text-sm text-main col-span-2">
- {{ humanizeTs(reviewPolicy.createdTs) }}
- </dd>
- </div>
- <div class="grid grid-cols-4 gap-4 px-4 py-2 items-center">
- <dt class="text-sm font-medium text-control-light">
- {{ $t("common.updated-at") }}
- </dt>
- <dd class="mt-1 flex text-sm text-main col-span-2">
- {{ humanizeTs(reviewPolicy.updatedTs) }}
- </dd>
- </div>
- <div class="grid grid-cols-4 gap-4 px-4 py-2 items-center">
- <dt class="text-sm font-medium text-control-light">
- {{ $t("common.creator") }}
- </dt>
- <dd class="mt-1 flex text-sm text-main col-span-2">
- {{ reviewPolicy.creator.name }}
- </dd>
- </div>
</dl>
</div>
</div>
diff --git a/frontend/src/store/modules/policy.ts b/frontend/src/store/modules/policy.ts
index 6cd68bd530..2620e0012c 100644
--- a/frontend/src/store/modules/policy.ts
+++ b/frontend/src/store/modules/policy.ts
@@ -20,7 +20,6 @@ import {
PolicyUpsert,
SensitiveDataPolicyPayload,
} from "@/types/policy";
-import { getPrincipalFromIncludedList } from "./principal";
import { useEnvironmentStore } from "./environment";
import { useCurrentUser } from "./auth";
@@ -57,19 +56,8 @@ function convert(
const environment = convertEnvironment(policy, includedList);
const result = {
- ...(policy.attributes as Omit<
- Policy,
- "id" | "environment" | "payload" | "creator" | "updater"
- >),
+ ...(policy.attributes as Omit<Policy, "id" | "environment" | "payload">),
id: parseInt(policy.id),
- creator: getPrincipalFromIncludedList(
- policy.relationships!.creator.data,
- includedList
- ),
- updater: getPrincipalFromIncludedList(
- policy.relationships!.updater.data,
- includedList
- ),
environment,
payload: JSON.parse((policy.attributes.payload as string) || "{}"),
};
diff --git a/frontend/src/store/modules/sqlReview.ts b/frontend/src/store/modules/sqlReview.ts
index 095f23bc23..7569a2c3b5 100644
--- a/frontend/src/store/modules/sqlReview.ts
+++ b/frontend/src/store/modules/sqlReview.ts
@@ -39,10 +39,6 @@ const convertToSQLReviewPolicy = (
return {
id: policy.id,
- creator: policy.creator,
- createdTs: policy.createdTs,
- updater: policy.updater,
- updatedTs: policy.updatedTs,
rowStatus: policy.rowStatus,
environment: policy.environment,
name: payload.name,
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index d983ccd4d6..8983e4babd 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -287,10 +287,6 @@ const makeUnknown = (type: ResourceType) => {
const UNKNOWN_POLICY: Policy = {
id: UNKNOWN_ID,
- creator: UNKNOWN_PRINCIPAL,
- createdTs: 0,
- updater: UNKNOWN_PRINCIPAL,
- updatedTs: 0,
rowStatus: "NORMAL",
resourceType: "",
resourceId: UNKNOWN_ID,
@@ -465,10 +461,6 @@ const makeUnknown = (type: ResourceType) => {
const UNKNOWN_SQL_REVIEW_POLICY: SQLReviewPolicy = {
id: UNKNOWN_ID,
- creator: UNKNOWN_PRINCIPAL,
- updater: UNKNOWN_PRINCIPAL,
- createdTs: 0,
- updatedTs: 0,
rowStatus: "NORMAL",
environment: UNKNOWN_ENVIRONMENT,
name: "",
@@ -660,10 +652,6 @@ const makeEmpty = (type: ResourceType) => {
const EMPTY_POLICY: Policy = {
id: EMPTY_ID,
- creator: EMPTY_PRINCIPAL,
- createdTs: 0,
- updater: EMPTY_PRINCIPAL,
- updatedTs: 0,
rowStatus: "NORMAL",
resourceType: "",
resourceId: EMPTY_ID,
@@ -838,10 +826,6 @@ const makeEmpty = (type: ResourceType) => {
const EMPTY_SQL_REVIEW_POLICY: SQLReviewPolicy = {
id: EMPTY_ID,
- creator: EMPTY_PRINCIPAL,
- updater: EMPTY_PRINCIPAL,
- createdTs: 0,
- updatedTs: 0,
rowStatus: "NORMAL",
environment: EMPTY_ENVIRONMENT,
name: "",
diff --git a/frontend/src/types/policy.ts b/frontend/src/types/policy.ts
index 5669cf1139..34a3bcda3b 100644
--- a/frontend/src/types/policy.ts
+++ b/frontend/src/types/policy.ts
@@ -3,7 +3,6 @@ import {
Environment,
IssueType,
PolicyId,
- Principal,
RuleType,
RuleLevel,
SubsetOf,
@@ -110,10 +109,6 @@ export type Policy = {
id: PolicyId;
// Standard fields
- creator: Principal;
- createdTs: number;
- updater: Principal;
- updatedTs: number;
rowStatus: RowStatus;
// Related fields
diff --git a/frontend/src/types/proto/v1/org_policy_service.ts b/frontend/src/types/proto/v1/org_policy_service.ts
index 23d4890520..76e4ebe316 100644
--- a/frontend/src/types/proto/v1/org_policy_service.ts
+++ b/frontend/src/types/proto/v1/org_policy_service.ts
@@ -373,6 +373,7 @@ export interface Policy {
sensitiveDataPolicy?: SensitiveDataPolicy | undefined;
accessControlPolicy?: AccessControlPolicy | undefined;
sqlReviewPolicy?: SQLReviewPolicy | undefined;
+ enforce: boolean;
}
export interface DeploymentApprovalPolicy {
@@ -793,6 +794,7 @@ function createBasePolicy(): Policy {
sensitiveDataPolicy: undefined,
accessControlPolicy: undefined,
sqlReviewPolicy: undefined,
+ enforce: false,
};
}
@@ -825,6 +827,9 @@ export const Policy = {
if (message.sqlReviewPolicy !== undefined) {
SQLReviewPolicy.encode(message.sqlReviewPolicy, writer.uint32(82).fork()).ldelim();
}
+ if (message.enforce === true) {
+ writer.uint32(88).bool(message.enforce);
+ }
return writer;
},
@@ -862,6 +867,9 @@ export const Policy = {
case 10:
message.sqlReviewPolicy = SQLReviewPolicy.decode(reader, reader.uint32());
break;
+ case 11:
+ message.enforce = reader.bool();
+ break;
default:
reader.skipType(tag & 7);
break;
@@ -887,6 +895,7 @@ export const Policy = {
? AccessControlPolicy.fromJSON(object.accessControlPolicy)
: undefined,
sqlReviewPolicy: isSet(object.sqlReviewPolicy) ? SQLReviewPolicy.fromJSON(object.sqlReviewPolicy) : undefined,
+ enforce: isSet(object.enforce) ? Boolean(object.enforce) : false,
};
},
@@ -909,6 +918,7 @@ export const Policy = {
: undefined);
message.sqlReviewPolicy !== undefined &&
(obj.sqlReviewPolicy = message.sqlReviewPolicy ? SQLReviewPolicy.toJSON(message.sqlReviewPolicy) : undefined);
+ message.enforce !== undefined && (obj.enforce = message.enforce);
return obj;
},
@@ -934,6 +944,7 @@ export const Policy = {
message.sqlReviewPolicy = (object.sqlReviewPolicy !== undefined && object.sqlReviewPolicy !== null)
? SQLReviewPolicy.fromPartial(object.sqlReviewPolicy)
: undefined;
+ message.enforce = object.enforce ?? false;
return message;
},
};
diff --git a/frontend/src/types/sqlReview.ts b/frontend/src/types/sqlReview.ts
index 3b2ea48b82..e9ac52e4e7 100644
--- a/frontend/src/types/sqlReview.ts
+++ b/frontend/src/types/sqlReview.ts
@@ -1,6 +1,5 @@
import { useI18n } from "vue-i18n";
import { PolicyId } from "./id";
-import { Principal } from "./principal";
import { RowStatus } from "./common";
import { Environment } from "./environment";
import { PlanType } from "./plan";
@@ -184,10 +183,6 @@ export interface SQLReviewPolicy {
id: PolicyId;
// Standard fields
- creator: Principal;
- createdTs: number;
- updater: Principal;
- updatedTs: number;
rowStatus: RowStatus;
// Domain specific fields
diff --git a/proto/generated-go/v1/org_policy_service.pb.go b/proto/generated-go/v1/org_policy_service.pb.go
index e3229bf452..4650792269 100644
--- a/proto/generated-go/v1/org_policy_service.pb.go
+++ b/proto/generated-go/v1/org_policy_service.pb.go
@@ -730,7 +730,8 @@ type Policy struct {
// *Policy_SensitiveDataPolicy
// *Policy_AccessControlPolicy
// *Policy_SqlReviewPolicy
- Policy isPolicy_Policy `protobuf_oneof:"policy"`
+ Policy isPolicy_Policy `protobuf_oneof:"policy"`
+ Enforce bool `protobuf:"varint,11,opt,name=enforce,proto3" json:"enforce,omitempty"`
}
func (x *Policy) Reset() {
@@ -835,6 +836,13 @@ func (x *Policy) GetSqlReviewPolicy() *SQLReviewPolicy {
return nil
}
+func (x *Policy) GetEnforce() bool {
+ if x != nil {
+ return x.Enforce
+ }
+ return false
+}
+
type isPolicy_Policy interface {
isPolicy_Policy()
}
@@ -1431,7 +1439,7 @@ var file_v1_org_policy_service_proto_rawDesc = []byte{
0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63,
0x69, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65,
0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65,
- 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xcd, 0x04, 0x0a, 0x06,
+ 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xe7, 0x04, 0x0a, 0x06,
0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x03, 0x75,
@@ -1468,224 +1476,226 @@ var file_v1_org_policy_service_proto_rawDesc = []byte{
0x32, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,
0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00,
0x52, 0x0f, 0x73, 0x71, 0x6c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x50, 0x6f, 0x6c, 0x69, 0x63,
- 0x79, 0x42, 0x08, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xd3, 0x01, 0x0a, 0x18,
+ 0x79, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x70,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xd3, 0x01, 0x0a, 0x18, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79,
+ 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x50, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x12, 0x48, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74,
+ 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f,
+ 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0f, 0x64, 0x65, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x6d, 0x0a, 0x1e,
+ 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x70, 0x72, 0x6f,
+ 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x18, 0x02,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
+ 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70,
+ 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x1c, 0x64,
+ 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61,
+ 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x22, 0xf1, 0x01, 0x0a, 0x1a,
0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76,
- 0x61, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x48, 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61,
- 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67,
- 0x79, 0x52, 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65,
- 0x67, 0x79, 0x12, 0x6d, 0x0a, 0x1e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74,
- 0x5f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65,
- 0x67, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d,
- 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74,
- 0x65, 0x67, 0x79, 0x52, 0x1c, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41,
- 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65,
- 0x73, 0x22, 0xf1, 0x01, 0x0a, 0x1a, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74,
- 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
- 0x12, 0x44, 0x0a, 0x0f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74,
- 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65,
- 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65,
- 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76,
- 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a,
+ 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x44, 0x0a, 0x0f, 0x64, 0x65,
+ 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+ 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65,
+ 0x52, 0x0e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65,
+ 0x12, 0x41, 0x0a, 0x0e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x6f,
+ 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47,
+ 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72,
+ 0x6f, 0x75, 0x70, 0x12, 0x4a, 0x0a, 0x11, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f,
+ 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d,
0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70,
- 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d, 0x61, 0x70, 0x70, 0x72,
- 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x4a, 0x0a, 0x11, 0x61, 0x70, 0x70,
- 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
- 0x76, 0x31, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74,
- 0x65, 0x67, 0x79, 0x52, 0x10, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72,
- 0x61, 0x74, 0x65, 0x67, 0x79, 0x22, 0x99, 0x01, 0x0a, 0x10, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70,
- 0x50, 0x6c, 0x61, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x63,
- 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75,
- 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x08, 0x73,
- 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x48, 0x0a, 0x12, 0x72, 0x65, 0x74, 0x65, 0x6e,
- 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11,
- 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
- 0x6e, 0x22, 0x58, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61,
- 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x41, 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x73,
- 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,
- 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0d, 0x73, 0x65,
- 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x22, 0x96, 0x01, 0x0a, 0x0d,
- 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a,
- 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
- 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63,
- 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c,
- 0x75, 0x6d, 0x6e, 0x12, 0x3f, 0x0a, 0x09, 0x6d, 0x61, 0x73, 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65,
- 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61,
- 0x74, 0x61, 0x4d, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x6d, 0x61, 0x73, 0x6b,
- 0x54, 0x79, 0x70, 0x65, 0x22, 0x5c, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f,
- 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x45, 0x0a, 0x0e, 0x64,
- 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20,
- 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
- 0x31, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x52,
- 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6c,
- 0x65, 0x73, 0x22, 0x38, 0x0a, 0x11, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74,
- 0x72, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6c, 0x6c, 0x5f,
- 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c,
- 0x66, 0x75, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0f,
- 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12,
- 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
- 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x02,
- 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
- 0x76, 0x31, 0x2e, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65,
- 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x74, 0x0a, 0x0d, 0x53, 0x51, 0x4c, 0x52, 0x65,
- 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x05,
- 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x79,
- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76,
- 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65,
- 0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x8b, 0x01,
- 0x0a, 0x0a, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17,
- 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50,
- 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x45, 0x50,
- 0x4c, 0x4f, 0x59, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c,
- 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41,
- 0x4e, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x5f, 0x52, 0x45, 0x56, 0x49, 0x45,
- 0x57, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x45, 0x4e, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45,
- 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x43, 0x45, 0x53,
- 0x53, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x4f, 0x4c, 0x10, 0x05, 0x2a, 0x69, 0x0a, 0x0d, 0x41,
- 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1e, 0x0a, 0x1a,
- 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x45, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x55,
- 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12,
- 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x44,
- 0x42, 0x41, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c,
- 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4f,
- 0x57, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x50, 0x0a, 0x10, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76,
- 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x50,
- 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f,
- 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a,
- 0x09, 0x41, 0x55, 0x54, 0x4f, 0x4d, 0x41, 0x54, 0x49, 0x43, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06,
- 0x4d, 0x41, 0x4e, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x50, 0x0a, 0x12, 0x42, 0x61, 0x63, 0x6b,
- 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x18,
- 0x0a, 0x14, 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
- 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45,
- 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x41, 0x49, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0a,
- 0x0a, 0x06, 0x57, 0x45, 0x45, 0x4b, 0x4c, 0x59, 0x10, 0x03, 0x2a, 0x3f, 0x0a, 0x15, 0x53, 0x65,
- 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x73, 0x6b, 0x54,
- 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45,
- 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b,
- 0x0a, 0x07, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x01, 0x2a, 0x51, 0x0a, 0x12, 0x53,
- 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x4c, 0x65, 0x76, 0x65,
- 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
- 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f,
- 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02,
- 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x32, 0x81,
- 0x0d, 0x0a, 0x10, 0x4f, 0x72, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76,
- 0x69, 0x63, 0x65, 0x12, 0xa7, 0x02, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63,
- 0x79, 0x12, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50,
- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xe5, 0x01, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,
- 0xd3, 0xe4, 0x93, 0x02, 0xd7, 0x01, 0x5a, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70,
- 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x26, 0x12, 0x24, 0x2f, 0x76,
- 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
- 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f,
- 0x2a, 0x7d, 0x5a, 0x32, 0x12, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69,
- 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63,
- 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x3e, 0x12, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73,
- 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64,
- 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63,
- 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xae, 0x02,
- 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x20,
- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
- 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
- 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x22, 0xd8, 0x01, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xce, 0x01,
- 0x5a, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d,
- 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69,
- 0x63, 0x69, 0x65, 0x73, 0x5a, 0x26, 0x12, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72,
- 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73,
- 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x32, 0x12, 0x30,
- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69,
- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61,
- 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
- 0x5a, 0x3e, 0x12, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d,
- 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69,
- 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62,
- 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
- 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0xd5,
- 0x02, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12,
- 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x8d, 0x02, 0xda, 0x41, 0x0d, 0x70, 0x61, 0x72, 0x65,
- 0x6e, 0x74, 0x2c, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xf6, 0x01,
- 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5a, 0x2a, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69,
- 0x63, 0x79, 0x22, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d,
- 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69,
- 0x63, 0x69, 0x65, 0x73, 0x5a, 0x2e, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x24,
- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69,
- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69,
- 0x63, 0x69, 0x65, 0x73, 0x5a, 0x3a, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x30,
- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69,
- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61,
- 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
- 0x5a, 0x46, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x3c, 0x2f, 0x76, 0x31, 0x2f,
- 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
- 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73,
- 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,
- 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6f,
- 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x86, 0x03, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74,
- 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69,
- 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65,
- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xbe,
- 0x02, 0xda, 0x41, 0x12, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74,
- 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xa2, 0x02, 0x3a, 0x06, 0x70,
- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5a, 0x31, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x32,
- 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c,
- 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x35, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69,
- 0x63, 0x79, 0x32, 0x2b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
- 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a,
- 0x41, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x32, 0x37, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
- 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69,
- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61,
- 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f,
- 0x2a, 0x7d, 0x5a, 0x4d, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x32, 0x43, 0x2f, 0x76,
+ 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x10, 0x61,
+ 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x22,
+ 0x99, 0x01, 0x0a, 0x10, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x50, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53,
+ 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,
+ 0x65, 0x12, 0x48, 0x0a, 0x12, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64,
+ 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74,
+ 0x69, 0x6f, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x58, 0x0a, 0x13, 0x53,
+ 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x12, 0x41, 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f,
+ 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69,
+ 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0d, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76,
+ 0x65, 0x44, 0x61, 0x74, 0x61, 0x22, 0x96, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74,
+ 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12,
+ 0x14, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
+ 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x3f, 0x0a,
+ 0x09, 0x6d, 0x61, 0x73, 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,
+ 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x73, 0x6b,
+ 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x6d, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5c,
+ 0x0a, 0x13, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x45, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f,
+ 0x77, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x65,
+ 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x64,
+ 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x38, 0x0a, 0x11,
+ 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x52, 0x75, 0x6c,
+ 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,
+ 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x75, 0x6c, 0x6c, 0x44, 0x61,
+ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0f, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76,
+ 0x69, 0x65, 0x77, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74,
+ 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12,
+ 0x30, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x51, 0x4c,
+ 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65,
+ 0x73, 0x22, 0x74, 0x0a, 0x0d, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75,
+ 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x75, 0x6c,
+ 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a,
+ 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
+ 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x8b, 0x01, 0x0a, 0x0a, 0x50, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
+ 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x4d, 0x45, 0x4e,
+ 0x54, 0x5f, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b,
+ 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41, 0x4e, 0x10, 0x02, 0x12, 0x0e, 0x0a,
+ 0x0a, 0x53, 0x51, 0x4c, 0x5f, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x10, 0x03, 0x12, 0x12, 0x0a,
+ 0x0e, 0x53, 0x45, 0x4e, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10,
+ 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x43, 0x4f, 0x4e, 0x54,
+ 0x52, 0x4f, 0x4c, 0x10, 0x05, 0x2a, 0x69, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61,
+ 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e,
+ 0x45, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,
+ 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56,
+ 0x41, 0x4c, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x44, 0x42, 0x41, 0x10, 0x01, 0x12, 0x20,
+ 0x0a, 0x1c, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50,
+ 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x02,
+ 0x2a, 0x50, 0x0a, 0x10, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x61,
+ 0x74, 0x65, 0x67, 0x79, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x50, 0x50, 0x52, 0x4f, 0x56, 0x41, 0x4c,
+ 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,
+ 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x55, 0x54, 0x4f, 0x4d,
+ 0x41, 0x54, 0x49, 0x43, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x41, 0x4e, 0x55, 0x41, 0x4c,
+ 0x10, 0x02, 0x2a, 0x50, 0x0a, 0x12, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e,
+ 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x43, 0x48, 0x45,
+ 0x44, 0x55, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
+ 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a,
+ 0x05, 0x44, 0x41, 0x49, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x57, 0x45, 0x45, 0x4b,
+ 0x4c, 0x59, 0x10, 0x03, 0x2a, 0x3f, 0x0a, 0x15, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76,
+ 0x65, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a,
+ 0x15, 0x4d, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
+ 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x46, 0x41,
+ 0x55, 0x4c, 0x54, 0x10, 0x01, 0x2a, 0x51, 0x0a, 0x12, 0x53, 0x51, 0x4c, 0x52, 0x65, 0x76, 0x69,
+ 0x65, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c,
+ 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
+ 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a,
+ 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49,
+ 0x53, 0x41, 0x42, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x32, 0x81, 0x0d, 0x0a, 0x10, 0x4f, 0x72, 0x67,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7, 0x02,
+ 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1d, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22,
+ 0xe5, 0x01, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xd7, 0x01,
+ 0x5a, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72,
+ 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
+ 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x26, 0x12, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,
+ 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a,
+ 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x32, 0x12, 0x30,
+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,
+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
+ 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d,
+ 0x5a, 0x3e, 0x12, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e,
+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73,
+ 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
+ 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d,
+ 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x6f, 0x6c, 0x69,
+ 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xae, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63,
+ 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x6c,
+ 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd8, 0x01,
+ 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xce, 0x01, 0x5a, 0x22, 0x12, 0x20, 0x2f, 0x76,
+ 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
+ 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x26,
+ 0x12, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e,
+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f,
+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x32, 0x12, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70,
+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,
+ 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x3e, 0x12, 0x3c, 0x2f, 0x76,
+ 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,
+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
+ 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a,
+ 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f,
+ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0xd5, 0x02, 0x0a, 0x0c, 0x43, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x22, 0x8d, 0x02, 0xda, 0x41, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x70, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xf6, 0x01, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x5a, 0x2a, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x20, 0x2f, 0x76,
+ 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
+ 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x2e,
+ 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70,
+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
+ 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x3a,
+ 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70,
+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,
+ 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5a, 0x46, 0x3a, 0x06, 0x70, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x22, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e,
+ 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a,
+ 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74,
+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,
+ 0x65, 0x73, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
+ 0x12, 0x86, 0x03, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63,
+ 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+ 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xbe, 0x02, 0xda, 0x41, 0x12, 0x70, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b,
+ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xa2, 0x02, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5a,
+ 0x31, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x32, 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
+ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a,
+ 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f,
+ 0x2a, 0x7d, 0x5a, 0x35, 0x3a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x32, 0x2b, 0x2f, 0x76,
0x31, 0x2f, 0x7b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65,
- 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e,
- 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,
- 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a,
- 0x7d, 0x32, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12,
- 0xb0, 0x02, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
- 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44,
- 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xe5, 0x01, 0xda, 0x41, 0x04,
- 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0xd7, 0x01, 0x5a, 0x22, 0x2a, 0x20, 0x2f,
- 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
- 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a,
- 0x26, 0x2a, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76,
- 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69,
- 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x32, 0x2a, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
- 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f,
- 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x3e, 0x2a, 0x3c, 0x2f,
- 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
+ 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f,
+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x41, 0x3a, 0x06, 0x70, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x32, 0x37, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
+ 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,
+ 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x4d, 0x3a, 0x06,
+ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x32, 0x43, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x2f,
- 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2a, 0x15, 0x2f, 0x76, 0x31,
- 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f,
- 0x2a, 0x7d, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d,
- 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x32, 0x1c, 0x2f, 0x76, 0x31,
+ 0x2f, 0x7b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x6f,
+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xb0, 0x02, 0x0a, 0x0c, 0x44, 0x65,
+ 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
+ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
+ 0x6d, 0x70, 0x74, 0x79, 0x22, 0xe5, 0x01, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3,
+ 0xe4, 0x93, 0x02, 0xd7, 0x01, 0x5a, 0x22, 0x2a, 0x20, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,
+ 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f,
+ 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x26, 0x2a, 0x24, 0x2f, 0x76, 0x31,
+ 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a,
+ 0x7d, 0x5a, 0x32, 0x2a, 0x30, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65,
+ 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e,
+ 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,
+ 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x5a, 0x3e, 0x2a, 0x3c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,
+ 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f,
+ 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61,
+ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,
+ 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2a, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
+ 0x3d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x11, 0x5a, 0x0f,
+ 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62,
+ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/v1/org_policy_service.proto b/proto/v1/org_policy_service.proto
index 5af07a505e..2f7ebd3f13 100644
--- a/proto/v1/org_policy_service.proto
+++ b/proto/v1/org_policy_service.proto
@@ -226,6 +226,8 @@ message Policy {
AccessControlPolicy access_control_policy = 9;
SQLReviewPolicy sql_review_policy = 10;
}
+
+ bool enforce = 11;
}
enum PolicyType {