1 Star 0 Fork 0

pengchengduan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webhook_policy.go 3.13 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"
"github.com/go-openapi/validate"
)
// WebhookPolicy The webhook policy object
//
// swagger:model WebhookPolicy
type WebhookPolicy struct {
// The create time of the webhook policy.
// Format: date-time
CreationTime strfmt.DateTime `json:"creation_time,omitempty"`
// The creator of the webhook policy.
Creator string `json:"creator,omitempty"`
// The description of webhook policy.
Description string `json:"description,omitempty"`
// Whether the webhook policy is enabled or not.
Enabled bool `json:"enabled"`
// event types
EventTypes []string `json:"event_types"`
// The webhook policy ID.
ID int64 `json:"id,omitempty"`
// The name of webhook policy.
Name string `json:"name,omitempty"`
// The project ID of webhook policy.
ProjectID int64 `json:"project_id,omitempty"`
// targets
Targets []*WebhookTargetObject `json:"targets"`
// The update time of the webhook policy.
// Format: date-time
UpdateTime strfmt.DateTime `json:"update_time,omitempty"`
}
// Validate validates this webhook policy
func (m *WebhookPolicy) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreationTime(formats); err != nil {
res = append(res, err)
}
if err := m.validateTargets(formats); err != nil {
res = append(res, err)
}
if err := m.validateUpdateTime(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *WebhookPolicy) validateCreationTime(formats strfmt.Registry) error {
if swag.IsZero(m.CreationTime) { // not required
return nil
}
if err := validate.FormatOf("creation_time", "body", "date-time", m.CreationTime.String(), formats); err != nil {
return err
}
return nil
}
func (m *WebhookPolicy) validateTargets(formats strfmt.Registry) error {
if swag.IsZero(m.Targets) { // not required
return nil
}
for i := 0; i < len(m.Targets); i++ {
if swag.IsZero(m.Targets[i]) { // not required
continue
}
if m.Targets[i] != nil {
if err := m.Targets[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("targets" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *WebhookPolicy) validateUpdateTime(formats strfmt.Registry) error {
if swag.IsZero(m.UpdateTime) { // not required
return nil
}
if err := validate.FormatOf("update_time", "body", "date-time", m.UpdateTime.String(), formats); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *WebhookPolicy) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *WebhookPolicy) UnmarshalBinary(b []byte) error {
var res WebhookPolicy
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