github.com/weaviate/weaviate@v1.24.6/entities/models/backup_create_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  // BackupCreateStatusResponse The definition of a backup create metadata
    30  //
    31  // swagger:model BackupCreateStatusResponse
    32  type BackupCreateStatusResponse struct {
    33  
    34  	// Backup backend name e.g. filesystem, gcs, s3.
    35  	Backend string `json:"backend,omitempty"`
    36  
    37  	// error message if creation 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 backend
    44  	Path string `json:"path,omitempty"`
    45  
    46  	// phase of backup creation process
    47  	// Enum: [STARTED TRANSFERRING TRANSFERRED SUCCESS FAILED]
    48  	Status *string `json:"status,omitempty"`
    49  }
    50  
    51  // Validate validates this backup create status response
    52  func (m *BackupCreateStatusResponse) 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 backupCreateStatusResponseTypeStatusPropEnum []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  		backupCreateStatusResponseTypeStatusPropEnum = append(backupCreateStatusResponseTypeStatusPropEnum, v)
    74  	}
    75  }
    76  
    77  const (
    78  
    79  	// BackupCreateStatusResponseStatusSTARTED captures enum value "STARTED"
    80  	BackupCreateStatusResponseStatusSTARTED string = "STARTED"
    81  
    82  	// BackupCreateStatusResponseStatusTRANSFERRING captures enum value "TRANSFERRING"
    83  	BackupCreateStatusResponseStatusTRANSFERRING string = "TRANSFERRING"
    84  
    85  	// BackupCreateStatusResponseStatusTRANSFERRED captures enum value "TRANSFERRED"
    86  	BackupCreateStatusResponseStatusTRANSFERRED string = "TRANSFERRED"
    87  
    88  	// BackupCreateStatusResponseStatusSUCCESS captures enum value "SUCCESS"
    89  	BackupCreateStatusResponseStatusSUCCESS string = "SUCCESS"
    90  
    91  	// BackupCreateStatusResponseStatusFAILED captures enum value "FAILED"
    92  	BackupCreateStatusResponseStatusFAILED string = "FAILED"
    93  )
    94  
    95  // prop value enum
    96  func (m *BackupCreateStatusResponse) validateStatusEnum(path, location string, value string) error {
    97  	if err := validate.EnumCase(path, location, value, backupCreateStatusResponseTypeStatusPropEnum, true); err != nil {
    98  		return err
    99  	}
   100  	return nil
   101  }
   102  
   103  func (m *BackupCreateStatusResponse) 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 create status response based on context it is used
   117  func (m *BackupCreateStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   118  	return nil
   119  }
   120  
   121  // MarshalBinary interface implementation
   122  func (m *BackupCreateStatusResponse) 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 *BackupCreateStatusResponse) UnmarshalBinary(b []byte) error {
   131  	var res BackupCreateStatusResponse
   132  	if err := swag.ReadJSON(b, &res); err != nil {
   133  		return err
   134  	}
   135  	*m = res
   136  	return nil
   137  }