github.com/minio/console@v1.3.0/models/bucket_quota.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 "encoding/json" 28 29 "github.com/go-openapi/errors" 30 "github.com/go-openapi/strfmt" 31 "github.com/go-openapi/swag" 32 "github.com/go-openapi/validate" 33 ) 34 35 // BucketQuota bucket quota 36 // 37 // swagger:model bucketQuota 38 type BucketQuota struct { 39 40 // quota 41 Quota int64 `json:"quota,omitempty"` 42 43 // type 44 // Enum: [hard] 45 Type string `json:"type,omitempty"` 46 } 47 48 // Validate validates this bucket quota 49 func (m *BucketQuota) Validate(formats strfmt.Registry) error { 50 var res []error 51 52 if err := m.validateType(formats); err != nil { 53 res = append(res, err) 54 } 55 56 if len(res) > 0 { 57 return errors.CompositeValidationError(res...) 58 } 59 return nil 60 } 61 62 var bucketQuotaTypeTypePropEnum []interface{} 63 64 func init() { 65 var res []string 66 if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil { 67 panic(err) 68 } 69 for _, v := range res { 70 bucketQuotaTypeTypePropEnum = append(bucketQuotaTypeTypePropEnum, v) 71 } 72 } 73 74 const ( 75 76 // BucketQuotaTypeHard captures enum value "hard" 77 BucketQuotaTypeHard string = "hard" 78 ) 79 80 // prop value enum 81 func (m *BucketQuota) validateTypeEnum(path, location string, value string) error { 82 if err := validate.EnumCase(path, location, value, bucketQuotaTypeTypePropEnum, true); err != nil { 83 return err 84 } 85 return nil 86 } 87 88 func (m *BucketQuota) validateType(formats strfmt.Registry) error { 89 if swag.IsZero(m.Type) { // not required 90 return nil 91 } 92 93 // value enum 94 if err := m.validateTypeEnum("type", "body", m.Type); err != nil { 95 return err 96 } 97 98 return nil 99 } 100 101 // ContextValidate validates this bucket quota based on context it is used 102 func (m *BucketQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 103 return nil 104 } 105 106 // MarshalBinary interface implementation 107 func (m *BucketQuota) MarshalBinary() ([]byte, error) { 108 if m == nil { 109 return nil, nil 110 } 111 return swag.WriteJSON(m) 112 } 113 114 // UnmarshalBinary interface implementation 115 func (m *BucketQuota) UnmarshalBinary(b []byte) error { 116 var res BucketQuota 117 if err := swag.ReadJSON(b, &res); err != nil { 118 return err 119 } 120 *m = res 121 return nil 122 }