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.

156 lines
3.5 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"
"gitlab.com/cyclops-utilities/datamodels"
)
// Event event
//
// swagger:model Event
type Event struct {
// account
Account string `json:"Account,omitempty" gorm:"index"`
// event time
// Required: true
EventTime *int64 `json:"EventTime"`
// ID
ID int64 `json:"ID,omitempty" gorm:"primary_key;auto_increment"`
// last event
// Required: true
// Enum: [active error inactive terminated suspended]
LastEvent *string `json:"LastEvent"`
// meta data
MetaData datamodels.JSONdb `json:"MetaData,omitempty" gorm:"type:jsonb"`
// region
Region string `json:"Region,omitempty"`
// resource Id
ResourceID string `json:"ResourceId,omitempty"`
// resource name
ResourceName string `json:"ResourceName,omitempty"`
// resource type
ResourceType string `json:"ResourceType,omitempty"`
// time from
TimeFrom int64 `json:"TimeFrom,omitempty" gorm:"index"`
// time to
TimeTo int64 `json:"TimeTo,omitempty" gorm:"index"`
}
// Validate validates this event
func (m *Event) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEventTime(formats); err != nil {
res = append(res, err)
}
if err := m.validateLastEvent(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Event) validateEventTime(formats strfmt.Registry) error {
if err := validate.Required("EventTime", "body", m.EventTime); err != nil {
return err
}
return nil
}
var eventTypeLastEventPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["active","error","inactive","terminated","suspended"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
eventTypeLastEventPropEnum = append(eventTypeLastEventPropEnum, v)
}
}
const (
// EventLastEventActive captures enum value "active"
EventLastEventActive string = "active"
// EventLastEventError captures enum value "error"
EventLastEventError string = "error"
// EventLastEventInactive captures enum value "inactive"
EventLastEventInactive string = "inactive"
// EventLastEventTerminated captures enum value "terminated"
EventLastEventTerminated string = "terminated"
// EventLastEventSuspended captures enum value "suspended"
EventLastEventSuspended string = "suspended"
)
// prop value enum
func (m *Event) validateLastEventEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, eventTypeLastEventPropEnum, true); err != nil {
return err
}
return nil
}
func (m *Event) validateLastEvent(formats strfmt.Registry) error {
if err := validate.Required("LastEvent", "body", m.LastEvent); err != nil {
return err
}
// value enum
if err := m.validateLastEventEnum("LastEvent", "body", *m.LastEvent); 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
}