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