2023-10-25 11:42:00 +00:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/muhlemmer/gu"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/command"
|
|
|
|
"github.com/zitadel/zitadel/pkg/grpc/system"
|
|
|
|
)
|
|
|
|
|
2024-01-17 10:16:48 +00:00
|
|
|
func setInstanceLimitsPbToCommand(req *system.SetLimitsRequest) *command.SetLimits {
|
2023-10-25 11:42:00 +00:00
|
|
|
var setLimits = new(command.SetLimits)
|
|
|
|
if req.AuditLogRetention != nil {
|
|
|
|
setLimits.AuditLogRetention = gu.Ptr(req.AuditLogRetention.AsDuration())
|
|
|
|
}
|
2024-01-17 10:16:48 +00:00
|
|
|
setLimits.Block = req.Block
|
2023-10-25 11:42:00 +00:00
|
|
|
return setLimits
|
|
|
|
}
|
2024-01-17 10:16:48 +00:00
|
|
|
|
|
|
|
func bulkSetInstanceLimitsPbToCommand(req *system.BulkSetLimitsRequest) []*command.SetInstanceLimitsBulk {
|
|
|
|
cmds := make([]*command.SetInstanceLimitsBulk, len(req.Limits))
|
|
|
|
for i := range req.Limits {
|
|
|
|
setLimitsReq := req.Limits[i]
|
|
|
|
cmds[i] = &command.SetInstanceLimitsBulk{
|
|
|
|
InstanceID: setLimitsReq.GetInstanceId(),
|
|
|
|
SetLimits: *setInstanceLimitsPbToCommand(req.Limits[i]),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cmds
|
|
|
|
}
|