You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
265 lines
5.7 KiB
265 lines
5.7 KiB
3 years ago
|
// Code generated by go-swagger; DO NOT EDIT.
|
||
|
|
||
|
package usage_management
|
||
|
|
||
|
// 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"
|
||
|
)
|
||
|
|
||
|
// NewGetUsageParams creates a new GetUsageParams object
|
||
|
// with the default values initialized.
|
||
|
func NewGetUsageParams() *GetUsageParams {
|
||
|
var ()
|
||
|
return &GetUsageParams{
|
||
|
|
||
|
timeout: cr.DefaultTimeout,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// NewGetUsageParamsWithTimeout creates a new GetUsageParams object
|
||
|
// with the default values initialized, and the ability to set a timeout on a request
|
||
|
func NewGetUsageParamsWithTimeout(timeout time.Duration) *GetUsageParams {
|
||
|
var ()
|
||
|
return &GetUsageParams{
|
||
|
|
||
|
timeout: timeout,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// NewGetUsageParamsWithContext creates a new GetUsageParams object
|
||
|
// with the default values initialized, and the ability to set a context for a request
|
||
|
func NewGetUsageParamsWithContext(ctx context.Context) *GetUsageParams {
|
||
|
var ()
|
||
|
return &GetUsageParams{
|
||
|
|
||
|
Context: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// NewGetUsageParamsWithHTTPClient creates a new GetUsageParams object
|
||
|
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||
|
func NewGetUsageParamsWithHTTPClient(client *http.Client) *GetUsageParams {
|
||
|
var ()
|
||
|
return &GetUsageParams{
|
||
|
HTTPClient: client,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*GetUsageParams contains all the parameters to send to the API endpoint
|
||
|
for the get usage operation typically these are written to a http.Request
|
||
|
*/
|
||
|
type GetUsageParams struct {
|
||
|
|
||
|
/*From
|
||
|
Datetime from which to get the usage report
|
||
|
|
||
|
*/
|
||
|
From *int64
|
||
|
/*ID
|
||
|
Id of the account to be checked
|
||
|
|
||
|
*/
|
||
|
ID string
|
||
|
/*Region
|
||
|
Resource region to filter the usage
|
||
|
|
||
|
*/
|
||
|
Region *string
|
||
|
/*Resource
|
||
|
Resource type to filter the usage
|
||
|
|
||
|
*/
|
||
|
Resource *string
|
||
|
/*To
|
||
|
Datetime until which to get the usage report
|
||
|
|
||
|
*/
|
||
|
To *int64
|
||
|
|
||
|
timeout time.Duration
|
||
|
Context context.Context
|
||
|
HTTPClient *http.Client
|
||
|
}
|
||
|
|
||
|
// WithTimeout adds the timeout to the get usage params
|
||
|
func (o *GetUsageParams) WithTimeout(timeout time.Duration) *GetUsageParams {
|
||
|
o.SetTimeout(timeout)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetTimeout adds the timeout to the get usage params
|
||
|
func (o *GetUsageParams) SetTimeout(timeout time.Duration) {
|
||
|
o.timeout = timeout
|
||
|
}
|
||
|
|
||
|
// WithContext adds the context to the get usage params
|
||
|
func (o *GetUsageParams) WithContext(ctx context.Context) *GetUsageParams {
|
||
|
o.SetContext(ctx)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetContext adds the context to the get usage params
|
||
|
func (o *GetUsageParams) SetContext(ctx context.Context) {
|
||
|
o.Context = ctx
|
||
|
}
|
||
|
|
||
|
// WithHTTPClient adds the HTTPClient to the get usage params
|
||
|
func (o *GetUsageParams) WithHTTPClient(client *http.Client) *GetUsageParams {
|
||
|
o.SetHTTPClient(client)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetHTTPClient adds the HTTPClient to the get usage params
|
||
|
func (o *GetUsageParams) SetHTTPClient(client *http.Client) {
|
||
|
o.HTTPClient = client
|
||
|
}
|
||
|
|
||
|
// WithFrom adds the from to the get usage params
|
||
|
func (o *GetUsageParams) WithFrom(from *int64) *GetUsageParams {
|
||
|
o.SetFrom(from)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetFrom adds the from to the get usage params
|
||
|
func (o *GetUsageParams) SetFrom(from *int64) {
|
||
|
o.From = from
|
||
|
}
|
||
|
|
||
|
// WithID adds the id to the get usage params
|
||
|
func (o *GetUsageParams) WithID(id string) *GetUsageParams {
|
||
|
o.SetID(id)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetID adds the id to the get usage params
|
||
|
func (o *GetUsageParams) SetID(id string) {
|
||
|
o.ID = id
|
||
|
}
|
||
|
|
||
|
// WithRegion adds the region to the get usage params
|
||
|
func (o *GetUsageParams) WithRegion(region *string) *GetUsageParams {
|
||
|
o.SetRegion(region)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetRegion adds the region to the get usage params
|
||
|
func (o *GetUsageParams) SetRegion(region *string) {
|
||
|
o.Region = region
|
||
|
}
|
||
|
|
||
|
// WithResource adds the resource to the get usage params
|
||
|
func (o *GetUsageParams) WithResource(resource *string) *GetUsageParams {
|
||
|
o.SetResource(resource)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetResource adds the resource to the get usage params
|
||
|
func (o *GetUsageParams) SetResource(resource *string) {
|
||
|
o.Resource = resource
|
||
|
}
|
||
|
|
||
|
// WithTo adds the to to the get usage params
|
||
|
func (o *GetUsageParams) WithTo(to *int64) *GetUsageParams {
|
||
|
o.SetTo(to)
|
||
|
return o
|
||
|
}
|
||
|
|
||
|
// SetTo adds the to to the get usage params
|
||
|
func (o *GetUsageParams) SetTo(to *int64) {
|
||
|
o.To = to
|
||
|
}
|
||
|
|
||
|
// WriteToRequest writes these params to a swagger request
|
||
|
func (o *GetUsageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||
|
|
||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
var res []error
|
||
|
|
||
|
if o.From != nil {
|
||
|
|
||
|
// query param from
|
||
|
var qrFrom int64
|
||
|
if o.From != nil {
|
||
|
qrFrom = *o.From
|
||
|
}
|
||
|
qFrom := swag.FormatInt64(qrFrom)
|
||
|
if qFrom != "" {
|
||
|
if err := r.SetQueryParam("from", qFrom); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// path param id
|
||
|
if err := r.SetPathParam("id", o.ID); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
if o.Region != nil {
|
||
|
|
||
|
// query param region
|
||
|
var qrRegion string
|
||
|
if o.Region != nil {
|
||
|
qrRegion = *o.Region
|
||
|
}
|
||
|
qRegion := qrRegion
|
||
|
if qRegion != "" {
|
||
|
if err := r.SetQueryParam("region", qRegion); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
if o.Resource != nil {
|
||
|
|
||
|
// query param resource
|
||
|
var qrResource string
|
||
|
if o.Resource != nil {
|
||
|
qrResource = *o.Resource
|
||
|
}
|
||
|
qResource := qrResource
|
||
|
if qResource != "" {
|
||
|
if err := r.SetQueryParam("resource", qResource); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
if o.To != nil {
|
||
|
|
||
|
// query param to
|
||
|
var qrTo int64
|
||
|
if o.To != nil {
|
||
|
qrTo = *o.To
|
||
|
}
|
||
|
qTo := swag.FormatInt64(qrTo)
|
||
|
if qTo != "" {
|
||
|
if err := r.SetQueryParam("to", qTo); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
if len(res) > 0 {
|
||
|
return errors.CompositeValidationError(res...)
|
||
|
}
|
||
|
return nil
|
||
|
}
|