diff --git a/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/index.html b/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/index.html index 5c7c86bbb75..456b10ee85d 100644 --- a/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/index.html +++ b/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/index.html @@ -80941,7 +80941,7 @@

func (*DeleteHostTagsOption -

type DeleteMonitorOptionalParameters +

type DeleteMonitorOptionalParameters @@ -80963,7 +80963,7 @@

type func NewDeleteMonitorOptionalParameters +

func NewDeleteMonitorOptionalParameters @@ -80977,7 +80977,7 @@

func func (*DeleteMonitorOptionalParameters) WithForce +

func (*DeleteMonitorOptionalParameters) WithForce @@ -102614,7 +102614,7 @@

func (*GetIngestedSpansOpt -

type GetMonitorOptionalParameters +

type GetMonitorOptionalParameters @@ -102637,7 +102637,7 @@

type func NewGetMonitorOptionalParameters +

func NewGetMonitorOptionalParameters @@ -102651,7 +102651,7 @@

func func (*GetMonitorOptionalParameters) WithGroupStates +

func (*GetMonitorOptionalParameters) WithGroupStates @@ -102664,7 +102664,7 @@

func (*GetMonitorOptionalP -

func (*GetMonitorOptionalParameters) WithWithDowntimes +

func (*GetMonitorOptionalParameters) WithWithDowntimes @@ -119594,7 +119594,7 @@

func (*ListHostsOptionalParameter -

type ListMonitorsOptionalParameters +

type ListMonitorsOptionalParameters @@ -119623,7 +119623,7 @@

type func NewListMonitorsOptionalParameters +

func NewListMonitorsOptionalParameters @@ -119637,7 +119637,7 @@

func func (*ListMonitorsOptionalParameters) WithGroupStates +

func (*ListMonitorsOptionalParameters) WithGroupStates @@ -119650,7 +119650,7 @@

func (*ListMonitorsOptio -

func (*ListMonitorsOptionalParameters) WithIdOffset +

func (*ListMonitorsOptionalParameters) WithIdOffset @@ -119663,7 +119663,7 @@

func (*ListMonitorsOptional -

func (*ListMonitorsOptionalParameters) WithMonitorTags +

func (*ListMonitorsOptionalParameters) WithMonitorTags @@ -119676,7 +119676,7 @@

func (*ListMonitorsOptio -

func (*ListMonitorsOptionalParameters) WithName +

func (*ListMonitorsOptionalParameters) WithName @@ -119689,7 +119689,7 @@

func (*ListMonitorsOptionalPara -

func (*ListMonitorsOptionalParameters) WithPage +

func (*ListMonitorsOptionalParameters) WithPage @@ -119702,7 +119702,7 @@

func (*ListMonitorsOptionalPara -

func (*ListMonitorsOptionalParameters) WithPageSize +

func (*ListMonitorsOptionalParameters) WithPageSize @@ -119715,7 +119715,7 @@

func (*ListMonitorsOptional -

func (*ListMonitorsOptionalParameters) WithTags +

func (*ListMonitorsOptionalParameters) WithTags @@ -119728,7 +119728,7 @@

func (*ListMonitorsOptionalPara -

func (*ListMonitorsOptionalParameters) WithWithDowntimes +

func (*ListMonitorsOptionalParameters) WithWithDowntimes @@ -154190,7 +154190,7 @@

type func NewMonitorsApi +

func NewMonitorsApi @@ -154218,7 +154218,7 @@

func (*MonitorsApi) func (*MonitorsApi) CreateMonitor +

func (*MonitorsApi) CreateMonitor @@ -154344,11 +154344,13 @@

func (*MonitorsApi) https://docs.datadoghq.com/logs/search_syntax/). -- `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. +- `issue_source` The issue source - supports `all`, `browser`, `mobile` and `backend` and defaults to `all` if omitted. +- `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality` and defaults to `count` if omitted. - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +- `group by` Comma-separated list of attributes to group by - should contain at least `issue.id`. - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - `#` an integer or decimal number used to set the threshold. @@ -154374,7 +154376,7 @@

func (*MonitorsApi) func (*MonitorsApi) DeleteMonitor +

func (*MonitorsApi) DeleteMonitor @@ -154388,7 +154390,7 @@

func (*MonitorsApi) func (*MonitorsApi) GetMonitor +

func (*MonitorsApi) GetMonitor @@ -154402,7 +154404,7 @@

func (*MonitorsApi) func (*MonitorsApi) ListMonitors +

func (*MonitorsApi) ListMonitors @@ -154416,7 +154418,7 @@

func (*MonitorsApi) func (*MonitorsApi) ListMonitorsWithPagination +

func (*MonitorsApi) ListMonitorsWithPagination @@ -154429,7 +154431,7 @@

func (*MonitorsApi) func (*MonitorsApi) SearchMonitorGroups +

func (*MonitorsApi) SearchMonitorGroups @@ -154443,7 +154445,7 @@

func (*MonitorsApi) func (*MonitorsApi) SearchMonitors +

func (*MonitorsApi) SearchMonitors @@ -154457,7 +154459,7 @@

func (*MonitorsApi) func (*MonitorsApi) UpdateMonitor +

func (*MonitorsApi) UpdateMonitor @@ -154471,7 +154473,7 @@

func (*MonitorsApi) func (*MonitorsApi) ValidateExistingMonitor +

func (*MonitorsApi) ValidateExistingMonitor @@ -154485,7 +154487,7 @@

func (*MonitorsApi) func (*MonitorsApi) ValidateMonitor +

func (*MonitorsApi) ValidateMonitor @@ -200852,7 +200854,7 @@

func (*ScatterplotWidgetFormula) -

type SearchMonitorGroupsOptionalParameters +

type SearchMonitorGroupsOptionalParameters @@ -200877,7 +200879,7 @@

type func NewSearchMonitorGroupsOptionalParameters +

func NewSearchMonitorGroupsOptionalParameters @@ -200891,7 +200893,7 @@

func func (*SearchMonitorGroupsOptionalParameters) WithPage +

func (*SearchMonitorGroupsOptionalParameters) WithPage @@ -200904,7 +200906,7 @@

func (*SearchMonitorGrou -

func (*SearchMonitorGroupsOptionalParameters) WithPerPage +

func (*SearchMonitorGroupsOptionalParameters) WithPerPage @@ -200917,7 +200919,7 @@

func (*SearchMonitorG -

func (*SearchMonitorGroupsOptionalParameters) WithQuery +

func (*SearchMonitorGroupsOptionalParameters) WithQuery @@ -200930,7 +200932,7 @@

func (*SearchMonitorGro -

func (*SearchMonitorGroupsOptionalParameters) WithSort +

func (*SearchMonitorGroupsOptionalParameters) WithSort @@ -200945,7 +200947,7 @@

func (*SearchMonitorGrou -

type SearchMonitorsOptionalParameters +

type SearchMonitorsOptionalParameters @@ -200970,7 +200972,7 @@

type func NewSearchMonitorsOptionalParameters +

func NewSearchMonitorsOptionalParameters @@ -200984,7 +200986,7 @@

func func (*SearchMonitorsOptionalParameters) WithPage +

func (*SearchMonitorsOptionalParameters) WithPage @@ -200997,7 +200999,7 @@

func (*SearchMonitorsOptional -

func (*SearchMonitorsOptionalParameters) WithPerPage +

func (*SearchMonitorsOptionalParameters) WithPerPage @@ -201010,7 +201012,7 @@

func (*SearchMonitorsOptio -

func (*SearchMonitorsOptionalParameters) WithQuery +

func (*SearchMonitorsOptionalParameters) WithQuery @@ -201023,7 +201025,7 @@

func (*SearchMonitorsOptiona -

func (*SearchMonitorsOptionalParameters) WithSort +

func (*SearchMonitorsOptionalParameters) WithSort diff --git a/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html b/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html index 3897ab0f315..29d202d19b4 100644 --- a/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html +++ b/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html @@ -79,7 +79,7 @@

14700 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.900527439 +0000 UTC @@ -88,7 +88,7 @@

18236 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.904527486 +0000 UTC @@ -97,7 +97,7 @@

622 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.904527486 +0000 UTC @@ -106,7 +106,7 @@

633 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.904527486 +0000 UTC @@ -115,7 +115,7 @@

405 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.904527486 +0000 UTC @@ -124,7 +124,7 @@

12924 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.904527486 +0000 UTC @@ -133,7 +133,7 @@

589 - 2024-11-06 15:03:12.876291133 +0000 UTC + 2024-11-06 21:32:11.904527486 +0000 UTC diff --git a/src/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_monitors.go.html b/src/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_monitors.go.html index dec6b7e271f..bef6ab58977 100644 --- a/src/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_monitors.go.html +++ b/src/github.com/DataDog/datadog-api-client-go/v2/api/datadogV1/api_monitors.go.html @@ -315,1014 +315,1016 @@

258  // 259  // ##### Error Tracking Alert Query 260  // - 261  // Example(RUM): `error-tracking-rum(query).rollup(rollup_method[, measure]).last(time_window) operator #` - 262  // Example(APM Traces): `error-tracking-traces(query).rollup(rollup_method[, measure]).last(time_window) operator #` + 261  // "New issue" example: `error-tracking(query).source(issue_source).new().rollup(rollup_method[, measure]).by(group_by).last(time_window) operator #` + 262  // "High impact issue" example: `error-tracking(query).source(issue_source).impact().rollup(rollup_method[, measure]).by(group_by).last(time_window) operator #` 263  // 264  // - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - 265  // - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. - 266  // - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - 267  // - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - 268  // - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - 269  // - `#` an integer or decimal number used to set the threshold. - 270  // - 271  // **Database Monitoring Alert Query** + 265  // - `issue_source` The issue source - supports `all`, `browser`, `mobile` and `backend` and defaults to `all` if omitted. + 266  // - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality` and defaults to `count` if omitted. + 267  // - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + 268  // - `group by` Comma-separated list of attributes to group by - should contain at least `issue.id`. + 269  // - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + 270  // - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + 271  // - `#` an integer or decimal number used to set the threshold. 272  // - 273  // Example: `database-monitoring(query).rollup(rollup_method[, measure]).last(time_window) operator #` + 273  // **Database Monitoring Alert Query** 274  // - 275  // - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - 276  // - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. - 277  // - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - 278  // - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - 279  // - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - 280  // - `#` an integer or decimal number used to set the threshold. - 281  // - 282  // **Network Performance Alert Query** + 275  // Example: `database-monitoring(query).rollup(rollup_method[, measure]).last(time_window) operator #` + 276  // + 277  // - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + 278  // - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. + 279  // - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + 280  // - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + 281  // - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + 282  // - `#` an integer or decimal number used to set the threshold. 283  // - 284  // Example: `network-performance(query).rollup(rollup_method[, measure]).last(time_window) operator #` + 284  // **Network Performance Alert Query** 285  // - 286  // - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - 287  // - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. - 288  // - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - 289  // - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - 290  // - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - 291  // - `#` an integer or decimal number used to set the threshold. - 292  func (a *MonitorsApi) CreateMonitor(ctx _context.Context, body Monitor) (Monitor, *_nethttp.Response, error) { - 293   var ( - 294   localVarHTTPMethod = _nethttp.MethodPost - 295   localVarPostBody interface{} - 296   localVarReturnValue Monitor - 297   ) - 298   - 299   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.CreateMonitor") - 300   if err != nil { - 301   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 302   } - 303   - 304   localVarPath := localBasePath + "/api/v1/monitor" + 286  // Example: `network-performance(query).rollup(rollup_method[, measure]).last(time_window) operator #` + 287  // + 288  // - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + 289  // - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. + 290  // - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + 291  // - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + 292  // - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + 293  // - `#` an integer or decimal number used to set the threshold. + 294  func (a *MonitorsApi) CreateMonitor(ctx _context.Context, body Monitor) (Monitor, *_nethttp.Response, error) { + 295   var ( + 296   localVarHTTPMethod = _nethttp.MethodPost + 297   localVarPostBody interface{} + 298   localVarReturnValue Monitor + 299   ) + 300   + 301   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.CreateMonitor") + 302   if err != nil { + 303   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 304   } 305   - 306   localVarHeaderParams := make(map[string]string) - 307   localVarQueryParams := _neturl.Values{} - 308   localVarFormParams := _neturl.Values{} - 309   localVarHeaderParams["Content-Type"] = "application/json" - 310   localVarHeaderParams["Accept"] = "application/json" - 311   - 312   // body params - 313   localVarPostBody = &body - 314   datadog.SetAuthKeys( - 315   ctx, - 316   &localVarHeaderParams, - 317   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 318   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 319   ) - 320   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 321   if err != nil { - 322   return localVarReturnValue, nil, err - 323   } - 324   - 325   localVarHTTPResponse, err := a.Client.CallAPI(req) - 326   if err != nil || localVarHTTPResponse == nil { - 327   return localVarReturnValue, localVarHTTPResponse, err - 328   } - 329   - 330   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 331   if err != nil { - 332   return localVarReturnValue, localVarHTTPResponse, err - 333   } - 334   - 335   if localVarHTTPResponse.StatusCode >= 300 { - 336   newErr := datadog.GenericOpenAPIError{ - 337   ErrorBody: localVarBody, - 338   ErrorMessage: localVarHTTPResponse.Status, - 339   } - 340   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - 341   var v APIErrorResponse - 342   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 343   if err != nil { - 344   return localVarReturnValue, localVarHTTPResponse, newErr - 345   } - 346   newErr.ErrorModel = v - 347   } - 348   return localVarReturnValue, localVarHTTPResponse, newErr - 349   } - 350   - 351   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 352   if err != nil { - 353   newErr := datadog.GenericOpenAPIError{ - 354   ErrorBody: localVarBody, - 355   ErrorMessage: err.Error(), - 356   } - 357   return localVarReturnValue, localVarHTTPResponse, newErr - 358   } - 359   - 360   return localVarReturnValue, localVarHTTPResponse, nil - 361  } - 362   - 363  // DeleteMonitorOptionalParameters holds optional parameters for DeleteMonitor. - 364  type DeleteMonitorOptionalParameters struct { - 365   Force *string - 366  } - 367   - 368  // NewDeleteMonitorOptionalParameters creates an empty struct for parameters. - 369  func NewDeleteMonitorOptionalParameters() *DeleteMonitorOptionalParameters { - 370   this := DeleteMonitorOptionalParameters{} - 371   return &this - 372  } - 373   - 374  // WithForce sets the corresponding parameter name and returns the struct. - 375  func (r *DeleteMonitorOptionalParameters) WithForce(force string) *DeleteMonitorOptionalParameters { - 376   r.Force = &force - 377   return r - 378  } - 379   - 380  // DeleteMonitor Delete a monitor. - 381  // Delete the specified monitor - 382  func (a *MonitorsApi) DeleteMonitor(ctx _context.Context, monitorId int64, o ...DeleteMonitorOptionalParameters) (DeletedMonitor, *_nethttp.Response, error) { - 383   var ( - 384   localVarHTTPMethod = _nethttp.MethodDelete - 385   localVarPostBody interface{} - 386   localVarReturnValue DeletedMonitor - 387   optionalParams DeleteMonitorOptionalParameters - 388   ) - 389   - 390   if len(o) > 1 { - 391   return localVarReturnValue, nil, datadog.ReportError("only one argument of type DeleteMonitorOptionalParameters is allowed") - 392   } - 393   if len(o) == 1 { - 394   optionalParams = o[0] - 395   } - 396   - 397   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.DeleteMonitor") - 398   if err != nil { - 399   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 400   } - 401   - 402   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" - 403   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) - 404   - 405   localVarHeaderParams := make(map[string]string) - 406   localVarQueryParams := _neturl.Values{} - 407   localVarFormParams := _neturl.Values{} - 408   if optionalParams.Force != nil { - 409   localVarQueryParams.Add("force", datadog.ParameterToString(*optionalParams.Force, "")) - 410   } - 411   localVarHeaderParams["Accept"] = "application/json" - 412   - 413   datadog.SetAuthKeys( - 414   ctx, - 415   &localVarHeaderParams, - 416   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 417   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 418   ) - 419   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 420   if err != nil { - 421   return localVarReturnValue, nil, err - 422   } - 423   - 424   localVarHTTPResponse, err := a.Client.CallAPI(req) - 425   if err != nil || localVarHTTPResponse == nil { - 426   return localVarReturnValue, localVarHTTPResponse, err - 427   } - 428   - 429   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 430   if err != nil { - 431   return localVarReturnValue, localVarHTTPResponse, err - 432   } - 433   - 434   if localVarHTTPResponse.StatusCode >= 300 { - 435   newErr := datadog.GenericOpenAPIError{ - 436   ErrorBody: localVarBody, - 437   ErrorMessage: localVarHTTPResponse.Status, - 438   } - 439   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - 440   var v APIErrorResponse - 441   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 442   if err != nil { - 443   return localVarReturnValue, localVarHTTPResponse, newErr - 444   } - 445   newErr.ErrorModel = v - 446   } - 447   return localVarReturnValue, localVarHTTPResponse, newErr - 448   } - 449   - 450   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 451   if err != nil { - 452   newErr := datadog.GenericOpenAPIError{ - 453   ErrorBody: localVarBody, - 454   ErrorMessage: err.Error(), - 455   } - 456   return localVarReturnValue, localVarHTTPResponse, newErr - 457   } - 458   - 459   return localVarReturnValue, localVarHTTPResponse, nil - 460  } - 461   - 462  // GetMonitorOptionalParameters holds optional parameters for GetMonitor. - 463  type GetMonitorOptionalParameters struct { - 464   GroupStates *string - 465   WithDowntimes *bool - 466  } - 467   - 468  // NewGetMonitorOptionalParameters creates an empty struct for parameters. - 469  func NewGetMonitorOptionalParameters() *GetMonitorOptionalParameters { - 470   this := GetMonitorOptionalParameters{} - 471   return &this - 472  } - 473   - 474  // WithGroupStates sets the corresponding parameter name and returns the struct. - 475  func (r *GetMonitorOptionalParameters) WithGroupStates(groupStates string) *GetMonitorOptionalParameters { - 476   r.GroupStates = &groupStates - 477   return r - 478  } - 479   - 480  // WithWithDowntimes sets the corresponding parameter name and returns the struct. - 481  func (r *GetMonitorOptionalParameters) WithWithDowntimes(withDowntimes bool) *GetMonitorOptionalParameters { - 482   r.WithDowntimes = &withDowntimes - 483   return r - 484  } - 485   - 486  // GetMonitor Get a monitor's details. - 487  // Get details about the specified monitor from your organization. - 488  func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (Monitor, *_nethttp.Response, error) { - 489   var ( - 490   localVarHTTPMethod = _nethttp.MethodGet - 491   localVarPostBody interface{} - 492   localVarReturnValue Monitor - 493   optionalParams GetMonitorOptionalParameters - 494   ) - 495   - 496   if len(o) > 1 { - 497   return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetMonitorOptionalParameters is allowed") - 498   } - 499   if len(o) == 1 { - 500   optionalParams = o[0] - 501   } - 502   - 503   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.GetMonitor") - 504   if err != nil { - 505   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 506   } - 507   - 508   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" - 509   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) - 510   - 511   localVarHeaderParams := make(map[string]string) - 512   localVarQueryParams := _neturl.Values{} - 513   localVarFormParams := _neturl.Values{} - 514   if optionalParams.GroupStates != nil { - 515   localVarQueryParams.Add("group_states", datadog.ParameterToString(*optionalParams.GroupStates, "")) - 516   } - 517   if optionalParams.WithDowntimes != nil { - 518   localVarQueryParams.Add("with_downtimes", datadog.ParameterToString(*optionalParams.WithDowntimes, "")) - 519   } - 520   localVarHeaderParams["Accept"] = "application/json" - 521   - 522   datadog.SetAuthKeys( - 523   ctx, - 524   &localVarHeaderParams, - 525   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 526   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 527   ) - 528   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 529   if err != nil { - 530   return localVarReturnValue, nil, err - 531   } - 532   - 533   localVarHTTPResponse, err := a.Client.CallAPI(req) - 534   if err != nil || localVarHTTPResponse == nil { - 535   return localVarReturnValue, localVarHTTPResponse, err - 536   } - 537   - 538   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 539   if err != nil { - 540   return localVarReturnValue, localVarHTTPResponse, err - 541   } - 542   - 543   if localVarHTTPResponse.StatusCode >= 300 { - 544   newErr := datadog.GenericOpenAPIError{ - 545   ErrorBody: localVarBody, - 546   ErrorMessage: localVarHTTPResponse.Status, - 547   } - 548   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - 549   var v APIErrorResponse - 550   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 551   if err != nil { - 552   return localVarReturnValue, localVarHTTPResponse, newErr - 553   } - 554   newErr.ErrorModel = v - 555   } - 556   return localVarReturnValue, localVarHTTPResponse, newErr - 557   } - 558   - 559   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 560   if err != nil { - 561   newErr := datadog.GenericOpenAPIError{ - 562   ErrorBody: localVarBody, - 563   ErrorMessage: err.Error(), - 564   } - 565   return localVarReturnValue, localVarHTTPResponse, newErr - 566   } - 567   - 568   return localVarReturnValue, localVarHTTPResponse, nil - 569  } - 570   - 571  // ListMonitorsOptionalParameters holds optional parameters for ListMonitors. - 572  type ListMonitorsOptionalParameters struct { - 573   GroupStates *string - 574   Name *string - 575   Tags *string - 576   MonitorTags *string - 577   WithDowntimes *bool - 578   IdOffset *int64 - 579   Page *int64 - 580   PageSize *int32 - 581  } - 582   - 583  // NewListMonitorsOptionalParameters creates an empty struct for parameters. - 584  func NewListMonitorsOptionalParameters() *ListMonitorsOptionalParameters { - 585   this := ListMonitorsOptionalParameters{} - 586   return &this - 587  } - 588   - 589  // WithGroupStates sets the corresponding parameter name and returns the struct. - 590  func (r *ListMonitorsOptionalParameters) WithGroupStates(groupStates string) *ListMonitorsOptionalParameters { - 591   r.GroupStates = &groupStates - 592   return r - 593  } - 594   - 595  // WithName sets the corresponding parameter name and returns the struct. - 596  func (r *ListMonitorsOptionalParameters) WithName(name string) *ListMonitorsOptionalParameters { - 597   r.Name = &name - 598   return r - 599  } - 600   - 601  // WithTags sets the corresponding parameter name and returns the struct. - 602  func (r *ListMonitorsOptionalParameters) WithTags(tags string) *ListMonitorsOptionalParameters { - 603   r.Tags = &tags - 604   return r - 605  } - 606   - 607  // WithMonitorTags sets the corresponding parameter name and returns the struct. - 608  func (r *ListMonitorsOptionalParameters) WithMonitorTags(monitorTags string) *ListMonitorsOptionalParameters { - 609   r.MonitorTags = &monitorTags - 610   return r - 611  } - 612   - 613  // WithWithDowntimes sets the corresponding parameter name and returns the struct. - 614  func (r *ListMonitorsOptionalParameters) WithWithDowntimes(withDowntimes bool) *ListMonitorsOptionalParameters { - 615   r.WithDowntimes = &withDowntimes - 616   return r - 617  } - 618   - 619  // WithIdOffset sets the corresponding parameter name and returns the struct. - 620  func (r *ListMonitorsOptionalParameters) WithIdOffset(idOffset int64) *ListMonitorsOptionalParameters { - 621   r.IdOffset = &idOffset - 622   return r - 623  } - 624   - 625  // WithPage sets the corresponding parameter name and returns the struct. - 626  func (r *ListMonitorsOptionalParameters) WithPage(page int64) *ListMonitorsOptionalParameters { - 627   r.Page = &page - 628   return r - 629  } - 630   - 631  // WithPageSize sets the corresponding parameter name and returns the struct. - 632  func (r *ListMonitorsOptionalParameters) WithPageSize(pageSize int32) *ListMonitorsOptionalParameters { - 633   r.PageSize = &pageSize - 634   return r - 635  } - 636   - 637  // ListMonitors Get all monitor details. - 638  // Get details about the specified monitor from your organization. - 639  func (a *MonitorsApi) ListMonitors(ctx _context.Context, o ...ListMonitorsOptionalParameters) ([]Monitor, *_nethttp.Response, error) { - 640   var ( - 641   localVarHTTPMethod = _nethttp.MethodGet - 642   localVarPostBody interface{} - 643   localVarReturnValue []Monitor - 644   optionalParams ListMonitorsOptionalParameters - 645   ) - 646   - 647   if len(o) > 1 { - 648   return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListMonitorsOptionalParameters is allowed") - 649   } - 650   if len(o) == 1 { - 651   optionalParams = o[0] - 652   } - 653   - 654   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.ListMonitors") - 655   if err != nil { - 656   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 657   } - 658   - 659   localVarPath := localBasePath + "/api/v1/monitor" + 306   localVarPath := localBasePath + "/api/v1/monitor" + 307   + 308   localVarHeaderParams := make(map[string]string) + 309   localVarQueryParams := _neturl.Values{} + 310   localVarFormParams := _neturl.Values{} + 311   localVarHeaderParams["Content-Type"] = "application/json" + 312   localVarHeaderParams["Accept"] = "application/json" + 313   + 314   // body params + 315   localVarPostBody = &body + 316   datadog.SetAuthKeys( + 317   ctx, + 318   &localVarHeaderParams, + 319   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 320   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 321   ) + 322   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 323   if err != nil { + 324   return localVarReturnValue, nil, err + 325   } + 326   + 327   localVarHTTPResponse, err := a.Client.CallAPI(req) + 328   if err != nil || localVarHTTPResponse == nil { + 329   return localVarReturnValue, localVarHTTPResponse, err + 330   } + 331   + 332   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 333   if err != nil { + 334   return localVarReturnValue, localVarHTTPResponse, err + 335   } + 336   + 337   if localVarHTTPResponse.StatusCode >= 300 { + 338   newErr := datadog.GenericOpenAPIError{ + 339   ErrorBody: localVarBody, + 340   ErrorMessage: localVarHTTPResponse.Status, + 341   } + 342   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + 343   var v APIErrorResponse + 344   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 345   if err != nil { + 346   return localVarReturnValue, localVarHTTPResponse, newErr + 347   } + 348   newErr.ErrorModel = v + 349   } + 350   return localVarReturnValue, localVarHTTPResponse, newErr + 351   } + 352   + 353   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 354   if err != nil { + 355   newErr := datadog.GenericOpenAPIError{ + 356   ErrorBody: localVarBody, + 357   ErrorMessage: err.Error(), + 358   } + 359   return localVarReturnValue, localVarHTTPResponse, newErr + 360   } + 361   + 362   return localVarReturnValue, localVarHTTPResponse, nil + 363  } + 364   + 365  // DeleteMonitorOptionalParameters holds optional parameters for DeleteMonitor. + 366  type DeleteMonitorOptionalParameters struct { + 367   Force *string + 368  } + 369   + 370  // NewDeleteMonitorOptionalParameters creates an empty struct for parameters. + 371  func NewDeleteMonitorOptionalParameters() *DeleteMonitorOptionalParameters { + 372   this := DeleteMonitorOptionalParameters{} + 373   return &this + 374  } + 375   + 376  // WithForce sets the corresponding parameter name and returns the struct. + 377  func (r *DeleteMonitorOptionalParameters) WithForce(force string) *DeleteMonitorOptionalParameters { + 378   r.Force = &force + 379   return r + 380  } + 381   + 382  // DeleteMonitor Delete a monitor. + 383  // Delete the specified monitor + 384  func (a *MonitorsApi) DeleteMonitor(ctx _context.Context, monitorId int64, o ...DeleteMonitorOptionalParameters) (DeletedMonitor, *_nethttp.Response, error) { + 385   var ( + 386   localVarHTTPMethod = _nethttp.MethodDelete + 387   localVarPostBody interface{} + 388   localVarReturnValue DeletedMonitor + 389   optionalParams DeleteMonitorOptionalParameters + 390   ) + 391   + 392   if len(o) > 1 { + 393   return localVarReturnValue, nil, datadog.ReportError("only one argument of type DeleteMonitorOptionalParameters is allowed") + 394   } + 395   if len(o) == 1 { + 396   optionalParams = o[0] + 397   } + 398   + 399   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.DeleteMonitor") + 400   if err != nil { + 401   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 402   } + 403   + 404   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" + 405   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) + 406   + 407   localVarHeaderParams := make(map[string]string) + 408   localVarQueryParams := _neturl.Values{} + 409   localVarFormParams := _neturl.Values{} + 410   if optionalParams.Force != nil { + 411   localVarQueryParams.Add("force", datadog.ParameterToString(*optionalParams.Force, "")) + 412   } + 413   localVarHeaderParams["Accept"] = "application/json" + 414   + 415   datadog.SetAuthKeys( + 416   ctx, + 417   &localVarHeaderParams, + 418   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 419   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 420   ) + 421   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 422   if err != nil { + 423   return localVarReturnValue, nil, err + 424   } + 425   + 426   localVarHTTPResponse, err := a.Client.CallAPI(req) + 427   if err != nil || localVarHTTPResponse == nil { + 428   return localVarReturnValue, localVarHTTPResponse, err + 429   } + 430   + 431   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 432   if err != nil { + 433   return localVarReturnValue, localVarHTTPResponse, err + 434   } + 435   + 436   if localVarHTTPResponse.StatusCode >= 300 { + 437   newErr := datadog.GenericOpenAPIError{ + 438   ErrorBody: localVarBody, + 439   ErrorMessage: localVarHTTPResponse.Status, + 440   } + 441   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + 442   var v APIErrorResponse + 443   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 444   if err != nil { + 445   return localVarReturnValue, localVarHTTPResponse, newErr + 446   } + 447   newErr.ErrorModel = v + 448   } + 449   return localVarReturnValue, localVarHTTPResponse, newErr + 450   } + 451   + 452   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 453   if err != nil { + 454   newErr := datadog.GenericOpenAPIError{ + 455   ErrorBody: localVarBody, + 456   ErrorMessage: err.Error(), + 457   } + 458   return localVarReturnValue, localVarHTTPResponse, newErr + 459   } + 460   + 461   return localVarReturnValue, localVarHTTPResponse, nil + 462  } + 463   + 464  // GetMonitorOptionalParameters holds optional parameters for GetMonitor. + 465  type GetMonitorOptionalParameters struct { + 466   GroupStates *string + 467   WithDowntimes *bool + 468  } + 469   + 470  // NewGetMonitorOptionalParameters creates an empty struct for parameters. + 471  func NewGetMonitorOptionalParameters() *GetMonitorOptionalParameters { + 472   this := GetMonitorOptionalParameters{} + 473   return &this + 474  } + 475   + 476  // WithGroupStates sets the corresponding parameter name and returns the struct. + 477  func (r *GetMonitorOptionalParameters) WithGroupStates(groupStates string) *GetMonitorOptionalParameters { + 478   r.GroupStates = &groupStates + 479   return r + 480  } + 481   + 482  // WithWithDowntimes sets the corresponding parameter name and returns the struct. + 483  func (r *GetMonitorOptionalParameters) WithWithDowntimes(withDowntimes bool) *GetMonitorOptionalParameters { + 484   r.WithDowntimes = &withDowntimes + 485   return r + 486  } + 487   + 488  // GetMonitor Get a monitor's details. + 489  // Get details about the specified monitor from your organization. + 490  func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (Monitor, *_nethttp.Response, error) { + 491   var ( + 492   localVarHTTPMethod = _nethttp.MethodGet + 493   localVarPostBody interface{} + 494   localVarReturnValue Monitor + 495   optionalParams GetMonitorOptionalParameters + 496   ) + 497   + 498   if len(o) > 1 { + 499   return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetMonitorOptionalParameters is allowed") + 500   } + 501   if len(o) == 1 { + 502   optionalParams = o[0] + 503   } + 504   + 505   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.GetMonitor") + 506   if err != nil { + 507   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 508   } + 509   + 510   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" + 511   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) + 512   + 513   localVarHeaderParams := make(map[string]string) + 514   localVarQueryParams := _neturl.Values{} + 515   localVarFormParams := _neturl.Values{} + 516   if optionalParams.GroupStates != nil { + 517   localVarQueryParams.Add("group_states", datadog.ParameterToString(*optionalParams.GroupStates, "")) + 518   } + 519   if optionalParams.WithDowntimes != nil { + 520   localVarQueryParams.Add("with_downtimes", datadog.ParameterToString(*optionalParams.WithDowntimes, "")) + 521   } + 522   localVarHeaderParams["Accept"] = "application/json" + 523   + 524   datadog.SetAuthKeys( + 525   ctx, + 526   &localVarHeaderParams, + 527   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 528   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 529   ) + 530   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 531   if err != nil { + 532   return localVarReturnValue, nil, err + 533   } + 534   + 535   localVarHTTPResponse, err := a.Client.CallAPI(req) + 536   if err != nil || localVarHTTPResponse == nil { + 537   return localVarReturnValue, localVarHTTPResponse, err + 538   } + 539   + 540   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 541   if err != nil { + 542   return localVarReturnValue, localVarHTTPResponse, err + 543   } + 544   + 545   if localVarHTTPResponse.StatusCode >= 300 { + 546   newErr := datadog.GenericOpenAPIError{ + 547   ErrorBody: localVarBody, + 548   ErrorMessage: localVarHTTPResponse.Status, + 549   } + 550   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + 551   var v APIErrorResponse + 552   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 553   if err != nil { + 554   return localVarReturnValue, localVarHTTPResponse, newErr + 555   } + 556   newErr.ErrorModel = v + 557   } + 558   return localVarReturnValue, localVarHTTPResponse, newErr + 559   } + 560   + 561   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 562   if err != nil { + 563   newErr := datadog.GenericOpenAPIError{ + 564   ErrorBody: localVarBody, + 565   ErrorMessage: err.Error(), + 566   } + 567   return localVarReturnValue, localVarHTTPResponse, newErr + 568   } + 569   + 570   return localVarReturnValue, localVarHTTPResponse, nil + 571  } + 572   + 573  // ListMonitorsOptionalParameters holds optional parameters for ListMonitors. + 574  type ListMonitorsOptionalParameters struct { + 575   GroupStates *string + 576   Name *string + 577   Tags *string + 578   MonitorTags *string + 579   WithDowntimes *bool + 580   IdOffset *int64 + 581   Page *int64 + 582   PageSize *int32 + 583  } + 584   + 585  // NewListMonitorsOptionalParameters creates an empty struct for parameters. + 586  func NewListMonitorsOptionalParameters() *ListMonitorsOptionalParameters { + 587   this := ListMonitorsOptionalParameters{} + 588   return &this + 589  } + 590   + 591  // WithGroupStates sets the corresponding parameter name and returns the struct. + 592  func (r *ListMonitorsOptionalParameters) WithGroupStates(groupStates string) *ListMonitorsOptionalParameters { + 593   r.GroupStates = &groupStates + 594   return r + 595  } + 596   + 597  // WithName sets the corresponding parameter name and returns the struct. + 598  func (r *ListMonitorsOptionalParameters) WithName(name string) *ListMonitorsOptionalParameters { + 599   r.Name = &name + 600   return r + 601  } + 602   + 603  // WithTags sets the corresponding parameter name and returns the struct. + 604  func (r *ListMonitorsOptionalParameters) WithTags(tags string) *ListMonitorsOptionalParameters { + 605   r.Tags = &tags + 606   return r + 607  } + 608   + 609  // WithMonitorTags sets the corresponding parameter name and returns the struct. + 610  func (r *ListMonitorsOptionalParameters) WithMonitorTags(monitorTags string) *ListMonitorsOptionalParameters { + 611   r.MonitorTags = &monitorTags + 612   return r + 613  } + 614   + 615  // WithWithDowntimes sets the corresponding parameter name and returns the struct. + 616  func (r *ListMonitorsOptionalParameters) WithWithDowntimes(withDowntimes bool) *ListMonitorsOptionalParameters { + 617   r.WithDowntimes = &withDowntimes + 618   return r + 619  } + 620   + 621  // WithIdOffset sets the corresponding parameter name and returns the struct. + 622  func (r *ListMonitorsOptionalParameters) WithIdOffset(idOffset int64) *ListMonitorsOptionalParameters { + 623   r.IdOffset = &idOffset + 624   return r + 625  } + 626   + 627  // WithPage sets the corresponding parameter name and returns the struct. + 628  func (r *ListMonitorsOptionalParameters) WithPage(page int64) *ListMonitorsOptionalParameters { + 629   r.Page = &page + 630   return r + 631  } + 632   + 633  // WithPageSize sets the corresponding parameter name and returns the struct. + 634  func (r *ListMonitorsOptionalParameters) WithPageSize(pageSize int32) *ListMonitorsOptionalParameters { + 635   r.PageSize = &pageSize + 636   return r + 637  } + 638   + 639  // ListMonitors Get all monitor details. + 640  // Get details about the specified monitor from your organization. + 641  func (a *MonitorsApi) ListMonitors(ctx _context.Context, o ...ListMonitorsOptionalParameters) ([]Monitor, *_nethttp.Response, error) { + 642   var ( + 643   localVarHTTPMethod = _nethttp.MethodGet + 644   localVarPostBody interface{} + 645   localVarReturnValue []Monitor + 646   optionalParams ListMonitorsOptionalParameters + 647   ) + 648   + 649   if len(o) > 1 { + 650   return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListMonitorsOptionalParameters is allowed") + 651   } + 652   if len(o) == 1 { + 653   optionalParams = o[0] + 654   } + 655   + 656   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.ListMonitors") + 657   if err != nil { + 658   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 659   } 660   - 661   localVarHeaderParams := make(map[string]string) - 662   localVarQueryParams := _neturl.Values{} - 663   localVarFormParams := _neturl.Values{} - 664   if optionalParams.GroupStates != nil { - 665   localVarQueryParams.Add("group_states", datadog.ParameterToString(*optionalParams.GroupStates, "")) - 666   } - 667   if optionalParams.Name != nil { - 668   localVarQueryParams.Add("name", datadog.ParameterToString(*optionalParams.Name, "")) - 669   } - 670   if optionalParams.Tags != nil { - 671   localVarQueryParams.Add("tags", datadog.ParameterToString(*optionalParams.Tags, "")) - 672   } - 673   if optionalParams.MonitorTags != nil { - 674   localVarQueryParams.Add("monitor_tags", datadog.ParameterToString(*optionalParams.MonitorTags, "")) - 675   } - 676   if optionalParams.WithDowntimes != nil { - 677   localVarQueryParams.Add("with_downtimes", datadog.ParameterToString(*optionalParams.WithDowntimes, "")) - 678   } - 679   if optionalParams.IdOffset != nil { - 680   localVarQueryParams.Add("id_offset", datadog.ParameterToString(*optionalParams.IdOffset, "")) - 681   } - 682   if optionalParams.Page != nil { - 683   localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, "")) - 684   } - 685   if optionalParams.PageSize != nil { - 686   localVarQueryParams.Add("page_size", datadog.ParameterToString(*optionalParams.PageSize, "")) - 687   } - 688   localVarHeaderParams["Accept"] = "application/json" - 689   - 690   datadog.SetAuthKeys( - 691   ctx, - 692   &localVarHeaderParams, - 693   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 694   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 695   ) - 696   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 697   if err != nil { - 698   return localVarReturnValue, nil, err - 699   } - 700   - 701   localVarHTTPResponse, err := a.Client.CallAPI(req) - 702   if err != nil || localVarHTTPResponse == nil { - 703   return localVarReturnValue, localVarHTTPResponse, err - 704   } - 705   - 706   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 707   if err != nil { - 708   return localVarReturnValue, localVarHTTPResponse, err - 709   } - 710   - 711   if localVarHTTPResponse.StatusCode >= 300 { - 712   newErr := datadog.GenericOpenAPIError{ - 713   ErrorBody: localVarBody, - 714   ErrorMessage: localVarHTTPResponse.Status, - 715   } - 716   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - 717   var v APIErrorResponse - 718   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 719   if err != nil { - 720   return localVarReturnValue, localVarHTTPResponse, newErr - 721   } - 722   newErr.ErrorModel = v - 723   } - 724   return localVarReturnValue, localVarHTTPResponse, newErr - 725   } - 726   - 727   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 728   if err != nil { - 729   newErr := datadog.GenericOpenAPIError{ - 730   ErrorBody: localVarBody, - 731   ErrorMessage: err.Error(), - 732   } - 733   return localVarReturnValue, localVarHTTPResponse, newErr - 734   } - 735   - 736   return localVarReturnValue, localVarHTTPResponse, nil - 737  } - 738   - 739  // ListMonitorsWithPagination provides a paginated version of ListMonitors returning a channel with all items. - 740  func (a *MonitorsApi) ListMonitorsWithPagination(ctx _context.Context, o ...ListMonitorsOptionalParameters) (<-chan datadog.PaginationResult[Monitor], func()) { - 741   ctx, cancel := _context.WithCancel(ctx) - 742   pageSize_ := int32(100) - 743   if len(o) == 0 { - 744   o = append(o, ListMonitorsOptionalParameters{}) - 745   } - 746   if o[0].PageSize != nil { - 747   pageSize_ = *o[0].PageSize - 748   } - 749   o[0].PageSize = &pageSize_ - 750   page_ := int64(0) - 751   o[0].Page = &page_ - 752   - 753   items := make(chan datadog.PaginationResult[Monitor], pageSize_) - 754   go func() { - 755   for { - 756   resp, _, err := a.ListMonitors(ctx, o...) - 757   if err != nil { - 758   var returnItem Monitor - 759   items <- datadog.PaginationResult[Monitor]{Item: returnItem, Error: err} - 760   break - 761   } - 762   results := resp - 763   - 764   for _, item := range results { - 765   select { - 766   case items <- datadog.PaginationResult[Monitor]{Item: item, Error: nil}: - 767   case <-ctx.Done(): - 768   close(items) - 769   return - 770   } - 771   } - 772   if len(results) < int(pageSize_) { - 773   break - 774   } - 775   pageOffset_ := *o[0].Page + 1 - 776   o[0].Page = &pageOffset_ - 777   } - 778   close(items) - 779   }() - 780   return items, cancel - 781  } - 782   - 783  // SearchMonitorGroupsOptionalParameters holds optional parameters for SearchMonitorGroups. - 784  type SearchMonitorGroupsOptionalParameters struct { - 785   Query *string - 786   Page *int64 - 787   PerPage *int64 - 788   Sort *string - 789  } - 790   - 791  // NewSearchMonitorGroupsOptionalParameters creates an empty struct for parameters. - 792  func NewSearchMonitorGroupsOptionalParameters() *SearchMonitorGroupsOptionalParameters { - 793   this := SearchMonitorGroupsOptionalParameters{} - 794   return &this - 795  } - 796   - 797  // WithQuery sets the corresponding parameter name and returns the struct. - 798  func (r *SearchMonitorGroupsOptionalParameters) WithQuery(query string) *SearchMonitorGroupsOptionalParameters { - 799   r.Query = &query - 800   return r - 801  } - 802   - 803  // WithPage sets the corresponding parameter name and returns the struct. - 804  func (r *SearchMonitorGroupsOptionalParameters) WithPage(page int64) *SearchMonitorGroupsOptionalParameters { - 805   r.Page = &page - 806   return r - 807  } - 808   - 809  // WithPerPage sets the corresponding parameter name and returns the struct. - 810  func (r *SearchMonitorGroupsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorGroupsOptionalParameters { - 811   r.PerPage = &perPage - 812   return r - 813  } - 814   - 815  // WithSort sets the corresponding parameter name and returns the struct. - 816  func (r *SearchMonitorGroupsOptionalParameters) WithSort(sort string) *SearchMonitorGroupsOptionalParameters { - 817   r.Sort = &sort - 818   return r - 819  } - 820   - 821  // SearchMonitorGroups Monitors group search. - 822  // Search and filter your monitor groups details. - 823  func (a *MonitorsApi) SearchMonitorGroups(ctx _context.Context, o ...SearchMonitorGroupsOptionalParameters) (MonitorGroupSearchResponse, *_nethttp.Response, error) { - 824   var ( - 825   localVarHTTPMethod = _nethttp.MethodGet - 826   localVarPostBody interface{} - 827   localVarReturnValue MonitorGroupSearchResponse - 828   optionalParams SearchMonitorGroupsOptionalParameters - 829   ) - 830   - 831   if len(o) > 1 { - 832   return localVarReturnValue, nil, datadog.ReportError("only one argument of type SearchMonitorGroupsOptionalParameters is allowed") - 833   } - 834   if len(o) == 1 { - 835   optionalParams = o[0] - 836   } - 837   - 838   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.SearchMonitorGroups") - 839   if err != nil { - 840   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 841   } - 842   - 843   localVarPath := localBasePath + "/api/v1/monitor/groups/search" + 661   localVarPath := localBasePath + "/api/v1/monitor" + 662   + 663   localVarHeaderParams := make(map[string]string) + 664   localVarQueryParams := _neturl.Values{} + 665   localVarFormParams := _neturl.Values{} + 666   if optionalParams.GroupStates != nil { + 667   localVarQueryParams.Add("group_states", datadog.ParameterToString(*optionalParams.GroupStates, "")) + 668   } + 669   if optionalParams.Name != nil { + 670   localVarQueryParams.Add("name", datadog.ParameterToString(*optionalParams.Name, "")) + 671   } + 672   if optionalParams.Tags != nil { + 673   localVarQueryParams.Add("tags", datadog.ParameterToString(*optionalParams.Tags, "")) + 674   } + 675   if optionalParams.MonitorTags != nil { + 676   localVarQueryParams.Add("monitor_tags", datadog.ParameterToString(*optionalParams.MonitorTags, "")) + 677   } + 678   if optionalParams.WithDowntimes != nil { + 679   localVarQueryParams.Add("with_downtimes", datadog.ParameterToString(*optionalParams.WithDowntimes, "")) + 680   } + 681   if optionalParams.IdOffset != nil { + 682   localVarQueryParams.Add("id_offset", datadog.ParameterToString(*optionalParams.IdOffset, "")) + 683   } + 684   if optionalParams.Page != nil { + 685   localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, "")) + 686   } + 687   if optionalParams.PageSize != nil { + 688   localVarQueryParams.Add("page_size", datadog.ParameterToString(*optionalParams.PageSize, "")) + 689   } + 690   localVarHeaderParams["Accept"] = "application/json" + 691   + 692   datadog.SetAuthKeys( + 693   ctx, + 694   &localVarHeaderParams, + 695   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 696   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 697   ) + 698   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 699   if err != nil { + 700   return localVarReturnValue, nil, err + 701   } + 702   + 703   localVarHTTPResponse, err := a.Client.CallAPI(req) + 704   if err != nil || localVarHTTPResponse == nil { + 705   return localVarReturnValue, localVarHTTPResponse, err + 706   } + 707   + 708   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 709   if err != nil { + 710   return localVarReturnValue, localVarHTTPResponse, err + 711   } + 712   + 713   if localVarHTTPResponse.StatusCode >= 300 { + 714   newErr := datadog.GenericOpenAPIError{ + 715   ErrorBody: localVarBody, + 716   ErrorMessage: localVarHTTPResponse.Status, + 717   } + 718   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + 719   var v APIErrorResponse + 720   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 721   if err != nil { + 722   return localVarReturnValue, localVarHTTPResponse, newErr + 723   } + 724   newErr.ErrorModel = v + 725   } + 726   return localVarReturnValue, localVarHTTPResponse, newErr + 727   } + 728   + 729   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 730   if err != nil { + 731   newErr := datadog.GenericOpenAPIError{ + 732   ErrorBody: localVarBody, + 733   ErrorMessage: err.Error(), + 734   } + 735   return localVarReturnValue, localVarHTTPResponse, newErr + 736   } + 737   + 738   return localVarReturnValue, localVarHTTPResponse, nil + 739  } + 740   + 741  // ListMonitorsWithPagination provides a paginated version of ListMonitors returning a channel with all items. + 742  func (a *MonitorsApi) ListMonitorsWithPagination(ctx _context.Context, o ...ListMonitorsOptionalParameters) (<-chan datadog.PaginationResult[Monitor], func()) { + 743   ctx, cancel := _context.WithCancel(ctx) + 744   pageSize_ := int32(100) + 745   if len(o) == 0 { + 746   o = append(o, ListMonitorsOptionalParameters{}) + 747   } + 748   if o[0].PageSize != nil { + 749   pageSize_ = *o[0].PageSize + 750   } + 751   o[0].PageSize = &pageSize_ + 752   page_ := int64(0) + 753   o[0].Page = &page_ + 754   + 755   items := make(chan datadog.PaginationResult[Monitor], pageSize_) + 756   go func() { + 757   for { + 758   resp, _, err := a.ListMonitors(ctx, o...) + 759   if err != nil { + 760   var returnItem Monitor + 761   items <- datadog.PaginationResult[Monitor]{Item: returnItem, Error: err} + 762   break + 763   } + 764   results := resp + 765   + 766   for _, item := range results { + 767   select { + 768   case items <- datadog.PaginationResult[Monitor]{Item: item, Error: nil}: + 769   case <-ctx.Done(): + 770   close(items) + 771   return + 772   } + 773   } + 774   if len(results) < int(pageSize_) { + 775   break + 776   } + 777   pageOffset_ := *o[0].Page + 1 + 778   o[0].Page = &pageOffset_ + 779   } + 780   close(items) + 781   }() + 782   return items, cancel + 783  } + 784   + 785  // SearchMonitorGroupsOptionalParameters holds optional parameters for SearchMonitorGroups. + 786  type SearchMonitorGroupsOptionalParameters struct { + 787   Query *string + 788   Page *int64 + 789   PerPage *int64 + 790   Sort *string + 791  } + 792   + 793  // NewSearchMonitorGroupsOptionalParameters creates an empty struct for parameters. + 794  func NewSearchMonitorGroupsOptionalParameters() *SearchMonitorGroupsOptionalParameters { + 795   this := SearchMonitorGroupsOptionalParameters{} + 796   return &this + 797  } + 798   + 799  // WithQuery sets the corresponding parameter name and returns the struct. + 800  func (r *SearchMonitorGroupsOptionalParameters) WithQuery(query string) *SearchMonitorGroupsOptionalParameters { + 801   r.Query = &query + 802   return r + 803  } + 804   + 805  // WithPage sets the corresponding parameter name and returns the struct. + 806  func (r *SearchMonitorGroupsOptionalParameters) WithPage(page int64) *SearchMonitorGroupsOptionalParameters { + 807   r.Page = &page + 808   return r + 809  } + 810   + 811  // WithPerPage sets the corresponding parameter name and returns the struct. + 812  func (r *SearchMonitorGroupsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorGroupsOptionalParameters { + 813   r.PerPage = &perPage + 814   return r + 815  } + 816   + 817  // WithSort sets the corresponding parameter name and returns the struct. + 818  func (r *SearchMonitorGroupsOptionalParameters) WithSort(sort string) *SearchMonitorGroupsOptionalParameters { + 819   r.Sort = &sort + 820   return r + 821  } + 822   + 823  // SearchMonitorGroups Monitors group search. + 824  // Search and filter your monitor groups details. + 825  func (a *MonitorsApi) SearchMonitorGroups(ctx _context.Context, o ...SearchMonitorGroupsOptionalParameters) (MonitorGroupSearchResponse, *_nethttp.Response, error) { + 826   var ( + 827   localVarHTTPMethod = _nethttp.MethodGet + 828   localVarPostBody interface{} + 829   localVarReturnValue MonitorGroupSearchResponse + 830   optionalParams SearchMonitorGroupsOptionalParameters + 831   ) + 832   + 833   if len(o) > 1 { + 834   return localVarReturnValue, nil, datadog.ReportError("only one argument of type SearchMonitorGroupsOptionalParameters is allowed") + 835   } + 836   if len(o) == 1 { + 837   optionalParams = o[0] + 838   } + 839   + 840   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.SearchMonitorGroups") + 841   if err != nil { + 842   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 843   } 844   - 845   localVarHeaderParams := make(map[string]string) - 846   localVarQueryParams := _neturl.Values{} - 847   localVarFormParams := _neturl.Values{} - 848   if optionalParams.Query != nil { - 849   localVarQueryParams.Add("query", datadog.ParameterToString(*optionalParams.Query, "")) - 850   } - 851   if optionalParams.Page != nil { - 852   localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, "")) - 853   } - 854   if optionalParams.PerPage != nil { - 855   localVarQueryParams.Add("per_page", datadog.ParameterToString(*optionalParams.PerPage, "")) - 856   } - 857   if optionalParams.Sort != nil { - 858   localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) - 859   } - 860   localVarHeaderParams["Accept"] = "application/json" - 861   - 862   datadog.SetAuthKeys( - 863   ctx, - 864   &localVarHeaderParams, - 865   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 866   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 867   ) - 868   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 869   if err != nil { - 870   return localVarReturnValue, nil, err - 871   } - 872   - 873   localVarHTTPResponse, err := a.Client.CallAPI(req) - 874   if err != nil || localVarHTTPResponse == nil { - 875   return localVarReturnValue, localVarHTTPResponse, err - 876   } - 877   - 878   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 879   if err != nil { - 880   return localVarReturnValue, localVarHTTPResponse, err - 881   } - 882   - 883   if localVarHTTPResponse.StatusCode >= 300 { - 884   newErr := datadog.GenericOpenAPIError{ - 885   ErrorBody: localVarBody, - 886   ErrorMessage: localVarHTTPResponse.Status, - 887   } - 888   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - 889   var v APIErrorResponse - 890   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 891   if err != nil { - 892   return localVarReturnValue, localVarHTTPResponse, newErr - 893   } - 894   newErr.ErrorModel = v - 895   } - 896   return localVarReturnValue, localVarHTTPResponse, newErr - 897   } - 898   - 899   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 900   if err != nil { - 901   newErr := datadog.GenericOpenAPIError{ - 902   ErrorBody: localVarBody, - 903   ErrorMessage: err.Error(), - 904   } - 905   return localVarReturnValue, localVarHTTPResponse, newErr - 906   } - 907   - 908   return localVarReturnValue, localVarHTTPResponse, nil - 909  } - 910   - 911  // SearchMonitorsOptionalParameters holds optional parameters for SearchMonitors. - 912  type SearchMonitorsOptionalParameters struct { - 913   Query *string - 914   Page *int64 - 915   PerPage *int64 - 916   Sort *string - 917  } - 918   - 919  // NewSearchMonitorsOptionalParameters creates an empty struct for parameters. - 920  func NewSearchMonitorsOptionalParameters() *SearchMonitorsOptionalParameters { - 921   this := SearchMonitorsOptionalParameters{} - 922   return &this - 923  } - 924   - 925  // WithQuery sets the corresponding parameter name and returns the struct. - 926  func (r *SearchMonitorsOptionalParameters) WithQuery(query string) *SearchMonitorsOptionalParameters { - 927   r.Query = &query - 928   return r - 929  } - 930   - 931  // WithPage sets the corresponding parameter name and returns the struct. - 932  func (r *SearchMonitorsOptionalParameters) WithPage(page int64) *SearchMonitorsOptionalParameters { - 933   r.Page = &page - 934   return r - 935  } - 936   - 937  // WithPerPage sets the corresponding parameter name and returns the struct. - 938  func (r *SearchMonitorsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorsOptionalParameters { - 939   r.PerPage = &perPage - 940   return r - 941  } - 942   - 943  // WithSort sets the corresponding parameter name and returns the struct. - 944  func (r *SearchMonitorsOptionalParameters) WithSort(sort string) *SearchMonitorsOptionalParameters { - 945   r.Sort = &sort - 946   return r - 947  } - 948   - 949  // SearchMonitors Monitors search. - 950  // Search and filter your monitors details. - 951  func (a *MonitorsApi) SearchMonitors(ctx _context.Context, o ...SearchMonitorsOptionalParameters) (MonitorSearchResponse, *_nethttp.Response, error) { - 952   var ( - 953   localVarHTTPMethod = _nethttp.MethodGet - 954   localVarPostBody interface{} - 955   localVarReturnValue MonitorSearchResponse - 956   optionalParams SearchMonitorsOptionalParameters - 957   ) - 958   - 959   if len(o) > 1 { - 960   return localVarReturnValue, nil, datadog.ReportError("only one argument of type SearchMonitorsOptionalParameters is allowed") - 961   } - 962   if len(o) == 1 { - 963   optionalParams = o[0] - 964   } - 965   - 966   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.SearchMonitors") - 967   if err != nil { - 968   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 969   } - 970   - 971   localVarPath := localBasePath + "/api/v1/monitor/search" + 845   localVarPath := localBasePath + "/api/v1/monitor/groups/search" + 846   + 847   localVarHeaderParams := make(map[string]string) + 848   localVarQueryParams := _neturl.Values{} + 849   localVarFormParams := _neturl.Values{} + 850   if optionalParams.Query != nil { + 851   localVarQueryParams.Add("query", datadog.ParameterToString(*optionalParams.Query, "")) + 852   } + 853   if optionalParams.Page != nil { + 854   localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, "")) + 855   } + 856   if optionalParams.PerPage != nil { + 857   localVarQueryParams.Add("per_page", datadog.ParameterToString(*optionalParams.PerPage, "")) + 858   } + 859   if optionalParams.Sort != nil { + 860   localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) + 861   } + 862   localVarHeaderParams["Accept"] = "application/json" + 863   + 864   datadog.SetAuthKeys( + 865   ctx, + 866   &localVarHeaderParams, + 867   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 868   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 869   ) + 870   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 871   if err != nil { + 872   return localVarReturnValue, nil, err + 873   } + 874   + 875   localVarHTTPResponse, err := a.Client.CallAPI(req) + 876   if err != nil || localVarHTTPResponse == nil { + 877   return localVarReturnValue, localVarHTTPResponse, err + 878   } + 879   + 880   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 881   if err != nil { + 882   return localVarReturnValue, localVarHTTPResponse, err + 883   } + 884   + 885   if localVarHTTPResponse.StatusCode >= 300 { + 886   newErr := datadog.GenericOpenAPIError{ + 887   ErrorBody: localVarBody, + 888   ErrorMessage: localVarHTTPResponse.Status, + 889   } + 890   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + 891   var v APIErrorResponse + 892   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 893   if err != nil { + 894   return localVarReturnValue, localVarHTTPResponse, newErr + 895   } + 896   newErr.ErrorModel = v + 897   } + 898   return localVarReturnValue, localVarHTTPResponse, newErr + 899   } + 900   + 901   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 902   if err != nil { + 903   newErr := datadog.GenericOpenAPIError{ + 904   ErrorBody: localVarBody, + 905   ErrorMessage: err.Error(), + 906   } + 907   return localVarReturnValue, localVarHTTPResponse, newErr + 908   } + 909   + 910   return localVarReturnValue, localVarHTTPResponse, nil + 911  } + 912   + 913  // SearchMonitorsOptionalParameters holds optional parameters for SearchMonitors. + 914  type SearchMonitorsOptionalParameters struct { + 915   Query *string + 916   Page *int64 + 917   PerPage *int64 + 918   Sort *string + 919  } + 920   + 921  // NewSearchMonitorsOptionalParameters creates an empty struct for parameters. + 922  func NewSearchMonitorsOptionalParameters() *SearchMonitorsOptionalParameters { + 923   this := SearchMonitorsOptionalParameters{} + 924   return &this + 925  } + 926   + 927  // WithQuery sets the corresponding parameter name and returns the struct. + 928  func (r *SearchMonitorsOptionalParameters) WithQuery(query string) *SearchMonitorsOptionalParameters { + 929   r.Query = &query + 930   return r + 931  } + 932   + 933  // WithPage sets the corresponding parameter name and returns the struct. + 934  func (r *SearchMonitorsOptionalParameters) WithPage(page int64) *SearchMonitorsOptionalParameters { + 935   r.Page = &page + 936   return r + 937  } + 938   + 939  // WithPerPage sets the corresponding parameter name and returns the struct. + 940  func (r *SearchMonitorsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorsOptionalParameters { + 941   r.PerPage = &perPage + 942   return r + 943  } + 944   + 945  // WithSort sets the corresponding parameter name and returns the struct. + 946  func (r *SearchMonitorsOptionalParameters) WithSort(sort string) *SearchMonitorsOptionalParameters { + 947   r.Sort = &sort + 948   return r + 949  } + 950   + 951  // SearchMonitors Monitors search. + 952  // Search and filter your monitors details. + 953  func (a *MonitorsApi) SearchMonitors(ctx _context.Context, o ...SearchMonitorsOptionalParameters) (MonitorSearchResponse, *_nethttp.Response, error) { + 954   var ( + 955   localVarHTTPMethod = _nethttp.MethodGet + 956   localVarPostBody interface{} + 957   localVarReturnValue MonitorSearchResponse + 958   optionalParams SearchMonitorsOptionalParameters + 959   ) + 960   + 961   if len(o) > 1 { + 962   return localVarReturnValue, nil, datadog.ReportError("only one argument of type SearchMonitorsOptionalParameters is allowed") + 963   } + 964   if len(o) == 1 { + 965   optionalParams = o[0] + 966   } + 967   + 968   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.SearchMonitors") + 969   if err != nil { + 970   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 971   } 972   - 973   localVarHeaderParams := make(map[string]string) - 974   localVarQueryParams := _neturl.Values{} - 975   localVarFormParams := _neturl.Values{} - 976   if optionalParams.Query != nil { - 977   localVarQueryParams.Add("query", datadog.ParameterToString(*optionalParams.Query, "")) - 978   } - 979   if optionalParams.Page != nil { - 980   localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, "")) - 981   } - 982   if optionalParams.PerPage != nil { - 983   localVarQueryParams.Add("per_page", datadog.ParameterToString(*optionalParams.PerPage, "")) - 984   } - 985   if optionalParams.Sort != nil { - 986   localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) - 987   } - 988   localVarHeaderParams["Accept"] = "application/json" - 989   - 990   datadog.SetAuthKeys( - 991   ctx, - 992   &localVarHeaderParams, - 993   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 994   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 995   ) - 996   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 997   if err != nil { - 998   return localVarReturnValue, nil, err - 999   } - 1000   - 1001   localVarHTTPResponse, err := a.Client.CallAPI(req) - 1002   if err != nil || localVarHTTPResponse == nil { - 1003   return localVarReturnValue, localVarHTTPResponse, err - 1004   } - 1005   - 1006   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 1007   if err != nil { - 1008   return localVarReturnValue, localVarHTTPResponse, err - 1009   } - 1010   - 1011   if localVarHTTPResponse.StatusCode >= 300 { - 1012   newErr := datadog.GenericOpenAPIError{ - 1013   ErrorBody: localVarBody, - 1014   ErrorMessage: localVarHTTPResponse.Status, - 1015   } - 1016   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - 1017   var v APIErrorResponse - 1018   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1019   if err != nil { - 1020   return localVarReturnValue, localVarHTTPResponse, newErr - 1021   } - 1022   newErr.ErrorModel = v - 1023   } - 1024   return localVarReturnValue, localVarHTTPResponse, newErr - 1025   } - 1026   - 1027   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1028   if err != nil { - 1029   newErr := datadog.GenericOpenAPIError{ - 1030   ErrorBody: localVarBody, - 1031   ErrorMessage: err.Error(), - 1032   } - 1033   return localVarReturnValue, localVarHTTPResponse, newErr - 1034   } - 1035   - 1036   return localVarReturnValue, localVarHTTPResponse, nil - 1037  } - 1038   - 1039  // UpdateMonitor Edit a monitor. - 1040  // Edit the specified monitor. - 1041  func (a *MonitorsApi) UpdateMonitor(ctx _context.Context, monitorId int64, body MonitorUpdateRequest) (Monitor, *_nethttp.Response, error) { - 1042   var ( - 1043   localVarHTTPMethod = _nethttp.MethodPut - 1044   localVarPostBody interface{} - 1045   localVarReturnValue Monitor - 1046   ) - 1047   - 1048   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.UpdateMonitor") - 1049   if err != nil { - 1050   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 1051   } - 1052   - 1053   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" - 1054   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) - 1055   - 1056   localVarHeaderParams := make(map[string]string) - 1057   localVarQueryParams := _neturl.Values{} - 1058   localVarFormParams := _neturl.Values{} - 1059   localVarHeaderParams["Content-Type"] = "application/json" - 1060   localVarHeaderParams["Accept"] = "application/json" - 1061   - 1062   // body params - 1063   localVarPostBody = &body - 1064   datadog.SetAuthKeys( - 1065   ctx, - 1066   &localVarHeaderParams, - 1067   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 1068   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 1069   ) - 1070   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 1071   if err != nil { - 1072   return localVarReturnValue, nil, err - 1073   } - 1074   - 1075   localVarHTTPResponse, err := a.Client.CallAPI(req) - 1076   if err != nil || localVarHTTPResponse == nil { - 1077   return localVarReturnValue, localVarHTTPResponse, err - 1078   } - 1079   - 1080   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 1081   if err != nil { - 1082   return localVarReturnValue, localVarHTTPResponse, err - 1083   } - 1084   - 1085   if localVarHTTPResponse.StatusCode >= 300 { - 1086   newErr := datadog.GenericOpenAPIError{ - 1087   ErrorBody: localVarBody, - 1088   ErrorMessage: localVarHTTPResponse.Status, - 1089   } - 1090   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { - 1091   var v APIErrorResponse - 1092   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1093   if err != nil { - 1094   return localVarReturnValue, localVarHTTPResponse, newErr - 1095   } - 1096   newErr.ErrorModel = v - 1097   } - 1098   return localVarReturnValue, localVarHTTPResponse, newErr - 1099   } - 1100   - 1101   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1102   if err != nil { - 1103   newErr := datadog.GenericOpenAPIError{ - 1104   ErrorBody: localVarBody, - 1105   ErrorMessage: err.Error(), - 1106   } - 1107   return localVarReturnValue, localVarHTTPResponse, newErr - 1108   } - 1109   - 1110   return localVarReturnValue, localVarHTTPResponse, nil - 1111  } - 1112   - 1113  // ValidateExistingMonitor Validate an existing monitor. - 1114  // Validate the monitor provided in the request. - 1115  func (a *MonitorsApi) ValidateExistingMonitor(ctx _context.Context, monitorId int64, body Monitor) (interface{}, *_nethttp.Response, error) { - 1116   var ( - 1117   localVarHTTPMethod = _nethttp.MethodPost - 1118   localVarPostBody interface{} - 1119   localVarReturnValue interface{} - 1120   ) - 1121   - 1122   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.ValidateExistingMonitor") - 1123   if err != nil { - 1124   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 1125   } - 1126   - 1127   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/validate" - 1128   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) - 1129   - 1130   localVarHeaderParams := make(map[string]string) - 1131   localVarQueryParams := _neturl.Values{} - 1132   localVarFormParams := _neturl.Values{} - 1133   localVarHeaderParams["Content-Type"] = "application/json" - 1134   localVarHeaderParams["Accept"] = "application/json" - 1135   - 1136   // body params - 1137   localVarPostBody = &body - 1138   datadog.SetAuthKeys( - 1139   ctx, - 1140   &localVarHeaderParams, - 1141   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 1142   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 1143   ) - 1144   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 1145   if err != nil { - 1146   return localVarReturnValue, nil, err - 1147   } - 1148   - 1149   localVarHTTPResponse, err := a.Client.CallAPI(req) - 1150   if err != nil || localVarHTTPResponse == nil { - 1151   return localVarReturnValue, localVarHTTPResponse, err - 1152   } - 1153   - 1154   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 1155   if err != nil { - 1156   return localVarReturnValue, localVarHTTPResponse, err - 1157   } - 1158   - 1159   if localVarHTTPResponse.StatusCode >= 300 { - 1160   newErr := datadog.GenericOpenAPIError{ - 1161   ErrorBody: localVarBody, - 1162   ErrorMessage: localVarHTTPResponse.Status, - 1163   } - 1164   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - 1165   var v APIErrorResponse - 1166   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1167   if err != nil { - 1168   return localVarReturnValue, localVarHTTPResponse, newErr - 1169   } - 1170   newErr.ErrorModel = v - 1171   } - 1172   return localVarReturnValue, localVarHTTPResponse, newErr - 1173   } - 1174   - 1175   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1176   if err != nil { - 1177   newErr := datadog.GenericOpenAPIError{ - 1178   ErrorBody: localVarBody, - 1179   ErrorMessage: err.Error(), - 1180   } - 1181   return localVarReturnValue, localVarHTTPResponse, newErr - 1182   } - 1183   - 1184   return localVarReturnValue, localVarHTTPResponse, nil - 1185  } - 1186   - 1187  // ValidateMonitor Validate a monitor. - 1188  // Validate the monitor provided in the request. - 1189  // - 1190  // **Note**: Log monitors require an unscoped App Key. - 1191  func (a *MonitorsApi) ValidateMonitor(ctx _context.Context, body Monitor) (interface{}, *_nethttp.Response, error) { - 1192   var ( - 1193   localVarHTTPMethod = _nethttp.MethodPost - 1194   localVarPostBody interface{} - 1195   localVarReturnValue interface{} - 1196   ) - 1197   - 1198   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.ValidateMonitor") - 1199   if err != nil { - 1200   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - 1201   } - 1202   - 1203   localVarPath := localBasePath + "/api/v1/monitor/validate" + 973   localVarPath := localBasePath + "/api/v1/monitor/search" + 974   + 975   localVarHeaderParams := make(map[string]string) + 976   localVarQueryParams := _neturl.Values{} + 977   localVarFormParams := _neturl.Values{} + 978   if optionalParams.Query != nil { + 979   localVarQueryParams.Add("query", datadog.ParameterToString(*optionalParams.Query, "")) + 980   } + 981   if optionalParams.Page != nil { + 982   localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, "")) + 983   } + 984   if optionalParams.PerPage != nil { + 985   localVarQueryParams.Add("per_page", datadog.ParameterToString(*optionalParams.PerPage, "")) + 986   } + 987   if optionalParams.Sort != nil { + 988   localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) + 989   } + 990   localVarHeaderParams["Accept"] = "application/json" + 991   + 992   datadog.SetAuthKeys( + 993   ctx, + 994   &localVarHeaderParams, + 995   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 996   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 997   ) + 998   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 999   if err != nil { + 1000   return localVarReturnValue, nil, err + 1001   } + 1002   + 1003   localVarHTTPResponse, err := a.Client.CallAPI(req) + 1004   if err != nil || localVarHTTPResponse == nil { + 1005   return localVarReturnValue, localVarHTTPResponse, err + 1006   } + 1007   + 1008   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 1009   if err != nil { + 1010   return localVarReturnValue, localVarHTTPResponse, err + 1011   } + 1012   + 1013   if localVarHTTPResponse.StatusCode >= 300 { + 1014   newErr := datadog.GenericOpenAPIError{ + 1015   ErrorBody: localVarBody, + 1016   ErrorMessage: localVarHTTPResponse.Status, + 1017   } + 1018   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + 1019   var v APIErrorResponse + 1020   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1021   if err != nil { + 1022   return localVarReturnValue, localVarHTTPResponse, newErr + 1023   } + 1024   newErr.ErrorModel = v + 1025   } + 1026   return localVarReturnValue, localVarHTTPResponse, newErr + 1027   } + 1028   + 1029   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1030   if err != nil { + 1031   newErr := datadog.GenericOpenAPIError{ + 1032   ErrorBody: localVarBody, + 1033   ErrorMessage: err.Error(), + 1034   } + 1035   return localVarReturnValue, localVarHTTPResponse, newErr + 1036   } + 1037   + 1038   return localVarReturnValue, localVarHTTPResponse, nil + 1039  } + 1040   + 1041  // UpdateMonitor Edit a monitor. + 1042  // Edit the specified monitor. + 1043  func (a *MonitorsApi) UpdateMonitor(ctx _context.Context, monitorId int64, body MonitorUpdateRequest) (Monitor, *_nethttp.Response, error) { + 1044   var ( + 1045   localVarHTTPMethod = _nethttp.MethodPut + 1046   localVarPostBody interface{} + 1047   localVarReturnValue Monitor + 1048   ) + 1049   + 1050   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.UpdateMonitor") + 1051   if err != nil { + 1052   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 1053   } + 1054   + 1055   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" + 1056   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) + 1057   + 1058   localVarHeaderParams := make(map[string]string) + 1059   localVarQueryParams := _neturl.Values{} + 1060   localVarFormParams := _neturl.Values{} + 1061   localVarHeaderParams["Content-Type"] = "application/json" + 1062   localVarHeaderParams["Accept"] = "application/json" + 1063   + 1064   // body params + 1065   localVarPostBody = &body + 1066   datadog.SetAuthKeys( + 1067   ctx, + 1068   &localVarHeaderParams, + 1069   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 1070   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 1071   ) + 1072   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 1073   if err != nil { + 1074   return localVarReturnValue, nil, err + 1075   } + 1076   + 1077   localVarHTTPResponse, err := a.Client.CallAPI(req) + 1078   if err != nil || localVarHTTPResponse == nil { + 1079   return localVarReturnValue, localVarHTTPResponse, err + 1080   } + 1081   + 1082   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 1083   if err != nil { + 1084   return localVarReturnValue, localVarHTTPResponse, err + 1085   } + 1086   + 1087   if localVarHTTPResponse.StatusCode >= 300 { + 1088   newErr := datadog.GenericOpenAPIError{ + 1089   ErrorBody: localVarBody, + 1090   ErrorMessage: localVarHTTPResponse.Status, + 1091   } + 1092   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + 1093   var v APIErrorResponse + 1094   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1095   if err != nil { + 1096   return localVarReturnValue, localVarHTTPResponse, newErr + 1097   } + 1098   newErr.ErrorModel = v + 1099   } + 1100   return localVarReturnValue, localVarHTTPResponse, newErr + 1101   } + 1102   + 1103   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1104   if err != nil { + 1105   newErr := datadog.GenericOpenAPIError{ + 1106   ErrorBody: localVarBody, + 1107   ErrorMessage: err.Error(), + 1108   } + 1109   return localVarReturnValue, localVarHTTPResponse, newErr + 1110   } + 1111   + 1112   return localVarReturnValue, localVarHTTPResponse, nil + 1113  } + 1114   + 1115  // ValidateExistingMonitor Validate an existing monitor. + 1116  // Validate the monitor provided in the request. + 1117  func (a *MonitorsApi) ValidateExistingMonitor(ctx _context.Context, monitorId int64, body Monitor) (interface{}, *_nethttp.Response, error) { + 1118   var ( + 1119   localVarHTTPMethod = _nethttp.MethodPost + 1120   localVarPostBody interface{} + 1121   localVarReturnValue interface{} + 1122   ) + 1123   + 1124   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.ValidateExistingMonitor") + 1125   if err != nil { + 1126   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 1127   } + 1128   + 1129   localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/validate" + 1130   localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(datadog.ParameterToString(monitorId, "")), -1) + 1131   + 1132   localVarHeaderParams := make(map[string]string) + 1133   localVarQueryParams := _neturl.Values{} + 1134   localVarFormParams := _neturl.Values{} + 1135   localVarHeaderParams["Content-Type"] = "application/json" + 1136   localVarHeaderParams["Accept"] = "application/json" + 1137   + 1138   // body params + 1139   localVarPostBody = &body + 1140   datadog.SetAuthKeys( + 1141   ctx, + 1142   &localVarHeaderParams, + 1143   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 1144   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 1145   ) + 1146   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 1147   if err != nil { + 1148   return localVarReturnValue, nil, err + 1149   } + 1150   + 1151   localVarHTTPResponse, err := a.Client.CallAPI(req) + 1152   if err != nil || localVarHTTPResponse == nil { + 1153   return localVarReturnValue, localVarHTTPResponse, err + 1154   } + 1155   + 1156   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 1157   if err != nil { + 1158   return localVarReturnValue, localVarHTTPResponse, err + 1159   } + 1160   + 1161   if localVarHTTPResponse.StatusCode >= 300 { + 1162   newErr := datadog.GenericOpenAPIError{ + 1163   ErrorBody: localVarBody, + 1164   ErrorMessage: localVarHTTPResponse.Status, + 1165   } + 1166   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + 1167   var v APIErrorResponse + 1168   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1169   if err != nil { + 1170   return localVarReturnValue, localVarHTTPResponse, newErr + 1171   } + 1172   newErr.ErrorModel = v + 1173   } + 1174   return localVarReturnValue, localVarHTTPResponse, newErr + 1175   } + 1176   + 1177   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1178   if err != nil { + 1179   newErr := datadog.GenericOpenAPIError{ + 1180   ErrorBody: localVarBody, + 1181   ErrorMessage: err.Error(), + 1182   } + 1183   return localVarReturnValue, localVarHTTPResponse, newErr + 1184   } + 1185   + 1186   return localVarReturnValue, localVarHTTPResponse, nil + 1187  } + 1188   + 1189  // ValidateMonitor Validate a monitor. + 1190  // Validate the monitor provided in the request. + 1191  // + 1192  // **Note**: Log monitors require an unscoped App Key. + 1193  func (a *MonitorsApi) ValidateMonitor(ctx _context.Context, body Monitor) (interface{}, *_nethttp.Response, error) { + 1194   var ( + 1195   localVarHTTPMethod = _nethttp.MethodPost + 1196   localVarPostBody interface{} + 1197   localVarReturnValue interface{} + 1198   ) + 1199   + 1200   localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v1.MonitorsApi.ValidateMonitor") + 1201   if err != nil { + 1202   return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + 1203   } 1204   - 1205   localVarHeaderParams := make(map[string]string) - 1206   localVarQueryParams := _neturl.Values{} - 1207   localVarFormParams := _neturl.Values{} - 1208   localVarHeaderParams["Content-Type"] = "application/json" - 1209   localVarHeaderParams["Accept"] = "application/json" - 1210   - 1211   // body params - 1212   localVarPostBody = &body - 1213   datadog.SetAuthKeys( - 1214   ctx, - 1215   &localVarHeaderParams, - 1216   [2]string{"apiKeyAuth", "DD-API-KEY"}, - 1217   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - 1218   ) - 1219   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - 1220   if err != nil { - 1221   return localVarReturnValue, nil, err - 1222   } - 1223   - 1224   localVarHTTPResponse, err := a.Client.CallAPI(req) - 1225   if err != nil || localVarHTTPResponse == nil { - 1226   return localVarReturnValue, localVarHTTPResponse, err - 1227   } - 1228   - 1229   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - 1230   if err != nil { - 1231   return localVarReturnValue, localVarHTTPResponse, err - 1232   } - 1233   - 1234   if localVarHTTPResponse.StatusCode >= 300 { - 1235   newErr := datadog.GenericOpenAPIError{ - 1236   ErrorBody: localVarBody, - 1237   ErrorMessage: localVarHTTPResponse.Status, - 1238   } - 1239   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - 1240   var v APIErrorResponse - 1241   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1242   if err != nil { - 1243   return localVarReturnValue, localVarHTTPResponse, newErr - 1244   } - 1245   newErr.ErrorModel = v - 1246   } - 1247   return localVarReturnValue, localVarHTTPResponse, newErr - 1248   } - 1249   - 1250   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - 1251   if err != nil { - 1252   newErr := datadog.GenericOpenAPIError{ - 1253   ErrorBody: localVarBody, - 1254   ErrorMessage: err.Error(), - 1255   } - 1256   return localVarReturnValue, localVarHTTPResponse, newErr - 1257   } - 1258   - 1259   return localVarReturnValue, localVarHTTPResponse, nil - 1260  } - 1261   - 1262  // NewMonitorsApi Returns NewMonitorsApi. - 1263  func NewMonitorsApi(client *datadog.APIClient) *MonitorsApi { - 1264   return &MonitorsApi{ - 1265   Client: client, - 1266   } - 1267  } - 1268   + 1205   localVarPath := localBasePath + "/api/v1/monitor/validate" + 1206   + 1207   localVarHeaderParams := make(map[string]string) + 1208   localVarQueryParams := _neturl.Values{} + 1209   localVarFormParams := _neturl.Values{} + 1210   localVarHeaderParams["Content-Type"] = "application/json" + 1211   localVarHeaderParams["Accept"] = "application/json" + 1212   + 1213   // body params + 1214   localVarPostBody = &body + 1215   datadog.SetAuthKeys( + 1216   ctx, + 1217   &localVarHeaderParams, + 1218   [2]string{"apiKeyAuth", "DD-API-KEY"}, + 1219   [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + 1220   ) + 1221   req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + 1222   if err != nil { + 1223   return localVarReturnValue, nil, err + 1224   } + 1225   + 1226   localVarHTTPResponse, err := a.Client.CallAPI(req) + 1227   if err != nil || localVarHTTPResponse == nil { + 1228   return localVarReturnValue, localVarHTTPResponse, err + 1229   } + 1230   + 1231   localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + 1232   if err != nil { + 1233   return localVarReturnValue, localVarHTTPResponse, err + 1234   } + 1235   + 1236   if localVarHTTPResponse.StatusCode >= 300 { + 1237   newErr := datadog.GenericOpenAPIError{ + 1238   ErrorBody: localVarBody, + 1239   ErrorMessage: localVarHTTPResponse.Status, + 1240   } + 1241   if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + 1242   var v APIErrorResponse + 1243   err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1244   if err != nil { + 1245   return localVarReturnValue, localVarHTTPResponse, newErr + 1246   } + 1247   newErr.ErrorModel = v + 1248   } + 1249   return localVarReturnValue, localVarHTTPResponse, newErr + 1250   } + 1251   + 1252   err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 1253   if err != nil { + 1254   newErr := datadog.GenericOpenAPIError{ + 1255   ErrorBody: localVarBody, + 1256   ErrorMessage: err.Error(), + 1257   } + 1258   return localVarReturnValue, localVarHTTPResponse, newErr + 1259   } + 1260   + 1261   return localVarReturnValue, localVarHTTPResponse, nil + 1262  } + 1263   + 1264  // NewMonitorsApi Returns NewMonitorsApi. + 1265  func NewMonitorsApi(client *datadog.APIClient) *MonitorsApi { + 1266   return &MonitorsApi{ + 1267   Client: client, + 1268   } + 1269  } + 1270