biz

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicySeedTableInvocation   = "policy_invocation"
	PolicySeedTableCircuitBreak = "policy_circuit_break"
)

Variables

This section is empty.

Functions

func FirstPolicySeedID added in v0.8.0

func FirstPolicySeedID(ctx context.Context, table string) (string, error)

FirstPolicySeedID returns the first seed ID of the given table from policy_seed.json. Extra rows of the same table are ignored with a warning. A missing file or empty table returns ("", nil) so callers can skip.

Types

type PolicyChangeSyncer

type PolicyChangeSyncer interface {
	SyncPolicyChange(ctx context.Context, scopeType, scopeCode, modelID string) error
}

type PolicyCircuitBreak

type PolicyCircuitBreak struct {
	Trans                 *util.Trans
	PolicyCircuitBreakDAL *dal.PolicyCircuitBreak
	PolicyRedisSync       PolicyChangeSyncer
	ModelDAL              *resourceDal.Model
	DataPermissionDAL     *resourceDal.DataPermission
	AuditLogBIZ           *opsBiz.AuditLog
}

Circuit break policy management

func (*PolicyCircuitBreak) CopyTemplateToModel

func (a *PolicyCircuitBreak) CopyTemplateToModel(ctx context.Context, templateID string, form *schema.PolicyCopyToModelForm) (*schema.PolicyCircuitBreak, error)

CopyTemplateToModel copies a policy template into a model-owned policy instance.

func (*PolicyCircuitBreak) Create

Create a new policy circuit break in the data access object.

func (*PolicyCircuitBreak) Delete

func (a *PolicyCircuitBreak) Delete(ctx context.Context, id string) error

Delete the specified policy circuit break from the data access object.

func (*PolicyCircuitBreak) Get

Get the specified policy circuit break from the data access object.

func (*PolicyCircuitBreak) Query

Query policy circuit breaks from the data access object based on the provided parameters and options.

func (*PolicyCircuitBreak) ToggleEnabled

func (a *PolicyCircuitBreak) ToggleEnabled(ctx context.Context, id string, formItem *schema.PolicyEnabledForm) error

ToggleEnabled updates only the enabled status of a policy and re-syncs policy cache.

func (*PolicyCircuitBreak) Update

Update the specified policy circuit break in the data access object.

type PolicyInvocation

type PolicyInvocation struct {
	Trans               *util.Trans
	PolicyInvocationDAL *dal.PolicyInvocation
	PolicyRedisSync     PolicyChangeSyncer
	ModelDAL            *resourceDal.Model
	DataPermissionDAL   *resourceDal.DataPermission
	AuditLogBIZ         *opsBiz.AuditLog
}

Invocation policy management

func (*PolicyInvocation) CopyTemplateToModel

func (a *PolicyInvocation) CopyTemplateToModel(ctx context.Context, templateID string, form *schema.PolicyCopyToModelForm) (*schema.PolicyInvocation, error)

CopyTemplateToModel copies a policy template into a model-owned policy instance.

func (*PolicyInvocation) Create

Create a new policy invocation in the data access object.

func (*PolicyInvocation) Delete

func (a *PolicyInvocation) Delete(ctx context.Context, id string) error

Delete the specified policy invocation from the data access object.

func (*PolicyInvocation) Get

Get the specified policy invocation from the data access object.

func (*PolicyInvocation) Query

Query policy invocations from the data access object based on the provided parameters and options.

func (*PolicyInvocation) ToggleEnabled

func (a *PolicyInvocation) ToggleEnabled(ctx context.Context, id string, formItem *schema.PolicyEnabledForm) error

ToggleEnabled updates only the enabled status of a policy and re-syncs policy cache.

func (*PolicyInvocation) Update

func (a *PolicyInvocation) Update(ctx context.Context, id string, formItem *schema.PolicyInvocationForm) error

Update the specified policy invocation in the data access object.

type PolicyLimit

type PolicyLimit struct {
	Trans             *util.Trans
	PolicyLimitDAL    *dal.PolicyLimit
	PolicyRedisSync   PolicyChangeSyncer
	ModelDAL          *resourceDal.Model
	DataPermissionDAL *resourceDal.DataPermission
	AuditLogBIZ       *opsBiz.AuditLog
}

