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/restapi/operations/credit_management/increase_credit_parameters.go

151 lines
3.7 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 (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// NewIncreaseCreditParams creates a new IncreaseCreditParams object
// no default values defined in spec.
func NewIncreaseCreditParams() IncreaseCreditParams {
return IncreaseCreditParams{}
}
// IncreaseCreditParams contains all the bound params for the increase credit operation
// typically these are obtained from a http.Request
//
// swagger:parameters increaseCredit
type IncreaseCreditParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*Amount to be inccreased
Required: true
In: query
*/
Amount float64
/*Id of the account to be checked
Required: true
In: path
*/
ID string
/*Medium (cash/credit) to be used in the accounting
Required: true
In: path
*/
Medium string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewIncreaseCreditParams() beforehand.
func (o *IncreaseCreditParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
qAmount, qhkAmount, _ := qs.GetOK("amount")
if err := o.bindAmount(qAmount, qhkAmount, route.Formats); err != nil {
res = append(res, err)
}
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rMedium, rhkMedium, _ := route.Params.GetOK("medium")
if err := o.bindMedium(rMedium, rhkMedium, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindAmount binds and validates parameter Amount from query.
func (o *IncreaseCreditParams) bindAmount(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("amount", "query", rawData)
}
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// AllowEmptyValue: false
if err := validate.RequiredString("amount", "query", raw); err != nil {
return err
}
value, err := swag.ConvertFloat64(raw)
if err != nil {
return errors.InvalidType("amount", "query", "float64", raw)
}
o.Amount = value
return nil
}
// bindID binds and validates parameter ID from path.
func (o *IncreaseCreditParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.ID = raw
return nil
}
// bindMedium binds and validates parameter Medium from path.
func (o *IncreaseCreditParams) bindMedium(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Medium = raw
if err := o.validateMedium(formats); err != nil {
return err
}
return nil
}
// validateMedium carries on validations for parameter Medium
func (o *IncreaseCreditParams) validateMedium(formats strfmt.Registry) error {
if err := validate.EnumCase("medium", "path", o.Medium, []interface{}{"credit", "cash"}, true); err != nil {
return err
}
return nil
}