github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/secrets/secrets_models/user_secret.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package secrets_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 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 "github.com/go-openapi/validate" 14 ) 15 16 // UserSecret user secret 17 // swagger:model UserSecret 18 type UserSecret struct { 19 20 // is user 21 // Required: true 22 IsUser *bool `json:"is_user"` 23 24 // name 25 // Required: true 26 Name *string `json:"name"` 27 28 // organization id 29 // Required: true 30 // Format: uuid 31 OrganizationID *strfmt.UUID `json:"organization_id"` 32 33 // project id 34 // Format: uuid 35 ProjectID strfmt.UUID `json:"project_id,omitempty"` 36 37 // secret id 38 // Required: true 39 // Format: uuid 40 SecretID *strfmt.UUID `json:"secret_id"` 41 42 // user id 43 // Required: true 44 // Format: uuid 45 UserID *strfmt.UUID `json:"user_id"` 46 47 // value 48 // Required: true 49 Value *string `json:"value"` 50 } 51 52 // Validate validates this user secret 53 func (m *UserSecret) Validate(formats strfmt.Registry) error { 54 var res []error 55 56 if err := m.validateIsUser(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if err := m.validateName(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validateOrganizationID(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validateProjectID(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if err := m.validateSecretID(formats); err != nil { 73 res = append(res, err) 74 } 75 76 if err := m.validateUserID(formats); err != nil { 77 res = append(res, err) 78 } 79 80 if err := m.validateValue(formats); err != nil { 81 res = append(res, err) 82 } 83 84 if len(res) > 0 { 85 return errors.CompositeValidationError(res...) 86 } 87 return nil 88 } 89 90 func (m *UserSecret) validateIsUser(formats strfmt.Registry) error { 91 92 if err := validate.Required("is_user", "body", m.IsUser); err != nil { 93 return err 94 } 95 96 return nil 97 } 98 99 func (m *UserSecret) validateName(formats strfmt.Registry) error { 100 101 if err := validate.Required("name", "body", m.Name); err != nil { 102 return err 103 } 104 105 return nil 106 } 107 108 func (m *UserSecret) validateOrganizationID(formats strfmt.Registry) error { 109 110 if err := validate.Required("organization_id", "body", m.OrganizationID); err != nil { 111 return err 112 } 113 114 if err := validate.FormatOf("organization_id", "body", "uuid", m.OrganizationID.String(), formats); err != nil { 115 return err 116 } 117 118 return nil 119 } 120 121 func (m *UserSecret) validateProjectID(formats strfmt.Registry) error { 122 123 if swag.IsZero(m.ProjectID) { // not required 124 return nil 125 } 126 127 if err := validate.FormatOf("project_id", "body", "uuid", m.ProjectID.String(), formats); err != nil { 128 return err 129 } 130 131 return nil 132 } 133 134 func (m *UserSecret) validateSecretID(formats strfmt.Registry) error { 135 136 if err := validate.Required("secret_id", "body", m.SecretID); err != nil { 137 return err 138 } 139 140 if err := validate.FormatOf("secret_id", "body", "uuid", m.SecretID.String(), formats); err != nil { 141 return err 142 } 143 144 return nil 145 } 146 147 func (m *UserSecret) validateUserID(formats strfmt.Registry) error { 148 149 if err := validate.Required("user_id", "body", m.UserID); err != nil { 150 return err 151 } 152 153 if err := validate.FormatOf("user_id", "body", "uuid", m.UserID.String(), formats); err != nil { 154 return err 155 } 156 157 return nil 158 } 159 160 func (m *UserSecret) validateValue(formats strfmt.Registry) error { 161 162 if err := validate.Required("value", "body", m.Value); err != nil { 163 return err 164 } 165 166 return nil 167 } 168 169 // MarshalBinary interface implementation 170 func (m *UserSecret) MarshalBinary() ([]byte, error) { 171 if m == nil { 172 return nil, nil 173 } 174 return swag.WriteJSON(m) 175 } 176 177 // UnmarshalBinary interface implementation 178 func (m *UserSecret) UnmarshalBinary(b []byte) error { 179 var res UserSecret 180 if err := swag.ReadJSON(b, &res); err != nil { 181 return err 182 } 183 *m = res 184 return nil 185 }