Cyclops 4 HPC is the purpose built stack to support large HPC centers with resource accounting and billing of cluster as well as cloud resources.
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.
cyclops-4-hpc/services/credit-system/client/credit_management/add_consumption_parameters.go

183 lines
4.6 KiB

// Code generated by go-swagger; DO NOT EDIT.
package credit_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"
)
// NewAddConsumptionParams creates a new AddConsumptionParams object
// with the default values initialized.
func NewAddConsumptionParams() *AddConsumptionParams {
var ()
return &AddConsumptionParams{
timeout: cr.DefaultTimeout,
}
}
// NewAddConsumptionParamsWithTimeout creates a new AddConsumptionParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewAddConsumptionParamsWithTimeout(timeout time.Duration) *AddConsumptionParams {
var ()
return &AddConsumptionParams{
timeout: timeout,
}
}
// NewAddConsumptionParamsWithContext creates a new AddConsumptionParams object
// with the default values initialized, and the ability to set a context for a request
func NewAddConsumptionParamsWithContext(ctx context.Context) *AddConsumptionParams {
var ()
return &AddConsumptionParams{
Context: ctx,
}
}
// NewAddConsumptionParamsWithHTTPClient creates a new AddConsumptionParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewAddConsumptionParamsWithHTTPClient(client *http.Client) *AddConsumptionParams {
var ()
return &AddConsumptionParams{
HTTPClient: client,
}
}
/*AddConsumptionParams contains all the parameters to send to the API endpoint
for the add consumption operation typically these are written to a http.Request
*/
type AddConsumptionParams struct {
/*Amount
Amount to be decreased
*/
Amount float64
/*ID
Id of the account to be checked
*/
ID string
/*Medium
Medium (cash/credit) to be used in the accounting
*/
Medium string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the add consumption params
func (o *AddConsumptionParams) WithTimeout(timeout time.Duration) *AddConsumptionParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the add consumption params
func (o *AddConsumptionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the add consumption params
func (o *AddConsumptionParams) WithContext(ctx context.Context) *AddConsumptionParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the add consumption params
func (o *AddConsumptionParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the add consumption params
func (o *AddConsumptionParams) WithHTTPClient(client *http.Client) *AddConsumptionParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the add consumption params
func (o *AddConsumptionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAmount adds the amount to the add consumption params
func (o *AddConsumptionParams) WithAmount(amount float64) *AddConsumptionParams {
o.SetAmount(amount)
return o
}
// SetAmount adds the amount to the add consumption params
func (o *AddConsumptionParams) SetAmount(amount float64) {
o.Amount = amount
}
// WithID adds the id to the add consumption params
func (o *AddConsumptionParams) WithID(id string) *AddConsumptionParams {
o.SetID(id)
return o
}
// SetID adds the id to the add consumption params
func (o *AddConsumptionParams) SetID(id string) {
o.ID = id
}
// WithMedium adds the medium to the add consumption params
func (o *AddConsumptionParams) WithMedium(medium string) *AddConsumptionParams {
o.SetMedium(medium)
return o
}
// SetMedium adds the medium to the add consumption params
func (o *AddConsumptionParams) SetMedium(medium string) {
o.Medium = medium
}
// WriteToRequest writes these params to a swagger request
func (o *AddConsumptionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param amount
qrAmount := o.Amount
qAmount := swag.FormatFloat64(qrAmount)
if qAmount != "" {
if err := r.SetQueryParam("amount", qAmount); err != nil {
return err
}
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
// path param medium
if err := r.SetPathParam("medium", o.Medium); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}