Skip to content

Commit

Permalink
Regenerate client from commit c392c0b2 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Aug 26, 2022
1 parent 130301e commit c26bf9c
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2022-08-26 14:02:53.343399",
"spec_repo_commit": "3f049059"
"regenerated": "2022-08-26 17:53:59.790126",
"spec_repo_commit": "c392c0b2"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-08-26 14:02:53.357032",
"spec_repo_commit": "3f049059"
"regenerated": "2022-08-26 17:53:59.802556",
"spec_repo_commit": "c392c0b2"
}
}
}
4 changes: 4 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5513,12 +5513,16 @@ components:
x-enum-varnames:
- USER_AGENT_PARSER
MetricContentEncoding:
default: deflate
description: HTTP header used to compress the media-type.
enum:
- deflate
- gzip
example: deflate
type: string
x-enum-varnames:
- DEFLATE
- GZIP
MetricMetadata:
description: Object with all metric related metadata.
properties:
Expand Down
5 changes: 5 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4319,9 +4319,14 @@ components:
description: HTTP header used to compress the media-type.
enum:
- deflate
- zstd1
- gzip
example: deflate
type: string
x-enum-varnames:
- DEFLATE
- ZSTD1
- GZIP
MetricCustomAggregation:
description: A time and space aggregation combination for use in query.
example:
Expand Down
47 changes: 47 additions & 0 deletions examples/v2/metrics/SubmitMetrics_1762007427.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Submit metrics with compression returns "Payload accepted" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.MetricsApi;
import com.datadog.api.client.v2.api.MetricsApi.SubmitMetricsOptionalParameters;
import com.datadog.api.client.v2.model.IntakePayloadAccepted;
import com.datadog.api.client.v2.model.MetricContentEncoding;
import com.datadog.api.client.v2.model.MetricIntakeType;
import com.datadog.api.client.v2.model.MetricPayload;
import com.datadog.api.client.v2.model.MetricPoint;
import com.datadog.api.client.v2.model.MetricSeries;
import java.time.OffsetDateTime;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
MetricsApi apiInstance = new MetricsApi(defaultClient);

MetricPayload body =
new MetricPayload()
.series(
Collections.singletonList(
new MetricSeries()
.metric("system.load.1")
.type(MetricIntakeType.UNSPECIFIED)
.points(
Collections.singletonList(
new MetricPoint()
.timestamp(OffsetDateTime.now().toInstant().getEpochSecond())
.value(0.7)))));

try {
IntakePayloadAccepted result =
apiInstance.submitMetrics(
body,
new SubmitMetricsOptionalParameters().contentEncoding(MetricContentEncoding.ZSTD1));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MetricsApi#submitMetrics");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/datadog/api/client/v1/api/MetricsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,8 @@ public static class SubmitMetricsOptionalParameters {
/**
* Set contentEncoding.
*
* @param contentEncoding HTTP header used to compress the media-type. (optional)
* @param contentEncoding HTTP header used to compress the media-type. (optional, default to
* "deflate")
* @return SubmitMetricsOptionalParameters
*/
public SubmitMetricsOptionalParameters contentEncoding(MetricContentEncoding contentEncoding) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
public class MetricContentEncoding {

public static final MetricContentEncoding DEFLATE = new MetricContentEncoding("deflate");
public static final MetricContentEncoding GZIP = new MetricContentEncoding("gzip");

private static final Set<String> allowedValues = new HashSet<String>(Arrays.asList("deflate"));
private static final Set<String> allowedValues =
new HashSet<String>(Arrays.asList("deflate", "gzip"));

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
public class MetricContentEncoding {

public static final MetricContentEncoding DEFLATE = new MetricContentEncoding("deflate");
public static final MetricContentEncoding ZSTD1 = new MetricContentEncoding("zstd1");
public static final MetricContentEncoding GZIP = new MetricContentEncoding("gzip");

private static final Set<String> allowedValues = new HashSet<String>(Arrays.asList("deflate"));
private static final Set<String> allowedValues =
new HashSet<String>(Arrays.asList("deflate", "zstd1", "gzip"));

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ Feature: Metrics
When the request is sent
Then the response status is 408 Request timeout

@integration-only @skip-terraform-config @skip-validation @team:DataDog/metrics-intake @team:DataDog/metrics-query
Scenario: Submit metrics with compression returns "Payload accepted" response
Given new "SubmitMetrics" request
And body with value {"series": [{"metric": "system.load.1", "type": 0, "points": [{"timestamp": {{ timestamp('now') }}, "value": 0.7}]}]}
And request contains "Content-Encoding" parameter with value "zstd1"
When the request is sent
Then the response status is 202 Payload accepted

@generated @skip @team:DataDog/points-aggregation
Scenario: Tag Configuration Cardinality Estimator returns "API error response." response
Given a valid "appKeyAuth" key in the system
Expand Down

0 comments on commit c26bf9c

Please sign in to comment.