github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-vault-secrets/preview/2023-11-28/models/secrets20231128_app.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package 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 "context" 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 // Secrets20231128App secrets 20231128 app 18 // 19 // swagger:model secrets_20231128App 20 type Secrets20231128App struct { 21 22 // created at 23 // Format: date-time 24 CreatedAt strfmt.DateTime `json:"created_at,omitempty"` 25 26 // created by 27 CreatedBy *Secrets20231128Principal `json:"created_by,omitempty"` 28 29 // description 30 Description string `json:"description,omitempty"` 31 32 // name 33 Name string `json:"name,omitempty"` 34 35 // organization id 36 OrganizationID string `json:"organization_id,omitempty"` 37 38 // project id 39 ProjectID string `json:"project_id,omitempty"` 40 41 // secret count 42 SecretCount int32 `json:"secret_count,omitempty"` 43 44 // sync integrations 45 SyncIntegrations []string `json:"sync_integrations"` 46 47 // updated at 48 // Format: date-time 49 UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"` 50 51 // updated by 52 UpdatedBy *Secrets20231128Principal `json:"updated_by,omitempty"` 53 } 54 55 // Validate validates this secrets 20231128 app 56 func (m *Secrets20231128App) Validate(formats strfmt.Registry) error { 57 var res []error 58 59 if err := m.validateCreatedAt(formats); err != nil { 60 res = append(res, err) 61 } 62 63 if err := m.validateCreatedBy(formats); err != nil { 64 res = append(res, err) 65 } 66 67 if err := m.validateUpdatedAt(formats); err != nil { 68 res = append(res, err) 69 } 70 71 if err := m.validateUpdatedBy(formats); err != nil { 72 res = append(res, err) 73 } 74 75 if len(res) > 0 { 76 return errors.CompositeValidationError(res...) 77 } 78 return nil 79 } 80 81 func (m *Secrets20231128App) validateCreatedAt(formats strfmt.Registry) error { 82 if swag.IsZero(m.CreatedAt) { // not required 83 return nil 84 } 85 86 if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { 87 return err 88 } 89 90 return nil 91 } 92 93 func (m *Secrets20231128App) validateCreatedBy(formats strfmt.Registry) error { 94 if swag.IsZero(m.CreatedBy) { // not required 95 return nil 96 } 97 98 if m.CreatedBy != nil { 99 if err := m.CreatedBy.Validate(formats); err != nil { 100 if ve, ok := err.(*errors.Validation); ok { 101 return ve.ValidateName("created_by") 102 } else if ce, ok := err.(*errors.CompositeError); ok { 103 return ce.ValidateName("created_by") 104 } 105 return err 106 } 107 } 108 109 return nil 110 } 111 112 func (m *Secrets20231128App) validateUpdatedAt(formats strfmt.Registry) error { 113 if swag.IsZero(m.UpdatedAt) { // not required 114 return nil 115 } 116 117 if err := validate.FormatOf("updated_at", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { 118 return err 119 } 120 121 return nil 122 } 123 124 func (m *Secrets20231128App) validateUpdatedBy(formats strfmt.Registry) error { 125 if swag.IsZero(m.UpdatedBy) { // not required 126 return nil 127 } 128 129 if m.UpdatedBy != nil { 130 if err := m.UpdatedBy.Validate(formats); err != nil { 131 if ve, ok := err.(*errors.Validation); ok { 132 return ve.ValidateName("updated_by") 133 } else if ce, ok := err.(*errors.CompositeError); ok { 134 return ce.ValidateName("updated_by") 135 } 136 return err 137 } 138 } 139 140 return nil 141 } 142 143 // ContextValidate validate this secrets 20231128 app based on the context it is used 144 func (m *Secrets20231128App) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 145 var res []error 146 147 if err := m.contextValidateCreatedBy(ctx, formats); err != nil { 148 res = append(res, err) 149 } 150 151 if err := m.contextValidateUpdatedBy(ctx, formats); err != nil { 152 res = append(res, err) 153 } 154 155 if len(res) > 0 { 156 return errors.CompositeValidationError(res...) 157 } 158 return nil 159 } 160 161 func (m *Secrets20231128App) contextValidateCreatedBy(ctx context.Context, formats strfmt.Registry) error { 162 163 if m.CreatedBy != nil { 164 165 if swag.IsZero(m.CreatedBy) { // not required 166 return nil 167 } 168 169 if err := m.CreatedBy.ContextValidate(ctx, formats); err != nil { 170 if ve, ok := err.(*errors.Validation); ok { 171 return ve.ValidateName("created_by") 172 } else if ce, ok := err.(*errors.CompositeError); ok { 173 return ce.ValidateName("created_by") 174 } 175 return err 176 } 177 } 178 179 return nil 180 } 181 182 func (m *Secrets20231128App) contextValidateUpdatedBy(ctx context.Context, formats strfmt.Registry) error { 183 184 if m.UpdatedBy != nil { 185 186 if swag.IsZero(m.UpdatedBy) { // not required 187 return nil 188 } 189 190 if err := m.UpdatedBy.ContextValidate(ctx, formats); err != nil { 191 if ve, ok := err.(*errors.Validation); ok { 192 return ve.ValidateName("updated_by") 193 } else if ce, ok := err.(*errors.CompositeError); ok { 194 return ce.ValidateName("updated_by") 195 } 196 return err 197 } 198 } 199 200 return nil 201 } 202 203 // MarshalBinary interface implementation 204 func (m *Secrets20231128App) MarshalBinary() ([]byte, error) { 205 if m == nil { 206 return nil, nil 207 } 208 return swag.WriteJSON(m) 209 } 210 211 // UnmarshalBinary interface implementation 212 func (m *Secrets20231128App) UnmarshalBinary(b []byte) error { 213 var res Secrets20231128App 214 if err := swag.ReadJSON(b, &res); err != nil { 215 return err 216 } 217 *m = res 218 return nil 219 }