1 Star 0 Fork 0

pengchengduan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
retention_policy.go 2.63 KB
一键复制 编辑 原始数据 按行查看 历史
pengchengduan 提交于 2024-02-01 17:28 . first commit
// Code generated by go-swagger; DO NOT EDIT.
package model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// RetentionPolicy retention policy
//
// swagger:model RetentionPolicy
type RetentionPolicy struct {
// algorithm
Algorithm string `json:"algorithm,omitempty"`
// id
ID int64 `json:"id,omitempty"`
// rules
Rules []*RetentionRule `json:"rules"`
// scope
Scope *RetentionPolicyScope `json:"scope,omitempty"`
// trigger
Trigger *RetentionRuleTrigger `json:"trigger,omitempty"`
}
// Validate validates this retention policy
func (m *RetentionPolicy) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateRules(formats); err != nil {
res = append(res, err)
}
if err := m.validateScope(formats); err != nil {
res = append(res, err)
}
if err := m.validateTrigger(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *RetentionPolicy) validateRules(formats strfmt.Registry) error {
if swag.IsZero(m.Rules) { // not required
return nil
}
for i := 0; i < len(m.Rules); i++ {
if swag.IsZero(m.Rules[i]) { // not required
continue
}
if m.Rules[i] != nil {
if err := m.Rules[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("rules" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *RetentionPolicy) validateScope(formats strfmt.Registry) error {
if swag.IsZero(m.Scope) { // not required
return nil
}
if m.Scope != nil {
if err := m.Scope.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("scope")
}
return err
}
}
return nil
}
func (m *RetentionPolicy) validateTrigger(formats strfmt.Registry) error {
if swag.IsZero(m.Trigger) { // not required
return nil
}
if m.Trigger != nil {
if err := m.Trigger.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("trigger")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *RetentionPolicy) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *RetentionPolicy) UnmarshalBinary(b []byte) error {
var res RetentionPolicy
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
1
https://gitee.com/pengchengduan/goharbor-client.git
git@gitee.com:pengchengduan/goharbor-client.git
pengchengduan
goharbor-client
goharbor-client
41c6882efe91

搜索帮助

53164aa7 5694891 3bd8fe86 5694891