github.com/minio/console@v1.4.1/api/operations/release/list_releases_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 release
    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  // NewListReleasesParams creates a new ListReleasesParams object
    36  //
    37  // There are no default values defined in the spec.
    38  func NewListReleasesParams() ListReleasesParams {
    39  
    40  	return ListReleasesParams{}
    41  }
    42  
    43  // ListReleasesParams contains all the bound params for the list releases operation
    44  // typically these are obtained from a http.Request
    45  //
    46  // swagger:parameters ListReleases
    47  type ListReleasesParams struct {
    48  
    49  	// HTTP Request Object
    50  	HTTPRequest *http.Request `json:"-"`
    51  
    52  	/*Current Release
    53  	  In: query
    54  	*/
    55  	Current *string
    56  	/*filter releases
    57  	  In: query
    58  	*/
    59  	Filter *string
    60  	/*repo name
    61  	  Required: true
    62  	  In: query
    63  	*/
    64  	Repo string
    65  	/*search content
    66  	  In: query
    67  	*/
    68  	Search *string
    69  }
    70  
    71  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    72  // for simple values it will use straight method calls.
    73  //
    74  // To ensure default values, the struct must have been initialized with NewListReleasesParams() beforehand.
    75  func (o *ListReleasesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    76  	var res []error
    77  
    78  	o.HTTPRequest = r
    79  
    80  	qs := runtime.Values(r.URL.Query())
    81  
    82  	qCurrent, qhkCurrent, _ := qs.GetOK("current")
    83  	if err := o.bindCurrent(qCurrent, qhkCurrent, route.Formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	qFilter, qhkFilter, _ := qs.GetOK("filter")
    88  	if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil {
    89  		res = append(res, err)
    90  	}
    91  
    92  	qRepo, qhkRepo, _ := qs.GetOK("repo")
    93  	if err := o.bindRepo(qRepo, qhkRepo, route.Formats); err != nil {
    94  		res = append(res, err)
    95  	}
    96  
    97  	qSearch, qhkSearch, _ := qs.GetOK("search")
    98  	if err := o.bindSearch(qSearch, qhkSearch, route.Formats); err != nil {
    99  		res = append(res, err)
   100  	}
   101  	if len(res) > 0 {
   102  		return errors.CompositeValidationError(res...)
   103  	}
   104  	return nil
   105  }
   106  
   107  // bindCurrent binds and validates parameter Current from query.
   108  func (o *ListReleasesParams) bindCurrent(rawData []string, hasKey bool, formats strfmt.Registry) error {
   109  	var raw string
   110  	if len(rawData) > 0 {
   111  		raw = rawData[len(rawData)-1]
   112  	}
   113  
   114  	// Required: false
   115  	// AllowEmptyValue: false
   116  
   117  	if raw == "" { // empty values pass all other validations
   118  		return nil
   119  	}
   120  	o.Current = &raw
   121  
   122  	return nil
   123  }
   124  
   125  // bindFilter binds and validates parameter Filter from query.
   126  func (o *ListReleasesParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error {
   127  	var raw string
   128  	if len(rawData) > 0 {
   129  		raw = rawData[len(rawData)-1]
   130  	}
   131  
   132  	// Required: false
   133  	// AllowEmptyValue: false
   134  
   135  	if raw == "" { // empty values pass all other validations
   136  		return nil
   137  	}
   138  	o.Filter = &raw
   139  
   140  	return nil
   141  }
   142  
   143  // bindRepo binds and validates parameter Repo from query.
   144  func (o *ListReleasesParams) bindRepo(rawData []string, hasKey bool, formats strfmt.Registry) error {
   145  	if !hasKey {
   146  		return errors.Required("repo", "query", rawData)
   147  	}
   148  	var raw string
   149  	if len(rawData) > 0 {
   150  		raw = rawData[len(rawData)-1]
   151  	}
   152  
   153  	// Required: true
   154  	// AllowEmptyValue: false
   155  
   156  	if err := validate.RequiredString("repo", "query", raw); err != nil {
   157  		return err
   158  	}
   159  	o.Repo = raw
   160  
   161  	return nil
   162  }
   163  
   164  // bindSearch binds and validates parameter Search from query.
   165  func (o *ListReleasesParams) bindSearch(rawData []string, hasKey bool, formats strfmt.Registry) error {
   166  	var raw string
   167  	if len(rawData) > 0 {
   168  		raw = rawData[len(rawData)-1]
   169  	}
   170  
   171  	// Required: false
   172  	// AllowEmptyValue: false
   173  
   174  	if raw == "" { // empty values pass all other validations
   175  		return nil
   176  	}
   177  	o.Search = &raw
   178  
   179  	return nil
   180  }