github.com/minio/console@v1.4.1/api/operations/object/put_object_restore_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  	"github.com/go-openapi/validate"
    33  )
    34  
    35  // NewPutObjectRestoreParams creates a new PutObjectRestoreParams object
    36  //
    37  // There are no default values defined in the spec.
    38  func NewPutObjectRestoreParams() PutObjectRestoreParams {
    39  
    40  	return PutObjectRestoreParams{}
    41  }
    42  
    43  // PutObjectRestoreParams contains all the bound params for the put object restore operation
    44  // typically these are obtained from a http.Request
    45  //
    46  // swagger:parameters PutObjectRestore
    47  type PutObjectRestoreParams struct {
    48  
    49  	// HTTP Request Object
    50  	HTTPRequest *http.Request `json:"-"`
    51  
    52  	/*
    53  	  Required: true
    54  	  In: path
    55  	*/
    56  	BucketName string
    57  	/*
    58  	  Required: true
    59  	  In: query
    60  	*/
    61  	Prefix string
    62  	/*
    63  	  Required: true
    64  	  In: query
    65  	*/
    66  	VersionID string
    67  }
    68  
    69  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    70  // for simple values it will use straight method calls.
    71  //
    72  // To ensure default values, the struct must have been initialized with NewPutObjectRestoreParams() beforehand.
    73  func (o *PutObjectRestoreParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    74  	var res []error
    75  
    76  	o.HTTPRequest = r
    77  
    78  	qs := runtime.Values(r.URL.Query())
    79  
    80  	rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
    81  	if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
    82  		res = append(res, err)
    83  	}
    84  
    85  	qPrefix, qhkPrefix, _ := qs.GetOK("prefix")
    86  	if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil {
    87  		res = append(res, err)
    88  	}
    89  
    90  	qVersionID, qhkVersionID, _ := qs.GetOK("version_id")
    91  	if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil {
    92  		res = append(res, err)
    93  	}
    94  	if len(res) > 0 {
    95  		return errors.CompositeValidationError(res...)
    96  	}
    97  	return nil
    98  }
    99  
   100  // bindBucketName binds and validates parameter BucketName from path.
   101  func (o *PutObjectRestoreParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
   102  	var raw string
   103  	if len(rawData) > 0 {
   104  		raw = rawData[len(rawData)-1]
   105  	}
   106  
   107  	// Required: true
   108  	// Parameter is provided by construction from the route
   109  	o.BucketName = raw
   110  
   111  	return nil
   112  }
   113  
   114  // bindPrefix binds and validates parameter Prefix from query.
   115  func (o *PutObjectRestoreParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error {
   116  	if !hasKey {
   117  		return errors.Required("prefix", "query", rawData)
   118  	}
   119  	var raw string
   120  	if len(rawData) > 0 {
   121  		raw = rawData[len(rawData)-1]
   122  	}
   123  
   124  	// Required: true
   125  	// AllowEmptyValue: false
   126  
   127  	if err := validate.RequiredString("prefix", "query", raw); err != nil {
   128  		return err
   129  	}
   130  	o.Prefix = raw
   131  
   132  	return nil
   133  }
   134  
   135  // bindVersionID binds and validates parameter VersionID from query.
   136  func (o *PutObjectRestoreParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error {
   137  	if !hasKey {
   138  		return errors.Required("version_id", "query", rawData)
   139  	}
   140  	var raw string
   141  	if len(rawData) > 0 {
   142  		raw = rawData[len(rawData)-1]
   143  	}
   144  
   145  	// Required: true
   146  	// AllowEmptyValue: false
   147  
   148  	if err := validate.RequiredString("version_id", "query", raw); err != nil {
   149  		return err
   150  	}
   151  	o.VersionID = raw
   152  
   153  	return nil
   154  }