github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_class_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 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  // NewObjectsClassDeleteParams creates a new ObjectsClassDeleteParams object
    30  //
    31  // There are no default values defined in the spec.
    32  func NewObjectsClassDeleteParams() ObjectsClassDeleteParams {
    33  
    34  	return ObjectsClassDeleteParams{}
    35  }
    36  
    37  // ObjectsClassDeleteParams contains all the bound params for the objects class delete operation
    38  // typically these are obtained from a http.Request
    39  //
    40  // swagger:parameters objects.class.delete
    41  type ObjectsClassDeleteParams 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  	/*Specifies the tenant in a request targeting a multi-tenant class
    61  	  In: query
    62  	*/
    63  	Tenant *string
    64  }
    65  
    66  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    67  // for simple values it will use straight method calls.
    68  //
    69  // To ensure default values, the struct must have been initialized with NewObjectsClassDeleteParams() beforehand.
    70  func (o *ObjectsClassDeleteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    71  	var res []error
    72  
    73  	o.HTTPRequest = r
    74  
    75  	qs := runtime.Values(r.URL.Query())
    76  
    77  	rClassName, rhkClassName, _ := route.Params.GetOK("className")
    78  	if err := o.bindClassName(rClassName, rhkClassName, route.Formats); err != nil {
    79  		res = append(res, err)
    80  	}
    81  
    82  	qConsistencyLevel, qhkConsistencyLevel, _ := qs.GetOK("consistency_level")
    83  	if err := o.bindConsistencyLevel(qConsistencyLevel, qhkConsistencyLevel, route.Formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	rID, rhkID, _ := route.Params.GetOK("id")
    88  	if err := o.bindID(rID, rhkID, route.Formats); err != nil {
    89  		res = append(res, err)
    90  	}
    91  
    92  	qTenant, qhkTenant, _ := qs.GetOK("tenant")
    93  	if err := o.bindTenant(qTenant, qhkTenant, route.Formats); err != nil {
    94  		res = append(res, err)
    95  	}
    96  	if len(res) > 0 {
    97  		return errors.CompositeValidationError(res...)
    98  	}
    99  	return nil
   100  }
   101  
   102  // bindClassName binds and validates parameter ClassName from path.
   103  func (o *ObjectsClassDeleteParams) bindClassName(rawData []string, hasKey bool, formats strfmt.Registry) error {
   104  	var raw string
   105  	if len(rawData) > 0 {
   106  		raw = rawData[len(rawData)-1]
   107  	}
   108  
   109  	// Required: true
   110  	// Parameter is provided by construction from the route
   111  	o.ClassName = raw
   112  
   113  	return nil
   114  }
   115  
   116  // bindConsistencyLevel binds and validates parameter ConsistencyLevel from query.
   117  func (o *ObjectsClassDeleteParams) bindConsistencyLevel(rawData []string, hasKey bool, formats strfmt.Registry) error {
   118  	var raw string
   119  	if len(rawData) > 0 {
   120  		raw = rawData[len(rawData)-1]
   121  	}
   122  
   123  	// Required: false
   124  	// AllowEmptyValue: false
   125  
   126  	if raw == "" { // empty values pass all other validations
   127  		return nil
   128  	}
   129  	o.ConsistencyLevel = &raw
   130  
   131  	return nil
   132  }
   133  
   134  // bindID binds and validates parameter ID from path.
   135  func (o *ObjectsClassDeleteParams) bindID(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: true
   142  	// Parameter is provided by construction from the route
   143  
   144  	// Format: uuid
   145  	value, err := formats.Parse("uuid", raw)
   146  	if err != nil {
   147  		return errors.InvalidType("id", "path", "strfmt.UUID", raw)
   148  	}
   149  	o.ID = *(value.(*strfmt.UUID))
   150  
   151  	if err := o.validateID(formats); err != nil {
   152  		return err
   153  	}
   154  
   155  	return nil
   156  }
   157  
   158  // validateID carries on validations for parameter ID
   159  func (o *ObjectsClassDeleteParams) validateID(formats strfmt.Registry) error {
   160  
   161  	if err := validate.FormatOf("id", "path", "uuid", o.ID.String(), formats); err != nil {
   162  		return err
   163  	}
   164  	return nil
   165  }
   166  
   167  // bindTenant binds and validates parameter Tenant from query.
   168  func (o *ObjectsClassDeleteParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
   169  	var raw string
   170  	if len(rawData) > 0 {
   171  		raw = rawData[len(rawData)-1]
   172  	}
   173  
   174  	// Required: false
   175  	// AllowEmptyValue: false
   176  
   177  	if raw == "" { // empty values pass all other validations
   178  		return nil
   179  	}
   180  	o.Tenant = &raw
   181  
   182  	return nil
   183  }