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/models/credit_events.go

194 lines
4.7 KiB

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CreditEvents credit events
//
// swagger:model CreditEvents
type CreditEvents struct {
// account Id
AccountID string `json:"AccountId,omitempty" gorm:"index"`
// authorized by
AuthorizedBy string `json:"AuthorizedBy,omitempty"`
// delta
Delta float64 `json:"Delta,omitempty" gorm:"type:numeric(23,13);default:0.0"`
// event type
// Enum: [AuthorizedIncrease AuthorizedDecrease Consumption AutomaticCreditExpiry Refund]
EventType *string `json:"EventType,omitempty" gorm:"index;default:Consumption"`
// ID
ID int64 `json:"ID,omitempty" gorm:"primary_key"`
// medium
// Enum: [CREDIT CASH]
Medium *string `json:"Medium,omitempty" gorm:"index;default:CREDIT"`
// timestamp
// Format: datetime
Timestamp strfmt.DateTime `json:"Timestamp,omitempty" gorm:"type:timestamptz"`
}
// Validate validates this credit events
func (m *CreditEvents) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEventType(formats); err != nil {
res = append(res, err)
}
if err := m.validateMedium(formats); err != nil {
res = append(res, err)
}
if err := m.validateTimestamp(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var creditEventsTypeEventTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["AuthorizedIncrease","AuthorizedDecrease","Consumption","AutomaticCreditExpiry","Refund"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
creditEventsTypeEventTypePropEnum = append(creditEventsTypeEventTypePropEnum, v)
}
}
const (
// CreditEventsEventTypeAuthorizedIncrease captures enum value "AuthorizedIncrease"
CreditEventsEventTypeAuthorizedIncrease string = "AuthorizedIncrease"
// CreditEventsEventTypeAuthorizedDecrease captures enum value "AuthorizedDecrease"
CreditEventsEventTypeAuthorizedDecrease string = "AuthorizedDecrease"
// CreditEventsEventTypeConsumption captures enum value "Consumption"
CreditEventsEventTypeConsumption string = "Consumption"
// CreditEventsEventTypeAutomaticCreditExpiry captures enum value "AutomaticCreditExpiry"
CreditEventsEventTypeAutomaticCreditExpiry string = "AutomaticCreditExpiry"
// CreditEventsEventTypeRefund captures enum value "Refund"
CreditEventsEventTypeRefund string = "Refund"
)
// prop value enum
func (m *CreditEvents) validateEventTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, creditEventsTypeEventTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *CreditEvents) validateEventType(formats strfmt.Registry) error {
if swag.IsZero(m.EventType) { // not required
return nil
}
// value enum
if err := m.validateEventTypeEnum("EventType", "body", *m.EventType); err != nil {
return err
}
return nil
}
var creditEventsTypeMediumPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["CREDIT","CASH"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
creditEventsTypeMediumPropEnum = append(creditEventsTypeMediumPropEnum, v)
}
}
const (
// CreditEventsMediumCREDIT captures enum value "CREDIT"
CreditEventsMediumCREDIT string = "CREDIT"
// CreditEventsMediumCASH captures enum value "CASH"
CreditEventsMediumCASH string = "CASH"
)
// prop value enum
func (m *CreditEvents) validateMediumEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, creditEventsTypeMediumPropEnum, true); err != nil {
return err
}
return nil
}
func (m *CreditEvents) validateMedium(formats strfmt.Registry) error {
if swag.IsZero(m.Medium) { // not required
return nil
}
// value enum
if err := m.validateMediumEnum("Medium", "body", *m.Medium); err != nil {
return err
}
return nil
}
func (m *CreditEvents) validateTimestamp(formats strfmt.Registry) error {
if swag.IsZero(m.Timestamp) { // not required
return nil
}
if err := validate.FormatOf("Timestamp", "body", "datetime", m.Timestamp.String(), formats); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *CreditEvents) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CreditEvents) UnmarshalBinary(b []byte) error {
var res CreditEvents
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}