github.com/minio/console@v1.4.1/api/operations/system/dashboard_widget_details_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  // NewDashboardWidgetDetailsParams creates a new DashboardWidgetDetailsParams object
    36  //
    37  // There are no default values defined in the spec.
    38  func NewDashboardWidgetDetailsParams() DashboardWidgetDetailsParams {
    39  
    40  	return DashboardWidgetDetailsParams{}
    41  }
    42  
    43  // DashboardWidgetDetailsParams contains all the bound params for the dashboard widget details operation
    44  // typically these are obtained from a http.Request
    45  //
    46  // swagger:parameters DashboardWidgetDetails
    47  type DashboardWidgetDetailsParams struct {
    48  
    49  	// HTTP Request Object
    50  	HTTPRequest *http.Request `json:"-"`
    51  
    52  	/*
    53  	  In: query
    54  	*/
    55  	End *int64
    56  	/*
    57  	  In: query
    58  	*/
    59  	Start *int64
    60  	/*
    61  	  In: query
    62  	*/
    63  	Step *int32
    64  	/*
    65  	  Required: true
    66  	  In: path
    67  	*/
    68  	WidgetID int32
    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 NewDashboardWidgetDetailsParams() beforehand.
    75  func (o *DashboardWidgetDetailsParams) 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  	qEnd, qhkEnd, _ := qs.GetOK("end")
    83  	if err := o.bindEnd(qEnd, qhkEnd, route.Formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	qStart, qhkStart, _ := qs.GetOK("start")
    88  	if err := o.bindStart(qStart, qhkStart, route.Formats); err != nil {
    89  		res = append(res, err)
    90  	}
    91  
    92  	qStep, qhkStep, _ := qs.GetOK("step")
    93  	if err := o.bindStep(qStep, qhkStep, route.Formats); err != nil {
    94  		res = append(res, err)
    95  	}
    96  
    97  	rWidgetID, rhkWidgetID, _ := route.Params.GetOK("widgetId")
    98  	if err := o.bindWidgetID(rWidgetID, rhkWidgetID, 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  // bindEnd binds and validates parameter End from query.
   108  func (o *DashboardWidgetDetailsParams) bindEnd(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  
   121  	value, err := swag.ConvertInt64(raw)
   122  	if err != nil {
   123  		return errors.InvalidType("end", "query", "int64", raw)
   124  	}
   125  	o.End = &value
   126  
   127  	return nil
   128  }
   129  
   130  // bindStart binds and validates parameter Start from query.
   131  func (o *DashboardWidgetDetailsParams) bindStart(rawData []string, hasKey bool, formats strfmt.Registry) error {
   132  	var raw string
   133  	if len(rawData) > 0 {
   134  		raw = rawData[len(rawData)-1]
   135  	}
   136  
   137  	// Required: false
   138  	// AllowEmptyValue: false
   139  
   140  	if raw == "" { // empty values pass all other validations
   141  		return nil
   142  	}
   143  
   144  	value, err := swag.ConvertInt64(raw)
   145  	if err != nil {
   146  		return errors.InvalidType("start", "query", "int64", raw)
   147  	}
   148  	o.Start = &value
   149  
   150  	return nil
   151  }
   152  
   153  // bindStep binds and validates parameter Step from query.
   154  func (o *DashboardWidgetDetailsParams) bindStep(rawData []string, hasKey bool, formats strfmt.Registry) error {
   155  	var raw string
   156  	if len(rawData) > 0 {
   157  		raw = rawData[len(rawData)-1]
   158  	}
   159  
   160  	// Required: false
   161  	// AllowEmptyValue: false
   162  
   163  	if raw == "" { // empty values pass all other validations
   164  		return nil
   165  	}
   166  
   167  	value, err := swag.ConvertInt32(raw)
   168  	if err != nil {
   169  		return errors.InvalidType("step", "query", "int32", raw)
   170  	}
   171  	o.Step = &value
   172  
   173  	return nil
   174  }
   175  
   176  // bindWidgetID binds and validates parameter WidgetID from path.
   177  func (o *DashboardWidgetDetailsParams) bindWidgetID(rawData []string, hasKey bool, formats strfmt.Registry) error {
   178  	var raw string
   179  	if len(rawData) > 0 {
   180  		raw = rawData[len(rawData)-1]
   181  	}
   182  
   183  	// Required: true
   184  	// Parameter is provided by construction from the route
   185  
   186  	value, err := swag.ConvertInt32(raw)
   187  	if err != nil {
   188  		return errors.InvalidType("widgetId", "path", "int32", raw)
   189  	}
   190  	o.WidgetID = value
   191  
   192  	return nil
   193  }