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.
 
 

187 lines
4.4 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"
)
// Event event
//
// swagger:model Event
type Event struct {
// 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"`
// 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 event
func (m *Event) 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 eventTypeEventTypePropEnum []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 {
eventTypeEventTypePropEnum = append(eventTypeEventTypePropEnum, v)
}
}
const (
// EventEventTypeAuthorizedIncrease captures enum value "AuthorizedIncrease"
EventEventTypeAuthorizedIncrease string = "AuthorizedIncrease"
// EventEventTypeAuthorizedDecrease captures enum value "AuthorizedDecrease"
EventEventTypeAuthorizedDecrease string = "AuthorizedDecrease"
// EventEventTypeConsumption captures enum value "Consumption"
EventEventTypeConsumption string = "Consumption"
// EventEventTypeAutomaticCreditExpiry captures enum value "AutomaticCreditExpiry"
EventEventTypeAutomaticCreditExpiry string = "AutomaticCreditExpiry"
// EventEventTypeRefund captures enum value "Refund"
EventEventTypeRefund string = "Refund"
)
// prop value enum
func (m *Event) validateEventTypeEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, eventTypeEventTypePropEnum, true); err != nil {
return err
}
return nil
}
func (m *Event) 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 eventTypeMediumPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["CREDIT","CASH"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
eventTypeMediumPropEnum = append(eventTypeMediumPropEnum, v)
}
}
const (
// EventMediumCREDIT captures enum value "CREDIT"
EventMediumCREDIT string = "CREDIT"
// EventMediumCASH captures enum value "CASH"
EventMediumCASH string = "CASH"
)
// prop value enum
func (m *Event) validateMediumEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, eventTypeMediumPropEnum, true); err != nil {
return err
}
return nil
}
func (m *Event) 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 *Event) 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 *Event) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Event) UnmarshalBinary(b []byte) error {
var res Event
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}