github.com/weaviate/weaviate@v1.24.6/entities/models/backup_restore_request.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 22 "github.com/go-openapi/errors" 23 "github.com/go-openapi/strfmt" 24 "github.com/go-openapi/swag" 25 ) 26 27 // BackupRestoreRequest Request body for restoring a backup for a set of classes 28 // 29 // swagger:model BackupRestoreRequest 30 type BackupRestoreRequest struct { 31 32 // Custom configuration for the backup restoration process 33 Config *RestoreConfig `json:"config,omitempty"` 34 35 // List of classes to exclude from the backup restoration process 36 Exclude []string `json:"exclude"` 37 38 // List of classes to include in the backup restoration process 39 Include []string `json:"include"` 40 41 // Allows overriding the node names stored in the backup with different ones. Useful when restoring backups to a different environment. 42 NodeMapping map[string]string `json:"node_mapping,omitempty"` 43 } 44 45 // Validate validates this backup restore request 46 func (m *BackupRestoreRequest) Validate(formats strfmt.Registry) error { 47 var res []error 48 49 if err := m.validateConfig(formats); err != nil { 50 res = append(res, err) 51 } 52 53 if len(res) > 0 { 54 return errors.CompositeValidationError(res...) 55 } 56 return nil 57 } 58 59 func (m *BackupRestoreRequest) validateConfig(formats strfmt.Registry) error { 60 if swag.IsZero(m.Config) { // not required 61 return nil 62 } 63 64 if m.Config != nil { 65 if err := m.Config.Validate(formats); err != nil { 66 if ve, ok := err.(*errors.Validation); ok { 67 return ve.ValidateName("config") 68 } else if ce, ok := err.(*errors.CompositeError); ok { 69 return ce.ValidateName("config") 70 } 71 return err 72 } 73 } 74 75 return nil 76 } 77 78 // ContextValidate validate this backup restore request based on the context it is used 79 func (m *BackupRestoreRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 80 var res []error 81 82 if err := m.contextValidateConfig(ctx, formats); err != nil { 83 res = append(res, err) 84 } 85 86 if len(res) > 0 { 87 return errors.CompositeValidationError(res...) 88 } 89 return nil 90 } 91 92 func (m *BackupRestoreRequest) contextValidateConfig(ctx context.Context, formats strfmt.Registry) error { 93 94 if m.Config != nil { 95 if err := m.Config.ContextValidate(ctx, formats); err != nil { 96 if ve, ok := err.(*errors.Validation); ok { 97 return ve.ValidateName("config") 98 } else if ce, ok := err.(*errors.CompositeError); ok { 99 return ce.ValidateName("config") 100 } 101 return err 102 } 103 } 104 105 return nil 106 } 107 108 // MarshalBinary interface implementation 109 func (m *BackupRestoreRequest) MarshalBinary() ([]byte, error) { 110 if m == nil { 111 return nil, nil 112 } 113 return swag.WriteJSON(m) 114 } 115 116 // UnmarshalBinary interface implementation 117 func (m *BackupRestoreRequest) UnmarshalBinary(b []byte) error { 118 var res BackupRestoreRequest 119 if err := swag.ReadJSON(b, &res); err != nil { 120 return err 121 } 122 *m = res 123 return nil 124 }