From 10cebcafa746f01b8c587377748357542d16f6ad Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" Date: Thu, 23 Jan 2025 20:41:58 +0000 Subject: [PATCH] Remove preview status for GetBillingDimensionMapping endpoint (#2892) Co-authored-by: ci.datadog-api-spec 201ca63ceae3dfbf593643cdcb1b72946c905ced --- .../v2/api/datadog/index.html | 18 +- .../v2/api/datadogV2/index.html | 112 +- .../v2/api/datadog/configuration.go.html | 547 ++- .../v2/api/datadog/index.html | 16 +- .../v2/api/datadogV1/index.html | 1862 ++++---- .../api/datadogV2/api_usage_metering.go.html | 2303 +++++----- .../v2/api/datadogV2/index.html | 4012 ++++++++--------- 7 files changed, 4430 insertions(+), 4440 deletions(-) diff --git a/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html b/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html index ffb6dbf3cdc..3c2abc2fd1f 100644 --- a/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html +++ b/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadog/index.html @@ -639,7 +639,7 @@

func func NewDefaultContext +

func NewDefaultContext @@ -1077,7 +1077,7 @@

func func (*Configuration) AddDefaultHeader +

func (*Configuration) AddDefaultHeader @@ -1090,7 +1090,7 @@

func (*Configuration) func (*Configuration) GetUnstableOperations +

func (*Configuration) GetUnstableOperations @@ -1103,7 +1103,7 @@

func (*Configuration) func (*Configuration) IsUnstableOperation +

func (*Configuration) IsUnstableOperation @@ -1117,7 +1117,7 @@

func (*Configuration) func (*Configuration) IsUnstableOperationEnabled +

func (*Configuration) IsUnstableOperationEnabled @@ -1132,7 +1132,7 @@

func (*Configuration) func (*Configuration) ServerURL +

func (*Configuration) ServerURL @@ -1145,7 +1145,7 @@

func (*Configuration) func (*Configuration) ServerURLWithContext +

func (*Configuration) ServerURLWithContext @@ -1158,7 +1158,7 @@

func (*Configuration) func (*Configuration) SetUnstableOperationEnabled +

func (*Configuration) SetUnstableOperationEnabled @@ -2420,7 +2420,7 @@

type func (ServerConfigurations) URL +

func (ServerConfigurations) URL diff --git a/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/index.html b/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/index.html index d2fb8748bdc..fdf749672e9 100644 --- a/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/index.html +++ b/pkg/github.com/DataDog/datadog-api-client-go/v2/api/datadogV2/index.html @@ -254896,7 +254896,7 @@

