mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-05-06 21:52:54 +08:00
feature: allow manager to preapre query context (#19451)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -215,7 +215,7 @@ func (man *SForwardManager) PerformCreateFromServer(ctx context.Context, userCre
|
||||
|
||||
validators.NewNonNegativeValidator("last_seen_timeout").Optional(true),
|
||||
} {
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ func (man *SForwardManager) ValidateCreateData(ctx context.Context, userCred mcc
|
||||
|
||||
validators.NewNonNegativeValidator("last_seen_timeout").Optional(true),
|
||||
} {
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -322,7 +322,7 @@ func (fwd *SForward) ValidateUpdateData(ctx context.Context, userCred mcclient.T
|
||||
validators.NewNonNegativeValidator("last_seen_timeout"),
|
||||
} {
|
||||
v.Optional(true)
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (man *SProxyAgentManager) ValidateCreateData(ctx context.Context, userCred
|
||||
validators.NewIPv4AddrValidator("advertise_addr").Optional(true),
|
||||
}
|
||||
for _, v := range vs {
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ func (proxyagent *SProxyAgent) ValidateUpdateData(ctx context.Context, userCred
|
||||
}
|
||||
for _, v := range vs {
|
||||
v.Optional(true)
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func (man *SProxyEndpointManager) PerformCreateFromServer(ctx context.Context, u
|
||||
return nil, errors.Wrapf(err, "db.GenerateName")
|
||||
}
|
||||
}
|
||||
if err := db.NewNameValidator(man, userCred, name, nil); err != nil {
|
||||
if err := db.NewNameValidator(ctx, man, userCred, name, nil); err != nil {
|
||||
return nil, httperrors.NewGeneralError(err)
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ func (man *SProxyEndpointManager) ValidateCreateData(
|
||||
validators.NewIPv4AddrValidator("intranet_ip_addr"),
|
||||
}
|
||||
for _, v := range vs {
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@ func (proxyendpoint *SProxyEndpoint) ValidateUpdateData(ctx context.Context, use
|
||||
}
|
||||
for _, v := range vs {
|
||||
v.Optional(true)
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return input, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (man *SProxyMatchManager) ValidateCreateData(ctx context.Context, userCred
|
||||
matchScopeV,
|
||||
endpointV,
|
||||
} {
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func (pm *SProxyMatch) ValidateUpdateData(ctx context.Context, userCred mcclient
|
||||
endpointV,
|
||||
} {
|
||||
v.Optional(true)
|
||||
if err := v.Validate(data); err != nil {
|
||||
if err := v.Validate(ctx, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func (man *SProxyMatchManager) ListItemFilter(
|
||||
}
|
||||
|
||||
if len(input.ProxyEndpointId) > 0 {
|
||||
_, err := validators.ValidateModel(userCred, ProxyEndpointManager, &input.ProxyEndpointId)
|
||||
_, err := validators.ValidateModel(ctx, userCred, ProxyEndpointManager, &input.ProxyEndpointId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user