github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/objects/objects_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  // NewObjectsDeleteParams creates a new ObjectsDeleteParams object
    30  //
    31  // There are no default values defined in the spec.
    32  func NewObjectsDeleteParams() ObjectsDeleteParams {
    33  
    34  	return ObjectsDeleteParams{}
    35  }
    36  
    37  // ObjectsDeleteParams contains all the bound params for the objects delete operation
    38  // typically these are obtained from a http.Request
    39  //
    40  // swagger:parameters objects.delete
    41  type ObjectsDeleteParams struct {
    42  
    43  	// HTTP Request Object
    44  	HTTPRequest *http.Request `json:"-"`
    45  
    46  	/*Determines how many replicas must acknowledge a request before it is considered successful
    47  	  In: query
    48  	*/
    49  	ConsistencyLevel *string
    50  	/*Unique ID of the Object.
    51  	  Required: true
    52  	  In: path
    53  	*/
    54  	ID strfmt.UUID
    55  	/*Specifies the tenant in a request targeting a multi-tenant class
    56  	  In: query
    57  	*/
    58  	Tenant *string
    59  }
    60  
    61  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    62  // for simple values it will use straight method calls.
    63  //
    64  // To ensure default values, the struct must have been initialized with NewObjectsDeleteParams() beforehand.
    65  func (o *ObjectsDeleteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    66  	var res []error
    67  
    68  	o.HTTPRequest = r
    69  
    70  	qs := runtime.Values(r.URL.Query())
    71  
    72  	qConsistencyLevel, qhkConsistencyLevel, _ := qs.GetOK("consistency_level")
    73  	if err := o.bindConsistencyLevel(qConsistencyLevel, qhkConsistencyLevel, route.Formats); err != nil {
    74  		res = append(res, err)
    75  	}
    76  
    77  	rID, rhkID, _ := route.Params.GetOK("id")
    78  	if err := o.bindID(rID, rhkID, route.Formats); err != nil {
    79  		res = append(res, err)
    80  	}
    81  
    82  	qTenant, qhkTenant, _ := qs.GetOK("tenant")
    83  	if err := o.bindTenant(qTenant, qhkTenant, route.Formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  	if len(res) > 0 {
    87  		return errors.CompositeValidationError(res...)
    88  	}
    89  	return nil
    90  }
    91  
    92  // bindConsistencyLevel binds and validates parameter ConsistencyLevel from query.
    93  func (o *ObjectsDeleteParams) bindConsistencyLevel(rawData []string, hasKey bool, formats strfmt.Registry) error {
    94  	var raw string
    95  	if len(rawData) > 0 {
    96  		raw = rawData[len(rawData)-1]
    97  	}
    98  
    99  	// Required: false
   100  	// AllowEmptyValue: false
   101  
   102  	if raw == "" { // empty values pass all other validations
   103  		return nil
   104  	}
   105  	o.ConsistencyLevel = &raw
   106  
   107  	return nil
   108  }
   109  
   110  // bindID binds and validates parameter ID from path.
   111  func (o *ObjectsDeleteParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
   112  	var raw string
   113  	if len(rawData) > 0 {
   114  		raw = rawData[len(rawData)-1]
   115  	}
   116  
   117  	// Required: true
   118  	// Parameter is provided by construction from the route
   119  
   120  	// Format: uuid
   121  	value, err := formats.Parse("uuid", raw)
   122  	if err != nil {
   123  		return errors.InvalidType("id", "path", "strfmt.UUID", raw)
   124  	}
   125  	o.ID = *(value.(*strfmt.UUID))
   126  
   127  	if err := o.validateID(formats); err != nil {
   128  		return err
   129  	}
   130  
   131  	return nil
   132  }
   133  
   134  // validateID carries on validations for parameter ID
   135  func (o *ObjectsDeleteParams) validateID(formats strfmt.Registry) error {
   136  
   137  	if err := validate.FormatOf("id", "path", "uuid", o.ID.String(), formats); err != nil {
   138  		return err
   139  	}
   140  	return nil
   141  }
   142  
   143  // bindTenant binds and validates parameter Tenant from query.
   144  func (o *ObjectsDeleteParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
   145  	var raw string
   146  	if len(rawData) > 0 {
   147  		raw = rawData[len(rawData)-1]
   148  	}
   149  
   150  	// Required: false
   151  	// AllowEmptyValue: false
   152  
   153  	if raw == "" { // empty values pass all other validations
   154  		return nil
   155  	}
   156  	o.Tenant = &raw
   157  
   158  	return nil
   159  }