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