autogits/bots-common/gitea-generated/models/push_mirror.go

113 lines
2.5 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// PushMirror PushMirror represents information of a push mirror
//
// swagger:model PushMirror
type PushMirror struct {
// created unix
// Format: date-time
CreatedUnix strfmt.DateTime `json:"created,omitempty"`
// interval
Interval string `json:"interval,omitempty"`
// last error
LastError string `json:"last_error,omitempty"`
// last update unix
// Format: date-time
LastUpdateUnix strfmt.DateTime `json:"last_update,omitempty"`
// remote address
RemoteAddress string `json:"remote_address,omitempty"`
// remote name
RemoteName string `json:"remote_name,omitempty"`
// repo name
RepoName string `json:"repo_name,omitempty"`
// sync on commit
SyncOnCommit bool `json:"sync_on_commit,omitempty"`
}
// Validate validates this push mirror
func (m *PushMirror) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreatedUnix(formats); err != nil {
res = append(res, err)
}
if err := m.validateLastUpdateUnix(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PushMirror) validateCreatedUnix(formats strfmt.Registry) error {
if swag.IsZero(m.CreatedUnix) { // not required
return nil
}
if err := validate.FormatOf("created", "body", "date-time", m.CreatedUnix.String(), formats); err != nil {
return err
}
return nil
}
func (m *PushMirror) validateLastUpdateUnix(formats strfmt.Registry) error {
if swag.IsZero(m.LastUpdateUnix) { // not required
return nil
}
if err := validate.FormatOf("last_update", "body", "date-time", m.LastUpdateUnix.String(), formats); err != nil {
return err
}
return nil
}
// ContextValidate validates this push mirror based on context it is used
func (m *PushMirror) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PushMirror) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PushMirror) UnmarshalBinary(b []byte) error {
var res PushMirror
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}