github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/schedule_task.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // ScheduleTask the schedule task info
    18  //
    19  // swagger:model ScheduleTask
    20  type ScheduleTask struct {
    21  
    22  	// the cron of the current schedule task
    23  	Cron string `json:"cron,omitempty"`
    24  
    25  	// the id of the Schedule task
    26  	ID int64 `json:"id,omitempty"`
    27  
    28  	// the update time of the schedule task
    29  	// Format: date-time
    30  	UpdateTime strfmt.DateTime `json:"update_time,omitempty"`
    31  
    32  	// the vendor id of the current task
    33  	VendorID int64 `json:"vendor_id,omitempty"`
    34  
    35  	// the vendor type of the current schedule task
    36  	VendorType string `json:"vendor_type,omitempty"`
    37  }
    38  
    39  // Validate validates this schedule task
    40  func (m *ScheduleTask) Validate(formats strfmt.Registry) error {
    41  	var res []error
    42  
    43  	if err := m.validateUpdateTime(formats); err != nil {
    44  		res = append(res, err)
    45  	}
    46  
    47  	if len(res) > 0 {
    48  		return errors.CompositeValidationError(res...)
    49  	}
    50  	return nil
    51  }
    52  
    53  func (m *ScheduleTask) validateUpdateTime(formats strfmt.Registry) error {
    54  	if swag.IsZero(m.UpdateTime) { // not required
    55  		return nil
    56  	}
    57  
    58  	if err := validate.FormatOf("update_time", "body", "date-time", m.UpdateTime.String(), formats); err != nil {
    59  		return err
    60  	}
    61  
    62  	return nil
    63  }
    64  
    65  // ContextValidate validates this schedule task based on context it is used
    66  func (m *ScheduleTask) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    67  	return nil
    68  }
    69  
    70  // MarshalBinary interface implementation
    71  func (m *ScheduleTask) MarshalBinary() ([]byte, error) {
    72  	if m == nil {
    73  		return nil, nil
    74  	}
    75  	return swag.WriteJSON(m)
    76  }
    77  
    78  // UnmarshalBinary interface implementation
    79  func (m *ScheduleTask) UnmarshalBinary(b []byte) error {
    80  	var res ScheduleTask
    81  	if err := swag.ReadJSON(b, &res); err != nil {
    82  		return err
    83  	}
    84  	*m = res
    85  	return nil
    86  }