github.com/minio/console@v1.4.1/api/operations/object/post_buckets_bucket_name_objects_upload_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // This file is part of MinIO Console Server
     4  // Copyright (c) 2023 MinIO, Inc.
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU Affero General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU Affero General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU Affero General Public License
    17  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  //
    19  
    20  package object
    21  
    22  // This file was generated by the swagger tool.
    23  // Editing this file might prove futile when you re-run the swagger generate command
    24  
    25  import (
    26  	"net/http"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/runtime"
    30  	"github.com/go-openapi/runtime/middleware"
    31  	"github.com/go-openapi/strfmt"
    32  )
    33  
    34  // NewPostBucketsBucketNameObjectsUploadParams creates a new PostBucketsBucketNameObjectsUploadParams object
    35  //
    36  // There are no default values defined in the spec.
    37  func NewPostBucketsBucketNameObjectsUploadParams() PostBucketsBucketNameObjectsUploadParams {
    38  
    39  	return PostBucketsBucketNameObjectsUploadParams{}
    40  }
    41  
    42  // PostBucketsBucketNameObjectsUploadParams contains all the bound params for the post buckets bucket name objects upload operation
    43  // typically these are obtained from a http.Request
    44  //
    45  // swagger:parameters PostBucketsBucketNameObjectsUpload
    46  type PostBucketsBucketNameObjectsUploadParams struct {
    47  
    48  	// HTTP Request Object
    49  	HTTPRequest *http.Request `json:"-"`
    50  
    51  	/*
    52  	  Required: true
    53  	  In: path
    54  	*/
    55  	BucketName string
    56  	/*
    57  	  In: query
    58  	*/
    59  	Prefix *string
    60  }
    61  
    62  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    63  // for simple values it will use straight method calls.
    64  //
    65  // To ensure default values, the struct must have been initialized with NewPostBucketsBucketNameObjectsUploadParams() beforehand.
    66  func (o *PostBucketsBucketNameObjectsUploadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    67  	var res []error
    68  
    69  	o.HTTPRequest = r
    70  
    71  	qs := runtime.Values(r.URL.Query())
    72  
    73  	rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
    74  	if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
    75  		res = append(res, err)
    76  	}
    77  
    78  	qPrefix, qhkPrefix, _ := qs.GetOK("prefix")
    79  	if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil {
    80  		res = append(res, err)
    81  	}
    82  	if len(res) > 0 {
    83  		return errors.CompositeValidationError(res...)
    84  	}
    85  	return nil
    86  }
    87  
    88  // bindBucketName binds and validates parameter BucketName from path.
    89  func (o *PostBucketsBucketNameObjectsUploadParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
    90  	var raw string
    91  	if len(rawData) > 0 {
    92  		raw = rawData[len(rawData)-1]
    93  	}
    94  
    95  	// Required: true
    96  	// Parameter is provided by construction from the route
    97  	o.BucketName = raw
    98  
    99  	return nil
   100  }
   101  
   102  // bindPrefix binds and validates parameter Prefix from query.
   103  func (o *PostBucketsBucketNameObjectsUploadParams) bindPrefix(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: false
   110  	// AllowEmptyValue: false
   111  
   112  	if raw == "" { // empty values pass all other validations
   113  		return nil
   114  	}
   115  	o.Prefix = &raw
   116  
   117  	return nil
   118  }