github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/webhook_last_trigger.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  // WebhookLastTrigger The webhook policy and last trigger time group by event type.
    18  //
    19  // swagger:model WebhookLastTrigger
    20  type WebhookLastTrigger struct {
    21  
    22  	// The creation time of webhook policy.
    23  	// Format: date-time
    24  	CreationTime strfmt.DateTime `json:"creation_time,omitempty"`
    25  
    26  	// Whether or not the webhook policy enabled.
    27  	Enabled bool `json:"enabled,omitempty"`
    28  
    29  	// The webhook event type.
    30  	EventType string `json:"event_type,omitempty"`
    31  
    32  	// The last trigger time of webhook policy.
    33  	// Format: date-time
    34  	LastTriggerTime strfmt.DateTime `json:"last_trigger_time,omitempty"`
    35  
    36  	// The webhook policy name.
    37  	PolicyName string `json:"policy_name,omitempty"`
    38  }
    39  
    40  // Validate validates this webhook last trigger
    41  func (m *WebhookLastTrigger) Validate(formats strfmt.Registry) error {
    42  	var res []error
    43  
    44  	if err := m.validateCreationTime(formats); err != nil {
    45  		res = append(res, err)
    46  	}
    47  
    48  	if err := m.validateLastTriggerTime(formats); err != nil {
    49  		res = append(res, err)
    50  	}
    51  
    52  	if len(res) > 0 {
    53  		return errors.CompositeValidationError(res...)
    54  	}
    55  	return nil
    56  }
    57  
    58  func (m *WebhookLastTrigger) validateCreationTime(formats strfmt.Registry) error {
    59  	if swag.IsZero(m.CreationTime) { // not required
    60  		return nil
    61  	}
    62  
    63  	if err := validate.FormatOf("creation_time", "body", "date-time", m.CreationTime.String(), formats); err != nil {
    64  		return err
    65  	}
    66  
    67  	return nil
    68  }
    69  
    70  func (m *WebhookLastTrigger) validateLastTriggerTime(formats strfmt.Registry) error {
    71  	if swag.IsZero(m.LastTriggerTime) { // not required
    72  		return nil
    73  	}
    74  
    75  	if err := validate.FormatOf("last_trigger_time", "body", "date-time", m.LastTriggerTime.String(), formats); err != nil {
    76  		return err
    77  	}
    78  
    79  	return nil
    80  }
    81  
    82  // ContextValidate validates this webhook last trigger based on context it is used
    83  func (m *WebhookLastTrigger) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    84  	return nil
    85  }
    86  
    87  // MarshalBinary interface implementation
    88  func (m *WebhookLastTrigger) MarshalBinary() ([]byte, error) {
    89  	if m == nil {
    90  		return nil, nil
    91  	}
    92  	return swag.WriteJSON(m)
    93  }
    94  
    95  // UnmarshalBinary interface implementation
    96  func (m *WebhookLastTrigger) UnmarshalBinary(b []byte) error {
    97  	var res WebhookLastTrigger
    98  	if err := swag.ReadJSON(b, &res); err != nil {
    99  		return err
   100  	}
   101  	*m = res
   102  	return nil
   103  }