Skip to content

Commit adfa1ce

Browse files
Merge master into datadog-api-spec/test/rberger/SYA-1140/synthetics-get-batch
2 parents 65b425c + e3f308c commit adfa1ce

40 files changed

+1443
-82
lines changed

.apigentools-info

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.5.1.dev2",
7-
"regenerated": "2021-10-06 12:14:40.623799",
8-
"spec_repo_commit": "d29f4bc"
7+
"regenerated": "2021-10-12 10:40:46.707919",
8+
"spec_repo_commit": "ba0941e"
99
},
1010
"v2": {
1111
"apigentools_version": "1.5.1.dev2",
12-
"regenerated": "2021-10-06 12:15:14.560325",
13-
"spec_repo_commit": "d29f4bc"
12+
"regenerated": "2021-10-12 10:41:23.326834",
13+
"spec_repo_commit": "ba0941e"
1414
}
1515
}
16-
}
16+
}

.generator/templates/client.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ func (c *APIClient) PrepareRequest(
426426
for header, value := range c.cfg.DefaultHeader {
427427
localVarRequest.Header.Add(header, value)
428428
}
429+
430+
if !c.cfg.Compress {
431+
// gzip is on by default, so disable it by setting encoding to identity
432+
localVarRequest.Header.Add("Accept-Encoding", "identity")
433+
}
429434
{{#withCustomMiddlewareFunction}}
430435

431436
if c.cfg.Middleware != nil {

.generator/templates/configuration.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ type Configuration struct {
110110
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
111111
UserAgent string `json:"userAgent,omitempty"`
112112
Debug bool `json:"debug,omitempty"`
113+
Compress bool `json:"compress,omitempty"`
113114
Servers ServerConfigurations
114115
OperationServers map[string]ServerConfigurations
115116
HTTPClient *http.Client
@@ -125,6 +126,7 @@ func NewConfiguration() *Configuration {
125126
DefaultHeader: make(map[string]string),
126127
UserAgent: getUserAgent(),
127128
Debug: false,
129+
Compress: true,
128130
{{#servers}}
129131
{{#-first}}
130132
Servers: ServerConfigurations{

.generator/templates/model_simple.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
466466
}
467467
{{#vars}}
468468
{{#allowableValues}}
469-
if v := all.{{name}}; {{^required}}{{^isNullable}}v != nil && {{/isNullable}}{{/required}}!v.IsValid() {
469+
if v := all.{{name}}; {{^required}}{{^isNullable}}v != nil && {{/isNullable}}{{/required}}{{#isNullable}}v.Get() != nil && !v.Get(){{/isNullable}}{{^isNullable}}!v{{/isNullable}}.IsValid() {
470470
err = json.Unmarshal(bytes, &raw)
471471
if err != nil {
472472
return err

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ When talking to a different server, like the `eu` instance, change the `ContextS
102102
})
103103
```
104104

105+
### Disable compressed payloads
106+
107+
If you want to disable GZIP compressed responses, set the `compress` flag
108+
on your configuration object:
109+
110+
```go
111+
configuration.Compress = false
112+
```
113+
105114
## Documentation
106115

107116
Documentation for API endpoints and models can be found under the docs subdirectories, in [v1](/api/v1/datadog#documentation-for-api-endpoints)

TESTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Running tests
2+
=============
3+
4+
The Datadog Go API client has 2 sorts of tests: regular tests and BDD tests.
5+
Both are using recodings to store HTTP interactions, allowing to run the tests without
6+
talking to the API. We also store the test time to be able to freeze.
7+
8+
You can control the behavior with the `RECORD` environment variable:
9+
- `RECORD=false`, the default value, means replaying HTTP requests from recordings.
10+
- `RECORD=true` creates or updates recordings. This will need valid credentials in `DD_TEST_CLIENT_API_KEY`
11+
and `DD_TEST_CLIENT_APP_KEY`.
12+
- `RECORD=none` ignores recordings. This will also runs tests that we call `integration-only`, i.e.
13+
tests that we don't record for security reasons. It also needs valid credentials.
14+
15+
Recording and freeze files are stored in `cassettes` directory in each test package with one file per tests
16+
(e.g. `tests/api/v1/datadog/cassettes/`).
17+
18+
To run the tests, navigate to the `tests` directory and run:
19+
20+
```shell
21+
go test $(go list ./...)
22+
```
23+
24+
You can get more verbose information with the `-v` flag, and run a specific
25+
test with the `-run` argument. For example:
26+
27+
```shell
28+
go test $(go list ./...) -run TestSLOEventLifecycle -v
29+
```
30+
31+
This takes a regular expression, so you don't have to specify the whole exact
32+
string.
33+
34+
The first time you run a test that needs recordings, it will fail with:
35+
`time file 'cassettes/$TEST_NAME.freeze' not found: create one setting 'RECORD=true' or ignore it using 'RECORD=none'`.
36+
37+
BDD tests are triggered by a parent test named `TestScenarios`. To run a specific test, you need to specify
38+
the parent feature name in the `-run` argument, to look like `TestScenarios/$VERSION/Feature_$NAME/$TEST_NAME`.
39+
For example:
40+
41+
```shell
42+
go test ./scenarios -run TestScenarios/v2/Feature_Users/Scenario_Send_invitation_emails
43+
```
44+
45+
Again we don't need to pass the full test name as it's a regular expression,
46+
but we do need to pass the full prefix.
47+
48+
To get a better output you can use `gotestsum` in place of `go test`, with the `--format` option to customize
49+
the output. For example:
50+
51+
```shell
52+
gotestsum --format testname ./scenarios -run TestScenarios/Feature_Users/Scenario_Send_invitation_emails
53+
```

api/v1/datadog/.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ docs/MonitorGroupSearchResult.md
293293
docs/MonitorOptions.md
294294
docs/MonitorOptionsAggregation.md
295295
docs/MonitorOverallStates.md
296+
docs/MonitorRenotifyStatusType.md
296297
docs/MonitorSearchResponse.md
297298
docs/MonitorSearchResponseCounts.md
298299
docs/MonitorSearchResponseMetadata.md
@@ -330,6 +331,8 @@ docs/NotebookLogStreamCellAttributes.md
330331
docs/NotebookMarkdownCellAttributes.md
331332
docs/NotebookMarkdownCellDefinition.md
332333
docs/NotebookMarkdownCellDefinitionType.md
334+
docs/NotebookMetadata.md
335+
docs/NotebookMetadataType.md
333336
docs/NotebookRelativeTime.md
334337
docs/NotebookResourceType.md
335338
docs/NotebookResponse.md
@@ -935,6 +938,7 @@ model_monitor_group_search_result.go
935938
model_monitor_options.go
936939
model_monitor_options_aggregation.go
937940
model_monitor_overall_states.go
941+
model_monitor_renotify_status_type.go
938942
model_monitor_search_response.go
939943
model_monitor_search_response_counts.go
940944
model_monitor_search_response_metadata.go
@@ -971,6 +975,8 @@ model_notebook_log_stream_cell_attributes.go
971975
model_notebook_markdown_cell_attributes.go
972976
model_notebook_markdown_cell_definition.go
973977
model_notebook_markdown_cell_definition_type.go
978+
model_notebook_metadata.go
979+
model_notebook_metadata_type.go
974980
model_notebook_relative_time.go
975981
model_notebook_resource_type.go
976982
model_notebook_response.go

api/v1/datadog/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ Class | Method | HTTP request | Description
527527
- [MonitorOptions](docs/MonitorOptions.md)
528528
- [MonitorOptionsAggregation](docs/MonitorOptionsAggregation.md)
529529
- [MonitorOverallStates](docs/MonitorOverallStates.md)
530+
- [MonitorRenotifyStatusType](docs/MonitorRenotifyStatusType.md)
530531
- [MonitorSearchResponse](docs/MonitorSearchResponse.md)
531532
- [MonitorSearchResponseCounts](docs/MonitorSearchResponseCounts.md)
532533
- [MonitorSearchResponseMetadata](docs/MonitorSearchResponseMetadata.md)
@@ -563,6 +564,8 @@ Class | Method | HTTP request | Description
563564
- [NotebookMarkdownCellAttributes](docs/NotebookMarkdownCellAttributes.md)
564565
- [NotebookMarkdownCellDefinition](docs/NotebookMarkdownCellDefinition.md)
565566
- [NotebookMarkdownCellDefinitionType](docs/NotebookMarkdownCellDefinitionType.md)
567+
- [NotebookMetadata](docs/NotebookMetadata.md)
568+
- [NotebookMetadataType](docs/NotebookMetadataType.md)
566569
- [NotebookRelativeTime](docs/NotebookRelativeTime.md)
567570
- [NotebookResourceType](docs/NotebookResourceType.md)
568571
- [NotebookResponse](docs/NotebookResponse.md)

0 commit comments

Comments
 (0)