github.com/minio/console@v1.4.1/models/add_multi_bucket_lifecycle.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 // AddMultiBucketLifecycle add multi bucket lifecycle 36 // 37 // swagger:model addMultiBucketLifecycle 38 type AddMultiBucketLifecycle struct { 39 40 // buckets 41 // Required: true 42 Buckets []string `json:"buckets"` 43 44 // Non required, toggle to disable or enable rule 45 ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` 46 47 // Non required, toggle to disable or enable rule 48 ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` 49 50 // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM 51 ExpiryDays int32 `json:"expiry_days,omitempty"` 52 53 // Non required, can be set in case of expiration is enabled 54 NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` 55 56 // Non required, can be set in case of transition is enabled 57 NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` 58 59 // Non required, can be set in case of transition is enabled 60 NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` 61 62 // Non required field, it matches a prefix to perform ILM operations on it 63 Prefix string `json:"prefix,omitempty"` 64 65 // Required only in case of transition is set. it refers to a tier 66 StorageClass string `json:"storage_class,omitempty"` 67 68 // Non required field, tags to match ILM files 69 Tags string `json:"tags,omitempty"` 70 71 // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM 72 TransitionDays int32 `json:"transition_days,omitempty"` 73 74 // ILM Rule type (Expiry or transition) 75 // Required: true 76 // Enum: [expiry transition] 77 Type *string `json:"type"` 78 } 79 80 // Validate validates this add multi bucket lifecycle 81 func (m *AddMultiBucketLifecycle) Validate(formats strfmt.Registry) error { 82 var res []error 83 84 if err := m.validateBuckets(formats); err != nil { 85 res = append(res, err) 86 } 87 88 if err := m.validateType(formats); err != nil { 89 res = append(res, err) 90 } 91 92 if len(res) > 0 { 93 return errors.CompositeValidationError(res...) 94 } 95 return nil 96 } 97 98 func (m *AddMultiBucketLifecycle) validateBuckets(formats strfmt.Registry) error { 99 100 if err := validate.Required("buckets", "body", m.Buckets); err != nil { 101 return err 102 } 103 104 return nil 105 } 106 107 var addMultiBucketLifecycleTypeTypePropEnum []interface{} 108 109 func init() { 110 var res []string 111 if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { 112 panic(err) 113 } 114 for _, v := range res { 115 addMultiBucketLifecycleTypeTypePropEnum = append(addMultiBucketLifecycleTypeTypePropEnum, v) 116 } 117 } 118 119 const ( 120 121 // AddMultiBucketLifecycleTypeExpiry captures enum value "expiry" 122 AddMultiBucketLifecycleTypeExpiry string = "expiry" 123 124 // AddMultiBucketLifecycleTypeTransition captures enum value "transition" 125 AddMultiBucketLifecycleTypeTransition string = "transition" 126 ) 127 128 // prop value enum 129 func (m *AddMultiBucketLifecycle) validateTypeEnum(path, location string, value string) error { 130 if err := validate.EnumCase(path, location, value, addMultiBucketLifecycleTypeTypePropEnum, true); err != nil { 131 return err 132 } 133 return nil 134 } 135 136 func (m *AddMultiBucketLifecycle) validateType(formats strfmt.Registry) error { 137 138 if err := validate.Required("type", "body", m.Type); err != nil { 139 return err 140 } 141 142 // value enum 143 if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { 144 return err 145 } 146 147 return nil 148 } 149 150 // ContextValidate validates this add multi bucket lifecycle based on context it is used 151 func (m *AddMultiBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 152 return nil 153 } 154 155 // MarshalBinary interface implementation 156 func (m *AddMultiBucketLifecycle) MarshalBinary() ([]byte, error) { 157 if m == nil { 158 return nil, nil 159 } 160 return swag.WriteJSON(m) 161 } 162 163 // UnmarshalBinary interface implementation 164 func (m *AddMultiBucketLifecycle) UnmarshalBinary(b []byte) error { 165 var res AddMultiBucketLifecycle 166 if err := swag.ReadJSON(b, &res); err != nil { 167 return err 168 } 169 *m = res 170 return nil 171 }