github.com/weaviate/weaviate@v1.24.6/entities/models/restore_config.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  	"github.com/go-openapi/validate"
    26  )
    27  
    28  // RestoreConfig Backup custom configuration
    29  //
    30  // swagger:model RestoreConfig
    31  type RestoreConfig struct {
    32  
    33  	// Desired CPU core utilization ranging from 1%-80%
    34  	// Maximum: 80
    35  	// Minimum: 1
    36  	CPUPercentage int64 `json:"CPUPercentage,omitempty"`
    37  }
    38  
    39  // Validate validates this restore config
    40  func (m *RestoreConfig) Validate(formats strfmt.Registry) error {
    41  	var res []error
    42  
    43  	if err := m.validateCPUPercentage(formats); err != nil {
    44  		res = append(res, err)
    45  	}
    46  
    47  	if len(res) > 0 {
    48  		return errors.CompositeValidationError(res...)
    49  	}
    50  	return nil
    51  }
    52  
    53  func (m *RestoreConfig) validateCPUPercentage(formats strfmt.Registry) error {
    54  	if swag.IsZero(m.CPUPercentage) { // not required
    55  		return nil
    56  	}
    57  
    58  	if err := validate.MinimumInt("CPUPercentage", "body", m.CPUPercentage, 1, false); err != nil {
    59  		return err
    60  	}
    61  
    62  	if err := validate.MaximumInt("CPUPercentage", "body", m.CPUPercentage, 80, false); err != nil {
    63  		return err
    64  	}
    65  
    66  	return nil
    67  }
    68  
    69  // ContextValidate validates this restore config based on context it is used
    70  func (m *RestoreConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    71  	return nil
    72  }
    73  
    74  // MarshalBinary interface implementation
    75  func (m *RestoreConfig) MarshalBinary() ([]byte, error) {
    76  	if m == nil {
    77  		return nil, nil
    78  	}
    79  	return swag.WriteJSON(m)
    80  }
    81  
    82  // UnmarshalBinary interface implementation
    83  func (m *RestoreConfig) UnmarshalBinary(b []byte) error {
    84  	var res RestoreConfig
    85  	if err := swag.ReadJSON(b, &res); err != nil {
    86  		return err
    87  	}
    88  	*m = res
    89  	return nil
    90  }