github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/webhook_job.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  // WebhookJob The webhook job.
    18  //
    19  // swagger:model WebhookJob
    20  type WebhookJob struct {
    21  
    22  	// The webhook job creation time.
    23  	// Format: date-time
    24  	CreationTime strfmt.DateTime `json:"creation_time,omitempty"`
    25  
    26  	// The webhook job event type.
    27  	EventType string `json:"event_type,omitempty"`
    28  
    29  	// The webhook job ID.
    30  	ID int64 `json:"id,omitempty"`
    31  
    32  	// The webhook job notify detailed data.
    33  	JobDetail string `json:"job_detail,omitempty"`
    34  
    35  	// The webhook job notify type.
    36  	NotifyType string `json:"notify_type,omitempty"`
    37  
    38  	// The webhook policy ID.
    39  	PolicyID int64 `json:"policy_id,omitempty"`
    40  
    41  	// The webhook job status.
    42  	Status string `json:"status,omitempty"`
    43  
    44  	// The webhook job update time.
    45  	// Format: date-time
    46  	UpdateTime strfmt.DateTime `json:"update_time,omitempty"`
    47  }
    48  
    49  // Validate validates this webhook job
    50  func (m *WebhookJob) Validate(formats strfmt.Registry) error {
    51  	var res []error
    52  
    53  	if err := m.validateCreationTime(formats); err != nil {
    54  		res = append(res, err)
    55  	}
    56  
    57  	if err := m.validateUpdateTime(formats); err != nil {
    58  		res = append(res, err)
    59  	}
    60  
    61  	if len(res) > 0 {
    62  		return errors.CompositeValidationError(res...)
    63  	}
    64  	return nil
    65  }
    66  
    67  func (m *WebhookJob) validateCreationTime(formats strfmt.Registry) error {
    68  	if swag.IsZero(m.CreationTime) { // not required
    69  		return nil
    70  	}
    71  
    72  	if err := validate.FormatOf("creation_time", "body", "date-time", m.CreationTime.String(), formats); err != nil {
    73  		return err
    74  	}
    75  
    76  	return nil
    77  }
    78  
    79  func (m *WebhookJob) validateUpdateTime(formats strfmt.Registry) error {
    80  	if swag.IsZero(m.UpdateTime) { // not required
    81  		return nil
    82  	}
    83  
    84  	if err := validate.FormatOf("update_time", "body", "date-time", m.UpdateTime.String(), formats); err != nil {
    85  		return err
    86  	}
    87  
    88  	return nil
    89  }
    90  
    91  // ContextValidate validates this webhook job based on context it is used
    92  func (m *WebhookJob) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    93  	return nil
    94  }
    95  
    96  // MarshalBinary interface implementation
    97  func (m *WebhookJob) MarshalBinary() ([]byte, error) {
    98  	if m == nil {
    99  		return nil, nil
   100  	}
   101  	return swag.WriteJSON(m)
   102  }
   103  
   104  // UnmarshalBinary interface implementation
   105  func (m *WebhookJob) UnmarshalBinary(b []byte) error {
   106  	var res WebhookJob
   107  	if err := swag.ReadJSON(b, &res); err != nil {
   108  		return err
   109  	}
   110  	*m = res
   111  	return nil
   112  }