Files
cloud-services/pkg/ota_api/client/operations/get_ecu_stats_parameters.go

347 lines
8.2 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetEcuStatsParams creates a new GetEcuStatsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetEcuStatsParams() *GetEcuStatsParams {
return &GetEcuStatsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetEcuStatsParamsWithTimeout creates a new GetEcuStatsParams object
// with the ability to set a timeout on a request.
func NewGetEcuStatsParamsWithTimeout(timeout time.Duration) *GetEcuStatsParams {
return &GetEcuStatsParams{
timeout: timeout,
}
}
// NewGetEcuStatsParamsWithContext creates a new GetEcuStatsParams object
// with the ability to set a context for a request.
func NewGetEcuStatsParamsWithContext(ctx context.Context) *GetEcuStatsParams {
return &GetEcuStatsParams{
Context: ctx,
}
}
// NewGetEcuStatsParamsWithHTTPClient creates a new GetEcuStatsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetEcuStatsParamsWithHTTPClient(client *http.Client) *GetEcuStatsParams {
return &GetEcuStatsParams{
HTTPClient: client,
}
}
/*
GetEcuStatsParams contains all the parameters to send to the API endpoint
for the get ecu stats operation.
Typically these are written to a http.Request.
*/
type GetEcuStatsParams struct {
/* Dbcs.
DBC hashes
*/
Dbcs []string
/* Ecus.
ECU names
*/
Ecus []string
/* Hours.
Past hours that must be included into the request
*/
Hours int64
/* MinOutOfRangePct.
Minimum out of range percent
*/
MinOutOfRangePct int64
/* MinZeroPct.
Minimum zero values percent
*/
MinZeroPct float64
/* Vins.
Array of VINs
*/
Vins []string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get ecu stats params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetEcuStatsParams) WithDefaults() *GetEcuStatsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get ecu stats params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetEcuStatsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get ecu stats params
func (o *GetEcuStatsParams) WithTimeout(timeout time.Duration) *GetEcuStatsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get ecu stats params
func (o *GetEcuStatsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get ecu stats params
func (o *GetEcuStatsParams) WithContext(ctx context.Context) *GetEcuStatsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get ecu stats params
func (o *GetEcuStatsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get ecu stats params
func (o *GetEcuStatsParams) WithHTTPClient(client *http.Client) *GetEcuStatsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get ecu stats params
func (o *GetEcuStatsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithDbcs adds the dbcs to the get ecu stats params
func (o *GetEcuStatsParams) WithDbcs(dbcs []string) *GetEcuStatsParams {
o.SetDbcs(dbcs)
return o
}
// SetDbcs adds the dbcs to the get ecu stats params
func (o *GetEcuStatsParams) SetDbcs(dbcs []string) {
o.Dbcs = dbcs
}
// WithEcus adds the ecus to the get ecu stats params
func (o *GetEcuStatsParams) WithEcus(ecus []string) *GetEcuStatsParams {
o.SetEcus(ecus)
return o
}
// SetEcus adds the ecus to the get ecu stats params
func (o *GetEcuStatsParams) SetEcus(ecus []string) {
o.Ecus = ecus
}
// WithHours adds the hours to the get ecu stats params
func (o *GetEcuStatsParams) WithHours(hours int64) *GetEcuStatsParams {
o.SetHours(hours)
return o
}
// SetHours adds the hours to the get ecu stats params
func (o *GetEcuStatsParams) SetHours(hours int64) {
o.Hours = hours
}
// WithMinOutOfRangePct adds the minOutOfRangePct to the get ecu stats params
func (o *GetEcuStatsParams) WithMinOutOfRangePct(minOutOfRangePct int64) *GetEcuStatsParams {
o.SetMinOutOfRangePct(minOutOfRangePct)
return o
}
// SetMinOutOfRangePct adds the minOutOfRangePct to the get ecu stats params
func (o *GetEcuStatsParams) SetMinOutOfRangePct(minOutOfRangePct int64) {
o.MinOutOfRangePct = minOutOfRangePct
}
// WithMinZeroPct adds the minZeroPct to the get ecu stats params
func (o *GetEcuStatsParams) WithMinZeroPct(minZeroPct float64) *GetEcuStatsParams {
o.SetMinZeroPct(minZeroPct)
return o
}
// SetMinZeroPct adds the minZeroPct to the get ecu stats params
func (o *GetEcuStatsParams) SetMinZeroPct(minZeroPct float64) {
o.MinZeroPct = minZeroPct
}
// WithVins adds the vins to the get ecu stats params
func (o *GetEcuStatsParams) WithVins(vins []string) *GetEcuStatsParams {
o.SetVins(vins)
return o
}
// SetVins adds the vins to the get ecu stats params
func (o *GetEcuStatsParams) SetVins(vins []string) {
o.Vins = vins
}
// WriteToRequest writes these params to a swagger request
func (o *GetEcuStatsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Dbcs != nil {
// binding items for dbcs
joinedDbcs := o.bindParamDbcs(reg)
// query array param dbcs
if err := r.SetQueryParam("dbcs", joinedDbcs...); err != nil {
return err
}
}
if o.Ecus != nil {
// binding items for ecus
joinedEcus := o.bindParamEcus(reg)
// query array param ecus
if err := r.SetQueryParam("ecus", joinedEcus...); err != nil {
return err
}
}
// query param hours
qrHours := o.Hours
qHours := swag.FormatInt64(qrHours)
if qHours != "" {
if err := r.SetQueryParam("hours", qHours); err != nil {
return err
}
}
// query param min_out_of_range_pct
qrMinOutOfRangePct := o.MinOutOfRangePct
qMinOutOfRangePct := swag.FormatInt64(qrMinOutOfRangePct)
if qMinOutOfRangePct != "" {
if err := r.SetQueryParam("min_out_of_range_pct", qMinOutOfRangePct); err != nil {
return err
}
}
// query param min_zero_pct
qrMinZeroPct := o.MinZeroPct
qMinZeroPct := swag.FormatFloat64(qrMinZeroPct)
if qMinZeroPct != "" {
if err := r.SetQueryParam("min_zero_pct", qMinZeroPct); err != nil {
return err
}
}
if o.Vins != nil {
// binding items for vins
joinedVins := o.bindParamVins(reg)
// query array param vins
if err := r.SetQueryParam("vins", joinedVins...); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindParamGetEcuStats binds the parameter dbcs
func (o *GetEcuStatsParams) bindParamDbcs(formats strfmt.Registry) []string {
dbcsIR := o.Dbcs
var dbcsIC []string
for _, dbcsIIR := range dbcsIR { // explode []string
dbcsIIV := dbcsIIR // string as string
dbcsIC = append(dbcsIC, dbcsIIV)
}
// items.CollectionFormat: ""
dbcsIS := swag.JoinByFormat(dbcsIC, "")
return dbcsIS
}
// bindParamGetEcuStats binds the parameter ecus
func (o *GetEcuStatsParams) bindParamEcus(formats strfmt.Registry) []string {
ecusIR := o.Ecus
var ecusIC []string
for _, ecusIIR := range ecusIR { // explode []string
ecusIIV := ecusIIR // string as string
ecusIC = append(ecusIC, ecusIIV)
}
// items.CollectionFormat: ""
ecusIS := swag.JoinByFormat(ecusIC, "")
return ecusIS
}
// bindParamGetEcuStats binds the parameter vins
func (o *GetEcuStatsParams) bindParamVins(formats strfmt.Registry) []string {
vinsIR := o.Vins
var vinsIC []string
for _, vinsIIR := range vinsIR { // explode []string
vinsIIV := vinsIIR // string as string
vinsIC = append(vinsIC, vinsIIV)
}
// items.CollectionFormat: ""
vinsIS := swag.JoinByFormat(vinsIC, "")
return vinsIS
}