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