MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetMaskingExemptionPolicyByProject

Method GetMaskingExemptionPolicyByProject

backend/store/policy.go:381–402  ·  view source on GitHub ↗

GetMaskingExemptionPolicyByProject gets the masking exemption policy for a project.

(ctx context.Context, workspaceID string, projectID string)

Source from the content-addressed store, hash-verified

379
380// GetMaskingExemptionPolicyByProject gets the masking exemption policy for a project.
381func (s *Store) GetMaskingExemptionPolicyByProject(ctx context.Context, workspaceID string, projectID string) (*storepb.MaskingExemptionPolicy, error) {
382 policy, err := s.GetPolicy(ctx, &FindPolicyMessage{
383 Workspace: workspaceID,
384 ResourceType: new(storepb.Policy_PROJECT),
385 Resource: new(common.FormatProject(projectID)),
386 Type: new(storepb.Policy_MASKING_EXEMPTION),
387 })
388 if err != nil {
389 return nil, err
390 }
391
392 if policy == nil {
393 return &storepb.MaskingExemptionPolicy{}, nil
394 }
395
396 p := new(storepb.MaskingExemptionPolicy)
397 if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policy.Payload), p); err != nil {
398 return nil, err
399 }
400
401 return p, nil
402}
403
404// PolicyMessage is the mssage for policy.
405type PolicyMessage struct {

Callers 1

Calls 2

GetPolicyMethod · 0.95
UnmarshalMethod · 0.80

Tested by

no test coverage detected