Skip to content

Commit

Permalink
pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Sep 19, 2024
1 parent 21f6445 commit 427fa59
Show file tree
Hide file tree
Showing 3,386 changed files with 59,185 additions and 34,332 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 10 additions & 8 deletions api/datadog/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.


package datadog

import (
"bytes"
"compress/gzip"
"compress/zlib"
"context"
"compress/zlib"
"compress/gzip"
"encoding/xml"
"errors"
"fmt"
Expand All @@ -26,6 +27,7 @@ import (
"strconv"
"strings"
"time"
"unicode/utf8"

Check failure on line 30 in api/datadog/client.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, --tags=goccy_gojson, ubuntu-latest)

imported and not used: "unicode/utf8" (compile)

Check failure on line 30 in api/datadog/client.go

View workflow job for this annotation

GitHub Actions / examples

imported and not used: "unicode/utf8"

Check failure on line 30 in api/datadog/client.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, ubuntu-latest)

imported and not used: "unicode/utf8" (compile)

Check failure on line 30 in api/datadog/client.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, --tags=goccy_gojson, ubuntu-latest)

"unicode/utf8" imported and not used (compile)

Check failure on line 30 in api/datadog/client.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

"unicode/utf8" imported and not used (compile)

"golang.org/x/oauth2"
)
Expand All @@ -39,14 +41,14 @@ var (
// APIClient manages communication with the Datadog API V2 Collection API v1.0.
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
Cfg *Configuration
Cfg *Configuration
}

// FormFile holds parameters for a file in multipart/form-data request.
type FormFile struct {
FormFileName string
FileName string
FileBytes []byte
FileName string
FileBytes []byte
}

// Service holds APIClient
Expand Down Expand Up @@ -180,7 +182,7 @@ func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error) {
}
}