Limit policy management

func (*PolicyLimit) CopyTemplateToModel

func (a *PolicyLimit) CopyTemplateToModel(ctx context.Context, templateID string, form *schema.PolicyCopyToModelForm) (*schema.PolicyLimit, error)

CopyTemplateToModel copies a policy template into a model-owned policy instance.

func (*PolicyLimit) Create

func (a *PolicyLimit) Create(ctx context.Context, formItem *schema.PolicyLimitForm) (*schema.PolicyLimit, error)

Create a new policy limit in the data access object.

func (*PolicyLimit) Delete

func (a *PolicyLimit) Delete(ctx context.Context, id string) error

Delete the specified policy limit from the data access object.

func (*PolicyLimit) Get

Get the specified policy limit from the data access object.

func (*PolicyLimit) Query

Query policy limits from the data access object based on the provided parameters and options.

func (*PolicyLimit) ToggleEnabled

func (a *PolicyLimit) ToggleEnabled(ctx context.Context, id string, formItem *schema.PolicyEnabledForm) error

ToggleEnabled updates only the enabled status of a policy and re-syncs policy cache.

func (*PolicyLimit) Update

func (a *PolicyLimit) Update(ctx context.Context, id string, formItem *schema.PolicyLimitForm) error

Update the specified policy limit in the data access object.

type PolicyLoadbalance

type PolicyLoadbalance struct {
	Trans                *util.Trans
	PolicyLoadbalanceDAL *dal.PolicyLoadbalance
	PolicyRedisSync      PolicyChangeSyncer
	ModelDAL             *resourceDal.Model
	DataPermissionDAL    *resourceDal.DataPermission
	AuditLogBIZ          *opsBiz.AuditLog
}

Loadbalance policy management

func (*PolicyLoadbalance) CopyTemplateToModel

func (a *PolicyLoadbalance) CopyTemplateToModel(ctx context.Context, templateID string, form *schema.PolicyCopyToModelForm) (*schema.PolicyLoadbalance, error)

CopyTemplateToModel copies a policy template into a model-owned policy instance.

func (*PolicyLoadbalance) Create

Create a new policy loadbalance in the data access object.

func (*PolicyLoadbalance) Delete

func (a *PolicyLoadbalance) Delete(ctx context.Context, id string) error

Delete the specified policy loadbalance from the data access object.

func (*PolicyLoadbalance) Get

Get the specified policy loadbalance from the data access object.

func (*PolicyLoadbalance) Query

Query policy loadbalances from the data access object based on the provided parameters and options.

func (*PolicyLoadbalance) ToggleEnabled

func (a *PolicyLoadbalance) ToggleEnabled(ctx context.Context, id string, formItem *schema.PolicyEnabledForm) error

ToggleEnabled updates only the enabled status of a policy and re-syncs policy cache.

func (*PolicyLoadbalance) Update

Update the specified policy loadbalance in the data access object.

type PolicyRedisSync

type PolicyRedisSync struct {
	RedisClient           *redis.Client
	PolicyLoadbalanceDAL  *dal.PolicyLoadbalance
	PolicyRouteDAL        *dal.PolicyRoute
	PolicyLimitDAL        *dal.PolicyLimit
	PolicyCircuitBreakDAL *dal.PolicyCircuitBreak
	PolicyInvocationDAL   *dal.PolicyInvocation
	PolicyTaggingDAL      *dal.PolicyTagging
	ModelDAL              *resourceDal.Model
}

func (*PolicyRedisSync) SyncDimension

func (s *PolicyRedisSync) SyncDimension(ctx context.Context, tenantCode, userID, modelCode string) (err error)

SyncDimension 同步一个维度下的所有策略到 Redis

func (*PolicyRedisSync) SyncPolicyChange

func (s *PolicyRedisSync) SyncPolicyChange(ctx context.Context, scopeType, scopeCode, modelID string) (err error)

SyncPolicyChange 当某个具体的策略配置变更时,同步该策略对应的维度

