github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/audit_log.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 // AuditLog audit log 18 // 19 // swagger:model AuditLog 20 type AuditLog struct { 21 22 // The ID of the audit log entry. 23 ID int64 `json:"id,omitempty"` 24 25 // The time when this operation is triggered. 26 // Example: 2006-01-02T15:04:05Z 27 // Format: date-time 28 OpTime strfmt.DateTime `json:"op_time,omitempty"` 29 30 // The operation against the repository in this log entry. 31 Operation string `json:"operation,omitempty"` 32 33 // Name of the repository in this log entry. 34 Resource string `json:"resource,omitempty"` 35 36 // Tag of the repository in this log entry. 37 ResourceType string `json:"resource_type,omitempty"` 38 39 // Username of the user in this log entry. 40 Username string `json:"username,omitempty"` 41 } 42 43 // Validate validates this audit log 44 func (m *AuditLog) Validate(formats strfmt.Registry) error { 45 var res []error 46 47 if err := m.validateOpTime(formats); err != nil { 48 res = append(res, err) 49 } 50 51 if len(res) > 0 { 52 return errors.CompositeValidationError(res...) 53 } 54 return nil 55 } 56 57 func (m *AuditLog) validateOpTime(formats strfmt.Registry) error { 58 if swag.IsZero(m.OpTime) { // not required 59 return nil 60 } 61 62 if err := validate.FormatOf("op_time", "body", "date-time", m.OpTime.String(), formats); err != nil { 63 return err 64 } 65 66 return nil 67 } 68 69 // ContextValidate validates this audit log based on context it is used 70 func (m *AuditLog) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 71 return nil 72 } 73 74 // MarshalBinary interface implementation 75 func (m *AuditLog) MarshalBinary() ([]byte, error) { 76 if m == nil { 77 return nil, nil 78 } 79 return swag.WriteJSON(m) 80 } 81 82 // UnmarshalBinary interface implementation 83 func (m *AuditLog) UnmarshalBinary(b []byte) error { 84 var res AuditLog 85 if err := swag.ReadJSON(b, &res); err != nil { 86 return err 87 } 88 *m = res 89 return nil 90 }