This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
orchestrator-swagger-go-client/model_models_plug_task_state.go

116 lines
2.8 KiB
Go

/*
Anthrove Orchestrator API
This service handles the communication between the manager and the plugs
API version: 0.1-PREVIEW
Contact: support@anthrove.art
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
"fmt"
)
// ModelsPlugTaskState the model 'ModelsPlugTaskState'
type ModelsPlugTaskState string
// List of models.PlugTaskState
const (
PlugTaskStateUnknown ModelsPlugTaskState = "UNKNOWN"
PlugTaskStateStarted ModelsPlugTaskState = "STARTED"
PlugTaskStateRunning ModelsPlugTaskState = "RUNNING"
PlugTaskStateStopped ModelsPlugTaskState = "STOPPED"
)
// All allowed values of ModelsPlugTaskState enum
var AllowedModelsPlugTaskStateEnumValues = []ModelsPlugTaskState{
"UNKNOWN",
"STARTED",
"RUNNING",
"STOPPED",
}
func (v *ModelsPlugTaskState) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := ModelsPlugTaskState(value)
for _, existing := range AllowedModelsPlugTaskStateEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid ModelsPlugTaskState", value)
}
// NewModelsPlugTaskStateFromValue returns a pointer to a valid ModelsPlugTaskState
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewModelsPlugTaskStateFromValue(v string) (*ModelsPlugTaskState, error) {
ev := ModelsPlugTaskState(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for ModelsPlugTaskState: valid values are %v", v, AllowedModelsPlugTaskStateEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v ModelsPlugTaskState) IsValid() bool {
for _, existing := range AllowedModelsPlugTaskStateEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to models.PlugTaskState value
func (v ModelsPlugTaskState) Ptr() *ModelsPlugTaskState {
return &v
}
type NullableModelsPlugTaskState struct {
value *ModelsPlugTaskState
isSet bool
}
func (v NullableModelsPlugTaskState) Get() *ModelsPlugTaskState {
return v.value
}
func (v *NullableModelsPlugTaskState) Set(val *ModelsPlugTaskState) {
v.value = val
v.isSet = true
}
func (v NullableModelsPlugTaskState) IsSet() bool {
return v.isSet
}
func (v *NullableModelsPlugTaskState) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableModelsPlugTaskState(val *ModelsPlugTaskState) *NullableModelsPlugTaskState {
return &NullableModelsPlugTaskState{value: val, isSet: true}
}
func (v NullableModelsPlugTaskState) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableModelsPlugTaskState) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}