// Code generated by go-swagger; DO NOT EDIT. package metrics // 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" ) // NewGetEnvironmentMetricsParams creates a new GetEnvironmentMetricsParams 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 NewGetEnvironmentMetricsParams() *GetEnvironmentMetricsParams { return &GetEnvironmentMetricsParams{ timeout: cr.DefaultTimeout, } } // NewGetEnvironmentMetricsParamsWithTimeout creates a new GetEnvironmentMetricsParams object // with the ability to set a timeout on a request. func NewGetEnvironmentMetricsParamsWithTimeout(timeout time.Duration) *GetEnvironmentMetricsParams { return &GetEnvironmentMetricsParams{ timeout: timeout, } } // NewGetEnvironmentMetricsParamsWithContext creates a new GetEnvironmentMetricsParams object // with the ability to set a context for a request. func NewGetEnvironmentMetricsParamsWithContext(ctx context.Context) *GetEnvironmentMetricsParams { return &GetEnvironmentMetricsParams{ Context: ctx, } } // NewGetEnvironmentMetricsParamsWithHTTPClient creates a new GetEnvironmentMetricsParams object // with the ability to set a custom HTTPClient for a request. func NewGetEnvironmentMetricsParamsWithHTTPClient(client *http.Client) *GetEnvironmentMetricsParams { return &GetEnvironmentMetricsParams{ HTTPClient: client, } } /* GetEnvironmentMetricsParams contains all the parameters to send to the API endpoint for the get environment metrics operation. Typically these are written to a http.Request. */ type GetEnvironmentMetricsParams struct { // Duration. Duration *float64 // EnvID. EnvID string timeout time.Duration Context context.Context HTTPClient *http.Client } // WithDefaults hydrates default values in the get environment metrics params (not the query body). // // All values with no default are reset to their zero value. func (o *GetEnvironmentMetricsParams) WithDefaults() *GetEnvironmentMetricsParams { o.SetDefaults() return o } // SetDefaults hydrates default values in the get environment metrics params (not the query body). // // All values with no default are reset to their zero value. func (o *GetEnvironmentMetricsParams) SetDefaults() { // no default values defined for this parameter } // WithTimeout adds the timeout to the get environment metrics params func (o *GetEnvironmentMetricsParams) WithTimeout(timeout time.Duration) *GetEnvironmentMetricsParams { o.SetTimeout(timeout) return o } // SetTimeout adds the timeout to the get environment metrics params func (o *GetEnvironmentMetricsParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } // WithContext adds the context to the get environment metrics params func (o *GetEnvironmentMetricsParams) WithContext(ctx context.Context) *GetEnvironmentMetricsParams { o.SetContext(ctx) return o } // SetContext adds the context to the get environment metrics params func (o *GetEnvironmentMetricsParams) SetContext(ctx context.Context) { o.Context = ctx } // WithHTTPClient adds the HTTPClient to the get environment metrics params func (o *GetEnvironmentMetricsParams) WithHTTPClient(client *http.Client) *GetEnvironmentMetricsParams { o.SetHTTPClient(client) return o } // SetHTTPClient adds the HTTPClient to the get environment metrics params func (o *GetEnvironmentMetricsParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } // WithDuration adds the duration to the get environment metrics params func (o *GetEnvironmentMetricsParams) WithDuration(duration *float64) *GetEnvironmentMetricsParams { o.SetDuration(duration) return o } // SetDuration adds the duration to the get environment metrics params func (o *GetEnvironmentMetricsParams) SetDuration(duration *float64) { o.Duration = duration } // WithEnvID adds the envID to the get environment metrics params func (o *GetEnvironmentMetricsParams) WithEnvID(envID string) *GetEnvironmentMetricsParams { o.SetEnvID(envID) return o } // SetEnvID adds the envId to the get environment metrics params func (o *GetEnvironmentMetricsParams) SetEnvID(envID string) { o.EnvID = envID } // WriteToRequest writes these params to a swagger request func (o *GetEnvironmentMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error if o.Duration != nil { // query param duration var qrDuration float64 if o.Duration != nil { qrDuration = *o.Duration } qDuration := swag.FormatFloat64(qrDuration) if qDuration != "" { if err := r.SetQueryParam("duration", qDuration); err != nil { return err } } } // path param envId if err := r.SetPathParam("envId", o.EnvID); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }