github.com/weaviate/weaviate@v1.24.6/entities/models/backup_restore_status_response.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 // BackupRestoreStatusResponse The definition of a backup restore metadata 30 // 31 // swagger:model BackupRestoreStatusResponse 32 type BackupRestoreStatusResponse struct { 33 34 // Backup backend name e.g. filesystem, gcs, s3. 35 Backend string `json:"backend,omitempty"` 36 37 // error message if restoration failed 38 Error string `json:"error,omitempty"` 39 40 // The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. 41 ID string `json:"id,omitempty"` 42 43 // destination path of backup files proper to selected backup backend 44 Path string `json:"path,omitempty"` 45 46 // phase of backup restoration process 47 // Enum: [STARTED TRANSFERRING TRANSFERRED SUCCESS FAILED] 48 Status *string `json:"status,omitempty"` 49 } 50 51 // Validate validates this backup restore status response 52 func (m *BackupRestoreStatusResponse) Validate(formats strfmt.Registry) error { 53 var res []error 54 55 if err := m.validateStatus(formats); err != nil { 56 res = append(res, err) 57 } 58 59 if len(res) > 0 { 60 return errors.CompositeValidationError(res...) 61 } 62 return nil 63 } 64 65 var backupRestoreStatusResponseTypeStatusPropEnum []interface{} 66 67 func init() { 68 var res []string 69 if err := json.Unmarshal([]byte(`["STARTED","TRANSFERRING","TRANSFERRED","SUCCESS","FAILED"]`), &res); err != nil { 70 panic(err) 71 } 72 for _, v := range res { 73 backupRestoreStatusResponseTypeStatusPropEnum = append(backupRestoreStatusResponseTypeStatusPropEnum, v) 74 } 75 } 76 77 const ( 78 79 // BackupRestoreStatusResponseStatusSTARTED captures enum value "STARTED" 80 BackupRestoreStatusResponseStatusSTARTED string = "STARTED" 81 82 // BackupRestoreStatusResponseStatusTRANSFERRING captures enum value "TRANSFERRING" 83 BackupRestoreStatusResponseStatusTRANSFERRING string = "TRANSFERRING" 84 85 // BackupRestoreStatusResponseStatusTRANSFERRED captures enum value "TRANSFERRED" 86 BackupRestoreStatusResponseStatusTRANSFERRED string = "TRANSFERRED" 87 88 // BackupRestoreStatusResponseStatusSUCCESS captures enum value "SUCCESS" 89 BackupRestoreStatusResponseStatusSUCCESS string = "SUCCESS" 90 91 // BackupRestoreStatusResponseStatusFAILED captures enum value "FAILED" 92 BackupRestoreStatusResponseStatusFAILED string = "FAILED" 93 ) 94 95 // prop value enum 96 func (m *BackupRestoreStatusResponse) validateStatusEnum(path, location string, value string) error { 97 if err := validate.EnumCase(path, location, value, backupRestoreStatusResponseTypeStatusPropEnum, true); err != nil { 98 return err 99 } 100 return nil 101 } 102 103 func (m *BackupRestoreStatusResponse) validateStatus(formats strfmt.Registry) error { 104 if swag.IsZero(m.Status) { // not required 105 return nil 106 } 107 108 // value enum 109 if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { 110 return err 111 } 112 113 return nil 114 } 115 116 // ContextValidate validates this backup restore status response based on context it is used 117 func (m *BackupRestoreStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 118 return nil 119 } 120 121 // MarshalBinary interface implementation 122 func (m *BackupRestoreStatusResponse) MarshalBinary() ([]byte, error) { 123 if m == nil { 124 return nil, nil 125 } 126 return swag.WriteJSON(m) 127 } 128 129 // UnmarshalBinary interface implementation 130 func (m *BackupRestoreStatusResponse) UnmarshalBinary(b []byte) error { 131 var res BackupRestoreStatusResponse 132 if err := swag.ReadJSON(b, &res); err != nil { 133 return err 134 } 135 *m = res 136 return nil 137 }