github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/schema/tenants_delete_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  	"io"
    21  	"net/http"
    22  
    23  	"github.com/go-openapi/errors"
    24  	"github.com/go-openapi/runtime"
    25  	"github.com/go-openapi/runtime/middleware"
    26  	"github.com/go-openapi/strfmt"
    27  )
    28  
    29  // NewTenantsDeleteParams creates a new TenantsDeleteParams object
    30  //
    31  // There are no default values defined in the spec.
    32  func NewTenantsDeleteParams() TenantsDeleteParams {
    33  
    34  	return TenantsDeleteParams{}
    35  }
    36  
    37  // TenantsDeleteParams contains all the bound params for the tenants delete operation
    38  // typically these are obtained from a http.Request
    39  //
    40  // swagger:parameters tenants.delete
    41  type TenantsDeleteParams struct {
    42  
    43  	// HTTP Request Object
    44  	HTTPRequest *http.Request `json:"-"`
    45  
    46  	/*
    47  	  Required: true
    48  	  In: path
    49  	*/
    50  	ClassName string
    51  	/*
    52  	  Required: true
    53  	  In: body
    54  	*/
    55  	Tenants []string
    56  }
    57  
    58  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    59  // for simple values it will use straight method calls.
    60  //
    61  // To ensure default values, the struct must have been initialized with NewTenantsDeleteParams() beforehand.
    62  func (o *TenantsDeleteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    63  	var res []error
    64  
    65  	o.HTTPRequest = r
    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  	if runtime.HasBody(r) {
    73  		defer r.Body.Close()
    74  		var body []string
    75  		if err := route.Consumer.Consume(r.Body, &body); err != nil {
    76  			if err == io.EOF {
    77  				res = append(res, errors.Required("tenants", "body", ""))
    78  			} else {
    79  				res = append(res, errors.NewParseError("tenants", "body", "", err))
    80  			}
    81  		} else {
    82  			// no validation required on inline body
    83  			o.Tenants = body
    84  		}
    85  	} else {
    86  		res = append(res, errors.Required("tenants", "body", ""))
    87  	}
    88  	if len(res) > 0 {
    89  		return errors.CompositeValidationError(res...)
    90  	}
    91  	return nil
    92  }
    93  
    94  // bindClassName binds and validates parameter ClassName from path.
    95  func (o *TenantsDeleteParams) bindClassName(rawData []string, hasKey bool, formats strfmt.Registry) error {
    96  	var raw string
    97  	if len(rawData) > 0 {
    98  		raw = rawData[len(rawData)-1]
    99  	}
   100  
   101  	// Required: true
   102  	// Parameter is provided by construction from the route
   103  	o.ClassName = raw
   104  
   105  	return nil
   106  }