type PolicyRoute

type PolicyRoute struct {
	Trans             *util.Trans
	PolicyRouteDAL    *dal.PolicyRoute
	PolicyRedisSync   PolicyChangeSyncer
	ModelDAL          *resourceDal.Model
	DataPermissionDAL *resourceDal.DataPermission
	AuditLogBIZ       *opsBiz.AuditLog
}

Route policy management

func (*PolicyRoute) CopyTemplateToModel

func (a *PolicyRoute) CopyTemplateToModel(ctx context.Context, templateID string, form *schema.PolicyCopyToModelForm) (*schema.PolicyRoute, error)

CopyTemplateToModel copies a policy template into a model-owned policy instance.

func (*PolicyRoute) Create

func (a *PolicyRoute) Create(ctx context.Context, formItem *schema.PolicyRouteForm) (*schema.PolicyRoute, error)

Create a new policy route in the data access object.

func (*PolicyRoute) Delete

func (a *PolicyRoute) Delete(ctx context.Context, id string) error

Delete the specified policy route from the data access object.

func (*PolicyRoute) Get

Get the specified policy route from the data access object.

func (*PolicyRoute) Query

Query policy routes from the data access object based on the provided parameters and options.

func (*PolicyRoute) ToggleEnabled

func (a *PolicyRoute) ToggleEnabled(ctx context.Context, id string, formItem *schema.PolicyEnabledForm) error

ToggleEnabled updates only the enabled status of a policy and re-syncs policy cache.

func (*PolicyRoute) Update

func (a *PolicyRoute) Update(ctx context.Context, id string, formItem *schema.PolicyRouteForm) error

Update the specified policy route in the data access object.

type PolicyRouteDetail

type PolicyRouteDetail struct {
	Trans                *util.Trans
	PolicyRouteDetailDAL *dal.PolicyRouteDetail
	PolicyRouteDAL       *dal.PolicyRoute
	PolicyRedisSync      PolicyChangeSyncer
}

Route policy detail management

func (*PolicyRouteDetail) Create

Create a new policy route detail in the data access object.

func (*PolicyRouteDetail) Delete

func (a *PolicyRouteDetail) Delete(ctx context.Context, id string) error

Delete the specified policy route detail from the data access object.

func (*PolicyRouteDetail) Get

Get the specified policy route detail from the data access object.

func (*PolicyRouteDetail) Query

Query policy route details from the data access object based on the provided parameters and options.

func (*PolicyRouteDetail) Update

Update the specified policy route detail in the data access object.

type PolicyTagging

type PolicyTagging struct {
	Trans             *util.Trans
	PolicyTaggingDAL  *dal.PolicyTagging
	PolicyRedisSync   PolicyChangeSyncer
	ModelDAL          *resourceDal.Model
	DataPermissionDAL *resourceDal.DataPermission
	AuditLogBIZ       *opsBiz.AuditLog
}

Tagging policy management

func (*PolicyTagging) CopyTemplateToModel

func (a *PolicyTagging) CopyTemplateToModel(ctx context.Context, templateID string, form *schema.PolicyCopyToModelForm) (*schema.PolicyTagging, error)

CopyTemplateToModel copies a policy template into a model-owned policy instance.

func (*PolicyTagging) Create

Create a new policy tagging in the data access object.

func (*PolicyTagging) Delete

func (a *PolicyTagging) Delete(ctx context.Context, id string) error

Delete the specified policy tagging from the data access object.

func (*PolicyTagging) Get

Get the specified policy tagging from the data access object.

func (*PolicyTagging) Query

Query policy taggings from the data access object based on the provided parameters and options.

func (*PolicyTagging) ToggleEnabled

func (a *PolicyTagging) ToggleEnabled(ctx context.Context, id string, formItem *schema.PolicyEnabledForm) error

ToggleEnabled updates only the enabled status of a policy and re-syncs policy cache.

func (*PolicyTagging) Update

func (a *PolicyTagging) Update(ctx context.Context, id string, formItem *schema.PolicyTaggingForm) error

Update the specified policy tagging in the data access object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL