github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildlogstream/buildlogstream_models/log_general.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package buildlogstream_models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "encoding/json" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/strfmt" 13 "github.com/go-openapi/swag" 14 "github.com/go-openapi/validate" 15 ) 16 17 // LogGeneral General log message 18 // 19 // A general status message 20 // 21 // swagger:model logGeneral 22 type LogGeneral struct { 23 24 // facility 25 // Required: true 26 // Enum: [DIE DUMP ERROR INFO LOG WARN] 27 Facility *string `json:"facility"` 28 29 // message 30 // Required: true 31 Message *string `json:"message"` 32 } 33 34 // Validate validates this log general 35 func (m *LogGeneral) Validate(formats strfmt.Registry) error { 36 var res []error 37 38 if err := m.validateFacility(formats); err != nil { 39 res = append(res, err) 40 } 41 42 if err := m.validateMessage(formats); err != nil { 43 res = append(res, err) 44 } 45 46 if len(res) > 0 { 47 return errors.CompositeValidationError(res...) 48 } 49 return nil 50 } 51 52 var logGeneralTypeFacilityPropEnum []interface{} 53 54 func init() { 55 var res []string 56 if err := json.Unmarshal([]byte(`["DIE","DUMP","ERROR","INFO","LOG","WARN"]`), &res); err != nil { 57 panic(err) 58 } 59 for _, v := range res { 60 logGeneralTypeFacilityPropEnum = append(logGeneralTypeFacilityPropEnum, v) 61 } 62 } 63 64 const ( 65 66 // LogGeneralFacilityDIE captures enum value "DIE" 67 LogGeneralFacilityDIE string = "DIE" 68 69 // LogGeneralFacilityDUMP captures enum value "DUMP" 70 LogGeneralFacilityDUMP string = "DUMP" 71 72 // LogGeneralFacilityERROR captures enum value "ERROR" 73 LogGeneralFacilityERROR string = "ERROR" 74 75 // LogGeneralFacilityINFO captures enum value "INFO" 76 LogGeneralFacilityINFO string = "INFO" 77 78 // LogGeneralFacilityLOG captures enum value "LOG" 79 LogGeneralFacilityLOG string = "LOG" 80 81 // LogGeneralFacilityWARN captures enum value "WARN" 82 LogGeneralFacilityWARN string = "WARN" 83 ) 84 85 // prop value enum 86 func (m *LogGeneral) validateFacilityEnum(path, location string, value string) error { 87 if err := validate.Enum(path, location, value, logGeneralTypeFacilityPropEnum); err != nil { 88 return err 89 } 90 return nil 91 } 92 93 func (m *LogGeneral) validateFacility(formats strfmt.Registry) error { 94 95 if err := validate.Required("facility", "body", m.Facility); err != nil { 96 return err 97 } 98 99 // value enum 100 if err := m.validateFacilityEnum("facility", "body", *m.Facility); err != nil { 101 return err 102 } 103 104 return nil 105 } 106 107 func (m *LogGeneral) validateMessage(formats strfmt.Registry) error { 108 109 if err := validate.Required("message", "body", m.Message); err != nil { 110 return err 111 } 112 113 return nil 114 } 115 116 // MarshalBinary interface implementation 117 func (m *LogGeneral) MarshalBinary() ([]byte, error) { 118 if m == nil { 119 return nil, nil 120 } 121 return swag.WriteJSON(m) 122 } 123 124 // UnmarshalBinary interface implementation 125 func (m *LogGeneral) UnmarshalBinary(b []byte) error { 126 var res LogGeneral 127 if err := swag.ReadJSON(b, &res); err != nil { 128 return err 129 } 130 *m = res 131 return nil 132 }