Skip to content

Commit

Permalink
Regenerate client from commit 824086bb of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 11, 2023
1 parent 847cfd5 commit ee38c3a
Show file tree
Hide file tree
Showing 9 changed files with 578 additions and 8 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.5",
"regenerated": "2023-07-11 14:36:43.463695",
"spec_repo_commit": "7ca677d6"
"regenerated": "2023-07-11 16:39:23.599213",
"spec_repo_commit": "824086bb"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-07-11 14:36:43.479079",
"spec_repo_commit": "7ca677d6"
"regenerated": "2023-07-11 16:39:23.611735",
"spec_repo_commit": "824086bb"
}
}
}
33 changes: 33 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,38 @@ components:
- service
- stat
type: object
FormulaAndFunctionCloudCostDataSource:
description: Data source for Cloud Cost queries.
enum:
- cloud_cost
example: cloud_cost
type: string
x-enum-varnames:
- CLOUD_COST
FormulaAndFunctionCloudCostQueryDefinition:
description: A formula and functions Cloud Cost query.
example:
data_source: cloud_cost
name: query1
query: sum:aws.cost.amortized{*}
properties:
aggregator:
$ref: '#/components/schemas/WidgetAggregator'
data_source:
$ref: '#/components/schemas/FormulaAndFunctionCloudCostDataSource'
name:
description: Name of the query for use in formulas.
example: my_query
type: string
query:
description: Query for Cloud Cost data.
example: ''
type: string
required:
- data_source
- query
- name
type: object
FormulaAndFunctionEventAggregation:
description: Aggregation methods for event platform queries.
enum:
Expand Down Expand Up @@ -2729,6 +2761,7 @@ components:
- $ref: '#/components/schemas/FormulaAndFunctionApmDependencyStatsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionApmResourceStatsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionSLOQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionCloudCostQueryDefinition'
type: object
FormulaAndFunctionResponseFormat:
description: Timeseries, scalar, or event list response. Event list response
Expand Down
82 changes: 82 additions & 0 deletions examples/v1/dashboards/CreateDashboard_1284514532.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Create a new dashboard with a timeseries widget using formulas and functions cloud cost query

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.FormulaAndFunctionCloudCostDataSource;
import com.datadog.api.client.v1.model.FormulaAndFunctionCloudCostQueryDefinition;
import com.datadog.api.client.v1.model.FormulaAndFunctionQueryDefinition;
import com.datadog.api.client.v1.model.FormulaAndFunctionResponseFormat;
import com.datadog.api.client.v1.model.TimeseriesWidgetDefinition;
import com.datadog.api.client.v1.model.TimeseriesWidgetDefinitionType;
import com.datadog.api.client.v1.model.TimeseriesWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetDisplayType;
import com.datadog.api.client.v1.model.WidgetFormula;
import com.datadog.api.client.v1.model.WidgetLineType;
import com.datadog.api.client.v1.model.WidgetLineWidth;
import com.datadog.api.client.v1.model.WidgetRequestStyle;
import com.datadog.api.client.v1.model.WidgetTextAlign;
import java.util.Collections;

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

Dashboard body =
new Dashboard()
.title("Example-Dashboard")
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new TimeseriesWidgetDefinition()
.title("Example Cloud Cost Query")
.titleSize("16")
.titleAlign(WidgetTextAlign.LEFT)
.type(TimeseriesWidgetDefinitionType.TIMESERIES)
.requests(
Collections.singletonList(
new TimeseriesWidgetRequest()
.formulas(
Collections.singletonList(
new WidgetFormula().formula("query1")))
.queries(
Collections.singletonList(
new FormulaAndFunctionQueryDefinition(
new FormulaAndFunctionCloudCostQueryDefinition()
.dataSource(
FormulaAndFunctionCloudCostDataSource
.CLOUD_COST)
.name("query1")
.query(
"sum:aws.cost.amortized{*} by"
+ " {aws_product}.rollup(sum,"
+ " monthly)"))))
.responseFormat(
FormulaAndFunctionResponseFormat.TIMESERIES)
.style(
new WidgetRequestStyle()
.palette("dog_classic")
.lineType(WidgetLineType.SOLID)
.lineWidth(WidgetLineWidth.NORMAL))
.displayType(WidgetDisplayType.BARS)))))))
.layoutType(DashboardLayoutType.ORDERED);

try {
Dashboard result = apiInstance.createDashboard(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#createDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v1.model;

import com.datadog.api.client.ModelEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/** Data source for Cloud Cost queries. */
@JsonSerialize(
using =
FormulaAndFunctionCloudCostDataSource.FormulaAndFunctionCloudCostDataSourceSerializer.class)
public class FormulaAndFunctionCloudCostDataSource extends ModelEnum<String> {

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

public static final FormulaAndFunctionCloudCostDataSource CLOUD_COST =
new FormulaAndFunctionCloudCostDataSource("cloud_cost");

FormulaAndFunctionCloudCostDataSource(String value) {
super(value, allowedValues);
}

public static class FormulaAndFunctionCloudCostDataSourceSerializer
extends StdSerializer<FormulaAndFunctionCloudCostDataSource> {
public FormulaAndFunctionCloudCostDataSourceSerializer(
Class<FormulaAndFunctionCloudCostDataSource> t) {
super(t);
}

public FormulaAndFunctionCloudCostDataSourceSerializer() {
this(null);
}

@Override
public void serialize(
FormulaAndFunctionCloudCostDataSource value,
JsonGenerator jgen,
SerializerProvider provider)
throws IOException, JsonProcessingException {
jgen.writeObject(value.value);
}
}

@JsonCreator
public static FormulaAndFunctionCloudCostDataSource fromValue(String value) {
return new FormulaAndFunctionCloudCostDataSource(value);
}
}
Loading

0 comments on commit ee38c3a

Please sign in to comment.