github.com/weaviate/weaviate@v1.24.6/entities/models/tenant.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 // Code generated by go-swagger; DO NOT EDIT. 13 14 package models 15 16 // This file was generated by the swagger tool. 17 // Editing this file might prove futile when you re-run the swagger generate command 18 19 import ( 20 "context" 21 "encoding/json" 22 23 "github.com/go-openapi/errors" 24 "github.com/go-openapi/strfmt" 25 "github.com/go-openapi/swag" 26 "github.com/go-openapi/validate" 27 ) 28 29 // Tenant attributes representing a single tenant within weaviate 30 // 31 // swagger:model Tenant 32 type Tenant struct { 33 34 // activity status of the tenant's shard. Optional for creating tenant (implicit `HOT`) and required for updating tenant. Allowed values are `HOT` - tenant is fully active, `WARM` - tenant is active, some restrictions are imposed (TBD; not supported yet), `COLD` - tenant is inactive; no actions can be performed on tenant, tenant's files are stored locally, `FROZEN` - as COLD, but files are stored on cloud storage (not supported yet) 35 // Enum: [HOT WARM COLD FROZEN] 36 ActivityStatus string `json:"activityStatus,omitempty"` 37 38 // name of the tenant 39 Name string `json:"name,omitempty"` 40 } 41 42 // Validate validates this tenant 43 func (m *Tenant) Validate(formats strfmt.Registry) error { 44 var res []error 45 46 if err := m.validateActivityStatus(formats); err != nil { 47 res = append(res, err) 48 } 49 50 if len(res) > 0 { 51 return errors.CompositeValidationError(res...) 52 } 53 return nil 54 } 55 56 var tenantTypeActivityStatusPropEnum []interface{} 57 58 func init() { 59 var res []string 60 if err := json.Unmarshal([]byte(`["HOT","WARM","COLD","FROZEN"]`), &res); err != nil { 61 panic(err) 62 } 63 for _, v := range res { 64 tenantTypeActivityStatusPropEnum = append(tenantTypeActivityStatusPropEnum, v) 65 } 66 } 67 68 const ( 69 70 // TenantActivityStatusHOT captures enum value "HOT" 71 TenantActivityStatusHOT string = "HOT" 72 73 // TenantActivityStatusWARM captures enum value "WARM" 74 TenantActivityStatusWARM string = "WARM" 75 76 // TenantActivityStatusCOLD captures enum value "COLD" 77 TenantActivityStatusCOLD string = "COLD" 78 79 // TenantActivityStatusFROZEN captures enum value "FROZEN" 80 TenantActivityStatusFROZEN string = "FROZEN" 81 ) 82 83 // prop value enum 84 func (m *Tenant) validateActivityStatusEnum(path, location string, value string) error { 85 if err := validate.EnumCase(path, location, value, tenantTypeActivityStatusPropEnum, true); err != nil { 86 return err 87 } 88 return nil 89 } 90 91 func (m *Tenant) validateActivityStatus(formats strfmt.Registry) error { 92 if swag.IsZero(m.ActivityStatus) { // not required 93 return nil 94 } 95 96 // value enum 97 if err := m.validateActivityStatusEnum("activityStatus", "body", m.ActivityStatus); err != nil { 98 return err 99 } 100 101 return nil 102 } 103 104 // ContextValidate validates this tenant based on context it is used 105 func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 106 return nil 107 } 108 109 // MarshalBinary interface implementation 110 func (m *Tenant) MarshalBinary() ([]byte, error) { 111 if m == nil { 112 return nil, nil 113 } 114 return swag.WriteJSON(m) 115 } 116 117 // UnmarshalBinary interface implementation 118 func (m *Tenant) UnmarshalBinary(b []byte) error { 119 var res Tenant 120 if err := swag.ReadJSON(b, &res); err != nil { 121 return err 122 } 123 *m = res 124 return nil 125 }