// Determine if a request should be retried
// Determine if a request should be retried
func (c *APIClient) shouldRetryRequest(response *http.Response, retryCount int) (*time.Duration, bool) {
enableRetry := c.Cfg.RetryConfiguration.EnableRetry
maxRetries := c.Cfg.RetryConfiguration.MaxRetries
Expand Down Expand Up @@ -517,9 +519,9 @@ func detectContentType(body interface{}) string {

// GenericOpenAPIError Provides access to the body, error and model on returned errors.
type GenericOpenAPIError struct {
ErrorBody []byte
ErrorBody []byte
ErrorMessage string
ErrorModel interface{}
ErrorModel interface{}
}

// Error returns non-empty string if there was an error.
Expand Down
136 changes: 68 additions & 68 deletions api/datadog/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.


package datadog

import (
Expand Down Expand Up @@ -108,23 +109,22 @@ type RetryConfiguration struct {
HTTPRetryTimeout time.Duration
MaxRetries int
}

// NewConfiguration returns a new Configuration object.
func NewConfiguration() *Configuration {
cfg := &Configuration{
DefaultHeader: make(map[string]string),
UserAgent: getUserAgent(),
Debug: false,
Compress: true,
Servers: ServerConfigurations{
Servers: ServerConfigurations{
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "The regional site for Datadog customers.",
DefaultValue: "datadoghq.com",
EnumValues: []string{
EnumValues: []string{
"datadoghq.com",
"us3.datadoghq.com",
"us5.datadoghq.com",
Expand All @@ -142,7 +142,7 @@ func NewConfiguration() *Configuration {
{
URL: "{protocol}://{name}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"name": {
Description: "Full site DNS name.",
DefaultValue: "api.datadoghq.com",
Expand All @@ -156,7 +156,7 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "Any Datadog deployment.",
DefaultValue: "datadoghq.com",
Expand All @@ -173,11 +173,11 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "The regional site for Datadog customers.",
DefaultValue: "datadoghq.com",
EnumValues: []string{
EnumValues: []string{
"datadoghq.com",
"us3.datadoghq.com",
"us5.datadoghq.com",
Expand All @@ -195,7 +195,7 @@ func NewConfiguration() *Configuration {
{
URL: "{protocol}://{name}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"name": {
Description: "Full site DNS name.",
DefaultValue: "ip-ranges.datadoghq.com",
Expand All @@ -209,7 +209,7 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.datadoghq.com",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"subdomain": {
Description: "The subdomain where the API is deployed.",
DefaultValue: "ip-ranges",
Expand All @@ -221,11 +221,11 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "The regional site for Datadog customers.",
DefaultValue: "datadoghq.com",
EnumValues: []string{
EnumValues: []string{
"datadoghq.com",
"us3.datadoghq.com",
"us5.datadoghq.com",
Expand All @@ -243,7 +243,7 @@ func NewConfiguration() *Configuration {
{
URL: "{protocol}://{name}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"name": {
Description: "Full site DNS name.",
DefaultValue: "http-intake.logs.datadoghq.com",
Expand All @@ -257,7 +257,7 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "Any Datadog deployment.",
DefaultValue: "datadoghq.com",
Expand All @@ -273,11 +273,11 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "The regional site for customers.",
DefaultValue: "datadoghq.com",
EnumValues: []string{
EnumValues: []string{
"datadoghq.com",
"us3.datadoghq.com",
"us5.datadoghq.com",
Expand All @@ -295,7 +295,7 @@ func NewConfiguration() *Configuration {
{
URL: "{protocol}://{name}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"name": {
Description: "Full site DNS name.",
DefaultValue: "http-intake.logs.datadoghq.com",
Expand All @@ -309,7 +309,7 @@ func NewConfiguration() *Configuration {
{
URL: "https://{subdomain}.{site}",
Description: "No description provided",
Variables: map[string]ServerVariable{
Variables: map[string]ServerVariable{
"site": {
Description: "Any Datadog deployment.",
DefaultValue: "datadoghq.com",
Expand All @@ -323,57 +323,57 @@ func NewConfiguration() *Configuration {
},
},
unstableOperations: map[string]bool{
"v2.CreateOpenAPI": false,
"v2.DeleteOpenAPI": false,
"v2.GetOpenAPI": false,
"v2.ListAPIs": false,
"v2.UpdateOpenAPI": false,
"v2.GetActiveBillingDimensions": false,
"v2.GetMonthlyCostAttribution": false,
"v2.CreateDORADeployment": false,
"v2.CreateDORAIncident": false,
"v2.CreateIncident": false,
"v2.CreateIncidentIntegration": false,
"v2.CreateIncidentTodo": false,
"v2.DeleteIncident": false,
"v2.DeleteIncidentIntegration": false,
"v2.DeleteIncidentTodo": false,
"v2.GetIncident": false,
"v2.GetIncidentIntegration": false,
"v2.GetIncidentTodo": false,
"v2.ListIncidentAttachments": false,
"v2.ListIncidentIntegrations": false,
"v2.ListIncidents": false,
"v2.ListIncidentTodos": false,
"v2.SearchIncidents": false,
"v2.UpdateIncident": false,
"v2.UpdateIncidentAttachments": false,
"v2.UpdateIncidentIntegration": false,
"v2.UpdateIncidentTodo": false,
"v2.QueryScalarData": false,
"v2.QueryTimeseriesData": false,
"v2.GetFinding": false,
"v2.ListFindings": false,
"v2.MuteFindings": false,
"v2.CreateOpenAPI": false,
"v2.DeleteOpenAPI": false,
"v2.GetOpenAPI": false,
"v2.ListAPIs": false,
"v2.UpdateOpenAPI": false,
"v2.GetActiveBillingDimensions": false,
"v2.GetMonthlyCostAttribution": false,
"v2.CreateDORADeployment": false,
"v2.CreateDORAIncident": false,
"v2.CreateIncident": false,
"v2.CreateIncidentIntegration": false,
"v2.CreateIncidentTodo": false,
"v2.DeleteIncident": false,
"v2.DeleteIncidentIntegration": false,
"v2.DeleteIncidentTodo": false,
"v2.GetIncident": false,
"v2.GetIncidentIntegration": false,
"v2.GetIncidentTodo": false,
"v2.ListIncidentAttachments": false,
"v2.ListIncidentIntegrations": false,
"v2.ListIncidents": false,
"v2.ListIncidentTodos": false,
"v2.SearchIncidents": false,
"v2.UpdateIncident": false,
"v2.UpdateIncidentAttachments": false,
"v2.UpdateIncidentIntegration": false,
"v2.UpdateIncidentTodo": false,
"v2.QueryScalarData": false,
"v2.QueryTimeseriesData": false,
"v2.GetFinding": false,
"v2.ListFindings": false,
"v2.MuteFindings": false,
"v2.CreateScorecardOutcomesBatch": false,
"v2.CreateScorecardRule": false,
"v2.DeleteScorecardRule": false,
"v2.ListScorecardOutcomes": false,
"v2.ListScorecardRules": false,
"v2.UpdateScorecardRule": false,
"v2.CreateIncidentService": false,
"v2.DeleteIncidentService": false,
"v2.GetIncidentService": false,
"v2.ListIncidentServices": false,
"v2.UpdateIncidentService": false,
"v2.CreateSLOReportJob": false,
"v2.GetSLOReport": false,
"v2.GetSLOReportJobStatus": false,
"v2.CreateIncidentTeam": false,
"v2.DeleteIncidentTeam": false,
"v2.GetIncidentTeam": false,
"v2.ListIncidentTeams": false,
"v2.UpdateIncidentTeam": false,
"v2.CreateScorecardRule": false,
"v2.DeleteScorecardRule": false,
"v2.ListScorecardOutcomes": false,
"v2.ListScorecardRules": false,
"v2.UpdateScorecardRule": false,
"v2.CreateIncidentService": false,
"v2.DeleteIncidentService": false,
"v2.GetIncidentService": false,
"v2.ListIncidentServices": false,
"v2.UpdateIncidentService": false,
"v2.CreateSLOReportJob": false,
"v2.GetSLOReport": false,
"v2.GetSLOReportJobStatus": false,
"v2.CreateIncidentTeam": false,
"v2.DeleteIncidentTeam": false,
"v2.GetIncidentTeam": false,
"v2.ListIncidentTeams": false,
"v2.UpdateIncidentTeam": false,
},
RetryConfiguration: RetryConfiguration{
EnableRetry: false,
Expand Down
3 changes: 2 additions & 1 deletion api/datadog/encoding_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.


//go:build !goccy_gojson

package datadog
Expand All @@ -25,4 +26,4 @@ func NewEncoder(w io.Writer) *json.Encoder {

func NewDecoder(r io.Reader) *json.Decoder {
return json.NewDecoder(r)
}
}
3 changes: 2 additions & 1 deletion api/datadog/goccy_gojson.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.


//go:build goccy_gojson

package datadog
Expand All @@ -26,4 +27,4 @@ func NewEncoder(w io.Writer) *json.Encoder {

func NewDecoder(r io.Reader) *json.Decoder {
return json.NewDecoder(r)
}
}
2 changes: 1 addition & 1 deletion api/datadog/no_zstd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

//go:build !cgo

//go:build !cgo
package datadog

import (
Expand Down
6 changes: 3 additions & 3 deletions api/datadog/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.


package datadog

import (
Expand All @@ -11,7 +12,6 @@ import (
"reflect"
"strings"
"time"
"unicode/utf8"
)

// PtrBool is a helper routine that returns a pointer to given boolean value.
Expand Down Expand Up @@ -40,7 +40,7 @@ func PtrTime(v time.Time) *time.Time { return &v }

// PaginationResult pagination item helper struct
type PaginationResult[T any] struct {
Item T
Item T
Error error
}

Expand Down Expand Up @@ -510,4 +510,4 @@ func copyRequest(r *http.Request, rawBody *[]byte) *http.Request {
}
newRequest.Body = io.NopCloser(bytes.NewBuffer(*rawBody))
return &newRequest
}
}
Loading

0 comments on commit 427fa59

Please sign in to comment.