github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-vault-secrets/preview/2023-11-28/models/secrets20231128_get_mongo_d_b_atlas_rotating_secret_config_response.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 "strconv" 11 12 "github.com/go-openapi/errors" 13 "github.com/go-openapi/strfmt" 14 "github.com/go-openapi/swag" 15 ) 16 17 // Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse secrets 20231128 get mongo d b atlas rotating secret config response 18 // 19 // swagger:model secrets_20231128GetMongoDBAtlasRotatingSecretConfigResponse 20 type Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse struct { 21 22 // config 23 Config *Secrets20231128RotatingSecretConfig `json:"config,omitempty"` 24 25 // mongodb group id 26 MongodbGroupID string `json:"mongodb_group_id,omitempty"` 27 28 // mongodb roles 29 MongodbRoles []*Secrets20231128MongoDBRole `json:"mongodb_roles"` 30 31 // mongodb scopes 32 MongodbScopes []*Secrets20231128MongoDBScope `json:"mongodb_scopes"` 33 } 34 35 // Validate validates this secrets 20231128 get mongo d b atlas rotating secret config response 36 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) Validate(formats strfmt.Registry) error { 37 var res []error 38 39 if err := m.validateConfig(formats); err != nil { 40 res = append(res, err) 41 } 42 43 if err := m.validateMongodbRoles(formats); err != nil { 44 res = append(res, err) 45 } 46 47 if err := m.validateMongodbScopes(formats); err != nil { 48 res = append(res, err) 49 } 50 51 if len(res) > 0 { 52 return errors.CompositeValidationError(res...) 53 } 54 return nil 55 } 56 57 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) validateConfig(formats strfmt.Registry) error { 58 if swag.IsZero(m.Config) { // not required 59 return nil 60 } 61 62 if m.Config != nil { 63 if err := m.Config.Validate(formats); err != nil { 64 if ve, ok := err.(*errors.Validation); ok { 65 return ve.ValidateName("config") 66 } else if ce, ok := err.(*errors.CompositeError); ok { 67 return ce.ValidateName("config") 68 } 69 return err 70 } 71 } 72 73 return nil 74 } 75 76 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) validateMongodbRoles(formats strfmt.Registry) error { 77 if swag.IsZero(m.MongodbRoles) { // not required 78 return nil 79 } 80 81 for i := 0; i < len(m.MongodbRoles); i++ { 82 if swag.IsZero(m.MongodbRoles[i]) { // not required 83 continue 84 } 85 86 if m.MongodbRoles[i] != nil { 87 if err := m.MongodbRoles[i].Validate(formats); err != nil { 88 if ve, ok := err.(*errors.Validation); ok { 89 return ve.ValidateName("mongodb_roles" + "." + strconv.Itoa(i)) 90 } else if ce, ok := err.(*errors.CompositeError); ok { 91 return ce.ValidateName("mongodb_roles" + "." + strconv.Itoa(i)) 92 } 93 return err 94 } 95 } 96 97 } 98 99 return nil 100 } 101 102 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) validateMongodbScopes(formats strfmt.Registry) error { 103 if swag.IsZero(m.MongodbScopes) { // not required 104 return nil 105 } 106 107 for i := 0; i < len(m.MongodbScopes); i++ { 108 if swag.IsZero(m.MongodbScopes[i]) { // not required 109 continue 110 } 111 112 if m.MongodbScopes[i] != nil { 113 if err := m.MongodbScopes[i].Validate(formats); err != nil { 114 if ve, ok := err.(*errors.Validation); ok { 115 return ve.ValidateName("mongodb_scopes" + "." + strconv.Itoa(i)) 116 } else if ce, ok := err.(*errors.CompositeError); ok { 117 return ce.ValidateName("mongodb_scopes" + "." + strconv.Itoa(i)) 118 } 119 return err 120 } 121 } 122 123 } 124 125 return nil 126 } 127 128 // ContextValidate validate this secrets 20231128 get mongo d b atlas rotating secret config response based on the context it is used 129 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 130 var res []error 131 132 if err := m.contextValidateConfig(ctx, formats); err != nil { 133 res = append(res, err) 134 } 135 136 if err := m.contextValidateMongodbRoles(ctx, formats); err != nil { 137 res = append(res, err) 138 } 139 140 if err := m.contextValidateMongodbScopes(ctx, formats); err != nil { 141 res = append(res, err) 142 } 143 144 if len(res) > 0 { 145 return errors.CompositeValidationError(res...) 146 } 147 return nil 148 } 149 150 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) contextValidateConfig(ctx context.Context, formats strfmt.Registry) error { 151 152 if m.Config != nil { 153 154 if swag.IsZero(m.Config) { // not required 155 return nil 156 } 157 158 if err := m.Config.ContextValidate(ctx, formats); err != nil { 159 if ve, ok := err.(*errors.Validation); ok { 160 return ve.ValidateName("config") 161 } else if ce, ok := err.(*errors.CompositeError); ok { 162 return ce.ValidateName("config") 163 } 164 return err 165 } 166 } 167 168 return nil 169 } 170 171 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) contextValidateMongodbRoles(ctx context.Context, formats strfmt.Registry) error { 172 173 for i := 0; i < len(m.MongodbRoles); i++ { 174 175 if m.MongodbRoles[i] != nil { 176 177 if swag.IsZero(m.MongodbRoles[i]) { // not required 178 return nil 179 } 180 181 if err := m.MongodbRoles[i].ContextValidate(ctx, formats); err != nil { 182 if ve, ok := err.(*errors.Validation); ok { 183 return ve.ValidateName("mongodb_roles" + "." + strconv.Itoa(i)) 184 } else if ce, ok := err.(*errors.CompositeError); ok { 185 return ce.ValidateName("mongodb_roles" + "." + strconv.Itoa(i)) 186 } 187 return err 188 } 189 } 190 191 } 192 193 return nil 194 } 195 196 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) contextValidateMongodbScopes(ctx context.Context, formats strfmt.Registry) error { 197 198 for i := 0; i < len(m.MongodbScopes); i++ { 199 200 if m.MongodbScopes[i] != nil { 201 202 if swag.IsZero(m.MongodbScopes[i]) { // not required 203 return nil 204 } 205 206 if err := m.MongodbScopes[i].ContextValidate(ctx, formats); err != nil { 207 if ve, ok := err.(*errors.Validation); ok { 208 return ve.ValidateName("mongodb_scopes" + "." + strconv.Itoa(i)) 209 } else if ce, ok := err.(*errors.CompositeError); ok { 210 return ce.ValidateName("mongodb_scopes" + "." + strconv.Itoa(i)) 211 } 212 return err 213 } 214 } 215 216 } 217 218 return nil 219 } 220 221 // MarshalBinary interface implementation 222 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) MarshalBinary() ([]byte, error) { 223 if m == nil { 224 return nil, nil 225 } 226 return swag.WriteJSON(m) 227 } 228 229 // UnmarshalBinary interface implementation 230 func (m *Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse) UnmarshalBinary(b []byte) error { 231 var res Secrets20231128GetMongoDBAtlasRotatingSecretConfigResponse 232 if err := swag.ReadJSON(b, &res); err != nil { 233 return err 234 } 235 *m = res 236 return nil 237 }