func (*GetB -

type GetCostByOrgOptionalParameters +

type GetCostByOrgOptionalParameters @@ -254918,7 +254918,7 @@

type func NewGetCostByOrgOptionalParameters +

func NewGetCostByOrgOptionalParameters @@ -254932,7 +254932,7 @@

func func (*GetCostByOrgOptionalParameters) WithEndMonth +

func (*GetCostByOrgOptionalParameters) WithEndMonth @@ -256812,7 +256812,7 @@

func (*GetDowntimeOptionalPar -

type GetEstimatedCostByOrgOptionalParameters +

type GetEstimatedCostByOrgOptionalParameters @@ -256839,7 +256839,7 @@

type func NewGetEstimatedCostByOrgOptionalParameters +

func NewGetEstimatedCostByOrgOptionalParameters @@ -256853,7 +256853,7 @@

func func (*GetEstimatedCostByOrgOptionalParameters) WithEndDate +

func (*GetEstimatedCostByOrgOptionalParameters) WithEndDate @@ -256866,7 +256866,7 @@

func (*GetEstimated -

func (*GetEstimatedCostByOrgOptionalParameters) WithEndMonth +

func (*GetEstimatedCostByOrgOptionalParameters) WithEndMonth @@ -256879,7 +256879,7 @@

func (*GetEstimate -

func (*GetEstimatedCostByOrgOptionalParameters) WithIncludeConnectedAccounts +

func (*GetEstimatedCostByOrgOptionalParameters) WithIncludeConnectedAccounts @@ -256892,7 +256892,7 @@

fu -

func (*GetEstimatedCostByOrgOptionalParameters) WithStartDate +

func (*GetEstimatedCostByOrgOptionalParameters) WithStartDate @@ -256905,7 +256905,7 @@

func (*GetEstimat -

func (*GetEstimatedCostByOrgOptionalParameters) WithStartMonth +

func (*GetEstimatedCostByOrgOptionalParameters) WithStartMonth @@ -256918,7 +256918,7 @@

func (*GetEstima -

func (*GetEstimatedCostByOrgOptionalParameters) WithView +

func (*GetEstimatedCostByOrgOptionalParameters) WithView @@ -257109,7 +257109,7 @@

func (*GetFindingResponse) type GetHistoricalCostByOrgOptionalParameters +

type GetHistoricalCostByOrgOptionalParameters @@ -257133,7 +257133,7 @@

type func NewGetHistoricalCostByOrgOptionalParameters +

func NewGetHistoricalCostByOrgOptionalParameters @@ -257147,7 +257147,7 @@

func func (*GetHistoricalCostByOrgOptionalParameters) WithEndMonth +

func (*GetHistoricalCostByOrgOptionalParameters) WithEndMonth @@ -257160,7 +257160,7 @@

func (*GetHistori -

func (*GetHistoricalCostByOrgOptionalParameters) WithIncludeConnectedAccounts +

func (*GetHistoricalCostByOrgOptionalParameters) WithIncludeConnectedAccounts @@ -257173,7 +257173,7 @@

f -

func (*GetHistoricalCostByOrgOptionalParameters) WithView +

func (*GetHistoricalCostByOrgOptionalParameters) WithView @@ -257188,7 +257188,7 @@

func (*GetHistoricalC -

type GetHourlyUsageOptionalParameters +

type GetHourlyUsageOptionalParameters @@ -257216,7 +257216,7 @@

type func NewGetHourlyUsageOptionalParameters +

func NewGetHourlyUsageOptionalParameters @@ -257230,7 +257230,7 @@

func func (*GetHourlyUsageOptionalParameters) WithFilterIncludeBreakdown +

func (*GetHourlyUsageOptionalParameters) WithFilterIncludeBreakdown @@ -257243,7 +257243,7 @@

func (*GetH -

func (*GetHourlyUsageOptionalParameters) WithFilterIncludeConnectedAccounts +

func (*GetHourlyUsageOptionalParameters) WithFilterIncludeConnectedAccounts @@ -257256,7 +257256,7 @@

fun -

func (*GetHourlyUsageOptionalParameters) WithFilterIncludeDescendants +

func (*GetHourlyUsageOptionalParameters) WithFilterIncludeDescendants @@ -257269,7 +257269,7 @@

func (*Ge -

func (*GetHourlyUsageOptionalParameters) WithFilterTimestampEnd +

func (*GetHourlyUsageOptionalParameters) WithFilterTimestampEnd @@ -257282,7 +257282,7 @@

func (*GetHourl -

func (*GetHourlyUsageOptionalParameters) WithFilterVersions +

func (*GetHourlyUsageOptionalParameters) WithFilterVersions @@ -257295,7 +257295,7 @@

func (*GetHourlyUsa -

func (*GetHourlyUsageOptionalParameters) WithPageLimit +

func (*GetHourlyUsageOptionalParameters) WithPageLimit @@ -257308,7 +257308,7 @@

func (*GetHourlyUsageOpt -

func (*GetHourlyUsageOptionalParameters) WithPageNextRecordId +

func (*GetHourlyUsageOptionalParameters) WithPageNextRecordId @@ -257862,7 +257862,7 @@

func (*GetInterfacesResponse) type GetMonthlyCostAttributionOptionalParameters +

type GetMonthlyCostAttributionOptionalParameters @@ -257889,7 +257889,7 @@

type func NewGetMonthlyCostAttributionOptionalParameters +

func NewGetMonthlyCostAttributionOptionalParameters @@ -257903,7 +257903,7 @@

func func (*GetMonthlyCostAttributionOptionalParameters) WithEndMonth +

func (*GetMonthlyCostAttributionOptionalParameters) WithEndMonth @@ -257916,7 +257916,7 @@

func (*GetMont -

func (*GetMonthlyCostAttributionOptionalParameters) WithIncludeDescendants +

func (*GetMonthlyCostAttributionOptionalParameters) WithIncludeDescendants @@ -257929,7 +257929,7 @@

func -

func (*GetMonthlyCostAttributionOptionalParameters) WithNextRecordId +

func (*GetMonthlyCostAttributionOptionalParameters) WithNextRecordId @@ -257942,7 +257942,7 @@

func (*Get -

func (*GetMonthlyCostAttributionOptionalParameters) WithSortDirection +

func (*GetMonthlyCostAttributionOptionalParameters) WithSortDirection @@ -257955,7 +257955,7 @@

func (*Ge -

func (*GetMonthlyCostAttributionOptionalParameters) WithSortName +

func (*GetMonthlyCostAttributionOptionalParameters) WithSortName @@ -257968,7 +257968,7 @@

func (*GetMont -

func (*GetMonthlyCostAttributionOptionalParameters) WithTagBreakdownKeys +

func (*GetMonthlyCostAttributionOptionalParameters) WithTagBreakdownKeys @@ -257983,7 +257983,7 @@

func ( -

type GetProjectedCostOptionalParameters +

type GetProjectedCostOptionalParameters @@ -258006,7 +258006,7 @@

type func NewGetProjectedCostOptionalParameters +

func NewGetProjectedCostOptionalParameters @@ -258020,7 +258020,7 @@

func func (*GetProjectedCostOptionalParameters) WithIncludeConnectedAccounts +

func (*GetProjectedCostOptionalParameters) WithIncludeConnectedAccounts @@ -258033,7 +258033,7 @@

func (* -

func (*GetProjectedCostOptionalParameters) WithView +

func (*GetProjectedCostOptionalParameters) WithView @@ -258469,7 +258469,7 @@

func (*GetTeamMembershipsSort) type GetUsageApplicationSecurityMonitoringOptionalParameters +

type GetUsageApplicationSecurityMonitoringOptionalParameters @@ -258491,7 +258491,7 @@

type func NewGetUsageApplicationSecurityMonitoringOptionalParameters +

func NewGetUsageApplicationSecurityMonitoringOptionalParameters @@ -258505,7 +258505,7 @@

func func (*GetUsageApplicationSecurityMonitoringOptionalParameters) WithEndHr +

func (*GetUsageApplicationSecurityMonitoringOptionalParameters) WithEndHr @@ -258520,7 +258520,7 @@

func -

type GetUsageLambdaTracedInvocationsOptionalParameters +

type GetUsageLambdaTracedInvocationsOptionalParameters @@ -258542,7 +258542,7 @@

type func NewGetUsageLambdaTracedInvocationsOptionalParameters +

func NewGetUsageLambdaTracedInvocationsOptionalParameters @@ -258556,7 +258556,7 @@

func func (*GetUsageLambdaTracedInvocationsOptionalParameters) WithEndHr +

func (*GetUsageLambdaTracedInvocationsOptionalParameters) WithEndHr @@ -258571,7 +258571,7 @@

func (*GetU -

type GetUsageObservabilityPipelinesOptionalParameters +

type GetUsageObservabilityPipelinesOptionalParameters @@ -258593,7 +258593,7 @@

type func NewGetUsageObservabilityPipelinesOptionalParameters +

func NewGetUsageObservabilityPipelinesOptionalParameters @@ -258607,7 +258607,7 @@

func func (*GetUsageObservabilityPipelinesOptionalParameters) WithEndHr +

func (*GetUsageObservabilityPipelinesOptionalParameters) WithEndHr @@ -496810,7 +496810,7 @@

type func NewUsageMeteringApi +

func NewUsageMeteringApi @@ -496854,7 +496854,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetCostByOrg +

func (*UsageMeteringApi) GetCostByOrg @@ -496874,7 +496874,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetEstimatedCostByOrg +

func (*UsageMeteringApi) GetEstimatedCostByOrg @@ -496892,7 +496892,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetHistoricalCostByOrg +

func (*UsageMeteringApi) GetHistoricalCostByOrg @@ -496908,7 +496908,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetHourlyUsage +

func (*UsageMeteringApi) GetHourlyUsage @@ -496922,7 +496922,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetMonthlyCostAttribution +

func (*UsageMeteringApi) GetMonthlyCostAttribution @@ -496951,7 +496951,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetProjectedCost +

func (*UsageMeteringApi) GetProjectedCost @@ -496967,7 +496967,7 @@

func (*UsageMeteringApi) func (*UsageMeteringApi) GetUsageApplicationSecurityMonitoring +

func (*UsageMeteringApi) GetUsageApplicationSecurityMonitoring @@ -496983,7 +496983,7 @@

func (*UsageMete -

func (*UsageMeteringApi) GetUsageLambdaTracedInvocations +

func (*UsageMeteringApi) GetUsageLambdaTracedInvocations @@ -496999,7 +496999,7 @@

func (*UsageMeteringAp -

func (*UsageMeteringApi) GetUsageObservabilityPipelines +

func (*UsageMeteringApi) GetUsageObservabilityPipelines diff --git a/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go.html b/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go.html index 7bf6281a1d0..6572e9bdd37 100644 --- a/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go.html +++ b/src/github.com/DataDog/datadog-api-client-go/v2/api/datadog/configuration.go.html @@ -394,280 +394,279 @@

337   "v2.ListApps": false, 338   "v2.UpdateApp": false, 339   "v2.GetActiveBillingDimensions": false, - 340   "v2.GetBillingDimensionMapping": false, - 341   "v2.GetMonthlyCostAttribution": false, - 342   "v2.CancelDataDeletionRequest": false, - 343   "v2.CreateDataDeletionRequest": false, - 344   "v2.GetDataDeletionRequests": false, - 345   "v2.CreateDORADeployment": false, - 346   "v2.CreateDORAIncident": false, - 347   "v2.CreateIncident": false, - 348   "v2.CreateIncidentIntegration": false, - 349   "v2.CreateIncidentTodo": false, - 350   "v2.CreateIncidentType": false, - 351   "v2.DeleteIncident": false, - 352   "v2.DeleteIncidentIntegration": false, - 353   "v2.DeleteIncidentTodo": false, - 354   "v2.DeleteIncidentType": false, - 355   "v2.GetIncident": false, - 356   "v2.GetIncidentIntegration": false, - 357   "v2.GetIncidentTodo": false, - 358   "v2.GetIncidentType": false, - 359   "v2.ListIncidentAttachments": false, - 360   "v2.ListIncidentIntegrations": false, - 361   "v2.ListIncidents": false, - 362   "v2.ListIncidentTodos": false, - 363   "v2.ListIncidentTypes": false, - 364   "v2.SearchIncidents": false, - 365   "v2.UpdateIncident": false, - 366   "v2.UpdateIncidentAttachments": false, - 367   "v2.UpdateIncidentIntegration": false, - 368   "v2.UpdateIncidentTodo": false, - 369   "v2.UpdateIncidentType": false, - 370   "v2.CreateAWSAccount": false, - 371   "v2.CreateNewAWSExternalID": false, - 372   "v2.DeleteAWSAccount": false, - 373   "v2.GetAWSAccount": false, - 374   "v2.ListAWSAccounts": false, - 375   "v2.ListAWSNamespaces": false, - 376   "v2.UpdateAWSAccount": false, - 377   "v2.ListAWSLogsServices": false, - 378   "v2.CancelHistoricalJob": false, - 379   "v2.ConvertJobResultToSignal": false, - 380   "v2.DeleteHistoricalJob": false, - 381   "v2.GetFinding": false, - 382   "v2.GetHistoricalJob": false, - 383   "v2.GetSBOM": false, - 384   "v2.ListFindings": false, - 385   "v2.ListHistoricalJobs": false, - 386   "v2.ListVulnerabilities": false, - 387   "v2.ListVulnerableAssets": false, - 388   "v2.MuteFindings": false, - 389   "v2.RunHistoricalJob": false, - 390   "v2.CreateScorecardOutcomesBatch": false, - 391   "v2.CreateScorecardRule": false, - 392   "v2.DeleteScorecardRule": false, - 393   "v2.ListScorecardOutcomes": false, - 394   "v2.ListScorecardRules": false, - 395   "v2.UpdateScorecardRule": false, - 396   "v2.CreateIncidentService": false, - 397   "v2.DeleteIncidentService": false, - 398   "v2.GetIncidentService": false, - 399   "v2.ListIncidentServices": false, - 400   "v2.UpdateIncidentService": false, - 401   "v2.CreateSLOReportJob": false, - 402   "v2.GetSLOReport": false, - 403   "v2.GetSLOReportJobStatus": false, - 404   "v2.CreateIncidentTeam": false, - 405   "v2.DeleteIncidentTeam": false, - 406   "v2.GetIncidentTeam": false, - 407   "v2.ListIncidentTeams": false, - 408   "v2.UpdateIncidentTeam": false, - 409   }, - 410   RetryConfiguration: RetryConfiguration{ - 411   EnableRetry: false, - 412   BackOffMultiplier: 2, - 413   BackOffBase: 2, - 414   HTTPRetryTimeout: 60 * time.Second, - 415   MaxRetries: 3, - 416   }, - 417   } - 418   return cfg - 419  } - 420   - 421  // AddDefaultHeader adds a new HTTP header to the default header in the request. - 422  func (c *Configuration) AddDefaultHeader(key string, value string) { - 423   c.DefaultHeader[key] = value - 424  } - 425   - 426  // URL formats template on a index using given variables. - 427  func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { - 428   if index < 0 || len(sc) <= index { - 429   return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) - 430   } - 431   server := sc[index] - 432   url := server.URL - 433   - 434   // go through variables and replace placeholders - 435   for name, variable := range server.Variables { - 436   if value, ok := variables[name]; ok { - 437   found := bool(len(variable.EnumValues) == 0) - 438   for _, enumValue := range variable.EnumValues { - 439   if value == enumValue { - 440   found = true - 441   } - 442   } - 443   if !found { - 444   return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) - 445   } - 446   url = strings.Replace(url, "{"+name+"}", value, -1) - 447   } else { - 448   url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) - 449   } - 450   } - 451   return url, nil - 452  } - 453   - 454  // ServerURL returns URL based on server settings. - 455  func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { - 456   return c.Servers.URL(index, variables) - 457  } - 458   - 459  func getServerIndex(ctx context.Context) (int, error) { - 460   si := ctx.Value(ContextServerIndex) - 461   if si != nil { - 462   if index, ok := si.(int); ok { - 463   return index, nil - 464   } - 465   return 0, ReportError("invalid type %T should be int", si) - 466   } - 467   return 0, nil - 468  } - 469   - 470  func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { - 471   osi := ctx.Value(ContextOperationServerIndices) - 472   if osi != nil { - 473   operationIndices, ok := osi.(map[string]int) - 474   if !ok { - 475   return 0, ReportError("invalid type %T should be map[string]int", osi) - 476   } - 477   index, ok := operationIndices[endpoint] - 478   if ok { - 479   return index, nil - 480   } - 481   } - 482   return getServerIndex(ctx) - 483  } - 484   - 485  func getServerVariables(ctx context.Context) (map[string]string, error) { - 486   sv := ctx.Value(ContextServerVariables) - 487   if sv != nil { - 488   if variables, ok := sv.(map[string]string); ok { - 489   return variables, nil - 490   } - 491   return nil, ReportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) - 492   } - 493   return nil, nil - 494  } - 495   - 496  func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { - 497   osv := ctx.Value(ContextOperationServerVariables) - 498   if osv != nil { - 499   operationVariables, ok := osv.(map[string]map[string]string) - 500   if !ok { - 501   return nil, ReportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) - 502   } - 503   variables, ok := operationVariables[endpoint] - 504   if ok { - 505   return variables, nil - 506   } - 507   } - 508   return getServerVariables(ctx) - 509  } - 510   - 511  // ServerURLWithContext returns a new server URL given an endpoint. - 512  func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { - 513   sc, ok := c.OperationServers[endpoint] - 514   if !ok { - 515   sc = c.Servers - 516   } - 517   - 518   if ctx == nil { - 519   return sc.URL(0, nil) - 520   } - 521   - 522   index, err := getServerOperationIndex(ctx, endpoint) - 523   if err != nil { - 524   return "", err - 525   } - 526   - 527   variables, err := getServerOperationVariables(ctx, endpoint) - 528   if err != nil { - 529   return "", err - 530   } - 531   - 532   return sc.URL(index, variables) - 533  } - 534   - 535  // GetUnstableOperations returns a slice with all unstable operation Ids. - 536  func (c *Configuration) GetUnstableOperations() []string { - 537   ids := make([]string, len(c.unstableOperations)) - 538   for id := range c.unstableOperations { - 539   ids = append(ids, id) - 540   } - 541   return ids - 542  } - 543   - 544  // SetUnstableOperationEnabled sets an unstable operation as enabled (true) or disabled (false). - 545  // This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" - 546  // Returns true if the operation is marked as unstable and thus was enabled/disabled, false otherwise. - 547  func (c *Configuration) SetUnstableOperationEnabled(operation string, enabled bool) bool { - 548   if _, ok := c.unstableOperations[operation]; ok { - 549   c.unstableOperations[operation] = enabled - 550   return true - 551   } - 552   log.Printf("WARNING: '%s' is not an unstable operation, can't enable/disable", operation) - 553   return false - 554  } - 555   - 556  // IsUnstableOperation determines whether an operation is an unstable operation. - 557  // This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo". - 558  func (c *Configuration) IsUnstableOperation(operation string) bool { - 559   _, present := c.unstableOperations[operation] - 560   return present - 561  } - 562   - 563  // IsUnstableOperationEnabled determines whether an unstable operation is enabled. - 564  // This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" - 565  // Returns true if the operation is unstable and it is enabled, false otherwise. - 566  func (c *Configuration) IsUnstableOperationEnabled(operation string) bool { - 567   if enabled, present := c.unstableOperations[operation]; present { - 568   return enabled - 569   } - 570   log.Printf("WARNING: '%s' is not an unstable operation, is always enabled", operation) - 571   return false - 572  } - 573   - 574  func getUserAgent() string { - 575   return fmt.Sprintf( - 576   "datadog-api-client-go/%s (go %s; os %s; arch %s)", - 577   client.Version, - 578   runtime.Version(), - 579   runtime.GOOS, - 580   runtime.GOARCH, - 581   ) - 582  } - 583   - 584  // NewDefaultContext returns a new context setup with environment variables. - 585  func NewDefaultContext(ctx context.Context) context.Context { - 586   if ctx == nil { - 587   ctx = context.Background() - 588   } - 589   - 590   if site, ok := os.LookupEnv("DD_SITE"); ok { - 591   ctx = context.WithValue( - 592   ctx, - 593   ContextServerVariables, - 594   map[string]string{"site": site}, - 595   ) - 596   } - 597   - 598   keys := make(map[string]APIKey) - 599   if apiKey, ok := os.LookupEnv("DD_API_KEY"); ok { - 600   keys["apiKeyAuth"] = APIKey{Key: apiKey} - 601   } - 602   if apiKey, ok := os.LookupEnv("DD_APP_KEY"); ok { - 603   keys["appKeyAuth"] = APIKey{Key: apiKey} - 604   } - 605   ctx = context.WithValue( - 606   ctx, - 607   ContextAPIKeys, - 608   keys, - 609   ) - 610   - 611   return ctx - 612  } - 613   + 340   "v2.GetMonthlyCostAttribution": false, + 341   "v2.CancelDataDeletionRequest": false, + 342   "v2.CreateDataDeletionRequest": false, + 343   "v2.GetDataDeletionRequests": false, + 344   "v2.CreateDORADeployment": false, + 345   "v2.CreateDORAIncident": false, + 346   "v2.CreateIncident": false, + 347   "v2.CreateIncidentIntegration": false, + 348   "v2.CreateIncidentTodo": false, + 349   "v2.CreateIncidentType": false, + 350   "v2.DeleteIncident": false, + 351   "v2.DeleteIncidentIntegration": false, + 352   "v2.DeleteIncidentTodo": false, + 353   "v2.DeleteIncidentType": false, + 354   "v2.GetIncident": false, + 355   "v2.GetIncidentIntegration": false, + 356   "v2.GetIncidentTodo": false, + 357   "v2.GetIncidentType": false, + 358   "v2.ListIncidentAttachments": false, + 359   "v2.ListIncidentIntegrations": false, + 360   "v2.ListIncidents": false, + 361   "v2.ListIncidentTodos": false, + 362   "v2.ListIncidentTypes": false, + 363   "v2.SearchIncidents": false, + 364   "v2.UpdateIncident": false, + 365   "v2.UpdateIncidentAttachments": false, + 366   "v2.UpdateIncidentIntegration": false, + 367   "v2.UpdateIncidentTodo": false, + 368   "v2.UpdateIncidentType": false, + 369   "v2.CreateAWSAccount": false, + 370   "v2.CreateNewAWSExternalID": false, + 371   "v2.DeleteAWSAccount": false, + 372   "v2.GetAWSAccount": false, + 373   "v2.ListAWSAccounts": false, + 374   "v2.ListAWSNamespaces": false, + 375   "v2.UpdateAWSAccount": false, + 376   "v2.ListAWSLogsServices": false, + 377   "v2.CancelHistoricalJob": false, + 378   "v2.ConvertJobResultToSignal": false, + 379   "v2.DeleteHistoricalJob": false, + 380   "v2.GetFinding": false, + 381   "v2.GetHistoricalJob": false, + 382   "v2.GetSBOM": false, + 383   "v2.ListFindings": false, + 384   "v2.ListHistoricalJobs": false, + 385   "v2.ListVulnerabilities": false, + 386   "v2.ListVulnerableAssets": false, + 387   "v2.MuteFindings": false, + 388   "v2.RunHistoricalJob": false, + 389   "v2.CreateScorecardOutcomesBatch": false, + 390   "v2.CreateScorecardRule": false, + 391   "v2.DeleteScorecardRule": false, + 392   "v2.ListScorecardOutcomes": false, + 393   "v2.ListScorecardRules": false, + 394   "v2.UpdateScorecardRule": false, + 395   "v2.CreateIncidentService": false, + 396   "v2.DeleteIncidentService": false, + 397   "v2.GetIncidentService": false, + 398   "v2.ListIncidentServices": false, + 399   "v2.UpdateIncidentService": false, + 400   "v2.CreateSLOReportJob": false, + 401   "v2.GetSLOReport": false, + 402   "v2.GetSLOReportJobStatus": false, + 403   "v2.CreateIncidentTeam": false, + 404   "v2.DeleteIncidentTeam": false, + 405   "v2.GetIncidentTeam": false, + 406   "v2.ListIncidentTeams": false, + 407   "v2.UpdateIncidentTeam": false, + 408   }, + 409   RetryConfiguration: RetryConfiguration{ + 410   EnableRetry: false, + 411   BackOffMultiplier: 2, + 412   BackOffBase: 2, + 413   HTTPRetryTimeout: 60 * time.Second, + 414   MaxRetries: 3, + 415   }, + 416   } + 417   return cfg + 418  } + 419   + 420  // AddDefaultHeader adds a new HTTP header to the default header in the request. + 421  func (c *Configuration) AddDefaultHeader(key string, value string) { + 422   c.DefaultHeader[key] = value + 423  } + 424   + 425  // URL formats template on a index using given variables. + 426  func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + 427   if index < 0 || len(sc) <= index { + 428   return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + 429   } + 430   server := sc[index] + 431   url := server.URL + 432   + 433   // go through variables and replace placeholders + 434   for name, variable := range server.Variables { + 435   if value, ok := variables[name]; ok { + 436   found := bool(len(variable.EnumValues) == 0) + 437   for _, enumValue := range variable.EnumValues { + 438   if value == enumValue { + 439   found = true + 440   } + 441   } + 442   if !found { + 443   return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + 444   } + 445   url = strings.Replace(url, "{"+name+"}", value, -1) + 446   } else { + 447   url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + 448   } + 449   } + 450   return url, nil + 451  } + 452   + 453  // ServerURL returns URL based on server settings. + 454  func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + 455   return c.Servers.URL(index, variables) + 456  } + 457   + 458  func getServerIndex(ctx context.Context) (int, error) { + 459   si := ctx.Value(ContextServerIndex) + 460   if si != nil { + 461   if index, ok := si.(int); ok { + 462   return index, nil + 463   } + 464   return 0, ReportError("invalid type %T should be int", si) + 465   } + 466   return 0, nil + 467  } + 468   + 469  func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + 470   osi := ctx.Value(ContextOperationServerIndices) + 471   if osi != nil { + 472   operationIndices, ok := osi.(map[string]int) + 473   if !ok { + 474   return 0, ReportError("invalid type %T should be map[string]int", osi) + 475   } + 476   index, ok := operationIndices[endpoint] + 477   if ok { + 478   return index, nil + 479   } + 480   } + 481   return getServerIndex(ctx) + 482  } + 483   + 484  func getServerVariables(ctx context.Context) (map[string]string, error) { + 485   sv := ctx.Value(ContextServerVariables) + 486   if sv != nil { + 487   if variables, ok := sv.(map[string]string); ok { + 488   return variables, nil + 489   } + 490   return nil, ReportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + 491   } + 492   return nil, nil + 493  } + 494   + 495  func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + 496   osv := ctx.Value(ContextOperationServerVariables) + 497   if osv != nil { + 498   operationVariables, ok := osv.(map[string]map[string]string) + 499   if !ok { + 500   return nil, ReportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + 501   } + 502   variables, ok := operationVariables[endpoint] + 503   if ok { + 504   return variables, nil + 505   } + 506   } + 507   return getServerVariables(ctx) + 508  } + 509   + 510  // ServerURLWithContext returns a new server URL given an endpoint. + 511  func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + 512   sc, ok := c.OperationServers[endpoint] + 513   if !ok { + 514   sc = c.Servers + 515   } + 516   + 517   if ctx == nil { + 518   return sc.URL(0, nil) + 519   } + 520   + 521   index, err := getServerOperationIndex(ctx, endpoint) + 522   if err != nil { + 523   return "", err + 524   } + 525   + 526   variables, err := getServerOperationVariables(ctx, endpoint) + 527   if err != nil { + 528   return "", err + 529   } + 530   + 531   return sc.URL(index, variables) + 532  } + 533   + 534  // GetUnstableOperations returns a slice with all unstable operation Ids. + 535  func (c *Configuration) GetUnstableOperations() []string { + 536   ids := make([]string, len(c.unstableOperations)) + 537   for id := range c.unstableOperations { + 538   ids = append(ids, id) + 539   } + 540   return ids + 541  } + 542   + 543  // SetUnstableOperationEnabled sets an unstable operation as enabled (true) or disabled (false). + 544  // This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" + 545  // Returns true if the operation is marked as unstable and thus was enabled/disabled, false otherwise. + 546  func (c *Configuration) SetUnstableOperationEnabled(operation string, enabled bool) bool { + 547   if _, ok := c.unstableOperations[operation]; ok { + 548   c.unstableOperations[operation] = enabled + 549   return true + 550   } + 551   log.Printf("WARNING: '%s' is not an unstable operation, can't enable/disable", operation) + 552   return false + 553  } + 554   + 555  // IsUnstableOperation determines whether an operation is an unstable operation. + 556  // This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo". + 557  func (c *Configuration) IsUnstableOperation(operation string) bool { + 558   _, present := c.unstableOperations[operation] + 559   return present + 560  } + 561   + 562  // IsUnstableOperationEnabled determines whether an unstable operation is enabled. + 563  // This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" + 564  // Returns true if the operation is unstable and it is enabled, false otherwise. + 565  func (c *Configuration) IsUnstableOperationEnabled(operation string) bool { + 566   if enabled, present := c.unstableOperations[operation]; present { + 567   return enabled + 568   } + 569   log.Printf("WARNING: '%s' is not an unstable operation, is always enabled", operation) + 570   return false + 571  } + 572   + 573  func getUserAgent() string { + 574   return fmt.Sprintf( + 575   "datadog-api-client-go/%s (go %s; os %s; arch %s)", + 576   client.Version, + 577   runtime.Version(), + 578   runtime.GOOS, + 579   runtime.GOARCH, + 580   ) + 581  } + 582   + 583  // NewDefaultContext returns a new context setup with environment variables. + 584  func NewDefaultContext(ctx context.Context) context.Context { + 585   if ctx == nil { + 586   ctx = context.Background() + 587   } + 588   + 589   if site, ok := os.LookupEnv("DD_SITE"); ok { + 590   ctx = context.WithValue( + 591   ctx, + 592   ContextServerVariables, + 593   map[string]string{"site": site}, + 594   ) + 595   } + 596   + 597   keys := make(map[string]APIKey) + 598   if apiKey, ok := os.LookupEnv("DD_API_KEY"); ok { + 599   keys["apiKeyAuth"] = APIKey{Key: apiKey} + 600   } + 601   if apiKey, ok := os.LookupEnv("DD_APP_KEY"); ok { + 602   keys["appKeyAuth"] = APIKey{Key: apiKey} + 603   } + 604   ctx = context.WithValue( + 605   ctx, + 606   ContextAPIKeys, + 607   keys, + 608   ) + 609   + 610   return ctx + 611  } + 612