github.com/weaviate/weaviate@v1.24.6/entities/models/backup_create_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  // BackupCreateRequest Request body for creating a backup of a set of classes
    28  //
    29  // swagger:model BackupCreateRequest
    30  type BackupCreateRequest struct {
    31  
    32  	// Custom configuration for the backup creation process
    33  	Config *BackupConfig `json:"config,omitempty"`
    34  
    35  	// List of classes to exclude from the backup creation process
    36  	Exclude []string `json:"exclude"`
    37  
    38  	// The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed.
    39  	ID string `json:"id,omitempty"`
    40  
    41  	// List of classes to include in the backup creation process
    42  	Include []string `json:"include"`
    43  }
    44  
    45  // Validate validates this backup create request
    46  func (m *BackupCreateRequest) 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 *BackupCreateRequest) 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 create request based on the context it is used
    79  func (m *BackupCreateRequest) 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 *BackupCreateRequest) 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 *BackupCreateRequest) 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 *BackupCreateRequest) UnmarshalBinary(b []byte) error {
   118  	var res BackupCreateRequest
   119  	if err := swag.ReadJSON(b, &res); err != nil {
   120  		return err
   121  	}
   122  	*m = res
   123  	return nil
   124  }