github.com/minio/console@v1.4.1/api/operations/system/admin_info_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 system
    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/swag"
    33  )
    34  
    35  // NewAdminInfoParams creates a new AdminInfoParams object
    36  // with the default values initialized.
    37  func NewAdminInfoParams() AdminInfoParams {
    38  
    39  	var (
    40  		// initialize parameters with default values
    41  
    42  		defaultOnlyDefault = bool(false)
    43  	)
    44  
    45  	return AdminInfoParams{
    46  		DefaultOnly: &defaultOnlyDefault,
    47  	}
    48  }
    49  
    50  // AdminInfoParams contains all the bound params for the admin info operation
    51  // typically these are obtained from a http.Request
    52  //
    53  // swagger:parameters AdminInfo
    54  type AdminInfoParams struct {
    55  
    56  	// HTTP Request Object
    57  	HTTPRequest *http.Request `json:"-"`
    58  
    59  	/*
    60  	  In: query
    61  	  Default: false
    62  	*/
    63  	DefaultOnly *bool
    64  }
    65  
    66  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    67  // for simple values it will use straight method calls.
    68  //
    69  // To ensure default values, the struct must have been initialized with NewAdminInfoParams() beforehand.
    70  func (o *AdminInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    71  	var res []error
    72  
    73  	o.HTTPRequest = r
    74  
    75  	qs := runtime.Values(r.URL.Query())
    76  
    77  	qDefaultOnly, qhkDefaultOnly, _ := qs.GetOK("defaultOnly")
    78  	if err := o.bindDefaultOnly(qDefaultOnly, qhkDefaultOnly, route.Formats); err != nil {
    79  		res = append(res, err)
    80  	}
    81  	if len(res) > 0 {
    82  		return errors.CompositeValidationError(res...)
    83  	}
    84  	return nil
    85  }
    86  
    87  // bindDefaultOnly binds and validates parameter DefaultOnly from query.
    88  func (o *AdminInfoParams) bindDefaultOnly(rawData []string, hasKey bool, formats strfmt.Registry) error {
    89  	var raw string
    90  	if len(rawData) > 0 {
    91  		raw = rawData[len(rawData)-1]
    92  	}
    93  
    94  	// Required: false
    95  	// AllowEmptyValue: false
    96  
    97  	if raw == "" { // empty values pass all other validations
    98  		// Default values have been previously initialized by NewAdminInfoParams()
    99  		return nil
   100  	}
   101  
   102  	value, err := swag.ConvertBool(raw)
   103  	if err != nil {
   104  		return errors.InvalidType("defaultOnly", "query", "bool", raw)
   105  	}
   106  	o.DefaultOnly = &value
   107  
   108  	return nil
   109  }