Files
autoglue/sdk/go/model_dto_job_status.go

121 lines
2.6 KiB
Go

/*
AutoGlue API
API for managing K3s clusters across cloud providers
API version: 1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package autoglue
import (
"encoding/json"
"fmt"
)
// DtoJobStatus the model 'DtoJobStatus'
type DtoJobStatus string
// List of dto.JobStatus
const (
StatusQueued DtoJobStatus = "queued"
StatusRunning DtoJobStatus = "running"
StatusSucceeded DtoJobStatus = "succeeded"
StatusFailed DtoJobStatus = "failed"
StatusCanceled DtoJobStatus = "canceled"
StatusRetrying DtoJobStatus = "retrying"
StatusScheduled DtoJobStatus = "scheduled"
)
// All allowed values of DtoJobStatus enum
var AllowedDtoJobStatusEnumValues = []DtoJobStatus{
"queued",
"running",
"succeeded",
"failed",
"canceled",
"retrying",
"scheduled",
}
func (v *DtoJobStatus) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := DtoJobStatus(value)
for _, existing := range AllowedDtoJobStatusEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid DtoJobStatus", value)
}
// NewDtoJobStatusFromValue returns a pointer to a valid DtoJobStatus
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewDtoJobStatusFromValue(v string) (*DtoJobStatus, error) {
ev := DtoJobStatus(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for DtoJobStatus: valid values are %v", v, AllowedDtoJobStatusEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v DtoJobStatus) IsValid() bool {
for _, existing := range AllowedDtoJobStatusEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to dto.JobStatus value
func (v DtoJobStatus) Ptr() *DtoJobStatus {
return &v
}
type NullableDtoJobStatus struct {
value *DtoJobStatus
isSet bool
}
func (v NullableDtoJobStatus) Get() *DtoJobStatus {
return v.value
}
func (v *NullableDtoJobStatus) Set(val *DtoJobStatus) {
v.value = val
v.isSet = true
}
func (v NullableDtoJobStatus) IsSet() bool {
return v.isSet
}
func (v *NullableDtoJobStatus) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDtoJobStatus(val *DtoJobStatus) *NullableDtoJobStatus {
return &NullableDtoJobStatus{value: val, isSet: true}
}
func (v NullableDtoJobStatus) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDtoJobStatus) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}