github.com/minio/console@v1.3.0/models/bucket_versioning_response.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 "strconv" 28 29 "github.com/go-openapi/errors" 30 "github.com/go-openapi/strfmt" 31 "github.com/go-openapi/swag" 32 ) 33 34 // BucketVersioningResponse bucket versioning response 35 // 36 // swagger:model bucketVersioningResponse 37 type BucketVersioningResponse struct { 38 39 // m f a delete 40 MFADelete string `json:"MFADelete,omitempty"` 41 42 // exclude folders 43 ExcludeFolders bool `json:"excludeFolders,omitempty"` 44 45 // excluded prefixes 46 ExcludedPrefixes []*BucketVersioningResponseExcludedPrefixesItems0 `json:"excludedPrefixes"` 47 48 // status 49 Status string `json:"status,omitempty"` 50 } 51 52 // Validate validates this bucket versioning response 53 func (m *BucketVersioningResponse) Validate(formats strfmt.Registry) error { 54 var res []error 55 56 if err := m.validateExcludedPrefixes(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if len(res) > 0 { 61 return errors.CompositeValidationError(res...) 62 } 63 return nil 64 } 65 66 func (m *BucketVersioningResponse) validateExcludedPrefixes(formats strfmt.Registry) error { 67 if swag.IsZero(m.ExcludedPrefixes) { // not required 68 return nil 69 } 70 71 for i := 0; i < len(m.ExcludedPrefixes); i++ { 72 if swag.IsZero(m.ExcludedPrefixes[i]) { // not required 73 continue 74 } 75 76 if m.ExcludedPrefixes[i] != nil { 77 if err := m.ExcludedPrefixes[i].Validate(formats); err != nil { 78 if ve, ok := err.(*errors.Validation); ok { 79 return ve.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) 80 } else if ce, ok := err.(*errors.CompositeError); ok { 81 return ce.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) 82 } 83 return err 84 } 85 } 86 87 } 88 89 return nil 90 } 91 92 // ContextValidate validate this bucket versioning response based on the context it is used 93 func (m *BucketVersioningResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 94 var res []error 95 96 if err := m.contextValidateExcludedPrefixes(ctx, formats); err != nil { 97 res = append(res, err) 98 } 99 100 if len(res) > 0 { 101 return errors.CompositeValidationError(res...) 102 } 103 return nil 104 } 105 106 func (m *BucketVersioningResponse) contextValidateExcludedPrefixes(ctx context.Context, formats strfmt.Registry) error { 107 108 for i := 0; i < len(m.ExcludedPrefixes); i++ { 109 110 if m.ExcludedPrefixes[i] != nil { 111 112 if swag.IsZero(m.ExcludedPrefixes[i]) { // not required 113 return nil 114 } 115 116 if err := m.ExcludedPrefixes[i].ContextValidate(ctx, formats); err != nil { 117 if ve, ok := err.(*errors.Validation); ok { 118 return ve.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) 119 } else if ce, ok := err.(*errors.CompositeError); ok { 120 return ce.ValidateName("excludedPrefixes" + "." + strconv.Itoa(i)) 121 } 122 return err 123 } 124 } 125 126 } 127 128 return nil 129 } 130 131 // MarshalBinary interface implementation 132 func (m *BucketVersioningResponse) MarshalBinary() ([]byte, error) { 133 if m == nil { 134 return nil, nil 135 } 136 return swag.WriteJSON(m) 137 } 138 139 // UnmarshalBinary interface implementation 140 func (m *BucketVersioningResponse) UnmarshalBinary(b []byte) error { 141 var res BucketVersioningResponse 142 if err := swag.ReadJSON(b, &res); err != nil { 143 return err 144 } 145 *m = res 146 return nil 147 } 148 149 // BucketVersioningResponseExcludedPrefixesItems0 bucket versioning response excluded prefixes items0 150 // 151 // swagger:model BucketVersioningResponseExcludedPrefixesItems0 152 type BucketVersioningResponseExcludedPrefixesItems0 struct { 153 154 // prefix 155 Prefix string `json:"prefix,omitempty"` 156 } 157 158 // Validate validates this bucket versioning response excluded prefixes items0 159 func (m *BucketVersioningResponseExcludedPrefixesItems0) Validate(formats strfmt.Registry) error { 160 return nil 161 } 162 163 // ContextValidate validates this bucket versioning response excluded prefixes items0 based on context it is used 164 func (m *BucketVersioningResponseExcludedPrefixesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 165 return nil 166 } 167 168 // MarshalBinary interface implementation 169 func (m *BucketVersioningResponseExcludedPrefixesItems0) MarshalBinary() ([]byte, error) { 170 if m == nil { 171 return nil, nil 172 } 173 return swag.WriteJSON(m) 174 } 175 176 // UnmarshalBinary interface implementation 177 func (m *BucketVersioningResponseExcludedPrefixesItems0) UnmarshalBinary(b []byte) error { 178 var res BucketVersioningResponseExcludedPrefixesItems0 179 if err := swag.ReadJSON(b, &res); err != nil { 180 return err 181 } 182 *m = res 183 return nil 184 }