github.com/minio/console@v1.3.0/models/put_object_legal_hold_request.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // This file is part of MinIO Console Server 4 // Copyright (c) 2023 MinIO, Inc. 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU Affero General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU Affero General Public License for more details. 15 // 16 // You should have received a copy of the GNU Affero General Public License 17 // along with this program. If not, see <http://www.gnu.org/licenses/>. 18 // 19 20 package models 21 22 // This file was generated by the swagger tool. 23 // Editing this file might prove futile when you re-run the swagger generate command 24 25 import ( 26 "context" 27 28 "github.com/go-openapi/errors" 29 "github.com/go-openapi/strfmt" 30 "github.com/go-openapi/swag" 31 "github.com/go-openapi/validate" 32 ) 33 34 // PutObjectLegalHoldRequest put object legal hold request 35 // 36 // swagger:model putObjectLegalHoldRequest 37 type PutObjectLegalHoldRequest struct { 38 39 // status 40 // Required: true 41 Status *ObjectLegalHoldStatus `json:"status"` 42 } 43 44 // Validate validates this put object legal hold request 45 func (m *PutObjectLegalHoldRequest) Validate(formats strfmt.Registry) error { 46 var res []error 47 48 if err := m.validateStatus(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 *PutObjectLegalHoldRequest) validateStatus(formats strfmt.Registry) error { 59 60 if err := validate.Required("status", "body", m.Status); err != nil { 61 return err 62 } 63 64 if err := validate.Required("status", "body", m.Status); err != nil { 65 return err 66 } 67 68 if m.Status != nil { 69 if err := m.Status.Validate(formats); err != nil { 70 if ve, ok := err.(*errors.Validation); ok { 71 return ve.ValidateName("status") 72 } else if ce, ok := err.(*errors.CompositeError); ok { 73 return ce.ValidateName("status") 74 } 75 return err 76 } 77 } 78 79 return nil 80 } 81 82 // ContextValidate validate this put object legal hold request based on the context it is used 83 func (m *PutObjectLegalHoldRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 84 var res []error 85 86 if err := m.contextValidateStatus(ctx, formats); err != nil { 87 res = append(res, err) 88 } 89 90 if len(res) > 0 { 91 return errors.CompositeValidationError(res...) 92 } 93 return nil 94 } 95 96 func (m *PutObjectLegalHoldRequest) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { 97 98 if m.Status != nil { 99 100 if err := m.Status.ContextValidate(ctx, formats); err != nil { 101 if ve, ok := err.(*errors.Validation); ok { 102 return ve.ValidateName("status") 103 } else if ce, ok := err.(*errors.CompositeError); ok { 104 return ce.ValidateName("status") 105 } 106 return err 107 } 108 } 109 110 return nil 111 } 112 113 // MarshalBinary interface implementation 114 func (m *PutObjectLegalHoldRequest) MarshalBinary() ([]byte, error) { 115 if m == nil { 116 return nil, nil 117 } 118 return swag.WriteJSON(m) 119 } 120 121 // UnmarshalBinary interface implementation 122 func (m *PutObjectLegalHoldRequest) UnmarshalBinary(b []byte) error { 123 var res PutObjectLegalHoldRequest 124 if err := swag.ReadJSON(b, &res); err != nil { 125 return err 126 } 127 *m = res 128 return nil 129 }