github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/replication_execution.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  // ReplicationExecution The replication execution
    18  //
    19  // swagger:model ReplicationExecution
    20  type ReplicationExecution struct {
    21  
    22  	// The end time
    23  	// Format: date-time
    24  	EndTime strfmt.DateTime `json:"end_time,omitempty"`
    25  
    26  	// The count of failed executions
    27  	Failed int64 `json:"failed"`
    28  
    29  	// The ID of the execution
    30  	ID int64 `json:"id,omitempty"`
    31  
    32  	// The count of in_progress executions
    33  	InProgress int64 `json:"in_progress"`
    34  
    35  	// The ID if the policy that the execution belongs to
    36  	PolicyID int64 `json:"policy_id,omitempty"`
    37  
    38  	// The start time
    39  	// Format: date-time
    40  	StartTime strfmt.DateTime `json:"start_time,omitempty"`
    41  
    42  	// The status of the execution
    43  	Status string `json:"status,omitempty"`
    44  
    45  	// The status text
    46  	StatusText string `json:"status_text"`
    47  
    48  	// The count of stopped executions
    49  	Stopped int64 `json:"stopped"`
    50  
    51  	// The count of succeed executions
    52  	Succeed int64 `json:"succeed"`
    53  
    54  	// The total count of all executions
    55  	Total int64 `json:"total"`
    56  
    57  	// The trigger mode
    58  	Trigger string `json:"trigger,omitempty"`
    59  }
    60  
    61  // Validate validates this replication execution
    62  func (m *ReplicationExecution) Validate(formats strfmt.Registry) error {
    63  	var res []error
    64  
    65  	if err := m.validateEndTime(formats); err != nil {
    66  		res = append(res, err)
    67  	}
    68  
    69  	if err := m.validateStartTime(formats); err != nil {
    70  		res = append(res, err)
    71  	}
    72  
    73  	if len(res) > 0 {
    74  		return errors.CompositeValidationError(res...)
    75  	}
    76  	return nil
    77  }
    78  
    79  func (m *ReplicationExecution) validateEndTime(formats strfmt.Registry) error {
    80  	if swag.IsZero(m.EndTime) { // not required
    81  		return nil
    82  	}
    83  
    84  	if err := validate.FormatOf("end_time", "body", "date-time", m.EndTime.String(), formats); err != nil {
    85  		return err
    86  	}
    87  
    88  	return nil
    89  }
    90  
    91  func (m *ReplicationExecution) validateStartTime(formats strfmt.Registry) error {
    92  	if swag.IsZero(m.StartTime) { // not required
    93  		return nil
    94  	}
    95  
    96  	if err := validate.FormatOf("start_time", "body", "date-time", m.StartTime.String(), formats); err != nil {
    97  		return err
    98  	}
    99  
   100  	return nil
   101  }
   102  
   103  // ContextValidate validates this replication execution based on context it is used
   104  func (m *ReplicationExecution) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   105  	return nil
   106  }
   107  
   108  // MarshalBinary interface implementation
   109  func (m *ReplicationExecution) MarshalBinary() ([]byte, error) {
   110  	if m == nil {
   111  		return nil, nil
   112  	}
   113  	return swag.WriteJSON(m)
   114  }
   115  
   116  // UnmarshalBinary interface implementation
   117  func (m *ReplicationExecution) UnmarshalBinary(b []byte) error {
   118  	var res ReplicationExecution
   119  	if err := swag.ReadJSON(b, &res); err != nil {
   120  		return err
   121  	}
   122  	*m = res
   123  	return nil
   124  }