github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/nodes/nodes_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 nodes
    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  // NewNodesGetParams creates a new NodesGetParams object
    29  // with the default values initialized.
    30  func NewNodesGetParams() NodesGetParams {
    31  
    32  	var (
    33  		// initialize parameters with default values
    34  
    35  		outputDefault = string("minimal")
    36  	)
    37  
    38  	return NodesGetParams{
    39  		Output: &outputDefault,
    40  	}
    41  }
    42  
    43  // NodesGetParams contains all the bound params for the nodes get operation
    44  // typically these are obtained from a http.Request
    45  //
    46  // swagger:parameters nodes.get
    47  type NodesGetParams struct {
    48  
    49  	// HTTP Request Object
    50  	HTTPRequest *http.Request `json:"-"`
    51  
    52  	/*Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal".
    53  	  In: query
    54  	  Default: "minimal"
    55  	*/
    56  	Output *string
    57  }
    58  
    59  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    60  // for simple values it will use straight method calls.
    61  //
    62  // To ensure default values, the struct must have been initialized with NewNodesGetParams() beforehand.
    63  func (o *NodesGetParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    64  	var res []error
    65  
    66  	o.HTTPRequest = r
    67  
    68  	qs := runtime.Values(r.URL.Query())
    69  
    70  	qOutput, qhkOutput, _ := qs.GetOK("output")
    71  	if err := o.bindOutput(qOutput, qhkOutput, route.Formats); err != nil {
    72  		res = append(res, err)
    73  	}
    74  	if len(res) > 0 {
    75  		return errors.CompositeValidationError(res...)
    76  	}
    77  	return nil
    78  }
    79  
    80  // bindOutput binds and validates parameter Output from query.
    81  func (o *NodesGetParams) bindOutput(rawData []string, hasKey bool, formats strfmt.Registry) error {
    82  	var raw string
    83  	if len(rawData) > 0 {
    84  		raw = rawData[len(rawData)-1]
    85  	}
    86  
    87  	// Required: false
    88  	// AllowEmptyValue: false
    89  
    90  	if raw == "" { // empty values pass all other validations
    91  		// Default values have been previously initialized by NewNodesGetParams()
    92  		return nil
    93  	}
    94  	o.Output = &raw
    95  
    96  	return nil
    97  }