Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "c38287b",
"generated": "2025-08-15 18:54:57.072"
"spec_repo_commit": "7851858",
"generated": "2025-08-18 14:49:09.895"
}
17 changes: 11 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13258,9 +13258,7 @@ components:
attributes:
$ref: '#/components/schemas/DatasetAttributesRequest'
type:
description: Resource type, always "dataset".
example: dataset
type: string
$ref: '#/components/schemas/DatasetType'
required:
- type
- attributes
Expand All @@ -13282,9 +13280,7 @@ components:
example: 123e4567-e89b-12d3-a456-426614174000
type: string
type:
description: Resource type, always "dataset".
example: dataset
type: string
$ref: '#/components/schemas/DatasetType'
type: object
DatasetResponseMulti:
description: Response containing a list of datasets.
Expand All @@ -13301,6 +13297,15 @@ components:
data:
$ref: '#/components/schemas/DatasetResponse'
type: object
DatasetType:
default: dataset
description: Resource type, always set to `dataset`.
enum:
- dataset
example: dataset
type: string
x-enum-varnames:
- DATASET
DatasetUpdateRequest:
description: Edit request for a dataset.
properties:
Expand Down
3 changes: 2 additions & 1 deletion examples/v2/datasets/CreateDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.datadog.api.client.v2.model.DatasetCreateRequest;
import com.datadog.api.client.v2.model.DatasetRequest;
import com.datadog.api.client.v2.model.DatasetResponseSingle;
import com.datadog.api.client.v2.model.DatasetType;
import com.datadog.api.client.v2.model.FiltersPerProduct;
import java.util.Collections;

Expand All @@ -31,7 +32,7 @@ public static void main(String[] args) {
new FiltersPerProduct()
.filters(Collections.singletonList("@application.id:ABCD"))
.product("metrics"))))
.type("dataset"));
.type(DatasetType.DATASET));

try {
DatasetResponseSingle result = apiInstance.createDataset(body);
Expand Down
3 changes: 2 additions & 1 deletion examples/v2/datasets/UpdateDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.datadog.api.client.v2.model.DatasetAttributesRequest;
import com.datadog.api.client.v2.model.DatasetRequest;
import com.datadog.api.client.v2.model.DatasetResponseSingle;
import com.datadog.api.client.v2.model.DatasetType;
import com.datadog.api.client.v2.model.DatasetUpdateRequest;
import com.datadog.api.client.v2.model.FiltersPerProduct;
import java.util.Collections;
Expand Down Expand Up @@ -34,7 +35,7 @@ public static void main(String[] args) {
new FiltersPerProduct()
.filters(Collections.singletonList("@application.id:1234"))
.product("metrics"))))
.type("dataset"));
.type(DatasetType.DATASET));

try {
DatasetResponseSingle result = apiInstance.updateDataset(DATASET_DATA_ID, body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ public class DatasetRequest {
private DatasetAttributesRequest attributes;

public static final String JSON_PROPERTY_TYPE = "type";
private String type;
private DatasetType type = DatasetType.DATASET;

public DatasetRequest() {}

@JsonCreator
public DatasetRequest(
@JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES)
DatasetAttributesRequest attributes,
@JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) {
@JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DatasetType type) {
this.attributes = attributes;
this.unparsed |= attributes.unparsed;
this.type = type;
this.unparsed |= !type.isValid();
}

public DatasetRequest attributes(DatasetAttributesRequest attributes) {
Expand All @@ -77,23 +78,27 @@ public void setAttributes(DatasetAttributesRequest attributes) {
this.attributes = attributes;
}

public DatasetRequest type(String type) {
public DatasetRequest type(DatasetType type) {
this.type = type;
this.unparsed |= !type.isValid();
return this;
}

/**
* Resource type, always "dataset".
* Resource type, always set to <code>dataset</code>.
*
* @return type
*/
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getType() {
public DatasetType getType() {
return type;
}

public void setType(String type) {
public void setType(DatasetType type) {
if (!type.isValid()) {
this.unparsed = true;
}
this.type = type;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class DatasetResponse {
private String id;

public static final String JSON_PROPERTY_TYPE = "type";
private String type;
private DatasetType type = DatasetType.DATASET;

public DatasetResponse attributes(DatasetAttributesResponse attributes) {
this.attributes = attributes;
Expand Down Expand Up @@ -93,24 +93,28 @@ public void setId(String id) {
this.id = id;
}

public DatasetResponse type(String type) {
public DatasetResponse type(DatasetType type) {
this.type = type;
this.unparsed |= !type.isValid();
return this;
}

/**
* Resource type, always "dataset".
* Resource type, always set to <code>dataset</code>.
*
* @return type
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getType() {
public DatasetType getType() {
return type;
}

public void setType(String type) {
public void setType(DatasetType type) {
if (!type.isValid()) {
this.unparsed = true;
}
this.type = type;
}

Expand Down
53 changes: 53 additions & 0 deletions src/main/java/com/datadog/api/client/v2/model/DatasetType.java
Original file line number Diff line number Diff line change
@@ -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;

/** Resource type, always set to <code>dataset</code>. */
@JsonSerialize(using = DatasetType.DatasetTypeSerializer.class)
public class DatasetType extends ModelEnum<String> {

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

public static final DatasetType DATASET = new DatasetType("dataset");

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

public static class DatasetTypeSerializer extends StdSerializer<DatasetType> {
public DatasetTypeSerializer(Class<DatasetType> t) {
super(t);
}

public DatasetTypeSerializer() {
this(null);
}

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

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