github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/schema/schema_objects_shards_get_parameters.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 schema
    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  	"net/http"
    21  
    22  	"github.com/go-openapi/errors"
    23  	"github.com/go-openapi/runtime"
    24  	"github.com/go-openapi/runtime/middleware"
    25  	"github.com/go-openapi/strfmt"
    26  )
    27  
    28  // NewSchemaObjectsShardsGetParams creates a new SchemaObjectsShardsGetParams object
    29  //
    30  // There are no default values defined in the spec.
    31  func NewSchemaObjectsShardsGetParams() SchemaObjectsShardsGetParams {
    32  
    33  	return SchemaObjectsShardsGetParams{}
    34  }
    35  
    36  // SchemaObjectsShardsGetParams contains all the bound params for the schema objects shards get operation
    37  // typically these are obtained from a http.Request
    38  //
    39  // swagger:parameters schema.objects.shards.get
    40  type SchemaObjectsShardsGetParams struct {
    41  
    42  	// HTTP Request Object
    43  	HTTPRequest *http.Request `json:"-"`
    44  
    45  	/*
    46  	  Required: true
    47  	  In: path
    48  	*/
    49  	ClassName string
    50  	/*
    51  	  In: query
    52  	*/
    53  	Tenant *string
    54  }
    55  
    56  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    57  // for simple values it will use straight method calls.
    58  //
    59  // To ensure default values, the struct must have been initialized with NewSchemaObjectsShardsGetParams() beforehand.
    60  func (o *SchemaObjectsShardsGetParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    61  	var res []error
    62  
    63  	o.HTTPRequest = r
    64  
    65  	qs := runtime.Values(r.URL.Query())
    66  
    67  	rClassName, rhkClassName, _ := route.Params.GetOK("className")
    68  	if err := o.bindClassName(rClassName, rhkClassName, route.Formats); err != nil {
    69  		res = append(res, err)
    70  	}
    71  
    72  	qTenant, qhkTenant, _ := qs.GetOK("tenant")
    73  	if err := o.bindTenant(qTenant, qhkTenant, route.Formats); err != nil {
    74  		res = append(res, err)
    75  	}
    76  	if len(res) > 0 {
    77  		return errors.CompositeValidationError(res...)
    78  	}
    79  	return nil
    80  }
    81  
    82  // bindClassName binds and validates parameter ClassName from path.
    83  func (o *SchemaObjectsShardsGetParams) bindClassName(rawData []string, hasKey bool, formats strfmt.Registry) error {
    84  	var raw string
    85  	if len(rawData) > 0 {
    86  		raw = rawData[len(rawData)-1]
    87  	}
    88  
    89  	// Required: true
    90  	// Parameter is provided by construction from the route
    91  	o.ClassName = raw
    92  
    93  	return nil
    94  }
    95  
    96  // bindTenant binds and validates parameter Tenant from query.
    97  func (o *SchemaObjectsShardsGetParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
    98  	var raw string
    99  	if len(rawData) > 0 {
   100  		raw = rawData[len(rawData)-1]
   101  	}
   102  
   103  	// Required: false
   104  	// AllowEmptyValue: false
   105  
   106  	if raw == "" { // empty values pass all other validations
   107  		return nil
   108  	}
   109  	o.Tenant = &raw
   110  
   111  	return nil
   112  }