// 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" ) // State state // // swagger:model State type State 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 state func (m *State) 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 *State) validateEventTime(formats strfmt.Registry) error { if err := validate.Required("EventTime", "body", m.EventTime); err != nil { return err } return nil } var stateTypeLastEventPropEnum []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 { stateTypeLastEventPropEnum = append(stateTypeLastEventPropEnum, v) } } const ( // StateLastEventActive captures enum value "active" StateLastEventActive string = "active" // StateLastEventError captures enum value "error" StateLastEventError string = "error" // StateLastEventInactive captures enum value "inactive" StateLastEventInactive string = "inactive" // StateLastEventTerminated captures enum value "terminated" StateLastEventTerminated string = "terminated" // StateLastEventSuspended captures enum value "suspended" StateLastEventSuspended string = "suspended" ) // prop value enum func (m *State) validateLastEventEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, stateTypeLastEventPropEnum, true); err != nil { return err } return nil } func (m *State) 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 *State) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *State) UnmarshalBinary(b []byte) error { var res State if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }