github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_class_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 objects
    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  	"github.com/go-openapi/validate"
    27  )
    28  
    29  // NewObjectsClassGetParams creates a new ObjectsClassGetParams object
    30  //
    31  // There are no default values defined in the spec.
    32  func NewObjectsClassGetParams() ObjectsClassGetParams {
    33  
    34  	return ObjectsClassGetParams{}
    35  }
    36  
    37  // ObjectsClassGetParams contains all the bound params for the objects class get operation
    38  // typically these are obtained from a http.Request
    39  //
    40  // swagger:parameters objects.class.get
    41  type ObjectsClassGetParams struct {
    42  
    43  	// HTTP Request Object
    44  	HTTPRequest *http.Request `json:"-"`
    45  
    46  	/*
    47  	  Required: true
    48  	  In: path
    49  	*/
    50  	ClassName string
    51  	/*Determines how many replicas must acknowledge a request before it is considered successful
    52  	  In: query
    53  	*/
    54  	ConsistencyLevel *string
    55  	/*Unique ID of the Object.
    56  	  Required: true
    57  	  In: path
    58  	*/
    59  	ID strfmt.UUID
    60  	/*Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation
    61  	  In: query
    62  	*/
    63  	Include *string
    64  	/*The target node which should fulfill the request
    65  	  In: query
    66  	*/
    67  	NodeName *string
    68  	/*Specifies the tenant in a request targeting a multi-tenant class
    69  	  In: query
    70  	*/
    71  	Tenant *string
    72  }
    73  
    74  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    75  // for simple values it will use straight method calls.
    76  //
    77  // To ensure default values, the struct must have been initialized with NewObjectsClassGetParams() beforehand.
    78  func (o *ObjectsClassGetParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    79  	var res []error
    80  
    81  	o.HTTPRequest = r
    82  
    83  	qs := runtime.Values(r.URL.Query())
    84  
    85  	rClassName, rhkClassName, _ := route.Params.GetOK("className")
    86  	if err := o.bindClassName(rClassName, rhkClassName, route.Formats); err != nil {
    87  		res = append(res, err)
    88  	}
    89  
    90  	qConsistencyLevel, qhkConsistencyLevel, _ := qs.GetOK("consistency_level")
    91  	if err := o.bindConsistencyLevel(qConsistencyLevel, qhkConsistencyLevel, route.Formats); err != nil {
    92  		res = append(res, err)
    93  	}
    94  
    95  	rID, rhkID, _ := route.Params.GetOK("id")
    96  	if err := o.bindID(rID, rhkID, route.Formats); err != nil {
    97  		res = append(res, err)
    98  	}
    99  
   100  	qInclude, qhkInclude, _ := qs.GetOK("include")
   101  	if err := o.bindInclude(qInclude, qhkInclude, route.Formats); err != nil {
   102  		res = append(res, err)
   103  	}
   104  
   105  	qNodeName, qhkNodeName, _ := qs.GetOK("node_name")
   106  	if err := o.bindNodeName(qNodeName, qhkNodeName, route.Formats); err != nil {
   107  		res = append(res, err)
   108  	}
   109  
   110  	qTenant, qhkTenant, _ := qs.GetOK("tenant")
   111  	if err := o.bindTenant(qTenant, qhkTenant, route.Formats); err != nil {
   112  		res = append(res, err)
   113  	}
   114  	if len(res) > 0 {
   115  		return errors.CompositeValidationError(res...)
   116  	}
   117  	return nil
   118  }
   119  
   120  // bindClassName binds and validates parameter ClassName from path.
   121  func (o *ObjectsClassGetParams) bindClassName(rawData []string, hasKey bool, formats strfmt.Registry) error {
   122  	var raw string
   123  	if len(rawData) > 0 {
   124  		raw = rawData[len(rawData)-1]
   125  	}
   126  
   127  	// Required: true
   128  	// Parameter is provided by construction from the route
   129  	o.ClassName = raw
   130  
   131  	return nil
   132  }
   133  
   134  // bindConsistencyLevel binds and validates parameter ConsistencyLevel from query.
   135  func (o *ObjectsClassGetParams) bindConsistencyLevel(rawData []string, hasKey bool, formats strfmt.Registry) error {
   136  	var raw string
   137  	if len(rawData) > 0 {
   138  		raw = rawData[len(rawData)-1]
   139  	}
   140  
   141  	// Required: false
   142  	// AllowEmptyValue: false
   143  
   144  	if raw == "" { // empty values pass all other validations
   145  		return nil
   146  	}
   147  	o.ConsistencyLevel = &raw
   148  
   149  	return nil
   150  }
   151  
   152  // bindID binds and validates parameter ID from path.
   153  func (o *ObjectsClassGetParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
   154  	var raw string
   155  	if len(rawData) > 0 {
   156  		raw = rawData[len(rawData)-1]
   157  	}
   158  
   159  	// Required: true
   160  	// Parameter is provided by construction from the route
   161  
   162  	// Format: uuid
   163  	value, err := formats.Parse("uuid", raw)
   164  	if err != nil {
   165  		return errors.InvalidType("id", "path", "strfmt.UUID", raw)
   166  	}
   167  	o.ID = *(value.(*strfmt.UUID))
   168  
   169  	if err := o.validateID(formats); err != nil {
   170  		return err
   171  	}
   172  
   173  	return nil
   174  }
   175  
   176  // validateID carries on validations for parameter ID
   177  func (o *ObjectsClassGetParams) validateID(formats strfmt.Registry) error {
   178  
   179  	if err := validate.FormatOf("id", "path", "uuid", o.ID.String(), formats); err != nil {
   180  		return err
   181  	}
   182  	return nil
   183  }
   184  
   185  // bindInclude binds and validates parameter Include from query.
   186  func (o *ObjectsClassGetParams) bindInclude(rawData []string, hasKey bool, formats strfmt.Registry) error {
   187  	var raw string
   188  	if len(rawData) > 0 {
   189  		raw = rawData[len(rawData)-1]
   190  	}
   191  
   192  	// Required: false
   193  	// AllowEmptyValue: false
   194  
   195  	if raw == "" { // empty values pass all other validations
   196  		return nil
   197  	}
   198  	o.Include = &raw
   199  
   200  	return nil
   201  }
   202  
   203  // bindNodeName binds and validates parameter NodeName from query.
   204  func (o *ObjectsClassGetParams) bindNodeName(rawData []string, hasKey bool, formats strfmt.Registry) error {
   205  	var raw string
   206  	if len(rawData) > 0 {
   207  		raw = rawData[len(rawData)-1]
   208  	}
   209  
   210  	// Required: false
   211  	// AllowEmptyValue: false
   212  
   213  	if raw == "" { // empty values pass all other validations
   214  		return nil
   215  	}
   216  	o.NodeName = &raw
   217  
   218  	return nil
   219  }
   220  
   221  // bindTenant binds and validates parameter Tenant from query.
   222  func (o *ObjectsClassGetParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
   223  	var raw string
   224  	if len(rawData) > 0 {
   225  		raw = rawData[len(rawData)-1]
   226  	}
   227  
   228  	// Required: false
   229  	// AllowEmptyValue: false
   230  
   231  	if raw == "" { // empty values pass all other validations
   232  		return nil
   233  	}
   234  	o.Tenant = &raw
   235  
   236  	return nil
   237  }