1 Star 0 Fork 0

nanjo_fan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
project_req.go 2.77 KB
一键复制 编辑 原始数据 按行查看 历史
王帆 提交于 2023-02-13 08:49 . 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 (
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// ProjectReq project req
//
// swagger:model ProjectReq
type ProjectReq struct {
// The CVE allowlist of the project.
CVEAllowlist *CVEAllowlist `json:"cve_allowlist,omitempty"`
// The metadata of the project.
Metadata *ProjectMetadata `json:"metadata,omitempty"`
// The name of the project.
// Max Length: 255
ProjectName string `json:"project_name,omitempty"`
// deprecated, reserved for project creation in replication
Public *bool `json:"public,omitempty"`
// The ID of referenced registry when creating the proxy cache project
RegistryID *int64 `json:"registry_id,omitempty"`
// The storage quota of the project.
StorageLimit *int64 `json:"storage_limit,omitempty"`
}
// Validate validates this project req
func (m *ProjectReq) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCVEAllowlist(formats); err != nil {
res = append(res, err)
}
if err := m.validateMetadata(formats); err != nil {
res = append(res, err)
}
if err := m.validateProjectName(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ProjectReq) validateCVEAllowlist(formats strfmt.Registry) error {
if swag.IsZero(m.CVEAllowlist) { // not required
return nil
}
if m.CVEAllowlist != nil {
if err := m.CVEAllowlist.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("cve_allowlist")
}
return err
}
}
return nil
}
func (m *ProjectReq) validateMetadata(formats strfmt.Registry) error {
if swag.IsZero(m.Metadata) { // not required
return nil
}
if m.Metadata != nil {
if err := m.Metadata.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("metadata")
}
return err
}
}
return nil
}
func (m *ProjectReq) validateProjectName(formats strfmt.Registry) error {
if swag.IsZero(m.ProjectName) { // not required
return nil
}
if err := validate.MaxLength("project_name", "body", string(m.ProjectName), 255); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *ProjectReq) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ProjectReq) UnmarshalBinary(b []byte) error {
var res ProjectReq
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
Go
1
https://gitee.com/nanjo-fan/goharbor-client.git
git@gitee.com:nanjo-fan/goharbor-client.git
nanjo-fan
goharbor-client
goharbor-client
v1.0.2

搜索帮助