-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit c392c0b2 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Aug 26, 2022
1 parent
130301e
commit c26bf9c
Showing
8 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters