github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-log-service/preview/2021-03-30/models/log_service20210330_destination.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 ) 15 16 // LogService20210330Destination Destination represents a destination to which to stream log events to. 17 // 18 // swagger:model log_service_20210330Destination 19 type LogService20210330Destination struct { 20 21 // cloudwatchlogs_provider represents a cloudwatch provider. 22 CloudwatchlogsProvider *LogService20210330CloudwatchLogsProvider `json:"cloudwatchlogs_provider,omitempty"` 23 24 // datadog_provider represents a datadog provider. 25 DatadogProvider *LogService20210330DatadogProvider `json:"datadog_provider,omitempty"` 26 27 // endpoint represents the endpoint that the destination is configured to stream to 28 Endpoint string `json:"endpoint,omitempty"` 29 30 // filter represents the filters that are attached to the destination record. 31 Filter *CloudlogService20210330Filter `json:"filter,omitempty"` 32 33 // in_error represents if the HCP platform is currently failing to stream to the destination. 34 InError bool `json:"in_error,omitempty"` 35 36 // last_error_message represents the error message from the response of the last streaming request sent to the destination. 37 LastErrorMessage string `json:"last_error_message,omitempty"` 38 39 // name represents the human readable name of a destination 40 Name string `json:"name,omitempty"` 41 42 // resource represents the destination record in the form of an HCP resource. 43 Resource *LocationLink `json:"resource,omitempty"` 44 45 // splunk_cloud_provider represents a splunk cloud provider. 46 SplunkCloudProvider *LogService20210330SplunkCloudProvider `json:"splunk_cloud_provider,omitempty"` 47 48 // status destination status field error/pending/success 49 Status string `json:"status,omitempty"` 50 } 51 52 // Validate validates this log service 20210330 destination 53 func (m *LogService20210330Destination) Validate(formats strfmt.Registry) error { 54 var res []error 55 56 if err := m.validateCloudwatchlogsProvider(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if err := m.validateDatadogProvider(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validateFilter(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validateResource(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if err := m.validateSplunkCloudProvider(formats); err != nil { 73 res = append(res, err) 74 } 75 76 if len(res) > 0 { 77 return errors.CompositeValidationError(res...) 78 } 79 return nil 80 } 81 82 func (m *LogService20210330Destination) validateCloudwatchlogsProvider(formats strfmt.Registry) error { 83 if swag.IsZero(m.CloudwatchlogsProvider) { // not required 84 return nil 85 } 86 87 if m.CloudwatchlogsProvider != nil { 88 if err := m.CloudwatchlogsProvider.Validate(formats); err != nil { 89 if ve, ok := err.(*errors.Validation); ok { 90 return ve.ValidateName("cloudwatchlogs_provider") 91 } else if ce, ok := err.(*errors.CompositeError); ok { 92 return ce.ValidateName("cloudwatchlogs_provider") 93 } 94 return err 95 } 96 } 97 98 return nil 99 } 100 101 func (m *LogService20210330Destination) validateDatadogProvider(formats strfmt.Registry) error { 102 if swag.IsZero(m.DatadogProvider) { // not required 103 return nil 104 } 105 106 if m.DatadogProvider != nil { 107 if err := m.DatadogProvider.Validate(formats); err != nil { 108 if ve, ok := err.(*errors.Validation); ok { 109 return ve.ValidateName("datadog_provider") 110 } else if ce, ok := err.(*errors.CompositeError); ok { 111 return ce.ValidateName("datadog_provider") 112 } 113 return err 114 } 115 } 116 117 return nil 118 } 119 120 func (m *LogService20210330Destination) validateFilter(formats strfmt.Registry) error { 121 if swag.IsZero(m.Filter) { // not required 122 return nil 123 } 124 125 if m.Filter != nil { 126 if err := m.Filter.Validate(formats); err != nil { 127 if ve, ok := err.(*errors.Validation); ok { 128 return ve.ValidateName("filter") 129 } else if ce, ok := err.(*errors.CompositeError); ok { 130 return ce.ValidateName("filter") 131 } 132 return err 133 } 134 } 135 136 return nil 137 } 138 139 func (m *LogService20210330Destination) validateResource(formats strfmt.Registry) error { 140 if swag.IsZero(m.Resource) { // not required 141 return nil 142 } 143 144 if m.Resource != nil { 145 if err := m.Resource.Validate(formats); err != nil { 146 if ve, ok := err.(*errors.Validation); ok { 147 return ve.ValidateName("resource") 148 } else if ce, ok := err.(*errors.CompositeError); ok { 149 return ce.ValidateName("resource") 150 } 151 return err 152 } 153 } 154 155 return nil 156 } 157 158 func (m *LogService20210330Destination) validateSplunkCloudProvider(formats strfmt.Registry) error { 159 if swag.IsZero(m.SplunkCloudProvider) { // not required 160 return nil 161 } 162 163 if m.SplunkCloudProvider != nil { 164 if err := m.SplunkCloudProvider.Validate(formats); err != nil { 165 if ve, ok := err.(*errors.Validation); ok { 166 return ve.ValidateName("splunk_cloud_provider") 167 } else if ce, ok := err.(*errors.CompositeError); ok { 168 return ce.ValidateName("splunk_cloud_provider") 169 } 170 return err 171 } 172 } 173 174 return nil 175 } 176 177 // ContextValidate validate this log service 20210330 destination based on the context it is used 178 func (m *LogService20210330Destination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 179 var res []error 180 181 if err := m.contextValidateCloudwatchlogsProvider(ctx, formats); err != nil { 182 res = append(res, err) 183 } 184 185 if err := m.contextValidateDatadogProvider(ctx, formats); err != nil { 186 res = append(res, err) 187 } 188 189 if err := m.contextValidateFilter(ctx, formats); err != nil { 190 res = append(res, err) 191 } 192 193 if err := m.contextValidateResource(ctx, formats); err != nil { 194 res = append(res, err) 195 } 196 197 if err := m.contextValidateSplunkCloudProvider(ctx, formats); err != nil { 198 res = append(res, err) 199 } 200 201 if len(res) > 0 { 202 return errors.CompositeValidationError(res...) 203 } 204 return nil 205 } 206 207 func (m *LogService20210330Destination) contextValidateCloudwatchlogsProvider(ctx context.Context, formats strfmt.Registry) error { 208 209 if m.CloudwatchlogsProvider != nil { 210 211 if swag.IsZero(m.CloudwatchlogsProvider) { // not required 212 return nil 213 } 214 215 if err := m.CloudwatchlogsProvider.ContextValidate(ctx, formats); err != nil { 216 if ve, ok := err.(*errors.Validation); ok { 217 return ve.ValidateName("cloudwatchlogs_provider") 218 } else if ce, ok := err.(*errors.CompositeError); ok { 219 return ce.ValidateName("cloudwatchlogs_provider") 220 } 221 return err 222 } 223 } 224 225 return nil 226 } 227 228 func (m *LogService20210330Destination) contextValidateDatadogProvider(ctx context.Context, formats strfmt.Registry) error { 229 230 if m.DatadogProvider != nil { 231 232 if swag.IsZero(m.DatadogProvider) { // not required 233 return nil 234 } 235 236 if err := m.DatadogProvider.ContextValidate(ctx, formats); err != nil { 237 if ve, ok := err.(*errors.Validation); ok { 238 return ve.ValidateName("datadog_provider") 239 } else if ce, ok := err.(*errors.CompositeError); ok { 240 return ce.ValidateName("datadog_provider") 241 } 242 return err 243 } 244 } 245 246 return nil 247 } 248 249 func (m *LogService20210330Destination) contextValidateFilter(ctx context.Context, formats strfmt.Registry) error { 250 251 if m.Filter != nil { 252 253 if swag.IsZero(m.Filter) { // not required 254 return nil 255 } 256 257 if err := m.Filter.ContextValidate(ctx, formats); err != nil { 258 if ve, ok := err.(*errors.Validation); ok { 259 return ve.ValidateName("filter") 260 } else if ce, ok := err.(*errors.CompositeError); ok { 261 return ce.ValidateName("filter") 262 } 263 return err 264 } 265 } 266 267 return nil 268 } 269 270 func (m *LogService20210330Destination) contextValidateResource(ctx context.Context, formats strfmt.Registry) error { 271 272 if m.Resource != nil { 273 274 if swag.IsZero(m.Resource) { // not required 275 return nil 276 } 277 278 if err := m.Resource.ContextValidate(ctx, formats); err != nil { 279 if ve, ok := err.(*errors.Validation); ok { 280 return ve.ValidateName("resource") 281 } else if ce, ok := err.(*errors.CompositeError); ok { 282 return ce.ValidateName("resource") 283 } 284 return err 285 } 286 } 287 288 return nil 289 } 290 291 func (m *LogService20210330Destination) contextValidateSplunkCloudProvider(ctx context.Context, formats strfmt.Registry) error { 292 293 if m.SplunkCloudProvider != nil { 294 295 if swag.IsZero(m.SplunkCloudProvider) { // not required 296 return nil 297 } 298 299 if err := m.SplunkCloudProvider.ContextValidate(ctx, formats); err != nil { 300 if ve, ok := err.(*errors.Validation); ok { 301 return ve.ValidateName("splunk_cloud_provider") 302 } else if ce, ok := err.(*errors.CompositeError); ok { 303 return ce.ValidateName("splunk_cloud_provider") 304 } 305 return err 306 } 307 } 308 309 return nil 310 } 311 312 // MarshalBinary interface implementation 313 func (m *LogService20210330Destination) MarshalBinary() ([]byte, error) { 314 if m == nil { 315 return nil, nil 316 } 317 return swag.WriteJSON(m) 318 } 319 320 // UnmarshalBinary interface implementation 321 func (m *LogService20210330Destination) UnmarshalBinary(b []byte) error { 322 var res LogService20210330Destination 323 if err := swag.ReadJSON(b, &res); err != nil { 324 return err 325 } 326 *m = res 327 return nil 328 }