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