diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441bd..2b33a7ca71b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3507,6 +3507,276 @@ components: example: "90646597-5fdb-4a17-a240-647003f8c028" format: uuid type: string + ApmDependencyStatName: + description: The APM dependency statistic to query. + enum: + - avg_duration + - avg_root_duration + - avg_spans_per_trace + - error_rate + - pct_exec_time + - pct_of_traces + - total_traces_count + example: avg_duration + type: string + x-enum-varnames: + - AVG_DURATION + - AVG_ROOT_DURATION + - AVG_SPANS_PER_TRACE + - ERROR_RATE + - PCT_EXEC_TIME + - PCT_OF_TRACES + - TOTAL_TRACES_COUNT + ApmDependencyStatsDataSource: + default: apm_dependency_stats + description: A data source for APM dependency statistics queries. + enum: + - apm_dependency_stats + example: apm_dependency_stats + type: string + x-enum-varnames: + - APM_DEPENDENCY_STATS + ApmDependencyStatsQuery: + description: An individual APM dependency stats query. + properties: + data_source: + $ref: "#/components/schemas/ApmDependencyStatsDataSource" + env: + description: The environment to query. + example: prod + type: string + is_upstream: + description: Determines whether stats for upstream or downstream dependencies should be queried. + example: true + type: boolean + name: + description: The variable name for use in formulas. + example: query1 + type: string + operation_name: + description: The APM operation name. + example: web.request + type: string + primary_tag_name: + description: The name of the second primary tag used within APM; required when `primary_tag_value` is specified. See https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog. + example: datacenter + type: string + primary_tag_value: + description: Filter APM data by the second primary tag. `primary_tag_name` must also be specified. + example: us-east-1 + type: string + resource_name: + description: The resource name to filter by. + example: "" + type: string + service: + description: The service name to filter by. + example: web-store + type: string + stat: + $ref: "#/components/schemas/ApmDependencyStatName" + required: + - data_source + - name + - env + - operation_name + - resource_name + - service + - stat + type: object + ApmMetricsDataSource: + default: apm_metrics + description: A data source for APM metrics queries. + enum: + - apm_metrics + example: apm_metrics + type: string + x-enum-varnames: + - APM_METRICS + ApmMetricsQuery: + description: An individual APM metrics query. + properties: + data_source: + $ref: "#/components/schemas/ApmMetricsDataSource" + group_by: + description: Optional fields to group the query results by. + items: + description: A field to group results by. + example: service + type: string + type: array + name: + description: The variable name for use in formulas. + example: query1 + type: string + operation_mode: + description: Optional operation mode to aggregate across operation names. + example: "primary" + type: string + operation_name: + description: Name of operation on service. If not provided, the primary operation name is used. + example: web.request + type: string + peer_tags: + description: Tags to query for a specific downstream entity (peer.service, peer.db_instance, peer.s3, peer.s3.bucket, etc.). + items: + description: A peer tag value. + example: "peer.service:my-service" + type: string + type: array + query_filter: + description: Additional filters for the query using metrics query syntax (e.g., env, primary_tag). + example: "env:prod" + type: string + resource_hash: + description: The resource hash for exact matching. + example: "abc123" + type: string + resource_name: + description: The full name of a specific resource to filter by. + example: "GET /api/v1/users" + type: string + service: + description: The service name to filter by. + example: web-store + type: string + span_kind: + description: Describes the relationship between the span, its parents, and its children in a trace. Known values include consumer, server, client, producer, internal. + example: server + type: string + stat: + $ref: "#/components/schemas/ApmMetricsStat" + required: + - data_source + - name + - stat + type: object + ApmMetricsStat: + description: The APM metric statistic to query. + enum: + - error_rate + - errors + - errors_per_second + - hits + - hits_per_second + - apdex + - latency_avg + - latency_max + - latency_p50 + - latency_p75 + - latency_p90 + - latency_p95 + - latency_p99 + - latency_p999 + - latency_distribution + - total_time + example: latency_p99 + type: string + x-enum-varnames: + - ERROR_RATE + - ERRORS + - ERRORS_PER_SECOND + - HITS + - HITS_PER_SECOND + - APDEX + - LATENCY_AVG + - LATENCY_MAX + - LATENCY_P50 + - LATENCY_P75 + - LATENCY_P90 + - LATENCY_P95 + - LATENCY_P99 + - LATENCY_P999 + - LATENCY_DISTRIBUTION + - TOTAL_TIME + ApmResourceStatName: + description: The APM resource statistic to query. + enum: + - error_rate + - errors + - hits + - latency_avg + - latency_max + - latency_p50 + - latency_p75 + - latency_p90 + - latency_p95 + - latency_p99 + - latency_distribution + - total_time + example: latency_p95 + type: string + x-enum-varnames: + - ERROR_RATE + - ERRORS + - HITS + - LATENCY_AVG + - LATENCY_MAX + - LATENCY_P50 + - LATENCY_P75 + - LATENCY_P90 + - LATENCY_P95 + - LATENCY_P99 + - LATENCY_DISTRIBUTION + - TOTAL_TIME + ApmResourceStatsDataSource: + default: apm_resource_stats + description: A data source for APM resource statistics queries. + enum: + - apm_resource_stats + example: apm_resource_stats + type: string + x-enum-varnames: + - APM_RESOURCE_STATS + ApmResourceStatsQuery: + description: An individual APM resource stats query. + properties: + data_source: + $ref: "#/components/schemas/ApmResourceStatsDataSource" + env: + description: The environment to query. + example: prod + type: string + group_by: + description: Tag keys to group results by. + items: + description: A tag key to group by. + example: resource_name + type: string + type: array + name: + description: The variable name for use in formulas. + example: query1 + type: string + operation_name: + description: The APM operation name. + example: web.request + type: string + primary_tag_name: + description: Name of the second primary tag used within APM. Required when `primary_tag_value` is specified. See https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog + example: datacenter + type: string + primary_tag_value: + description: Value of the second primary tag by which to filter APM data. `primary_tag_name` must also be specified. + example: us-east-1 + type: string + resource_name: + description: The resource name to filter by. + example: "Admin::ProductsController#create" + type: string + service: + description: The service name to filter by. + example: web-store + type: string + stat: + $ref: "#/components/schemas/ApmResourceStatName" + required: + - data_source + - name + - env + - service + - stat + type: object ApmRetentionFilterType: default: apm_retention_filter description: The type of the resource. @@ -13405,6 +13675,15 @@ components: type: string type: array type: object + ContainerDataSource: + default: container + description: A data source for container-level infrastructure metrics. + enum: + - container + example: container + type: string + x-enum-varnames: + - CONTAINER ContainerGroup: description: Container group object. properties: @@ -13816,6 +14095,86 @@ components: type: string x-enum-varnames: - CURSOR_LIMIT + ContainerScalarQuery: + description: An individual scalar container query. + properties: + aggregator: + description: The temporal reduction function to apply. + example: avg + type: string + data_source: + $ref: "#/components/schemas/ContainerDataSource" + is_normalized_cpu: + description: Whether CPU metrics should be normalized by core count. + type: boolean + limit: + description: Maximum number of timeseries to return. + format: int64 + type: integer + metric: + description: The container metric to query. + example: container.cpu.user + type: string + name: + description: The variable name for use in formulas. + example: query1 + type: string + sort: + description: Sort order for the results. + type: string + tag_filters: + description: Tag filters to narrow down containers. + items: + description: A tag filter value. + example: "env:prod" + type: string + type: array + text_filter: + description: A full-text search filter to match container names. + type: string + required: + - data_source + - name + - metric + type: object + ContainerTimeseriesQuery: + description: An individual timeseries container query. + properties: + data_source: + $ref: "#/components/schemas/ContainerDataSource" + is_normalized_cpu: + description: Whether CPU metrics should be normalized by core count. + type: boolean + limit: + description: Maximum number of timeseries to return. + format: int64 + type: integer + metric: + description: The container metric to query. + example: container.cpu.user + type: string + name: + description: The variable name for use in formulas. + example: query1 + type: string + sort: + description: Sort order for the results. + type: string + tag_filters: + description: Tag filters to narrow down containers. + items: + description: A tag filter value. + example: "env:prod" + type: string + type: array + text_filter: + description: A full-text search filter to match container names. + type: string + required: + - data_source + - name + - metric + type: object ContainerType: default: container description: Type of container. @@ -24345,13 +24704,35 @@ components: description: A data source that is powered by the Events Platform. enum: - logs + - spans + - network - rum + - security_signals + - profiles + - audit + - events + - ci_tests + - ci_pipelines + - incident_analytics + - product_analytics + - on_call_events - dora example: logs type: string x-enum-varnames: - LOGS + - SPANS + - NETWORK - RUM + - SECURITY_SIGNALS + - PROFILES + - AUDIT + - EVENTS + - CI_TESTS + - CI_PIPELINES + - INCIDENT_ANALYTICS + - PRODUCT_ANALYTICS + - ON_CALL_EVENTS - DORA EventsGroupBy: description: A dimension on which to split a query's results. @@ -49380,6 +49761,57 @@ components: required: - type type: object + ProcessDataSource: + default: process + description: A data source for process-level infrastructure metrics. + enum: + - process + example: process + type: string + x-enum-varnames: + - PROCESS + ProcessScalarQuery: + description: An individual scalar process query. + properties: + aggregator: + description: The temporal reduction function to apply. + example: avg + type: string + data_source: + $ref: "#/components/schemas/ProcessDataSource" + is_normalized_cpu: + description: Whether CPU metrics should be normalized by core count. + type: boolean + limit: + description: Maximum number of timeseries to return. + format: int64 + type: integer + metric: + description: The process metric to query. + example: process.cpu.user + type: string + name: + description: The variable name for use in formulas. + example: query1 + type: string + sort: + description: Sort order for the results. + type: string + tag_filters: + description: Tag filters to narrow down processes. + items: + description: A tag filter value. + example: "env:prod" + type: string + type: array + text_filter: + description: A full-text search filter to match process names or commands. + type: string + required: + - data_source + - name + - metric + type: object ProcessSummariesMeta: description: Response metadata object. properties: @@ -49466,6 +49898,44 @@ components: type: string x-enum-varnames: - PROCESS + ProcessTimeseriesQuery: + description: An individual timeseries process query. + properties: + data_source: + $ref: "#/components/schemas/ProcessDataSource" + is_normalized_cpu: + description: Whether CPU metrics should be normalized by core count. + type: boolean + limit: + description: Maximum number of timeseries to return. + format: int64 + type: integer + metric: + description: The process metric to query. + example: process.cpu.user + type: string + name: + description: The variable name for use in formulas. + example: query1 + type: string + sort: + description: Sort order for the results. + type: string + tag_filters: + description: Tag filters to narrow down processes. + items: + description: A tag filter value. + example: "env:prod" + type: string + type: array + text_filter: + description: A full-text search filter to match process names or commands. + type: string + required: + - data_source + - name + - metric + type: object ProductAnalyticsAnalyticsQuery: description: The analytics query definition containing a base query, compute rule, and optional grouping. properties: @@ -55590,6 +56060,12 @@ components: oneOf: - $ref: "#/components/schemas/MetricsScalarQuery" - $ref: "#/components/schemas/EventsScalarQuery" + - $ref: "#/components/schemas/ApmResourceStatsQuery" + - $ref: "#/components/schemas/ApmMetricsQuery" + - $ref: "#/components/schemas/ApmDependencyStatsQuery" + - $ref: "#/components/schemas/SloQuery" + - $ref: "#/components/schemas/ProcessScalarQuery" + - $ref: "#/components/schemas/ContainerScalarQuery" ScalarResponse: description: A message containing the response to a scalar query. properties: @@ -62793,6 +63269,51 @@ components: required: - slackTrigger type: object + SloDataSource: + default: slo + description: A data source for SLO queries. + enum: + - slo + example: slo + type: string + x-enum-varnames: + - SLO + SloQuery: + description: An individual SLO query. + example: + additional_query_filters: "*" + data_source: "slo" + group_mode: "overall" + measure: "good_events" + name: "my_slo" + slo_id: "12345678910" + slo_query_type: "metric" + properties: + additional_query_filters: + description: Additional filters applied to the SLO query. + example: "host:host_a,env:prod" + type: string + data_source: + $ref: "#/components/schemas/SloDataSource" + group_mode: + $ref: "#/components/schemas/SlosGroupMode" + measure: + $ref: "#/components/schemas/SlosMeasure" + name: + description: The variable name for use in formulas. + example: query1 + type: string + slo_id: + description: The unique identifier of the SLO to query. + example: "a]b123c45de6f78g90h" + type: string + slo_query_type: + $ref: "#/components/schemas/SlosQueryType" + required: + - data_source + - slo_id + - measure + type: object SloReportCreateRequest: description: The SLO report request body. properties: @@ -62900,6 +63421,54 @@ components: type: string x-enum-varnames: - SLO_STATUS + SlosGroupMode: + description: How SLO results are grouped in the response. + enum: + - overall + - components + example: overall + type: string + x-enum-varnames: + - OVERALL + - COMPONENTS + SlosMeasure: + description: The SLO measurement to retrieve. + enum: + - good_events + - bad_events + - slo_status + - error_budget_remaining + - error_budget_remaining_history + - error_budget_burndown + - burn_rate + - slo_status_history + - good_minutes + - bad_minutes + example: slo_status + type: string + x-enum-varnames: + - GOOD_EVENTS + - BAD_EVENTS + - SLO_STATUS + - ERROR_BUDGET_REMAINING + - ERROR_BUDGET_REMAINING_HISTORY + - ERROR_BUDGET_BURNDOWN + - BURN_RATE + - SLO_STATUS_HISTORY + - GOOD_MINUTES + - BAD_MINUTES + SlosQueryType: + description: The type of SLO definition being queried. + enum: + - metric + - time_slice + - monitor + example: metric + type: string + x-enum-varnames: + - METRIC + - TIME_SLICE + - MONITOR Snapshot: description: A single heatmap snapshot resource returned by create or update operations. properties: @@ -69639,6 +70208,12 @@ components: oneOf: - $ref: "#/components/schemas/MetricsTimeseriesQuery" - $ref: "#/components/schemas/EventsTimeseriesQuery" + - $ref: "#/components/schemas/ApmResourceStatsQuery" + - $ref: "#/components/schemas/ApmMetricsQuery" + - $ref: "#/components/schemas/ApmDependencyStatsQuery" + - $ref: "#/components/schemas/SloQuery" + - $ref: "#/components/schemas/ProcessTimeseriesQuery" + - $ref: "#/components/schemas/ContainerTimeseriesQuery" TimeseriesResponse: description: A message containing the response to a timeseries query. properties: diff --git a/examples/v2/metrics/QueryScalarData_1479548882.java b/examples/v2/metrics/QueryScalarData_1479548882.java new file mode 100644 index 00000000000..1ffb1f6fe75 --- /dev/null +++ b/examples/v2/metrics/QueryScalarData_1479548882.java @@ -0,0 +1,68 @@ +// Scalar cross product query with apm_resource_stats data source returns "OK" 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.model.ApmResourceStatName; +import com.datadog.api.client.v2.model.ApmResourceStatsDataSource; +import com.datadog.api.client.v2.model.ApmResourceStatsQuery; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest; +import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse; +import com.datadog.api.client.v2.model.ScalarFormulaRequest; +import com.datadog.api.client.v2.model.ScalarFormulaRequestAttributes; +import com.datadog.api.client.v2.model.ScalarFormulaRequestType; +import com.datadog.api.client.v2.model.ScalarQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + ScalarFormulaQueryRequest body = + new ScalarFormulaQueryRequest() + .data( + new ScalarFormulaRequest() + .attributes( + new ScalarFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .queries( + Collections.singletonList( + new ScalarQuery( + new ApmResourceStatsQuery() + .dataSource( + ApmResourceStatsDataSource.APM_RESOURCE_STATS) + .name("a") + .env("staging") + .service("azure-bill-import") + .stat(ApmResourceStatName.HITS) + .operationName("cassandra.query") + .groupBy(Collections.singletonList("resource_name")) + .primaryTagName("datacenter") + .primaryTagValue("*")))) + .to(1636629071000L)) + .type(ScalarFormulaRequestType.SCALAR_REQUEST)); + + try { + ScalarFormulaQueryResponse result = apiInstance.queryScalarData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryScalarData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryScalarData_1904811219.java b/examples/v2/metrics/QueryScalarData_1904811219.java new file mode 100644 index 00000000000..8a74e8735ed --- /dev/null +++ b/examples/v2/metrics/QueryScalarData_1904811219.java @@ -0,0 +1,64 @@ +// Scalar cross product query with apm_metrics data source returns "OK" 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.model.ApmMetricsDataSource; +import com.datadog.api.client.v2.model.ApmMetricsQuery; +import com.datadog.api.client.v2.model.ApmMetricsStat; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest; +import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse; +import com.datadog.api.client.v2.model.ScalarFormulaRequest; +import com.datadog.api.client.v2.model.ScalarFormulaRequestAttributes; +import com.datadog.api.client.v2.model.ScalarFormulaRequestType; +import com.datadog.api.client.v2.model.ScalarQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + ScalarFormulaQueryRequest body = + new ScalarFormulaQueryRequest() + .data( + new ScalarFormulaRequest() + .attributes( + new ScalarFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .queries( + Collections.singletonList( + new ScalarQuery( + new ApmMetricsQuery() + .dataSource(ApmMetricsDataSource.APM_METRICS) + .name("a") + .stat(ApmMetricsStat.HITS) + .service("web-store") + .queryFilter("env:prod") + .groupBy(Collections.singletonList("resource_name"))))) + .to(1636629071000L)) + .type(ScalarFormulaRequestType.SCALAR_REQUEST)); + + try { + ScalarFormulaQueryResponse result = apiInstance.queryScalarData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryScalarData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryScalarData_2298288525.java b/examples/v2/metrics/QueryScalarData_2298288525.java new file mode 100644 index 00000000000..b49fb99136d --- /dev/null +++ b/examples/v2/metrics/QueryScalarData_2298288525.java @@ -0,0 +1,67 @@ +// Scalar cross product query with slo data source returns "OK" 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.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest; +import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse; +import com.datadog.api.client.v2.model.ScalarFormulaRequest; +import com.datadog.api.client.v2.model.ScalarFormulaRequestAttributes; +import com.datadog.api.client.v2.model.ScalarFormulaRequestType; +import com.datadog.api.client.v2.model.ScalarQuery; +import com.datadog.api.client.v2.model.SloDataSource; +import com.datadog.api.client.v2.model.SloQuery; +import com.datadog.api.client.v2.model.SlosGroupMode; +import com.datadog.api.client.v2.model.SlosMeasure; +import com.datadog.api.client.v2.model.SlosQueryType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + ScalarFormulaQueryRequest body = + new ScalarFormulaQueryRequest() + .data( + new ScalarFormulaRequest() + .attributes( + new ScalarFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .queries( + Collections.singletonList( + new ScalarQuery( + new SloQuery() + .dataSource(SloDataSource.SLO) + .name("a") + .sloId("12345678910") + .measure(SlosMeasure.SLO_STATUS) + .sloQueryType(SlosQueryType.METRIC) + .groupMode(SlosGroupMode.OVERALL) + .additionalQueryFilters("*")))) + .to(1636629071000L)) + .type(ScalarFormulaRequestType.SCALAR_REQUEST)); + + try { + ScalarFormulaQueryResponse result = apiInstance.queryScalarData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryScalarData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryScalarData_2533499017.java b/examples/v2/metrics/QueryScalarData_2533499017.java new file mode 100644 index 00000000000..d0a1e0685b6 --- /dev/null +++ b/examples/v2/metrics/QueryScalarData_2533499017.java @@ -0,0 +1,72 @@ +// Scalar cross product query with apm_dependency_stats data source returns "OK" 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.model.ApmDependencyStatName; +import com.datadog.api.client.v2.model.ApmDependencyStatsDataSource; +import com.datadog.api.client.v2.model.ApmDependencyStatsQuery; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest; +import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse; +import com.datadog.api.client.v2.model.ScalarFormulaRequest; +import com.datadog.api.client.v2.model.ScalarFormulaRequestAttributes; +import com.datadog.api.client.v2.model.ScalarFormulaRequestType; +import com.datadog.api.client.v2.model.ScalarQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + ScalarFormulaQueryRequest body = + new ScalarFormulaQueryRequest() + .data( + new ScalarFormulaRequest() + .attributes( + new ScalarFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .queries( + Collections.singletonList( + new ScalarQuery( + new ApmDependencyStatsQuery() + .dataSource( + ApmDependencyStatsDataSource.APM_DEPENDENCY_STATS) + .name("a") + .env("ci") + .service("cassandra") + .stat(ApmDependencyStatName.AVG_DURATION) + .operationName("cassandra.query") + .resourceName( + "DELETE FROM" + + " monitor_history.monitor_state_change_history" + + " WHERE org_id = ? AND monitor_id IN ? AND" + + " group = ?") + .primaryTagName("datacenter") + .primaryTagValue("edge-eu1.prod.dog")))) + .to(1636629071000L)) + .type(ScalarFormulaRequestType.SCALAR_REQUEST)); + + try { + ScalarFormulaQueryResponse result = apiInstance.queryScalarData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryScalarData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryScalarData_4230617918.java b/examples/v2/metrics/QueryScalarData_4230617918.java new file mode 100644 index 00000000000..db65d77ef38 --- /dev/null +++ b/examples/v2/metrics/QueryScalarData_4230617918.java @@ -0,0 +1,64 @@ +// Scalar cross product query with process data source returns "OK" 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.model.FormulaLimit; +import com.datadog.api.client.v2.model.ProcessDataSource; +import com.datadog.api.client.v2.model.ProcessScalarQuery; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest; +import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse; +import com.datadog.api.client.v2.model.ScalarFormulaRequest; +import com.datadog.api.client.v2.model.ScalarFormulaRequestAttributes; +import com.datadog.api.client.v2.model.ScalarFormulaRequestType; +import com.datadog.api.client.v2.model.ScalarQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + ScalarFormulaQueryRequest body = + new ScalarFormulaQueryRequest() + .data( + new ScalarFormulaRequest() + .attributes( + new ScalarFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .queries( + Collections.singletonList( + new ScalarQuery( + new ProcessScalarQuery() + .dataSource(ProcessDataSource.PROCESS) + .name("a") + .metric("process.stat.cpu.total_pct") + .textFilter("") + .limit(10L) + .sort("desc") + .isNormalizedCpu(false)))) + .to(1636629071000L)) + .type(ScalarFormulaRequestType.SCALAR_REQUEST)); + + try { + ScalarFormulaQueryResponse result = apiInstance.queryScalarData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryScalarData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryScalarData_891952130.java b/examples/v2/metrics/QueryScalarData_891952130.java new file mode 100644 index 00000000000..2629ba293bc --- /dev/null +++ b/examples/v2/metrics/QueryScalarData_891952130.java @@ -0,0 +1,62 @@ +// Scalar cross product query with container data source returns "OK" 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.model.ContainerDataSource; +import com.datadog.api.client.v2.model.ContainerScalarQuery; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest; +import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse; +import com.datadog.api.client.v2.model.ScalarFormulaRequest; +import com.datadog.api.client.v2.model.ScalarFormulaRequestAttributes; +import com.datadog.api.client.v2.model.ScalarFormulaRequestType; +import com.datadog.api.client.v2.model.ScalarQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + ScalarFormulaQueryRequest body = + new ScalarFormulaQueryRequest() + .data( + new ScalarFormulaRequest() + .attributes( + new ScalarFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .queries( + Collections.singletonList( + new ScalarQuery( + new ContainerScalarQuery() + .dataSource(ContainerDataSource.CONTAINER) + .name("a") + .metric("container.cpu.usage") + .limit(10L) + .sort("desc")))) + .to(1636629071000L)) + .type(ScalarFormulaRequestType.SCALAR_REQUEST)); + + try { + ScalarFormulaQueryResponse result = apiInstance.queryScalarData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryScalarData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryTimeseriesData_108927825.java b/examples/v2/metrics/QueryTimeseriesData_108927825.java new file mode 100644 index 00000000000..76f11627cd9 --- /dev/null +++ b/examples/v2/metrics/QueryTimeseriesData_108927825.java @@ -0,0 +1,68 @@ +// Timeseries cross product query with slo data source returns "OK" 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.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.SloDataSource; +import com.datadog.api.client.v2.model.SloQuery; +import com.datadog.api.client.v2.model.SlosGroupMode; +import com.datadog.api.client.v2.model.SlosMeasure; +import com.datadog.api.client.v2.model.SlosQueryType; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryResponse; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestAttributes; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestType; +import com.datadog.api.client.v2.model.TimeseriesQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + TimeseriesFormulaQueryRequest body = + new TimeseriesFormulaQueryRequest() + .data( + new TimeseriesFormulaRequest() + .attributes( + new TimeseriesFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .interval(5000L) + .queries( + Collections.singletonList( + new TimeseriesQuery( + new SloQuery() + .dataSource(SloDataSource.SLO) + .name("a") + .sloId("12345678910") + .measure(SlosMeasure.SLO_STATUS) + .sloQueryType(SlosQueryType.METRIC) + .groupMode(SlosGroupMode.OVERALL) + .additionalQueryFilters("*")))) + .to(1636629071000L)) + .type(TimeseriesFormulaRequestType.TIMESERIES_REQUEST)); + + try { + TimeseriesFormulaQueryResponse result = apiInstance.queryTimeseriesData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryTimeseriesData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryTimeseriesData_2159746306.java b/examples/v2/metrics/QueryTimeseriesData_2159746306.java new file mode 100644 index 00000000000..713412a8c39 --- /dev/null +++ b/examples/v2/metrics/QueryTimeseriesData_2159746306.java @@ -0,0 +1,65 @@ +// Timeseries cross product query with process data source returns "OK" 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.model.FormulaLimit; +import com.datadog.api.client.v2.model.ProcessDataSource; +import com.datadog.api.client.v2.model.ProcessTimeseriesQuery; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryResponse; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestAttributes; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestType; +import com.datadog.api.client.v2.model.TimeseriesQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + TimeseriesFormulaQueryRequest body = + new TimeseriesFormulaQueryRequest() + .data( + new TimeseriesFormulaRequest() + .attributes( + new TimeseriesFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .interval(5000L) + .queries( + Collections.singletonList( + new TimeseriesQuery( + new ProcessTimeseriesQuery() + .dataSource(ProcessDataSource.PROCESS) + .name("a") + .metric("process.stat.cpu.total_pct") + .textFilter("") + .limit(10L) + .sort("desc") + .isNormalizedCpu(false)))) + .to(1636629071000L)) + .type(TimeseriesFormulaRequestType.TIMESERIES_REQUEST)); + + try { + TimeseriesFormulaQueryResponse result = apiInstance.queryTimeseriesData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryTimeseriesData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryTimeseriesData_3174309318.java b/examples/v2/metrics/QueryTimeseriesData_3174309318.java new file mode 100644 index 00000000000..bc666787480 --- /dev/null +++ b/examples/v2/metrics/QueryTimeseriesData_3174309318.java @@ -0,0 +1,63 @@ +// Timeseries cross product query with container data source returns "OK" 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.model.ContainerDataSource; +import com.datadog.api.client.v2.model.ContainerTimeseriesQuery; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryResponse; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestAttributes; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestType; +import com.datadog.api.client.v2.model.TimeseriesQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + TimeseriesFormulaQueryRequest body = + new TimeseriesFormulaQueryRequest() + .data( + new TimeseriesFormulaRequest() + .attributes( + new TimeseriesFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .interval(5000L) + .queries( + Collections.singletonList( + new TimeseriesQuery( + new ContainerTimeseriesQuery() + .dataSource(ContainerDataSource.CONTAINER) + .name("a") + .metric("container.cpu.usage") + .limit(10L) + .sort("desc")))) + .to(1636629071000L)) + .type(TimeseriesFormulaRequestType.TIMESERIES_REQUEST)); + + try { + TimeseriesFormulaQueryResponse result = apiInstance.queryTimeseriesData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryTimeseriesData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryTimeseriesData_4028506518.java b/examples/v2/metrics/QueryTimeseriesData_4028506518.java new file mode 100644 index 00000000000..2e5dd095022 --- /dev/null +++ b/examples/v2/metrics/QueryTimeseriesData_4028506518.java @@ -0,0 +1,69 @@ +// Timeseries cross product query with apm_resource_stats data source returns "OK" 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.model.ApmResourceStatName; +import com.datadog.api.client.v2.model.ApmResourceStatsDataSource; +import com.datadog.api.client.v2.model.ApmResourceStatsQuery; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryResponse; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestAttributes; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestType; +import com.datadog.api.client.v2.model.TimeseriesQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + TimeseriesFormulaQueryRequest body = + new TimeseriesFormulaQueryRequest() + .data( + new TimeseriesFormulaRequest() + .attributes( + new TimeseriesFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .interval(5000L) + .queries( + Collections.singletonList( + new TimeseriesQuery( + new ApmResourceStatsQuery() + .dataSource( + ApmResourceStatsDataSource.APM_RESOURCE_STATS) + .name("a") + .env("staging") + .service("azure-bill-import") + .stat(ApmResourceStatName.HITS) + .operationName("cassandra.query") + .groupBy(Collections.singletonList("resource_name")) + .primaryTagName("datacenter") + .primaryTagValue("*")))) + .to(1636629071000L)) + .type(TimeseriesFormulaRequestType.TIMESERIES_REQUEST)); + + try { + TimeseriesFormulaQueryResponse result = apiInstance.queryTimeseriesData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryTimeseriesData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryTimeseriesData_4246412951.java b/examples/v2/metrics/QueryTimeseriesData_4246412951.java new file mode 100644 index 00000000000..77a55fcc2d1 --- /dev/null +++ b/examples/v2/metrics/QueryTimeseriesData_4246412951.java @@ -0,0 +1,65 @@ +// Timeseries cross product query with apm_metrics data source returns "OK" 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.model.ApmMetricsDataSource; +import com.datadog.api.client.v2.model.ApmMetricsQuery; +import com.datadog.api.client.v2.model.ApmMetricsStat; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryResponse; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestAttributes; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestType; +import com.datadog.api.client.v2.model.TimeseriesQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + TimeseriesFormulaQueryRequest body = + new TimeseriesFormulaQueryRequest() + .data( + new TimeseriesFormulaRequest() + .attributes( + new TimeseriesFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .interval(5000L) + .queries( + Collections.singletonList( + new TimeseriesQuery( + new ApmMetricsQuery() + .dataSource(ApmMetricsDataSource.APM_METRICS) + .name("a") + .stat(ApmMetricsStat.HITS) + .service("web-store") + .queryFilter("env:prod") + .groupBy(Collections.singletonList("resource_name"))))) + .to(1636629071000L)) + .type(TimeseriesFormulaRequestType.TIMESERIES_REQUEST)); + + try { + TimeseriesFormulaQueryResponse result = apiInstance.queryTimeseriesData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryTimeseriesData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/metrics/QueryTimeseriesData_847716941.java b/examples/v2/metrics/QueryTimeseriesData_847716941.java new file mode 100644 index 00000000000..78b8b4dfdeb --- /dev/null +++ b/examples/v2/metrics/QueryTimeseriesData_847716941.java @@ -0,0 +1,73 @@ +// Timeseries cross product query with apm_dependency_stats data source returns "OK" 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.model.ApmDependencyStatName; +import com.datadog.api.client.v2.model.ApmDependencyStatsDataSource; +import com.datadog.api.client.v2.model.ApmDependencyStatsQuery; +import com.datadog.api.client.v2.model.FormulaLimit; +import com.datadog.api.client.v2.model.QueryFormula; +import com.datadog.api.client.v2.model.QuerySortOrder; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaQueryResponse; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequest; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestAttributes; +import com.datadog.api.client.v2.model.TimeseriesFormulaRequestType; +import com.datadog.api.client.v2.model.TimeseriesQuery; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + TimeseriesFormulaQueryRequest body = + new TimeseriesFormulaQueryRequest() + .data( + new TimeseriesFormulaRequest() + .attributes( + new TimeseriesFormulaRequestAttributes() + .formulas( + Collections.singletonList( + new QueryFormula() + .formula("a") + .limit( + new FormulaLimit() + .count(10) + .order(QuerySortOrder.DESC)))) + .from(1636625471000L) + .interval(5000L) + .queries( + Collections.singletonList( + new TimeseriesQuery( + new ApmDependencyStatsQuery() + .dataSource( + ApmDependencyStatsDataSource.APM_DEPENDENCY_STATS) + .name("a") + .env("ci") + .service("cassandra") + .stat(ApmDependencyStatName.AVG_DURATION) + .operationName("cassandra.query") + .resourceName( + "DELETE FROM" + + " monitor_history.monitor_state_change_history" + + " WHERE org_id = ? AND monitor_id IN ? AND" + + " group = ?") + .primaryTagName("datacenter") + .primaryTagValue("edge-eu1.prod.dog")))) + .to(1636629071000L)) + .type(TimeseriesFormulaRequestType.TIMESERIES_REQUEST)); + + try { + TimeseriesFormulaQueryResponse result = apiInstance.queryTimeseriesData(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#queryTimeseriesData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatName.java b/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatName.java new file mode 100644 index 00000000000..606f0419d8f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatName.java @@ -0,0 +1,75 @@ +/* + * 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.v2.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; + +/** The APM dependency statistic to query. */ +@JsonSerialize(using = ApmDependencyStatName.ApmDependencyStatNameSerializer.class) +public class ApmDependencyStatName extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "avg_duration", + "avg_root_duration", + "avg_spans_per_trace", + "error_rate", + "pct_exec_time", + "pct_of_traces", + "total_traces_count")); + + public static final ApmDependencyStatName AVG_DURATION = + new ApmDependencyStatName("avg_duration"); + public static final ApmDependencyStatName AVG_ROOT_DURATION = + new ApmDependencyStatName("avg_root_duration"); + public static final ApmDependencyStatName AVG_SPANS_PER_TRACE = + new ApmDependencyStatName("avg_spans_per_trace"); + public static final ApmDependencyStatName ERROR_RATE = new ApmDependencyStatName("error_rate"); + public static final ApmDependencyStatName PCT_EXEC_TIME = + new ApmDependencyStatName("pct_exec_time"); + public static final ApmDependencyStatName PCT_OF_TRACES = + new ApmDependencyStatName("pct_of_traces"); + public static final ApmDependencyStatName TOTAL_TRACES_COUNT = + new ApmDependencyStatName("total_traces_count"); + + ApmDependencyStatName(String value) { + super(value, allowedValues); + } + + public static class ApmDependencyStatNameSerializer extends StdSerializer { + public ApmDependencyStatNameSerializer(Class t) { + super(t); + } + + public ApmDependencyStatNameSerializer() { + this(null); + } + + @Override + public void serialize( + ApmDependencyStatName value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ApmDependencyStatName fromValue(String value) { + return new ApmDependencyStatName(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatsDataSource.java b/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatsDataSource.java new file mode 100644 index 00000000000..127f88b9dd1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatsDataSource.java @@ -0,0 +1,57 @@ +/* + * 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.v2.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; + +/** A data source for APM dependency statistics queries. */ +@JsonSerialize(using = ApmDependencyStatsDataSource.ApmDependencyStatsDataSourceSerializer.class) +public class ApmDependencyStatsDataSource extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("apm_dependency_stats")); + + public static final ApmDependencyStatsDataSource APM_DEPENDENCY_STATS = + new ApmDependencyStatsDataSource("apm_dependency_stats"); + + ApmDependencyStatsDataSource(String value) { + super(value, allowedValues); + } + + public static class ApmDependencyStatsDataSourceSerializer + extends StdSerializer { + public ApmDependencyStatsDataSourceSerializer(Class t) { + super(t); + } + + public ApmDependencyStatsDataSourceSerializer() { + this(null); + } + + @Override + public void serialize( + ApmDependencyStatsDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ApmDependencyStatsDataSource fromValue(String value) { + return new ApmDependencyStatsDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatsQuery.java b/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatsQuery.java new file mode 100644 index 00000000000..dcf29af9b87 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmDependencyStatsQuery.java @@ -0,0 +1,420 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An individual APM dependency stats query. */ +@JsonPropertyOrder({ + ApmDependencyStatsQuery.JSON_PROPERTY_DATA_SOURCE, + ApmDependencyStatsQuery.JSON_PROPERTY_ENV, + ApmDependencyStatsQuery.JSON_PROPERTY_IS_UPSTREAM, + ApmDependencyStatsQuery.JSON_PROPERTY_NAME, + ApmDependencyStatsQuery.JSON_PROPERTY_OPERATION_NAME, + ApmDependencyStatsQuery.JSON_PROPERTY_PRIMARY_TAG_NAME, + ApmDependencyStatsQuery.JSON_PROPERTY_PRIMARY_TAG_VALUE, + ApmDependencyStatsQuery.JSON_PROPERTY_RESOURCE_NAME, + ApmDependencyStatsQuery.JSON_PROPERTY_SERVICE, + ApmDependencyStatsQuery.JSON_PROPERTY_STAT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ApmDependencyStatsQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ApmDependencyStatsDataSource dataSource = + ApmDependencyStatsDataSource.APM_DEPENDENCY_STATS; + + public static final String JSON_PROPERTY_ENV = "env"; + private String env; + + public static final String JSON_PROPERTY_IS_UPSTREAM = "is_upstream"; + private Boolean isUpstream; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OPERATION_NAME = "operation_name"; + private String operationName; + + public static final String JSON_PROPERTY_PRIMARY_TAG_NAME = "primary_tag_name"; + private String primaryTagName; + + public static final String JSON_PROPERTY_PRIMARY_TAG_VALUE = "primary_tag_value"; + private String primaryTagValue; + + public static final String JSON_PROPERTY_RESOURCE_NAME = "resource_name"; + private String resourceName; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_STAT = "stat"; + private ApmDependencyStatName stat; + + public ApmDependencyStatsQuery() {} + + @JsonCreator + public ApmDependencyStatsQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ApmDependencyStatsDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_ENV) String env, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_OPERATION_NAME) String operationName, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_NAME) String resourceName, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE) String service, + @JsonProperty(required = true, value = JSON_PROPERTY_STAT) ApmDependencyStatName stat) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.env = env; + this.name = name; + this.operationName = operationName; + this.resourceName = resourceName; + this.service = service; + this.stat = stat; + this.unparsed |= !stat.isValid(); + } + + public ApmDependencyStatsQuery dataSource(ApmDependencyStatsDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for APM dependency statistics queries. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApmDependencyStatsDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ApmDependencyStatsDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ApmDependencyStatsQuery env(String env) { + this.env = env; + return this; + } + + /** + * The environment to query. + * + * @return env + */ + @JsonProperty(JSON_PROPERTY_ENV) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEnv() { + return env; + } + + public void setEnv(String env) { + this.env = env; + } + + public ApmDependencyStatsQuery isUpstream(Boolean isUpstream) { + this.isUpstream = isUpstream; + return this; + } + + /** + * Determines whether stats for upstream or downstream dependencies should be queried. + * + * @return isUpstream + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_UPSTREAM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsUpstream() { + return isUpstream; + } + + public void setIsUpstream(Boolean isUpstream) { + this.isUpstream = isUpstream; + } + + public ApmDependencyStatsQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ApmDependencyStatsQuery operationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * The APM operation name. + * + * @return operationName + */ + @JsonProperty(JSON_PROPERTY_OPERATION_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOperationName() { + return operationName; + } + + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + public ApmDependencyStatsQuery primaryTagName(String primaryTagName) { + this.primaryTagName = primaryTagName; + return this; + } + + /** + * The name of the second primary tag used within APM; required when primary_tag_value + * is specified. See + * https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog. + * + * @return primaryTagName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRIMARY_TAG_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrimaryTagName() { + return primaryTagName; + } + + public void setPrimaryTagName(String primaryTagName) { + this.primaryTagName = primaryTagName; + } + + public ApmDependencyStatsQuery primaryTagValue(String primaryTagValue) { + this.primaryTagValue = primaryTagValue; + return this; + } + + /** + * Filter APM data by the second primary tag. primary_tag_name must also be + * specified. + * + * @return primaryTagValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRIMARY_TAG_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrimaryTagValue() { + return primaryTagValue; + } + + public void setPrimaryTagValue(String primaryTagValue) { + this.primaryTagValue = primaryTagValue; + } + + public ApmDependencyStatsQuery resourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * The resource name to filter by. + * + * @return resourceName + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public ApmDependencyStatsQuery service(String service) { + this.service = service; + return this; + } + + /** + * The service name to filter by. + * + * @return service + */ + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public ApmDependencyStatsQuery stat(ApmDependencyStatName stat) { + this.stat = stat; + this.unparsed |= !stat.isValid(); + return this; + } + + /** + * The APM dependency statistic to query. + * + * @return stat + */ + @JsonProperty(JSON_PROPERTY_STAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApmDependencyStatName getStat() { + return stat; + } + + public void setStat(ApmDependencyStatName stat) { + if (!stat.isValid()) { + this.unparsed = true; + } + this.stat = stat; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ApmDependencyStatsQuery + */ + @JsonAnySetter + public ApmDependencyStatsQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ApmDependencyStatsQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApmDependencyStatsQuery apmDependencyStatsQuery = (ApmDependencyStatsQuery) o; + return Objects.equals(this.dataSource, apmDependencyStatsQuery.dataSource) + && Objects.equals(this.env, apmDependencyStatsQuery.env) + && Objects.equals(this.isUpstream, apmDependencyStatsQuery.isUpstream) + && Objects.equals(this.name, apmDependencyStatsQuery.name) + && Objects.equals(this.operationName, apmDependencyStatsQuery.operationName) + && Objects.equals(this.primaryTagName, apmDependencyStatsQuery.primaryTagName) + && Objects.equals(this.primaryTagValue, apmDependencyStatsQuery.primaryTagValue) + && Objects.equals(this.resourceName, apmDependencyStatsQuery.resourceName) + && Objects.equals(this.service, apmDependencyStatsQuery.service) + && Objects.equals(this.stat, apmDependencyStatsQuery.stat) + && Objects.equals(this.additionalProperties, apmDependencyStatsQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dataSource, + env, + isUpstream, + name, + operationName, + primaryTagName, + primaryTagValue, + resourceName, + service, + stat, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApmDependencyStatsQuery {\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" env: ").append(toIndentedString(env)).append("\n"); + sb.append(" isUpstream: ").append(toIndentedString(isUpstream)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); + sb.append(" primaryTagName: ").append(toIndentedString(primaryTagName)).append("\n"); + sb.append(" primaryTagValue: ").append(toIndentedString(primaryTagValue)).append("\n"); + sb.append(" resourceName: ").append(toIndentedString(resourceName)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" stat: ").append(toIndentedString(stat)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmMetricsDataSource.java b/src/main/java/com/datadog/api/client/v2/model/ApmMetricsDataSource.java new file mode 100644 index 00000000000..6a731a435b9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmMetricsDataSource.java @@ -0,0 +1,55 @@ +/* + * 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.v2.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; + +/** A data source for APM metrics queries. */ +@JsonSerialize(using = ApmMetricsDataSource.ApmMetricsDataSourceSerializer.class) +public class ApmMetricsDataSource extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("apm_metrics")); + + public static final ApmMetricsDataSource APM_METRICS = new ApmMetricsDataSource("apm_metrics"); + + ApmMetricsDataSource(String value) { + super(value, allowedValues); + } + + public static class ApmMetricsDataSourceSerializer extends StdSerializer { + public ApmMetricsDataSourceSerializer(Class t) { + super(t); + } + + public ApmMetricsDataSourceSerializer() { + this(null); + } + + @Override + public void serialize( + ApmMetricsDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ApmMetricsDataSource fromValue(String value) { + return new ApmMetricsDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmMetricsQuery.java b/src/main/java/com/datadog/api/client/v2/model/ApmMetricsQuery.java new file mode 100644 index 00000000000..b2b342b091f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmMetricsQuery.java @@ -0,0 +1,488 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An individual APM metrics query. */ +@JsonPropertyOrder({ + ApmMetricsQuery.JSON_PROPERTY_DATA_SOURCE, + ApmMetricsQuery.JSON_PROPERTY_GROUP_BY, + ApmMetricsQuery.JSON_PROPERTY_NAME, + ApmMetricsQuery.JSON_PROPERTY_OPERATION_MODE, + ApmMetricsQuery.JSON_PROPERTY_OPERATION_NAME, + ApmMetricsQuery.JSON_PROPERTY_PEER_TAGS, + ApmMetricsQuery.JSON_PROPERTY_QUERY_FILTER, + ApmMetricsQuery.JSON_PROPERTY_RESOURCE_HASH, + ApmMetricsQuery.JSON_PROPERTY_RESOURCE_NAME, + ApmMetricsQuery.JSON_PROPERTY_SERVICE, + ApmMetricsQuery.JSON_PROPERTY_SPAN_KIND, + ApmMetricsQuery.JSON_PROPERTY_STAT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ApmMetricsQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ApmMetricsDataSource dataSource = ApmMetricsDataSource.APM_METRICS; + + public static final String JSON_PROPERTY_GROUP_BY = "group_by"; + private List groupBy = null; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OPERATION_MODE = "operation_mode"; + private String operationMode; + + public static final String JSON_PROPERTY_OPERATION_NAME = "operation_name"; + private String operationName; + + public static final String JSON_PROPERTY_PEER_TAGS = "peer_tags"; + private List peerTags = null; + + public static final String JSON_PROPERTY_QUERY_FILTER = "query_filter"; + private String queryFilter; + + public static final String JSON_PROPERTY_RESOURCE_HASH = "resource_hash"; + private String resourceHash; + + public static final String JSON_PROPERTY_RESOURCE_NAME = "resource_name"; + private String resourceName; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_SPAN_KIND = "span_kind"; + private String spanKind; + + public static final String JSON_PROPERTY_STAT = "stat"; + private ApmMetricsStat stat; + + public ApmMetricsQuery() {} + + @JsonCreator + public ApmMetricsQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ApmMetricsDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_STAT) ApmMetricsStat stat) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.name = name; + this.stat = stat; + this.unparsed |= !stat.isValid(); + } + + public ApmMetricsQuery dataSource(ApmMetricsDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for APM metrics queries. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApmMetricsDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ApmMetricsDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ApmMetricsQuery groupBy(List groupBy) { + this.groupBy = groupBy; + return this; + } + + public ApmMetricsQuery addGroupByItem(String groupByItem) { + if (this.groupBy == null) { + this.groupBy = new ArrayList<>(); + } + this.groupBy.add(groupByItem); + return this; + } + + /** + * Optional fields to group the query results by. + * + * @return groupBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GROUP_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getGroupBy() { + return groupBy; + } + + public void setGroupBy(List groupBy) { + this.groupBy = groupBy; + } + + public ApmMetricsQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ApmMetricsQuery operationMode(String operationMode) { + this.operationMode = operationMode; + return this; + } + + /** + * Optional operation mode to aggregate across operation names. + * + * @return operationMode + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPERATION_MODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOperationMode() { + return operationMode; + } + + public void setOperationMode(String operationMode) { + this.operationMode = operationMode; + } + + public ApmMetricsQuery operationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * Name of operation on service. If not provided, the primary operation name is used. + * + * @return operationName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPERATION_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOperationName() { + return operationName; + } + + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + public ApmMetricsQuery peerTags(List peerTags) { + this.peerTags = peerTags; + return this; + } + + public ApmMetricsQuery addPeerTagsItem(String peerTagsItem) { + if (this.peerTags == null) { + this.peerTags = new ArrayList<>(); + } + this.peerTags.add(peerTagsItem); + return this; + } + + /** + * Tags to query for a specific downstream entity (peer.service, peer.db_instance, peer.s3, + * peer.s3.bucket, etc.). + * + * @return peerTags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PEER_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPeerTags() { + return peerTags; + } + + public void setPeerTags(List peerTags) { + this.peerTags = peerTags; + } + + public ApmMetricsQuery queryFilter(String queryFilter) { + this.queryFilter = queryFilter; + return this; + } + + /** + * Additional filters for the query using metrics query syntax (e.g., env, primary_tag). + * + * @return queryFilter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUERY_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getQueryFilter() { + return queryFilter; + } + + public void setQueryFilter(String queryFilter) { + this.queryFilter = queryFilter; + } + + public ApmMetricsQuery resourceHash(String resourceHash) { + this.resourceHash = resourceHash; + return this; + } + + /** + * The resource hash for exact matching. + * + * @return resourceHash + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_HASH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResourceHash() { + return resourceHash; + } + + public void setResourceHash(String resourceHash) { + this.resourceHash = resourceHash; + } + + public ApmMetricsQuery resourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * The full name of a specific resource to filter by. + * + * @return resourceName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public ApmMetricsQuery service(String service) { + this.service = service; + return this; + } + + /** + * The service name to filter by. + * + * @return service + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public ApmMetricsQuery spanKind(String spanKind) { + this.spanKind = spanKind; + return this; + } + + /** + * Describes the relationship between the span, its parents, and its children in a trace. Known + * values include consumer, server, client, producer, internal. + * + * @return spanKind + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SPAN_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSpanKind() { + return spanKind; + } + + public void setSpanKind(String spanKind) { + this.spanKind = spanKind; + } + + public ApmMetricsQuery stat(ApmMetricsStat stat) { + this.stat = stat; + this.unparsed |= !stat.isValid(); + return this; + } + + /** + * The APM metric statistic to query. + * + * @return stat + */ + @JsonProperty(JSON_PROPERTY_STAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApmMetricsStat getStat() { + return stat; + } + + public void setStat(ApmMetricsStat stat) { + if (!stat.isValid()) { + this.unparsed = true; + } + this.stat = stat; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ApmMetricsQuery + */ + @JsonAnySetter + public ApmMetricsQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ApmMetricsQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApmMetricsQuery apmMetricsQuery = (ApmMetricsQuery) o; + return Objects.equals(this.dataSource, apmMetricsQuery.dataSource) + && Objects.equals(this.groupBy, apmMetricsQuery.groupBy) + && Objects.equals(this.name, apmMetricsQuery.name) + && Objects.equals(this.operationMode, apmMetricsQuery.operationMode) + && Objects.equals(this.operationName, apmMetricsQuery.operationName) + && Objects.equals(this.peerTags, apmMetricsQuery.peerTags) + && Objects.equals(this.queryFilter, apmMetricsQuery.queryFilter) + && Objects.equals(this.resourceHash, apmMetricsQuery.resourceHash) + && Objects.equals(this.resourceName, apmMetricsQuery.resourceName) + && Objects.equals(this.service, apmMetricsQuery.service) + && Objects.equals(this.spanKind, apmMetricsQuery.spanKind) + && Objects.equals(this.stat, apmMetricsQuery.stat) + && Objects.equals(this.additionalProperties, apmMetricsQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dataSource, + groupBy, + name, + operationMode, + operationName, + peerTags, + queryFilter, + resourceHash, + resourceName, + service, + spanKind, + stat, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApmMetricsQuery {\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" operationMode: ").append(toIndentedString(operationMode)).append("\n"); + sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); + sb.append(" peerTags: ").append(toIndentedString(peerTags)).append("\n"); + sb.append(" queryFilter: ").append(toIndentedString(queryFilter)).append("\n"); + sb.append(" resourceHash: ").append(toIndentedString(resourceHash)).append("\n"); + sb.append(" resourceName: ").append(toIndentedString(resourceName)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" spanKind: ").append(toIndentedString(spanKind)).append("\n"); + sb.append(" stat: ").append(toIndentedString(stat)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmMetricsStat.java b/src/main/java/com/datadog/api/client/v2/model/ApmMetricsStat.java new file mode 100644 index 00000000000..a12a579d41a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmMetricsStat.java @@ -0,0 +1,87 @@ +/* + * 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.v2.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; + +/** The APM metric statistic to query. */ +@JsonSerialize(using = ApmMetricsStat.ApmMetricsStatSerializer.class) +public class ApmMetricsStat extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "error_rate", + "errors", + "errors_per_second", + "hits", + "hits_per_second", + "apdex", + "latency_avg", + "latency_max", + "latency_p50", + "latency_p75", + "latency_p90", + "latency_p95", + "latency_p99", + "latency_p999", + "latency_distribution", + "total_time")); + + public static final ApmMetricsStat ERROR_RATE = new ApmMetricsStat("error_rate"); + public static final ApmMetricsStat ERRORS = new ApmMetricsStat("errors"); + public static final ApmMetricsStat ERRORS_PER_SECOND = new ApmMetricsStat("errors_per_second"); + public static final ApmMetricsStat HITS = new ApmMetricsStat("hits"); + public static final ApmMetricsStat HITS_PER_SECOND = new ApmMetricsStat("hits_per_second"); + public static final ApmMetricsStat APDEX = new ApmMetricsStat("apdex"); + public static final ApmMetricsStat LATENCY_AVG = new ApmMetricsStat("latency_avg"); + public static final ApmMetricsStat LATENCY_MAX = new ApmMetricsStat("latency_max"); + public static final ApmMetricsStat LATENCY_P50 = new ApmMetricsStat("latency_p50"); + public static final ApmMetricsStat LATENCY_P75 = new ApmMetricsStat("latency_p75"); + public static final ApmMetricsStat LATENCY_P90 = new ApmMetricsStat("latency_p90"); + public static final ApmMetricsStat LATENCY_P95 = new ApmMetricsStat("latency_p95"); + public static final ApmMetricsStat LATENCY_P99 = new ApmMetricsStat("latency_p99"); + public static final ApmMetricsStat LATENCY_P999 = new ApmMetricsStat("latency_p999"); + public static final ApmMetricsStat LATENCY_DISTRIBUTION = + new ApmMetricsStat("latency_distribution"); + public static final ApmMetricsStat TOTAL_TIME = new ApmMetricsStat("total_time"); + + ApmMetricsStat(String value) { + super(value, allowedValues); + } + + public static class ApmMetricsStatSerializer extends StdSerializer { + public ApmMetricsStatSerializer(Class t) { + super(t); + } + + public ApmMetricsStatSerializer() { + this(null); + } + + @Override + public void serialize(ApmMetricsStat value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ApmMetricsStat fromValue(String value) { + return new ApmMetricsStat(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatName.java b/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatName.java new file mode 100644 index 00000000000..e91a96b468c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatName.java @@ -0,0 +1,80 @@ +/* + * 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.v2.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; + +/** The APM resource statistic to query. */ +@JsonSerialize(using = ApmResourceStatName.ApmResourceStatNameSerializer.class) +public class ApmResourceStatName extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "error_rate", + "errors", + "hits", + "latency_avg", + "latency_max", + "latency_p50", + "latency_p75", + "latency_p90", + "latency_p95", + "latency_p99", + "latency_distribution", + "total_time")); + + public static final ApmResourceStatName ERROR_RATE = new ApmResourceStatName("error_rate"); + public static final ApmResourceStatName ERRORS = new ApmResourceStatName("errors"); + public static final ApmResourceStatName HITS = new ApmResourceStatName("hits"); + public static final ApmResourceStatName LATENCY_AVG = new ApmResourceStatName("latency_avg"); + public static final ApmResourceStatName LATENCY_MAX = new ApmResourceStatName("latency_max"); + public static final ApmResourceStatName LATENCY_P50 = new ApmResourceStatName("latency_p50"); + public static final ApmResourceStatName LATENCY_P75 = new ApmResourceStatName("latency_p75"); + public static final ApmResourceStatName LATENCY_P90 = new ApmResourceStatName("latency_p90"); + public static final ApmResourceStatName LATENCY_P95 = new ApmResourceStatName("latency_p95"); + public static final ApmResourceStatName LATENCY_P99 = new ApmResourceStatName("latency_p99"); + public static final ApmResourceStatName LATENCY_DISTRIBUTION = + new ApmResourceStatName("latency_distribution"); + public static final ApmResourceStatName TOTAL_TIME = new ApmResourceStatName("total_time"); + + ApmResourceStatName(String value) { + super(value, allowedValues); + } + + public static class ApmResourceStatNameSerializer extends StdSerializer { + public ApmResourceStatNameSerializer(Class t) { + super(t); + } + + public ApmResourceStatNameSerializer() { + this(null); + } + + @Override + public void serialize( + ApmResourceStatName value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ApmResourceStatName fromValue(String value) { + return new ApmResourceStatName(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatsDataSource.java b/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatsDataSource.java new file mode 100644 index 00000000000..78e6f505b60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatsDataSource.java @@ -0,0 +1,57 @@ +/* + * 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.v2.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; + +/** A data source for APM resource statistics queries. */ +@JsonSerialize(using = ApmResourceStatsDataSource.ApmResourceStatsDataSourceSerializer.class) +public class ApmResourceStatsDataSource extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("apm_resource_stats")); + + public static final ApmResourceStatsDataSource APM_RESOURCE_STATS = + new ApmResourceStatsDataSource("apm_resource_stats"); + + ApmResourceStatsDataSource(String value) { + super(value, allowedValues); + } + + public static class ApmResourceStatsDataSourceSerializer + extends StdSerializer { + public ApmResourceStatsDataSourceSerializer(Class t) { + super(t); + } + + public ApmResourceStatsDataSourceSerializer() { + this(null); + } + + @Override + public void serialize( + ApmResourceStatsDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ApmResourceStatsDataSource fromValue(String value) { + return new ApmResourceStatsDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatsQuery.java b/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatsQuery.java new file mode 100644 index 00000000000..efc6f798032 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApmResourceStatsQuery.java @@ -0,0 +1,427 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An individual APM resource stats query. */ +@JsonPropertyOrder({ + ApmResourceStatsQuery.JSON_PROPERTY_DATA_SOURCE, + ApmResourceStatsQuery.JSON_PROPERTY_ENV, + ApmResourceStatsQuery.JSON_PROPERTY_GROUP_BY, + ApmResourceStatsQuery.JSON_PROPERTY_NAME, + ApmResourceStatsQuery.JSON_PROPERTY_OPERATION_NAME, + ApmResourceStatsQuery.JSON_PROPERTY_PRIMARY_TAG_NAME, + ApmResourceStatsQuery.JSON_PROPERTY_PRIMARY_TAG_VALUE, + ApmResourceStatsQuery.JSON_PROPERTY_RESOURCE_NAME, + ApmResourceStatsQuery.JSON_PROPERTY_SERVICE, + ApmResourceStatsQuery.JSON_PROPERTY_STAT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ApmResourceStatsQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ApmResourceStatsDataSource dataSource = ApmResourceStatsDataSource.APM_RESOURCE_STATS; + + public static final String JSON_PROPERTY_ENV = "env"; + private String env; + + public static final String JSON_PROPERTY_GROUP_BY = "group_by"; + private List groupBy = null; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OPERATION_NAME = "operation_name"; + private String operationName; + + public static final String JSON_PROPERTY_PRIMARY_TAG_NAME = "primary_tag_name"; + private String primaryTagName; + + public static final String JSON_PROPERTY_PRIMARY_TAG_VALUE = "primary_tag_value"; + private String primaryTagValue; + + public static final String JSON_PROPERTY_RESOURCE_NAME = "resource_name"; + private String resourceName; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_STAT = "stat"; + private ApmResourceStatName stat; + + public ApmResourceStatsQuery() {} + + @JsonCreator + public ApmResourceStatsQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ApmResourceStatsDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_ENV) String env, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE) String service, + @JsonProperty(required = true, value = JSON_PROPERTY_STAT) ApmResourceStatName stat) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.env = env; + this.name = name; + this.service = service; + this.stat = stat; + this.unparsed |= !stat.isValid(); + } + + public ApmResourceStatsQuery dataSource(ApmResourceStatsDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for APM resource statistics queries. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApmResourceStatsDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ApmResourceStatsDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ApmResourceStatsQuery env(String env) { + this.env = env; + return this; + } + + /** + * The environment to query. + * + * @return env + */ + @JsonProperty(JSON_PROPERTY_ENV) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEnv() { + return env; + } + + public void setEnv(String env) { + this.env = env; + } + + public ApmResourceStatsQuery groupBy(List groupBy) { + this.groupBy = groupBy; + return this; + } + + public ApmResourceStatsQuery addGroupByItem(String groupByItem) { + if (this.groupBy == null) { + this.groupBy = new ArrayList<>(); + } + this.groupBy.add(groupByItem); + return this; + } + + /** + * Tag keys to group results by. + * + * @return groupBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GROUP_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getGroupBy() { + return groupBy; + } + + public void setGroupBy(List groupBy) { + this.groupBy = groupBy; + } + + public ApmResourceStatsQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ApmResourceStatsQuery operationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * The APM operation name. + * + * @return operationName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPERATION_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOperationName() { + return operationName; + } + + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + public ApmResourceStatsQuery primaryTagName(String primaryTagName) { + this.primaryTagName = primaryTagName; + return this; + } + + /** + * Name of the second primary tag used within APM. Required when primary_tag_value is + * specified. See + * https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog + * + * @return primaryTagName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRIMARY_TAG_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrimaryTagName() { + return primaryTagName; + } + + public void setPrimaryTagName(String primaryTagName) { + this.primaryTagName = primaryTagName; + } + + public ApmResourceStatsQuery primaryTagValue(String primaryTagValue) { + this.primaryTagValue = primaryTagValue; + return this; + } + + /** + * Value of the second primary tag by which to filter APM data. primary_tag_name must + * also be specified. + * + * @return primaryTagValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRIMARY_TAG_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrimaryTagValue() { + return primaryTagValue; + } + + public void setPrimaryTagValue(String primaryTagValue) { + this.primaryTagValue = primaryTagValue; + } + + public ApmResourceStatsQuery resourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * The resource name to filter by. + * + * @return resourceName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public ApmResourceStatsQuery service(String service) { + this.service = service; + return this; + } + + /** + * The service name to filter by. + * + * @return service + */ + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public ApmResourceStatsQuery stat(ApmResourceStatName stat) { + this.stat = stat; + this.unparsed |= !stat.isValid(); + return this; + } + + /** + * The APM resource statistic to query. + * + * @return stat + */ + @JsonProperty(JSON_PROPERTY_STAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApmResourceStatName getStat() { + return stat; + } + + public void setStat(ApmResourceStatName stat) { + if (!stat.isValid()) { + this.unparsed = true; + } + this.stat = stat; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ApmResourceStatsQuery + */ + @JsonAnySetter + public ApmResourceStatsQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ApmResourceStatsQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApmResourceStatsQuery apmResourceStatsQuery = (ApmResourceStatsQuery) o; + return Objects.equals(this.dataSource, apmResourceStatsQuery.dataSource) + && Objects.equals(this.env, apmResourceStatsQuery.env) + && Objects.equals(this.groupBy, apmResourceStatsQuery.groupBy) + && Objects.equals(this.name, apmResourceStatsQuery.name) + && Objects.equals(this.operationName, apmResourceStatsQuery.operationName) + && Objects.equals(this.primaryTagName, apmResourceStatsQuery.primaryTagName) + && Objects.equals(this.primaryTagValue, apmResourceStatsQuery.primaryTagValue) + && Objects.equals(this.resourceName, apmResourceStatsQuery.resourceName) + && Objects.equals(this.service, apmResourceStatsQuery.service) + && Objects.equals(this.stat, apmResourceStatsQuery.stat) + && Objects.equals(this.additionalProperties, apmResourceStatsQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dataSource, + env, + groupBy, + name, + operationName, + primaryTagName, + primaryTagValue, + resourceName, + service, + stat, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApmResourceStatsQuery {\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" env: ").append(toIndentedString(env)).append("\n"); + sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" operationName: ").append(toIndentedString(operationName)).append("\n"); + sb.append(" primaryTagName: ").append(toIndentedString(primaryTagName)).append("\n"); + sb.append(" primaryTagValue: ").append(toIndentedString(primaryTagValue)).append("\n"); + sb.append(" resourceName: ").append(toIndentedString(resourceName)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" stat: ").append(toIndentedString(stat)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ContainerDataSource.java b/src/main/java/com/datadog/api/client/v2/model/ContainerDataSource.java new file mode 100644 index 00000000000..5c3d7b90efe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ContainerDataSource.java @@ -0,0 +1,54 @@ +/* + * 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.v2.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; + +/** A data source for container-level infrastructure metrics. */ +@JsonSerialize(using = ContainerDataSource.ContainerDataSourceSerializer.class) +public class ContainerDataSource extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("container")); + + public static final ContainerDataSource CONTAINER = new ContainerDataSource("container"); + + ContainerDataSource(String value) { + super(value, allowedValues); + } + + public static class ContainerDataSourceSerializer extends StdSerializer { + public ContainerDataSourceSerializer(Class t) { + super(t); + } + + public ContainerDataSourceSerializer() { + this(null); + } + + @Override + public void serialize( + ContainerDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ContainerDataSource fromValue(String value) { + return new ContainerDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ContainerScalarQuery.java b/src/main/java/com/datadog/api/client/v2/model/ContainerScalarQuery.java new file mode 100644 index 00000000000..3d184907d71 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ContainerScalarQuery.java @@ -0,0 +1,389 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An individual scalar container query. */ +@JsonPropertyOrder({ + ContainerScalarQuery.JSON_PROPERTY_AGGREGATOR, + ContainerScalarQuery.JSON_PROPERTY_DATA_SOURCE, + ContainerScalarQuery.JSON_PROPERTY_IS_NORMALIZED_CPU, + ContainerScalarQuery.JSON_PROPERTY_LIMIT, + ContainerScalarQuery.JSON_PROPERTY_METRIC, + ContainerScalarQuery.JSON_PROPERTY_NAME, + ContainerScalarQuery.JSON_PROPERTY_SORT, + ContainerScalarQuery.JSON_PROPERTY_TAG_FILTERS, + ContainerScalarQuery.JSON_PROPERTY_TEXT_FILTER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ContainerScalarQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AGGREGATOR = "aggregator"; + private String aggregator; + + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ContainerDataSource dataSource = ContainerDataSource.CONTAINER; + + public static final String JSON_PROPERTY_IS_NORMALIZED_CPU = "is_normalized_cpu"; + private Boolean isNormalizedCpu; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_METRIC = "metric"; + private String metric; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SORT = "sort"; + private String sort; + + public static final String JSON_PROPERTY_TAG_FILTERS = "tag_filters"; + private List tagFilters = null; + + public static final String JSON_PROPERTY_TEXT_FILTER = "text_filter"; + private String textFilter; + + public ContainerScalarQuery() {} + + @JsonCreator + public ContainerScalarQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ContainerDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC) String metric, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.metric = metric; + this.name = name; + } + + public ContainerScalarQuery aggregator(String aggregator) { + this.aggregator = aggregator; + return this; + } + + /** + * The temporal reduction function to apply. + * + * @return aggregator + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AGGREGATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAggregator() { + return aggregator; + } + + public void setAggregator(String aggregator) { + this.aggregator = aggregator; + } + + public ContainerScalarQuery dataSource(ContainerDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for container-level infrastructure metrics. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ContainerDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ContainerDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ContainerScalarQuery isNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + return this; + } + + /** + * Whether CPU metrics should be normalized by core count. + * + * @return isNormalizedCpu + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_NORMALIZED_CPU) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsNormalizedCpu() { + return isNormalizedCpu; + } + + public void setIsNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + } + + public ContainerScalarQuery limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of timeseries to return. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public ContainerScalarQuery metric(String metric) { + this.metric = metric; + return this; + } + + /** + * The container metric to query. + * + * @return metric + */ + @JsonProperty(JSON_PROPERTY_METRIC) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public ContainerScalarQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ContainerScalarQuery sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Sort order for the results. + * + * @return sort + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SORT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public ContainerScalarQuery tagFilters(List tagFilters) { + this.tagFilters = tagFilters; + return this; + } + + public ContainerScalarQuery addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList<>(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Tag filters to narrow down containers. + * + * @return tagFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTagFilters() { + return tagFilters; + } + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + public ContainerScalarQuery textFilter(String textFilter) { + this.textFilter = textFilter; + return this; + } + + /** + * A full-text search filter to match container names. + * + * @return textFilter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEXT_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTextFilter() { + return textFilter; + } + + public void setTextFilter(String textFilter) { + this.textFilter = textFilter; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ContainerScalarQuery + */ + @JsonAnySetter + public ContainerScalarQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ContainerScalarQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContainerScalarQuery containerScalarQuery = (ContainerScalarQuery) o; + return Objects.equals(this.aggregator, containerScalarQuery.aggregator) + && Objects.equals(this.dataSource, containerScalarQuery.dataSource) + && Objects.equals(this.isNormalizedCpu, containerScalarQuery.isNormalizedCpu) + && Objects.equals(this.limit, containerScalarQuery.limit) + && Objects.equals(this.metric, containerScalarQuery.metric) + && Objects.equals(this.name, containerScalarQuery.name) + && Objects.equals(this.sort, containerScalarQuery.sort) + && Objects.equals(this.tagFilters, containerScalarQuery.tagFilters) + && Objects.equals(this.textFilter, containerScalarQuery.textFilter) + && Objects.equals(this.additionalProperties, containerScalarQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + aggregator, + dataSource, + isNormalizedCpu, + limit, + metric, + name, + sort, + tagFilters, + textFilter, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContainerScalarQuery {\n"); + sb.append(" aggregator: ").append(toIndentedString(aggregator)).append("\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" isNormalizedCpu: ").append(toIndentedString(isNormalizedCpu)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" textFilter: ").append(toIndentedString(textFilter)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ContainerTimeseriesQuery.java b/src/main/java/com/datadog/api/client/v2/model/ContainerTimeseriesQuery.java new file mode 100644 index 00000000000..5768a96579a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ContainerTimeseriesQuery.java @@ -0,0 +1,361 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An individual timeseries container query. */ +@JsonPropertyOrder({ + ContainerTimeseriesQuery.JSON_PROPERTY_DATA_SOURCE, + ContainerTimeseriesQuery.JSON_PROPERTY_IS_NORMALIZED_CPU, + ContainerTimeseriesQuery.JSON_PROPERTY_LIMIT, + ContainerTimeseriesQuery.JSON_PROPERTY_METRIC, + ContainerTimeseriesQuery.JSON_PROPERTY_NAME, + ContainerTimeseriesQuery.JSON_PROPERTY_SORT, + ContainerTimeseriesQuery.JSON_PROPERTY_TAG_FILTERS, + ContainerTimeseriesQuery.JSON_PROPERTY_TEXT_FILTER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ContainerTimeseriesQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ContainerDataSource dataSource = ContainerDataSource.CONTAINER; + + public static final String JSON_PROPERTY_IS_NORMALIZED_CPU = "is_normalized_cpu"; + private Boolean isNormalizedCpu; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_METRIC = "metric"; + private String metric; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SORT = "sort"; + private String sort; + + public static final String JSON_PROPERTY_TAG_FILTERS = "tag_filters"; + private List tagFilters = null; + + public static final String JSON_PROPERTY_TEXT_FILTER = "text_filter"; + private String textFilter; + + public ContainerTimeseriesQuery() {} + + @JsonCreator + public ContainerTimeseriesQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ContainerDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC) String metric, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.metric = metric; + this.name = name; + } + + public ContainerTimeseriesQuery dataSource(ContainerDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for container-level infrastructure metrics. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ContainerDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ContainerDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ContainerTimeseriesQuery isNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + return this; + } + + /** + * Whether CPU metrics should be normalized by core count. + * + * @return isNormalizedCpu + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_NORMALIZED_CPU) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsNormalizedCpu() { + return isNormalizedCpu; + } + + public void setIsNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + } + + public ContainerTimeseriesQuery limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of timeseries to return. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public ContainerTimeseriesQuery metric(String metric) { + this.metric = metric; + return this; + } + + /** + * The container metric to query. + * + * @return metric + */ + @JsonProperty(JSON_PROPERTY_METRIC) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public ContainerTimeseriesQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ContainerTimeseriesQuery sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Sort order for the results. + * + * @return sort + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SORT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public ContainerTimeseriesQuery tagFilters(List tagFilters) { + this.tagFilters = tagFilters; + return this; + } + + public ContainerTimeseriesQuery addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList<>(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Tag filters to narrow down containers. + * + * @return tagFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTagFilters() { + return tagFilters; + } + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + public ContainerTimeseriesQuery textFilter(String textFilter) { + this.textFilter = textFilter; + return this; + } + + /** + * A full-text search filter to match container names. + * + * @return textFilter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEXT_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTextFilter() { + return textFilter; + } + + public void setTextFilter(String textFilter) { + this.textFilter = textFilter; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ContainerTimeseriesQuery + */ + @JsonAnySetter + public ContainerTimeseriesQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ContainerTimeseriesQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContainerTimeseriesQuery containerTimeseriesQuery = (ContainerTimeseriesQuery) o; + return Objects.equals(this.dataSource, containerTimeseriesQuery.dataSource) + && Objects.equals(this.isNormalizedCpu, containerTimeseriesQuery.isNormalizedCpu) + && Objects.equals(this.limit, containerTimeseriesQuery.limit) + && Objects.equals(this.metric, containerTimeseriesQuery.metric) + && Objects.equals(this.name, containerTimeseriesQuery.name) + && Objects.equals(this.sort, containerTimeseriesQuery.sort) + && Objects.equals(this.tagFilters, containerTimeseriesQuery.tagFilters) + && Objects.equals(this.textFilter, containerTimeseriesQuery.textFilter) + && Objects.equals(this.additionalProperties, containerTimeseriesQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dataSource, + isNormalizedCpu, + limit, + metric, + name, + sort, + tagFilters, + textFilter, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContainerTimeseriesQuery {\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" isNormalizedCpu: ").append(toIndentedString(isNormalizedCpu)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" textFilter: ").append(toIndentedString(textFilter)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EventsDataSource.java b/src/main/java/com/datadog/api/client/v2/model/EventsDataSource.java index b44fdf92f1c..3a6ac8c7d3a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventsDataSource.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventsDataSource.java @@ -23,10 +23,38 @@ public class EventsDataSource extends ModelEnum { private static final Set allowedValues = - new HashSet(Arrays.asList("logs", "rum", "dora")); + new HashSet( + Arrays.asList( + "logs", + "spans", + "network", + "rum", + "security_signals", + "profiles", + "audit", + "events", + "ci_tests", + "ci_pipelines", + "incident_analytics", + "product_analytics", + "on_call_events", + "dora")); public static final EventsDataSource LOGS = new EventsDataSource("logs"); + public static final EventsDataSource SPANS = new EventsDataSource("spans"); + public static final EventsDataSource NETWORK = new EventsDataSource("network"); public static final EventsDataSource RUM = new EventsDataSource("rum"); + public static final EventsDataSource SECURITY_SIGNALS = new EventsDataSource("security_signals"); + public static final EventsDataSource PROFILES = new EventsDataSource("profiles"); + public static final EventsDataSource AUDIT = new EventsDataSource("audit"); + public static final EventsDataSource EVENTS = new EventsDataSource("events"); + public static final EventsDataSource CI_TESTS = new EventsDataSource("ci_tests"); + public static final EventsDataSource CI_PIPELINES = new EventsDataSource("ci_pipelines"); + public static final EventsDataSource INCIDENT_ANALYTICS = + new EventsDataSource("incident_analytics"); + public static final EventsDataSource PRODUCT_ANALYTICS = + new EventsDataSource("product_analytics"); + public static final EventsDataSource ON_CALL_EVENTS = new EventsDataSource("on_call_events"); public static final EventsDataSource DORA = new EventsDataSource("dora"); EventsDataSource(String value) { diff --git a/src/main/java/com/datadog/api/client/v2/model/ProcessDataSource.java b/src/main/java/com/datadog/api/client/v2/model/ProcessDataSource.java new file mode 100644 index 00000000000..42ea74f165b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProcessDataSource.java @@ -0,0 +1,53 @@ +/* + * 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.v2.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; + +/** A data source for process-level infrastructure metrics. */ +@JsonSerialize(using = ProcessDataSource.ProcessDataSourceSerializer.class) +public class ProcessDataSource extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("process")); + + public static final ProcessDataSource PROCESS = new ProcessDataSource("process"); + + ProcessDataSource(String value) { + super(value, allowedValues); + } + + public static class ProcessDataSourceSerializer extends StdSerializer { + public ProcessDataSourceSerializer(Class t) { + super(t); + } + + public ProcessDataSourceSerializer() { + this(null); + } + + @Override + public void serialize(ProcessDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ProcessDataSource fromValue(String value) { + return new ProcessDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProcessScalarQuery.java b/src/main/java/com/datadog/api/client/v2/model/ProcessScalarQuery.java new file mode 100644 index 00000000000..78e42837876 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProcessScalarQuery.java @@ -0,0 +1,389 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An individual scalar process query. */ +@JsonPropertyOrder({ + ProcessScalarQuery.JSON_PROPERTY_AGGREGATOR, + ProcessScalarQuery.JSON_PROPERTY_DATA_SOURCE, + ProcessScalarQuery.JSON_PROPERTY_IS_NORMALIZED_CPU, + ProcessScalarQuery.JSON_PROPERTY_LIMIT, + ProcessScalarQuery.JSON_PROPERTY_METRIC, + ProcessScalarQuery.JSON_PROPERTY_NAME, + ProcessScalarQuery.JSON_PROPERTY_SORT, + ProcessScalarQuery.JSON_PROPERTY_TAG_FILTERS, + ProcessScalarQuery.JSON_PROPERTY_TEXT_FILTER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProcessScalarQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AGGREGATOR = "aggregator"; + private String aggregator; + + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ProcessDataSource dataSource = ProcessDataSource.PROCESS; + + public static final String JSON_PROPERTY_IS_NORMALIZED_CPU = "is_normalized_cpu"; + private Boolean isNormalizedCpu; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_METRIC = "metric"; + private String metric; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SORT = "sort"; + private String sort; + + public static final String JSON_PROPERTY_TAG_FILTERS = "tag_filters"; + private List tagFilters = null; + + public static final String JSON_PROPERTY_TEXT_FILTER = "text_filter"; + private String textFilter; + + public ProcessScalarQuery() {} + + @JsonCreator + public ProcessScalarQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ProcessDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC) String metric, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.metric = metric; + this.name = name; + } + + public ProcessScalarQuery aggregator(String aggregator) { + this.aggregator = aggregator; + return this; + } + + /** + * The temporal reduction function to apply. + * + * @return aggregator + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AGGREGATOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAggregator() { + return aggregator; + } + + public void setAggregator(String aggregator) { + this.aggregator = aggregator; + } + + public ProcessScalarQuery dataSource(ProcessDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for process-level infrastructure metrics. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProcessDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ProcessDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ProcessScalarQuery isNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + return this; + } + + /** + * Whether CPU metrics should be normalized by core count. + * + * @return isNormalizedCpu + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_NORMALIZED_CPU) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsNormalizedCpu() { + return isNormalizedCpu; + } + + public void setIsNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + } + + public ProcessScalarQuery limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of timeseries to return. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public ProcessScalarQuery metric(String metric) { + this.metric = metric; + return this; + } + + /** + * The process metric to query. + * + * @return metric + */ + @JsonProperty(JSON_PROPERTY_METRIC) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public ProcessScalarQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ProcessScalarQuery sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Sort order for the results. + * + * @return sort + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SORT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public ProcessScalarQuery tagFilters(List tagFilters) { + this.tagFilters = tagFilters; + return this; + } + + public ProcessScalarQuery addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList<>(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Tag filters to narrow down processes. + * + * @return tagFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTagFilters() { + return tagFilters; + } + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + public ProcessScalarQuery textFilter(String textFilter) { + this.textFilter = textFilter; + return this; + } + + /** + * A full-text search filter to match process names or commands. + * + * @return textFilter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEXT_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTextFilter() { + return textFilter; + } + + public void setTextFilter(String textFilter) { + this.textFilter = textFilter; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProcessScalarQuery + */ + @JsonAnySetter + public ProcessScalarQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProcessScalarQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProcessScalarQuery processScalarQuery = (ProcessScalarQuery) o; + return Objects.equals(this.aggregator, processScalarQuery.aggregator) + && Objects.equals(this.dataSource, processScalarQuery.dataSource) + && Objects.equals(this.isNormalizedCpu, processScalarQuery.isNormalizedCpu) + && Objects.equals(this.limit, processScalarQuery.limit) + && Objects.equals(this.metric, processScalarQuery.metric) + && Objects.equals(this.name, processScalarQuery.name) + && Objects.equals(this.sort, processScalarQuery.sort) + && Objects.equals(this.tagFilters, processScalarQuery.tagFilters) + && Objects.equals(this.textFilter, processScalarQuery.textFilter) + && Objects.equals(this.additionalProperties, processScalarQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + aggregator, + dataSource, + isNormalizedCpu, + limit, + metric, + name, + sort, + tagFilters, + textFilter, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProcessScalarQuery {\n"); + sb.append(" aggregator: ").append(toIndentedString(aggregator)).append("\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" isNormalizedCpu: ").append(toIndentedString(isNormalizedCpu)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" textFilter: ").append(toIndentedString(textFilter)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ProcessTimeseriesQuery.java b/src/main/java/com/datadog/api/client/v2/model/ProcessTimeseriesQuery.java new file mode 100644 index 00000000000..760510bf446 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ProcessTimeseriesQuery.java @@ -0,0 +1,361 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An individual timeseries process query. */ +@JsonPropertyOrder({ + ProcessTimeseriesQuery.JSON_PROPERTY_DATA_SOURCE, + ProcessTimeseriesQuery.JSON_PROPERTY_IS_NORMALIZED_CPU, + ProcessTimeseriesQuery.JSON_PROPERTY_LIMIT, + ProcessTimeseriesQuery.JSON_PROPERTY_METRIC, + ProcessTimeseriesQuery.JSON_PROPERTY_NAME, + ProcessTimeseriesQuery.JSON_PROPERTY_SORT, + ProcessTimeseriesQuery.JSON_PROPERTY_TAG_FILTERS, + ProcessTimeseriesQuery.JSON_PROPERTY_TEXT_FILTER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ProcessTimeseriesQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private ProcessDataSource dataSource = ProcessDataSource.PROCESS; + + public static final String JSON_PROPERTY_IS_NORMALIZED_CPU = "is_normalized_cpu"; + private Boolean isNormalizedCpu; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_METRIC = "metric"; + private String metric; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SORT = "sort"; + private String sort; + + public static final String JSON_PROPERTY_TAG_FILTERS = "tag_filters"; + private List tagFilters = null; + + public static final String JSON_PROPERTY_TEXT_FILTER = "text_filter"; + private String textFilter; + + public ProcessTimeseriesQuery() {} + + @JsonCreator + public ProcessTimeseriesQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + ProcessDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC) String metric, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.metric = metric; + this.name = name; + } + + public ProcessTimeseriesQuery dataSource(ProcessDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for process-level infrastructure metrics. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ProcessDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(ProcessDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public ProcessTimeseriesQuery isNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + return this; + } + + /** + * Whether CPU metrics should be normalized by core count. + * + * @return isNormalizedCpu + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_NORMALIZED_CPU) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsNormalizedCpu() { + return isNormalizedCpu; + } + + public void setIsNormalizedCpu(Boolean isNormalizedCpu) { + this.isNormalizedCpu = isNormalizedCpu; + } + + public ProcessTimeseriesQuery limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of timeseries to return. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public ProcessTimeseriesQuery metric(String metric) { + this.metric = metric; + return this; + } + + /** + * The process metric to query. + * + * @return metric + */ + @JsonProperty(JSON_PROPERTY_METRIC) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public ProcessTimeseriesQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ProcessTimeseriesQuery sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Sort order for the results. + * + * @return sort + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SORT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public ProcessTimeseriesQuery tagFilters(List tagFilters) { + this.tagFilters = tagFilters; + return this; + } + + public ProcessTimeseriesQuery addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList<>(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Tag filters to narrow down processes. + * + * @return tagFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTagFilters() { + return tagFilters; + } + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + public ProcessTimeseriesQuery textFilter(String textFilter) { + this.textFilter = textFilter; + return this; + } + + /** + * A full-text search filter to match process names or commands. + * + * @return textFilter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEXT_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTextFilter() { + return textFilter; + } + + public void setTextFilter(String textFilter) { + this.textFilter = textFilter; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ProcessTimeseriesQuery + */ + @JsonAnySetter + public ProcessTimeseriesQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ProcessTimeseriesQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProcessTimeseriesQuery processTimeseriesQuery = (ProcessTimeseriesQuery) o; + return Objects.equals(this.dataSource, processTimeseriesQuery.dataSource) + && Objects.equals(this.isNormalizedCpu, processTimeseriesQuery.isNormalizedCpu) + && Objects.equals(this.limit, processTimeseriesQuery.limit) + && Objects.equals(this.metric, processTimeseriesQuery.metric) + && Objects.equals(this.name, processTimeseriesQuery.name) + && Objects.equals(this.sort, processTimeseriesQuery.sort) + && Objects.equals(this.tagFilters, processTimeseriesQuery.tagFilters) + && Objects.equals(this.textFilter, processTimeseriesQuery.textFilter) + && Objects.equals(this.additionalProperties, processTimeseriesQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dataSource, + isNormalizedCpu, + limit, + metric, + name, + sort, + tagFilters, + textFilter, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProcessTimeseriesQuery {\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" isNormalizedCpu: ").append(toIndentedString(isNormalizedCpu)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" textFilter: ").append(toIndentedString(textFilter)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ScalarQuery.java b/src/main/java/com/datadog/api/client/v2/model/ScalarQuery.java index 1e151dab2a0..130738d1dd1 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ScalarQuery.java +++ b/src/main/java/com/datadog/api/client/v2/model/ScalarQuery.java @@ -165,6 +165,271 @@ public ScalarQuery deserialize(JsonParser jp, DeserializationContext ctxt) log.log(Level.FINER, "Input data does not match schema 'EventsScalarQuery'", e); } + // deserialize ApmResourceStatsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ApmResourceStatsQuery.class.equals(Integer.class) + || ApmResourceStatsQuery.class.equals(Long.class) + || ApmResourceStatsQuery.class.equals(Float.class) + || ApmResourceStatsQuery.class.equals(Double.class) + || ApmResourceStatsQuery.class.equals(Boolean.class) + || ApmResourceStatsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ApmResourceStatsQuery.class.equals(Integer.class) + || ApmResourceStatsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ApmResourceStatsQuery.class.equals(Float.class) + || ApmResourceStatsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ApmResourceStatsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ApmResourceStatsQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ApmResourceStatsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ApmResourceStatsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ApmResourceStatsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ApmResourceStatsQuery'", e); + } + + // deserialize ApmMetricsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ApmMetricsQuery.class.equals(Integer.class) + || ApmMetricsQuery.class.equals(Long.class) + || ApmMetricsQuery.class.equals(Float.class) + || ApmMetricsQuery.class.equals(Double.class) + || ApmMetricsQuery.class.equals(Boolean.class) + || ApmMetricsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ApmMetricsQuery.class.equals(Integer.class) + || ApmMetricsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ApmMetricsQuery.class.equals(Float.class) + || ApmMetricsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ApmMetricsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ApmMetricsQuery.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ApmMetricsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ApmMetricsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ApmMetricsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ApmMetricsQuery'", e); + } + + // deserialize ApmDependencyStatsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ApmDependencyStatsQuery.class.equals(Integer.class) + || ApmDependencyStatsQuery.class.equals(Long.class) + || ApmDependencyStatsQuery.class.equals(Float.class) + || ApmDependencyStatsQuery.class.equals(Double.class) + || ApmDependencyStatsQuery.class.equals(Boolean.class) + || ApmDependencyStatsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ApmDependencyStatsQuery.class.equals(Integer.class) + || ApmDependencyStatsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ApmDependencyStatsQuery.class.equals(Float.class) + || ApmDependencyStatsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ApmDependencyStatsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ApmDependencyStatsQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ApmDependencyStatsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ApmDependencyStatsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ApmDependencyStatsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ApmDependencyStatsQuery'", e); + } + + // deserialize SloQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SloQuery.class.equals(Integer.class) + || SloQuery.class.equals(Long.class) + || SloQuery.class.equals(Float.class) + || SloQuery.class.equals(Double.class) + || SloQuery.class.equals(Boolean.class) + || SloQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SloQuery.class.equals(Integer.class) || SloQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SloQuery.class.equals(Float.class) || SloQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SloQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SloQuery.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SloQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SloQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SloQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SloQuery'", e); + } + + // deserialize ProcessScalarQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ProcessScalarQuery.class.equals(Integer.class) + || ProcessScalarQuery.class.equals(Long.class) + || ProcessScalarQuery.class.equals(Float.class) + || ProcessScalarQuery.class.equals(Double.class) + || ProcessScalarQuery.class.equals(Boolean.class) + || ProcessScalarQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ProcessScalarQuery.class.equals(Integer.class) + || ProcessScalarQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ProcessScalarQuery.class.equals(Float.class) + || ProcessScalarQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ProcessScalarQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ProcessScalarQuery.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ProcessScalarQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ProcessScalarQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ProcessScalarQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ProcessScalarQuery'", e); + } + + // deserialize ContainerScalarQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ContainerScalarQuery.class.equals(Integer.class) + || ContainerScalarQuery.class.equals(Long.class) + || ContainerScalarQuery.class.equals(Float.class) + || ContainerScalarQuery.class.equals(Double.class) + || ContainerScalarQuery.class.equals(Boolean.class) + || ContainerScalarQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ContainerScalarQuery.class.equals(Integer.class) + || ContainerScalarQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ContainerScalarQuery.class.equals(Float.class) + || ContainerScalarQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ContainerScalarQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ContainerScalarQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ContainerScalarQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ContainerScalarQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ContainerScalarQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ContainerScalarQuery'", e); + } + ScalarQuery ret = new ScalarQuery(); if (match == 1) { ret.setActualInstance(deserialized); @@ -203,9 +468,45 @@ public ScalarQuery(EventsScalarQuery o) { setActualInstance(o); } + public ScalarQuery(ApmResourceStatsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarQuery(ApmMetricsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarQuery(ApmDependencyStatsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarQuery(SloQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarQuery(ProcessScalarQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarQuery(ContainerScalarQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("MetricsScalarQuery", new GenericType() {}); schemas.put("EventsScalarQuery", new GenericType() {}); + schemas.put("ApmResourceStatsQuery", new GenericType() {}); + schemas.put("ApmMetricsQuery", new GenericType() {}); + schemas.put("ApmDependencyStatsQuery", new GenericType() {}); + schemas.put("SloQuery", new GenericType() {}); + schemas.put("ProcessScalarQuery", new GenericType() {}); + schemas.put("ContainerScalarQuery", new GenericType() {}); JSON.registerDescendants(ScalarQuery.class, Collections.unmodifiableMap(schemas)); } @@ -216,7 +517,8 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: MetricsScalarQuery, EventsScalarQuery + * against the oneOf child schemas: MetricsScalarQuery, EventsScalarQuery, ApmResourceStatsQuery, + * ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery, ProcessScalarQuery, ContainerScalarQuery * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -231,19 +533,49 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(ApmResourceStatsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ApmMetricsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ApmDependencyStatsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(SloQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ProcessScalarQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ContainerScalarQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be MetricsScalarQuery, EventsScalarQuery"); + "Invalid instance type. Must be MetricsScalarQuery, EventsScalarQuery," + + " ApmResourceStatsQuery, ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery," + + " ProcessScalarQuery, ContainerScalarQuery"); } /** - * Get the actual instance, which can be the following: MetricsScalarQuery, EventsScalarQuery + * Get the actual instance, which can be the following: MetricsScalarQuery, EventsScalarQuery, + * ApmResourceStatsQuery, ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery, ProcessScalarQuery, + * ContainerScalarQuery * - * @return The actual instance (MetricsScalarQuery, EventsScalarQuery) + * @return The actual instance (MetricsScalarQuery, EventsScalarQuery, ApmResourceStatsQuery, + * ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery, ProcessScalarQuery, + * ContainerScalarQuery) */ @Override public Object getActualInstance() { @@ -271,4 +603,70 @@ public MetricsScalarQuery getMetricsScalarQuery() throws ClassCastException { public EventsScalarQuery getEventsScalarQuery() throws ClassCastException { return (EventsScalarQuery) super.getActualInstance(); } + + /** + * Get the actual instance of `ApmResourceStatsQuery`. If the actual instance is not + * `ApmResourceStatsQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ApmResourceStatsQuery` + * @throws ClassCastException if the instance is not `ApmResourceStatsQuery` + */ + public ApmResourceStatsQuery getApmResourceStatsQuery() throws ClassCastException { + return (ApmResourceStatsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ApmMetricsQuery`. If the actual instance is not `ApmMetricsQuery`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ApmMetricsQuery` + * @throws ClassCastException if the instance is not `ApmMetricsQuery` + */ + public ApmMetricsQuery getApmMetricsQuery() throws ClassCastException { + return (ApmMetricsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ApmDependencyStatsQuery`. If the actual instance is not + * `ApmDependencyStatsQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ApmDependencyStatsQuery` + * @throws ClassCastException if the instance is not `ApmDependencyStatsQuery` + */ + public ApmDependencyStatsQuery getApmDependencyStatsQuery() throws ClassCastException { + return (ApmDependencyStatsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `SloQuery`. If the actual instance is not `SloQuery`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `SloQuery` + * @throws ClassCastException if the instance is not `SloQuery` + */ + public SloQuery getSloQuery() throws ClassCastException { + return (SloQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ProcessScalarQuery`. If the actual instance is not + * `ProcessScalarQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ProcessScalarQuery` + * @throws ClassCastException if the instance is not `ProcessScalarQuery` + */ + public ProcessScalarQuery getProcessScalarQuery() throws ClassCastException { + return (ProcessScalarQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ContainerScalarQuery`. If the actual instance is not + * `ContainerScalarQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ContainerScalarQuery` + * @throws ClassCastException if the instance is not `ContainerScalarQuery` + */ + public ContainerScalarQuery getContainerScalarQuery() throws ClassCastException { + return (ContainerScalarQuery) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/SloDataSource.java b/src/main/java/com/datadog/api/client/v2/model/SloDataSource.java new file mode 100644 index 00000000000..2638b1f9c5e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SloDataSource.java @@ -0,0 +1,53 @@ +/* + * 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.v2.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; + +/** A data source for SLO queries. */ +@JsonSerialize(using = SloDataSource.SloDataSourceSerializer.class) +public class SloDataSource extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("slo")); + + public static final SloDataSource SLO = new SloDataSource("slo"); + + SloDataSource(String value) { + super(value, allowedValues); + } + + public static class SloDataSourceSerializer extends StdSerializer { + public SloDataSourceSerializer(Class t) { + super(t); + } + + public SloDataSourceSerializer() { + this(null); + } + + @Override + public void serialize(SloDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SloDataSource fromValue(String value) { + return new SloDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SloQuery.java b/src/main/java/com/datadog/api/client/v2/model/SloQuery.java new file mode 100644 index 00000000000..798e263e675 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SloQuery.java @@ -0,0 +1,337 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An individual SLO query. */ +@JsonPropertyOrder({ + SloQuery.JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS, + SloQuery.JSON_PROPERTY_DATA_SOURCE, + SloQuery.JSON_PROPERTY_GROUP_MODE, + SloQuery.JSON_PROPERTY_MEASURE, + SloQuery.JSON_PROPERTY_NAME, + SloQuery.JSON_PROPERTY_SLO_ID, + SloQuery.JSON_PROPERTY_SLO_QUERY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SloQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS = "additional_query_filters"; + private String additionalQueryFilters; + + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private SloDataSource dataSource = SloDataSource.SLO; + + public static final String JSON_PROPERTY_GROUP_MODE = "group_mode"; + private SlosGroupMode groupMode; + + public static final String JSON_PROPERTY_MEASURE = "measure"; + private SlosMeasure measure; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SLO_ID = "slo_id"; + private String sloId; + + public static final String JSON_PROPERTY_SLO_QUERY_TYPE = "slo_query_type"; + private SlosQueryType sloQueryType; + + public SloQuery() {} + + @JsonCreator + public SloQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) SloDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_MEASURE) SlosMeasure measure, + @JsonProperty(required = true, value = JSON_PROPERTY_SLO_ID) String sloId) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.measure = measure; + this.unparsed |= !measure.isValid(); + this.sloId = sloId; + } + + public SloQuery additionalQueryFilters(String additionalQueryFilters) { + this.additionalQueryFilters = additionalQueryFilters; + return this; + } + + /** + * Additional filters applied to the SLO query. + * + * @return additionalQueryFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAdditionalQueryFilters() { + return additionalQueryFilters; + } + + public void setAdditionalQueryFilters(String additionalQueryFilters) { + this.additionalQueryFilters = additionalQueryFilters; + } + + public SloQuery dataSource(SloDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * A data source for SLO queries. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SloDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(SloDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public SloQuery groupMode(SlosGroupMode groupMode) { + this.groupMode = groupMode; + this.unparsed |= !groupMode.isValid(); + return this; + } + + /** + * How SLO results are grouped in the response. + * + * @return groupMode + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GROUP_MODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SlosGroupMode getGroupMode() { + return groupMode; + } + + public void setGroupMode(SlosGroupMode groupMode) { + if (!groupMode.isValid()) { + this.unparsed = true; + } + this.groupMode = groupMode; + } + + public SloQuery measure(SlosMeasure measure) { + this.measure = measure; + this.unparsed |= !measure.isValid(); + return this; + } + + /** + * The SLO measurement to retrieve. + * + * @return measure + */ + @JsonProperty(JSON_PROPERTY_MEASURE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SlosMeasure getMeasure() { + return measure; + } + + public void setMeasure(SlosMeasure measure) { + if (!measure.isValid()) { + this.unparsed = true; + } + this.measure = measure; + } + + public SloQuery name(String name) { + this.name = name; + return this; + } + + /** + * The variable name for use in formulas. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SloQuery sloId(String sloId) { + this.sloId = sloId; + return this; + } + + /** + * The unique identifier of the SLO to query. + * + * @return sloId + */ + @JsonProperty(JSON_PROPERTY_SLO_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSloId() { + return sloId; + } + + public void setSloId(String sloId) { + this.sloId = sloId; + } + + public SloQuery sloQueryType(SlosQueryType sloQueryType) { + this.sloQueryType = sloQueryType; + this.unparsed |= !sloQueryType.isValid(); + return this; + } + + /** + * The type of SLO definition being queried. + * + * @return sloQueryType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SLO_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SlosQueryType getSloQueryType() { + return sloQueryType; + } + + public void setSloQueryType(SlosQueryType sloQueryType) { + if (!sloQueryType.isValid()) { + this.unparsed = true; + } + this.sloQueryType = sloQueryType; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SloQuery + */ + @JsonAnySetter + public SloQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SloQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SloQuery sloQuery = (SloQuery) o; + return Objects.equals(this.additionalQueryFilters, sloQuery.additionalQueryFilters) + && Objects.equals(this.dataSource, sloQuery.dataSource) + && Objects.equals(this.groupMode, sloQuery.groupMode) + && Objects.equals(this.measure, sloQuery.measure) + && Objects.equals(this.name, sloQuery.name) + && Objects.equals(this.sloId, sloQuery.sloId) + && Objects.equals(this.sloQueryType, sloQuery.sloQueryType) + && Objects.equals(this.additionalProperties, sloQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + additionalQueryFilters, + dataSource, + groupMode, + measure, + name, + sloId, + sloQueryType, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SloQuery {\n"); + sb.append(" additionalQueryFilters: ") + .append(toIndentedString(additionalQueryFilters)) + .append("\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" groupMode: ").append(toIndentedString(groupMode)).append("\n"); + sb.append(" measure: ").append(toIndentedString(measure)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sloId: ").append(toIndentedString(sloId)).append("\n"); + sb.append(" sloQueryType: ").append(toIndentedString(sloQueryType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SlosGroupMode.java b/src/main/java/com/datadog/api/client/v2/model/SlosGroupMode.java new file mode 100644 index 00000000000..912294f1166 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SlosGroupMode.java @@ -0,0 +1,55 @@ +/* + * 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.v2.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; + +/** How SLO results are grouped in the response. */ +@JsonSerialize(using = SlosGroupMode.SlosGroupModeSerializer.class) +public class SlosGroupMode extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("overall", "components")); + + public static final SlosGroupMode OVERALL = new SlosGroupMode("overall"); + public static final SlosGroupMode COMPONENTS = new SlosGroupMode("components"); + + SlosGroupMode(String value) { + super(value, allowedValues); + } + + public static class SlosGroupModeSerializer extends StdSerializer { + public SlosGroupModeSerializer(Class t) { + super(t); + } + + public SlosGroupModeSerializer() { + this(null); + } + + @Override + public void serialize(SlosGroupMode value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SlosGroupMode fromValue(String value) { + return new SlosGroupMode(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SlosMeasure.java b/src/main/java/com/datadog/api/client/v2/model/SlosMeasure.java new file mode 100644 index 00000000000..5a1ac0cce78 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SlosMeasure.java @@ -0,0 +1,76 @@ +/* + * 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.v2.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; + +/** The SLO measurement to retrieve. */ +@JsonSerialize(using = SlosMeasure.SlosMeasureSerializer.class) +public class SlosMeasure extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "good_events", + "bad_events", + "slo_status", + "error_budget_remaining", + "error_budget_remaining_history", + "error_budget_burndown", + "burn_rate", + "slo_status_history", + "good_minutes", + "bad_minutes")); + + public static final SlosMeasure GOOD_EVENTS = new SlosMeasure("good_events"); + public static final SlosMeasure BAD_EVENTS = new SlosMeasure("bad_events"); + public static final SlosMeasure SLO_STATUS = new SlosMeasure("slo_status"); + public static final SlosMeasure ERROR_BUDGET_REMAINING = + new SlosMeasure("error_budget_remaining"); + public static final SlosMeasure ERROR_BUDGET_REMAINING_HISTORY = + new SlosMeasure("error_budget_remaining_history"); + public static final SlosMeasure ERROR_BUDGET_BURNDOWN = new SlosMeasure("error_budget_burndown"); + public static final SlosMeasure BURN_RATE = new SlosMeasure("burn_rate"); + public static final SlosMeasure SLO_STATUS_HISTORY = new SlosMeasure("slo_status_history"); + public static final SlosMeasure GOOD_MINUTES = new SlosMeasure("good_minutes"); + public static final SlosMeasure BAD_MINUTES = new SlosMeasure("bad_minutes"); + + SlosMeasure(String value) { + super(value, allowedValues); + } + + public static class SlosMeasureSerializer extends StdSerializer { + public SlosMeasureSerializer(Class t) { + super(t); + } + + public SlosMeasureSerializer() { + this(null); + } + + @Override + public void serialize(SlosMeasure value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SlosMeasure fromValue(String value) { + return new SlosMeasure(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SlosQueryType.java b/src/main/java/com/datadog/api/client/v2/model/SlosQueryType.java new file mode 100644 index 00000000000..238169b8b6a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SlosQueryType.java @@ -0,0 +1,56 @@ +/* + * 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.v2.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; + +/** The type of SLO definition being queried. */ +@JsonSerialize(using = SlosQueryType.SlosQueryTypeSerializer.class) +public class SlosQueryType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("metric", "time_slice", "monitor")); + + public static final SlosQueryType METRIC = new SlosQueryType("metric"); + public static final SlosQueryType TIME_SLICE = new SlosQueryType("time_slice"); + public static final SlosQueryType MONITOR = new SlosQueryType("monitor"); + + SlosQueryType(String value) { + super(value, allowedValues); + } + + public static class SlosQueryTypeSerializer extends StdSerializer { + public SlosQueryTypeSerializer(Class t) { + super(t); + } + + public SlosQueryTypeSerializer() { + this(null); + } + + @Override + public void serialize(SlosQueryType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SlosQueryType fromValue(String value) { + return new SlosQueryType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TimeseriesQuery.java b/src/main/java/com/datadog/api/client/v2/model/TimeseriesQuery.java index 7de1e2ba54c..16182287894 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TimeseriesQuery.java +++ b/src/main/java/com/datadog/api/client/v2/model/TimeseriesQuery.java @@ -167,6 +167,272 @@ public TimeseriesQuery deserialize(JsonParser jp, DeserializationContext ctxt) log.log(Level.FINER, "Input data does not match schema 'EventsTimeseriesQuery'", e); } + // deserialize ApmResourceStatsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ApmResourceStatsQuery.class.equals(Integer.class) + || ApmResourceStatsQuery.class.equals(Long.class) + || ApmResourceStatsQuery.class.equals(Float.class) + || ApmResourceStatsQuery.class.equals(Double.class) + || ApmResourceStatsQuery.class.equals(Boolean.class) + || ApmResourceStatsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ApmResourceStatsQuery.class.equals(Integer.class) + || ApmResourceStatsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ApmResourceStatsQuery.class.equals(Float.class) + || ApmResourceStatsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ApmResourceStatsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ApmResourceStatsQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ApmResourceStatsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ApmResourceStatsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ApmResourceStatsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ApmResourceStatsQuery'", e); + } + + // deserialize ApmMetricsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ApmMetricsQuery.class.equals(Integer.class) + || ApmMetricsQuery.class.equals(Long.class) + || ApmMetricsQuery.class.equals(Float.class) + || ApmMetricsQuery.class.equals(Double.class) + || ApmMetricsQuery.class.equals(Boolean.class) + || ApmMetricsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ApmMetricsQuery.class.equals(Integer.class) + || ApmMetricsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ApmMetricsQuery.class.equals(Float.class) + || ApmMetricsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ApmMetricsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ApmMetricsQuery.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ApmMetricsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ApmMetricsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ApmMetricsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ApmMetricsQuery'", e); + } + + // deserialize ApmDependencyStatsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ApmDependencyStatsQuery.class.equals(Integer.class) + || ApmDependencyStatsQuery.class.equals(Long.class) + || ApmDependencyStatsQuery.class.equals(Float.class) + || ApmDependencyStatsQuery.class.equals(Double.class) + || ApmDependencyStatsQuery.class.equals(Boolean.class) + || ApmDependencyStatsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ApmDependencyStatsQuery.class.equals(Integer.class) + || ApmDependencyStatsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ApmDependencyStatsQuery.class.equals(Float.class) + || ApmDependencyStatsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ApmDependencyStatsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ApmDependencyStatsQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ApmDependencyStatsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ApmDependencyStatsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ApmDependencyStatsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ApmDependencyStatsQuery'", e); + } + + // deserialize SloQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SloQuery.class.equals(Integer.class) + || SloQuery.class.equals(Long.class) + || SloQuery.class.equals(Float.class) + || SloQuery.class.equals(Double.class) + || SloQuery.class.equals(Boolean.class) + || SloQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SloQuery.class.equals(Integer.class) || SloQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SloQuery.class.equals(Float.class) || SloQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SloQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SloQuery.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SloQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SloQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SloQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SloQuery'", e); + } + + // deserialize ProcessTimeseriesQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ProcessTimeseriesQuery.class.equals(Integer.class) + || ProcessTimeseriesQuery.class.equals(Long.class) + || ProcessTimeseriesQuery.class.equals(Float.class) + || ProcessTimeseriesQuery.class.equals(Double.class) + || ProcessTimeseriesQuery.class.equals(Boolean.class) + || ProcessTimeseriesQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ProcessTimeseriesQuery.class.equals(Integer.class) + || ProcessTimeseriesQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ProcessTimeseriesQuery.class.equals(Float.class) + || ProcessTimeseriesQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ProcessTimeseriesQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ProcessTimeseriesQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ProcessTimeseriesQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ProcessTimeseriesQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ProcessTimeseriesQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ProcessTimeseriesQuery'", e); + } + + // deserialize ContainerTimeseriesQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ContainerTimeseriesQuery.class.equals(Integer.class) + || ContainerTimeseriesQuery.class.equals(Long.class) + || ContainerTimeseriesQuery.class.equals(Float.class) + || ContainerTimeseriesQuery.class.equals(Double.class) + || ContainerTimeseriesQuery.class.equals(Boolean.class) + || ContainerTimeseriesQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ContainerTimeseriesQuery.class.equals(Integer.class) + || ContainerTimeseriesQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ContainerTimeseriesQuery.class.equals(Float.class) + || ContainerTimeseriesQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ContainerTimeseriesQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ContainerTimeseriesQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ContainerTimeseriesQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ContainerTimeseriesQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ContainerTimeseriesQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ContainerTimeseriesQuery'", e); + } + TimeseriesQuery ret = new TimeseriesQuery(); if (match == 1) { ret.setActualInstance(deserialized); @@ -205,9 +471,45 @@ public TimeseriesQuery(EventsTimeseriesQuery o) { setActualInstance(o); } + public TimeseriesQuery(ApmResourceStatsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TimeseriesQuery(ApmMetricsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TimeseriesQuery(ApmDependencyStatsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TimeseriesQuery(SloQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TimeseriesQuery(ProcessTimeseriesQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TimeseriesQuery(ContainerTimeseriesQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("MetricsTimeseriesQuery", new GenericType() {}); schemas.put("EventsTimeseriesQuery", new GenericType() {}); + schemas.put("ApmResourceStatsQuery", new GenericType() {}); + schemas.put("ApmMetricsQuery", new GenericType() {}); + schemas.put("ApmDependencyStatsQuery", new GenericType() {}); + schemas.put("SloQuery", new GenericType() {}); + schemas.put("ProcessTimeseriesQuery", new GenericType() {}); + schemas.put("ContainerTimeseriesQuery", new GenericType() {}); JSON.registerDescendants(TimeseriesQuery.class, Collections.unmodifiableMap(schemas)); } @@ -218,7 +520,9 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: MetricsTimeseriesQuery, EventsTimeseriesQuery + * against the oneOf child schemas: MetricsTimeseriesQuery, EventsTimeseriesQuery, + * ApmResourceStatsQuery, ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery, + * ProcessTimeseriesQuery, ContainerTimeseriesQuery * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -233,20 +537,49 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(ApmResourceStatsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ApmMetricsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ApmDependencyStatsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(SloQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ProcessTimeseriesQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(ContainerTimeseriesQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be MetricsTimeseriesQuery, EventsTimeseriesQuery"); + "Invalid instance type. Must be MetricsTimeseriesQuery, EventsTimeseriesQuery," + + " ApmResourceStatsQuery, ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery," + + " ProcessTimeseriesQuery, ContainerTimeseriesQuery"); } /** * Get the actual instance, which can be the following: MetricsTimeseriesQuery, - * EventsTimeseriesQuery + * EventsTimeseriesQuery, ApmResourceStatsQuery, ApmMetricsQuery, ApmDependencyStatsQuery, + * SloQuery, ProcessTimeseriesQuery, ContainerTimeseriesQuery * - * @return The actual instance (MetricsTimeseriesQuery, EventsTimeseriesQuery) + * @return The actual instance (MetricsTimeseriesQuery, EventsTimeseriesQuery, + * ApmResourceStatsQuery, ApmMetricsQuery, ApmDependencyStatsQuery, SloQuery, + * ProcessTimeseriesQuery, ContainerTimeseriesQuery) */ @Override public Object getActualInstance() { @@ -274,4 +607,70 @@ public MetricsTimeseriesQuery getMetricsTimeseriesQuery() throws ClassCastExcept public EventsTimeseriesQuery getEventsTimeseriesQuery() throws ClassCastException { return (EventsTimeseriesQuery) super.getActualInstance(); } + + /** + * Get the actual instance of `ApmResourceStatsQuery`. If the actual instance is not + * `ApmResourceStatsQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ApmResourceStatsQuery` + * @throws ClassCastException if the instance is not `ApmResourceStatsQuery` + */ + public ApmResourceStatsQuery getApmResourceStatsQuery() throws ClassCastException { + return (ApmResourceStatsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ApmMetricsQuery`. If the actual instance is not `ApmMetricsQuery`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ApmMetricsQuery` + * @throws ClassCastException if the instance is not `ApmMetricsQuery` + */ + public ApmMetricsQuery getApmMetricsQuery() throws ClassCastException { + return (ApmMetricsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ApmDependencyStatsQuery`. If the actual instance is not + * `ApmDependencyStatsQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ApmDependencyStatsQuery` + * @throws ClassCastException if the instance is not `ApmDependencyStatsQuery` + */ + public ApmDependencyStatsQuery getApmDependencyStatsQuery() throws ClassCastException { + return (ApmDependencyStatsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `SloQuery`. If the actual instance is not `SloQuery`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `SloQuery` + * @throws ClassCastException if the instance is not `SloQuery` + */ + public SloQuery getSloQuery() throws ClassCastException { + return (SloQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ProcessTimeseriesQuery`. If the actual instance is not + * `ProcessTimeseriesQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ProcessTimeseriesQuery` + * @throws ClassCastException if the instance is not `ProcessTimeseriesQuery` + */ + public ProcessTimeseriesQuery getProcessTimeseriesQuery() throws ClassCastException { + return (ProcessTimeseriesQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `ContainerTimeseriesQuery`. If the actual instance is not + * `ContainerTimeseriesQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `ContainerTimeseriesQuery` + * @throws ClassCastException if the instance is not `ContainerTimeseriesQuery` + */ + public ContainerTimeseriesQuery getContainerTimeseriesQuery() throws ClassCastException { + return (ContainerTimeseriesQuery) super.getActualInstance(); + } } diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..87b432ac4f6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:01.856Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.json new file mode 100644 index 00000000000..e5ba696517b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897981000,\"queries\":[{\"data_source\":\"apm_dependency_stats\",\"env\":\"ci\",\"name\":\"a\",\"operation_name\":\"cassandra.query\",\"primary_tag_name\":\"datacenter\",\"primary_tag_value\":\"edge-eu1.prod.dog\",\"resource_name\":\"DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?\",\"service\":\"cassandra\",\"stat\":\"avg_duration\"}],\"to\":1774901581000},\"type\":\"scalar_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/scalar", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"name\":\"a\",\"values\":[1245.83],\"type\":\"number\",\"meta\":{\"unit\":[{\"family\":\"time\",\"name\":\"microsecond\",\"plural\":\"microseconds\",\"scale_factor\":1e-06,\"short_name\":\"\\u03bcs\",\"id\":9},null]}}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "85212f75-f667-8550-eef7-7f09d0100e44" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_metrics_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_metrics_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..dbac657f026 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_metrics_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:02.979Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_metrics_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_metrics_data_source_returns_OK_response.json new file mode 100644 index 00000000000..e880ecac961 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_metrics_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897982000,\"queries\":[{\"data_source\":\"apm_metrics\",\"group_by\":[\"resource_name\"],\"name\":\"a\",\"query_filter\":\"env:prod\",\"service\":\"web-store\",\"stat\":\"hits\"}],\"to\":1774901582000},\"type\":\"scalar_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/scalar", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"name\":\"a\",\"values\":[3847.0],\"type\":\"number\",\"meta\":{\"unit\":[{\"family\":\"cache\",\"name\":\"hit\",\"plural\":\"hits\",\"scale_factor\":1.0,\"short_name\":null,\"id\":39},null]}}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4bf1a49d-9af9-ebf5-798c-2a03adba8c8e" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..16fc156df7a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:03.270Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.json new file mode 100644 index 00000000000..af098a7da60 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897983000,\"queries\":[{\"data_source\":\"apm_resource_stats\",\"env\":\"staging\",\"group_by\":[\"resource_name\"],\"name\":\"a\",\"operation_name\":\"cassandra.query\",\"primary_tag_name\":\"datacenter\",\"primary_tag_value\":\"*\",\"service\":\"azure-bill-import\",\"stat\":\"hits\"}],\"to\":1774901583000},\"type\":\"scalar_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/scalar", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"name\":\"a\",\"values\":[12453.0],\"type\":\"number\",\"meta\":{\"unit\":[{\"family\":\"cache\",\"name\":\"hit\",\"plural\":\"hits\",\"scale_factor\":1.0,\"short_name\":null,\"id\":39},null]}}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "699d88e3-cac2-0de9-9ab2-b2c58091299e" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_slo_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_slo_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..f33961554e0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_slo_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:03.521Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_slo_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_slo_data_source_returns_OK_response.json new file mode 100644 index 00000000000..28486bfe8ae --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Scalar_cross_product_query_with_slo_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897983000,\"queries\":[{\"additional_query_filters\":\"*\",\"data_source\":\"slo\",\"group_mode\":\"overall\",\"measure\":\"slo_status\",\"name\":\"a\",\"slo_id\":\"12345678910\",\"slo_query_type\":\"metric\"}],\"to\":1774901583000},\"type\":\"scalar_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/scalar", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"name\":\"a\",\"values\":[99.73],\"type\":\"number\",\"meta\":{\"unit\":[{\"family\":\"percentage\",\"name\":\"percent\",\"plural\":\"percent\",\"scale_factor\":1.0,\"short_name\":\"%\",\"id\":17},null]}}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5c3a2232-8065-1c5f-dd51-34ff6403a5e2" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..7029bc50266 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:03.773Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.json new file mode 100644 index 00000000000..469729eabe6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_dependency_stats_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897983000,\"interval\":5000,\"queries\":[{\"data_source\":\"apm_dependency_stats\",\"env\":\"ci\",\"name\":\"a\",\"operation_name\":\"cassandra.query\",\"primary_tag_name\":\"datacenter\",\"primary_tag_value\":\"edge-eu1.prod.dog\",\"resource_name\":\"DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?\",\"service\":\"cassandra\",\"stat\":\"avg_duration\"}],\"to\":1774901583000},\"type\":\"timeseries_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/timeseries", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"timeseries_response\",\"attributes\":{\"series\":[{\"group_tags\":[],\"query_index\":0,\"unit\":[{\"family\":\"time\",\"name\":\"microsecond\",\"plural\":\"microseconds\",\"scale_factor\":1e-06,\"short_name\":\"\\u03bcs\",\"id\":9},null]}],\"times\":[1774898000000,1774898300000,1774898600000,1774898900000,1774899200000],\"values\":[[1187.5,1302.1,1245.8,1198.3,1276.4]]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f2497655-b6c9-1b6d-dd54-a076cf307c05" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_metrics_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_metrics_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..794c8abe8fe --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_metrics_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:04.042Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_metrics_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_metrics_data_source_returns_OK_response.json new file mode 100644 index 00000000000..14d40b62985 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_metrics_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897984000,\"interval\":5000,\"queries\":[{\"data_source\":\"apm_metrics\",\"group_by\":[\"resource_name\"],\"name\":\"a\",\"query_filter\":\"env:prod\",\"service\":\"web-store\",\"stat\":\"hits\"}],\"to\":1774901584000},\"type\":\"timeseries_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/timeseries", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"timeseries_response\",\"attributes\":{\"series\":[{\"group_tags\":[],\"query_index\":0,\"unit\":[{\"family\":\"cache\",\"name\":\"hit\",\"plural\":\"hits\",\"scale_factor\":1.0,\"short_name\":null,\"id\":39},null]}],\"times\":[1774898000000,1774898300000,1774898600000,1774898900000,1774899200000],\"values\":[[743,812,795,768,829]]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4132cd8b-4110-3810-b461-a46463f35238" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..ed75bd90422 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:05.076Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.json new file mode 100644 index 00000000000..1db0d98b95b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_apm_resource_stats_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897985000,\"interval\":5000,\"queries\":[{\"data_source\":\"apm_resource_stats\",\"env\":\"staging\",\"group_by\":[\"resource_name\"],\"name\":\"a\",\"operation_name\":\"cassandra.query\",\"primary_tag_name\":\"datacenter\",\"primary_tag_value\":\"*\",\"service\":\"azure-bill-import\",\"stat\":\"hits\"}],\"to\":1774901585000},\"type\":\"timeseries_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/timeseries", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"timeseries_response\",\"attributes\":{\"series\":[{\"group_tags\":[],\"query_index\":0,\"unit\":[{\"family\":\"cache\",\"name\":\"hit\",\"plural\":\"hits\",\"scale_factor\":1.0,\"short_name\":null,\"id\":39},null]}],\"times\":[1774898000000,1774898300000,1774898600000,1774898900000,1774899200000],\"values\":[[2451,2587,2503,2478,2612]]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "501d0ab2-c691-02c3-c295-a931d6925c77" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_slo_data_source_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_slo_data_source_returns_OK_response.freeze new file mode 100644 index 00000000000..43000a01809 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_slo_data_source_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-30T20:13:05.551Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_slo_data_source_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_slo_data_source_returns_OK_response.json new file mode 100644 index 00000000000..329cc40bd49 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Timeseries_cross_product_query_with_slo_data_source_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1774897985000,\"interval\":5000,\"queries\":[{\"additional_query_filters\":\"*\",\"data_source\":\"slo\",\"group_mode\":\"overall\",\"measure\":\"slo_status\",\"name\":\"a\",\"slo_id\":\"12345678910\",\"slo_query_type\":\"metric\"}],\"to\":1774901585000},\"type\":\"timeseries_request\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/query/timeseries", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0\",\"type\":\"timeseries_response\",\"attributes\":{\"series\":[{\"group_tags\":[],\"query_index\":0,\"unit\":[{\"family\":\"percentage\",\"name\":\"percent\",\"plural\":\"percent\",\"scale_factor\":1.0,\"short_name\":\"%\",\"id\":17},null]}],\"times\":[1774898000000,1774898300000,1774898600000,1774898900000,1774899200000],\"values\":[[99.82,99.71,99.76,99.68,99.79]]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5fb050af-a125-e6c4-0eb8-1a2e86bde9ec" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/metrics.feature b/src/test/resources/com/datadog/api/client/v2/api/metrics.feature index 41e753dfb3f..4d9c08fa626 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/metrics.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/metrics.feature @@ -344,6 +344,60 @@ Feature: Metrics And the response "data.type" is equal to "scalar_response" And the response "data.attributes.columns[0].name" is equal to "a" + @skip-validation @team:Datadog/timeseries-query + Scenario: Scalar cross product query with apm_dependency_stats data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryScalarData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"data_source": "apm_dependency_stats", "name": "a", "env": "ci", "service": "cassandra", "stat": "avg_duration", "operation_name": "cassandra.query", "resource_name": "DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?", "primary_tag_name": "datacenter", "primary_tag_value": "edge-eu1.prod.dog"}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "scalar_response" + + @skip-validation @team:Datadog/timeseries-query + Scenario: Scalar cross product query with apm_metrics data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryScalarData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"data_source": "apm_metrics", "name": "a", "stat": "hits", "service": "web-store", "query_filter": "env:prod", "group_by": ["resource_name"]}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "scalar_response" + + @skip-validation @team:Datadog/timeseries-query + Scenario: Scalar cross product query with apm_resource_stats data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryScalarData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"data_source": "apm_resource_stats", "name": "a", "env": "staging", "service": "azure-bill-import", "stat": "hits", "operation_name": "cassandra.query", "group_by": ["resource_name"], "primary_tag_name": "datacenter", "primary_tag_value": "*"}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "scalar_response" + + @skip @skip-validation @team:Datadog/timeseries-query + Scenario: Scalar cross product query with container data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryScalarData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"data_source": "container", "name": "a", "metric": "container.cpu.usage", "tag_filters": [], "limit": 10, "sort": "desc"}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "scalar_response" + + @skip @skip-validation @team:Datadog/timeseries-query + Scenario: Scalar cross product query with process data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryScalarData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"data_source": "process", "name": "a", "metric": "process.stat.cpu.total_pct", "text_filter": "", "tag_filters": [], "limit": 10, "sort": "desc", "is_normalized_cpu": false}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "scalar_response" + + @skip-validation @team:Datadog/timeseries-query + Scenario: Scalar cross product query with slo data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryScalarData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"data_source": "slo", "name": "a", "slo_id": "12345678910", "measure": "slo_status", "slo_query_type": "metric", "group_mode": "overall", "additional_query_filters": "*"}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "scalar_response" + @generated @skip @team:DataDog/metrics-intake Scenario: Submit metrics returns "Bad Request" response Given new "SubmitMetrics" request @@ -415,6 +469,60 @@ Feature: Metrics Then the response status is 200 OK And the response "data.type" is equal to "timeseries_response" + @skip-validation @team:Datadog/timeseries-query + Scenario: Timeseries cross product query with apm_dependency_stats data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryTimeseriesData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "apm_dependency_stats", "name": "a", "env": "ci", "service": "cassandra", "stat": "avg_duration", "operation_name": "cassandra.query", "resource_name": "DELETE FROM monitor_history.monitor_state_change_history WHERE org_id = ? AND monitor_id IN ? AND group = ?", "primary_tag_name": "datacenter", "primary_tag_value": "edge-eu1.prod.dog"}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "timeseries_response" + + @skip-validation @team:Datadog/timeseries-query + Scenario: Timeseries cross product query with apm_metrics data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryTimeseriesData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "apm_metrics", "name": "a", "stat": "hits", "service": "web-store", "query_filter": "env:prod", "group_by": ["resource_name"]}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "timeseries_response" + + @skip-validation @team:Datadog/timeseries-query + Scenario: Timeseries cross product query with apm_resource_stats data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryTimeseriesData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "apm_resource_stats", "name": "a", "env": "staging", "service": "azure-bill-import", "stat": "hits", "operation_name": "cassandra.query", "group_by": ["resource_name"], "primary_tag_name": "datacenter", "primary_tag_value": "*"}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "timeseries_response" + + @skip @skip-validation @team:Datadog/timeseries-query + Scenario: Timeseries cross product query with container data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryTimeseriesData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "container", "name": "a", "metric": "container.cpu.usage", "tag_filters": [], "limit": 10, "sort": "desc"}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "timeseries_response" + + @skip @skip-validation @team:Datadog/timeseries-query + Scenario: Timeseries cross product query with process data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryTimeseriesData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "process", "name": "a", "metric": "process.stat.cpu.total_pct", "text_filter": "", "tag_filters": [], "limit": 10, "sort": "desc", "is_normalized_cpu": false}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "timeseries_response" + + @skip-validation @team:Datadog/timeseries-query + Scenario: Timeseries cross product query with slo data source returns "OK" response + Given a valid "appKeyAuth" key in the system + And new "QueryTimeseriesData" request + And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "slo", "name": "a", "slo_id": "12345678910", "measure": "slo_status", "slo_query_type": "metric", "group_mode": "overall", "additional_query_filters": "*"}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "timeseries_response" + @generated @skip @team:DataDog/metrics-experience Scenario: Update a tag configuration returns "Bad Request" response Given a valid "appKeyAuth" key in the system