From 6ac9142314661f45250c2efea8e558d336167170 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 19 Oct 2026 17:40:46 +0000 Subject: [PATCH] Regenerate client from commit 84d7f49 of spec repo --- .generator/schemas/v2/openapi.yaml | 137 +++++++++ .../ListAgentHealthHostIssues.java | 30 ++ .../api/client/v2/api/AgentHealthApi.java | 263 ++++++++++++++++++ .../client/v2/model/AgentHealthAgentType.java | 56 ++++ .../client/v2/model/AgentHealthHostIssue.java | 229 +++++++++++++++ .../AgentHealthHostIssuesAttributes.java | 165 +++++++++++ .../v2/model/AgentHealthHostIssuesData.java | 213 ++++++++++++++ .../model/AgentHealthHostIssuesResponse.java | 149 ++++++++++ .../v2/model/AgentHealthHostIssuesType.java | 57 ++++ .../api/client/v2/api/agent_health.feature | 21 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + 11 files changed, 1326 insertions(+) create mode 100644 examples/v2/agent-health/ListAgentHealthHostIssues.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/AgentHealthApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AgentHealthAgentType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssue.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesType.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/agent_health.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 04454bdda2d..1ea0da0c9bc 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -4969,6 +4969,91 @@ components: - id - base_severity type: object + AgentHealthAgentType: + default: node + description: Agent type associated with the resource. + enum: + - node + - cluster + example: node + type: string + x-enum-varnames: + - NODE + - CLUSTER + AgentHealthHostIssue: + description: An active Agent Health issue associated with a resource. + properties: + category: + description: The category used by the Agent to group and reconcile the issue. + example: configuration + type: string + issue_id: + description: The unique identifier of the issue. + example: invalid-config:4828e7d6c704c4a3 + type: string + issue_name: + description: The human-readable name of the issue. + example: Invalid Config + type: string + issue_type: + description: The machine-readable type of the issue. + example: invalid_config + type: string + required: + - issue_id + - issue_name + - issue_type + - category + type: object + AgentHealthHostIssuesAttributes: + description: Active Agent Health issues for a resource. + properties: + issues: + description: The active issues and their reconciliation metadata. + example: + - category: configuration + issue_id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + issue_type: invalid_config + items: + $ref: "#/components/schemas/AgentHealthHostIssue" + type: array + required: + - issues + type: object + AgentHealthHostIssuesData: + description: Agent Health issue data for a resource. + properties: + attributes: + $ref: "#/components/schemas/AgentHealthHostIssuesAttributes" + id: + description: The resource identifier. + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + type: + $ref: "#/components/schemas/AgentHealthHostIssuesType" + required: + - id + - type + - attributes + type: object + AgentHealthHostIssuesResponse: + description: Response containing the active Agent Health issues for a resource. + properties: + data: + $ref: "#/components/schemas/AgentHealthHostIssuesData" + required: + - data + type: object + AgentHealthHostIssuesType: + default: agent_health_issues + description: The Agent Health issue resource type. + enum: + - agent_health_issues + example: agent_health_issues + type: string + x-enum-varnames: + - AGENT_HEALTH_ISSUES AgentTrigger: description: "Trigger a workflow from an agent via the MCP execute tool. Workflow can be executed from Bits Chat, Bits Agent Builder, Claude Code, Codex, Cursor, and any other coding agent using the Datadog MCP." properties: @@ -144008,6 +144093,56 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/agenthealth/hosts/{resource_id}/issues: + get: + description: Returns the active Agent Health issues for a node Agent or Cluster Agent resource. + operationId: ListAgentHealthHostIssues + parameters: + - description: >- + Resource identifier whose active Agent Health issues should be returned: a DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. + example: 123e4567-e89b-12d3-a456-426614174000 + in: path + name: resource_id + required: true + schema: + type: string + - description: Agent type associated with the resource. Defaults to `node` when omitted. + example: node + in: query + name: agent_type + required: false + schema: + $ref: "#/components/schemas/AgentHealthAgentType" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + issues: + - category: configuration + issue_id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + issue_type: invalid_config + id: 123e4567-e89b-12d3-a456-426614174000 + type: agent_health_issues + schema: + $ref: "#/components/schemas/AgentHealthHostIssuesResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + summary: List active Agent Health issues + tags: + - Agent Health /api/v2/agentless_scanning/accounts/aws: get: description: Fetches the scan options configured for AWS accounts. @@ -250883,6 +251018,8 @@ tags: externalDocs: url: https://docs.datadoghq.com/actions/datastore name: Actions Datastores + - description: View Agent Health issues reported for node Agents and Cluster Agents. + name: Agent Health - description: >- Manage Agent Observability spans, data, projects, datasets, dataset records, experiments, prompts, and annotations. name: Agent Observability diff --git a/examples/v2/agent-health/ListAgentHealthHostIssues.java b/examples/v2/agent-health/ListAgentHealthHostIssues.java new file mode 100644 index 00000000000..45b100916df --- /dev/null +++ b/examples/v2/agent-health/ListAgentHealthHostIssues.java @@ -0,0 +1,30 @@ +// List active Agent Health issues returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.AgentHealthApi; +import com.datadog.api.client.v2.api.AgentHealthApi.ListAgentHealthHostIssuesOptionalParameters; +import com.datadog.api.client.v2.model.AgentHealthAgentType; +import com.datadog.api.client.v2.model.AgentHealthHostIssuesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentHealthApi apiInstance = new AgentHealthApi(defaultClient); + + try { + AgentHealthHostIssuesResponse result = + apiInstance.listAgentHealthHostIssues( + "123e4567-e89b-12d3-a456-426614174000", + new ListAgentHealthHostIssuesOptionalParameters() + .agentType(AgentHealthAgentType.NODE)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentHealthApi#listAgentHealthHostIssues"); + 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/api/AgentHealthApi.java b/src/main/java/com/datadog/api/client/v2/api/AgentHealthApi.java new file mode 100644 index 00000000000..34ef01aaa82 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/AgentHealthApi.java @@ -0,0 +1,263 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.AgentHealthAgentType; +import com.datadog.api.client.v2.model.AgentHealthHostIssuesResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AgentHealthApi { + private ApiClient apiClient; + + public AgentHealthApi() { + this(ApiClient.getDefaultApiClient()); + } + + public AgentHealthApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to listAgentHealthHostIssues. */ + public static class ListAgentHealthHostIssuesOptionalParameters { + private AgentHealthAgentType agentType; + + /** + * Set agentType. + * + * @param agentType Agent type associated with the resource. Defaults to node when + * omitted. (optional, default to "node") + * @return ListAgentHealthHostIssuesOptionalParameters + */ + public ListAgentHealthHostIssuesOptionalParameters agentType(AgentHealthAgentType agentType) { + this.agentType = agentType; + return this; + } + } + + /** + * List active Agent Health issues. + * + *

See {@link #listAgentHealthHostIssuesWithHttpInfo}. + * + * @param resourceId Resource identifier whose active Agent Health issues should be returned: a + * DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. (required) + * @return AgentHealthHostIssuesResponse + * @throws ApiException if fails to make API call + */ + public AgentHealthHostIssuesResponse listAgentHealthHostIssues(String resourceId) + throws ApiException { + return listAgentHealthHostIssuesWithHttpInfo( + resourceId, new ListAgentHealthHostIssuesOptionalParameters()) + .getData(); + } + + /** + * List active Agent Health issues. + * + *

See {@link #listAgentHealthHostIssuesWithHttpInfoAsync}. + * + * @param resourceId Resource identifier whose active Agent Health issues should be returned: a + * DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. (required) + * @return CompletableFuture<AgentHealthHostIssuesResponse> + */ + public CompletableFuture listAgentHealthHostIssuesAsync( + String resourceId) { + return listAgentHealthHostIssuesWithHttpInfoAsync( + resourceId, new ListAgentHealthHostIssuesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List active Agent Health issues. + * + *

See {@link #listAgentHealthHostIssuesWithHttpInfo}. + * + * @param resourceId Resource identifier whose active Agent Health issues should be returned: a + * DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. (required) + * @param parameters Optional parameters for the request. + * @return AgentHealthHostIssuesResponse + * @throws ApiException if fails to make API call + */ + public AgentHealthHostIssuesResponse listAgentHealthHostIssues( + String resourceId, ListAgentHealthHostIssuesOptionalParameters parameters) + throws ApiException { + return listAgentHealthHostIssuesWithHttpInfo(resourceId, parameters).getData(); + } + + /** + * List active Agent Health issues. + * + *

See {@link #listAgentHealthHostIssuesWithHttpInfoAsync}. + * + * @param resourceId Resource identifier whose active Agent Health issues should be returned: a + * DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<AgentHealthHostIssuesResponse> + */ + public CompletableFuture listAgentHealthHostIssuesAsync( + String resourceId, ListAgentHealthHostIssuesOptionalParameters parameters) { + return listAgentHealthHostIssuesWithHttpInfoAsync(resourceId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns the active Agent Health issues for a node Agent or Cluster Agent resource. + * + * @param resourceId Resource identifier whose active Agent Health issues should be returned: a + * DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<AgentHealthHostIssuesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listAgentHealthHostIssuesWithHttpInfo( + String resourceId, ListAgentHealthHostIssuesOptionalParameters parameters) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling listAgentHealthHostIssues"); + } + AgentHealthAgentType agentType = parameters.agentType; + // create path and map variables + String localVarPath = + "/api/v2/agenthealth/hosts/{resource_id}/issues" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "agent_type", agentType)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentHealthApi.listAgentHealthHostIssues", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List active Agent Health issues. + * + *

See {@link #listAgentHealthHostIssuesWithHttpInfo}. + * + * @param resourceId Resource identifier whose active Agent Health issues should be returned: a + * DaemonSet UID for a node Agent or a cluster UUID for a Cluster Agent. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<AgentHealthHostIssuesResponse>> + */ + public CompletableFuture> + listAgentHealthHostIssuesWithHttpInfoAsync( + String resourceId, ListAgentHealthHostIssuesOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'resourceId' is set + if (resourceId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'resourceId' when calling" + + " listAgentHealthHostIssues")); + return result; + } + AgentHealthAgentType agentType = parameters.agentType; + // create path and map variables + String localVarPath = + "/api/v2/agenthealth/hosts/{resource_id}/issues" + .replaceAll( + "\\{" + "resource_id" + "\\}", apiClient.escapeString(resourceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "agent_type", agentType)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentHealthApi.listAgentHealthHostIssues", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AgentHealthAgentType.java b/src/main/java/com/datadog/api/client/v2/model/AgentHealthAgentType.java new file mode 100644 index 00000000000..30e1f7a09af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AgentHealthAgentType.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; + +/** Agent type associated with the resource. */ +@JsonSerialize(using = AgentHealthAgentType.AgentHealthAgentTypeSerializer.class) +public class AgentHealthAgentType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("node", "cluster")); + + public static final AgentHealthAgentType NODE = new AgentHealthAgentType("node"); + public static final AgentHealthAgentType CLUSTER = new AgentHealthAgentType("cluster"); + + AgentHealthAgentType(String value) { + super(value, allowedValues); + } + + public static class AgentHealthAgentTypeSerializer extends StdSerializer { + public AgentHealthAgentTypeSerializer(Class t) { + super(t); + } + + public AgentHealthAgentTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AgentHealthAgentType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AgentHealthAgentType fromValue(String value) { + return new AgentHealthAgentType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssue.java b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssue.java new file mode 100644 index 00000000000..746a0ac0817 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssue.java @@ -0,0 +1,229 @@ +/* + * 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 active Agent Health issue associated with a resource. */ +@JsonPropertyOrder({ + AgentHealthHostIssue.JSON_PROPERTY_CATEGORY, + AgentHealthHostIssue.JSON_PROPERTY_ISSUE_ID, + AgentHealthHostIssue.JSON_PROPERTY_ISSUE_NAME, + AgentHealthHostIssue.JSON_PROPERTY_ISSUE_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AgentHealthHostIssue { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private String category; + + public static final String JSON_PROPERTY_ISSUE_ID = "issue_id"; + private String issueId; + + public static final String JSON_PROPERTY_ISSUE_NAME = "issue_name"; + private String issueName; + + public static final String JSON_PROPERTY_ISSUE_TYPE = "issue_type"; + private String issueType; + + public AgentHealthHostIssue() {} + + @JsonCreator + public AgentHealthHostIssue( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) String category, + @JsonProperty(required = true, value = JSON_PROPERTY_ISSUE_ID) String issueId, + @JsonProperty(required = true, value = JSON_PROPERTY_ISSUE_NAME) String issueName, + @JsonProperty(required = true, value = JSON_PROPERTY_ISSUE_TYPE) String issueType) { + this.category = category; + this.issueId = issueId; + this.issueName = issueName; + this.issueType = issueType; + } + + public AgentHealthHostIssue category(String category) { + this.category = category; + return this; + } + + /** + * The category used by the Agent to group and reconcile the issue. + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public AgentHealthHostIssue issueId(String issueId) { + this.issueId = issueId; + return this; + } + + /** + * The unique identifier of the issue. + * + * @return issueId + */ + @JsonProperty(JSON_PROPERTY_ISSUE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIssueId() { + return issueId; + } + + public void setIssueId(String issueId) { + this.issueId = issueId; + } + + public AgentHealthHostIssue issueName(String issueName) { + this.issueName = issueName; + return this; + } + + /** + * The human-readable name of the issue. + * + * @return issueName + */ + @JsonProperty(JSON_PROPERTY_ISSUE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIssueName() { + return issueName; + } + + public void setIssueName(String issueName) { + this.issueName = issueName; + } + + public AgentHealthHostIssue issueType(String issueType) { + this.issueType = issueType; + return this; + } + + /** + * The machine-readable type of the issue. + * + * @return issueType + */ + @JsonProperty(JSON_PROPERTY_ISSUE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIssueType() { + return issueType; + } + + public void setIssueType(String issueType) { + this.issueType = issueType; + } + + /** + * 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 AgentHealthHostIssue + */ + @JsonAnySetter + public AgentHealthHostIssue 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 AgentHealthHostIssue object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentHealthHostIssue agentHealthHostIssue = (AgentHealthHostIssue) o; + return Objects.equals(this.category, agentHealthHostIssue.category) + && Objects.equals(this.issueId, agentHealthHostIssue.issueId) + && Objects.equals(this.issueName, agentHealthHostIssue.issueName) + && Objects.equals(this.issueType, agentHealthHostIssue.issueType) + && Objects.equals(this.additionalProperties, agentHealthHostIssue.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(category, issueId, issueName, issueType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentHealthHostIssue {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" issueId: ").append(toIndentedString(issueId)).append("\n"); + sb.append(" issueName: ").append(toIndentedString(issueName)).append("\n"); + sb.append(" issueType: ").append(toIndentedString(issueType)).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/AgentHealthHostIssuesAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesAttributes.java new file mode 100644 index 00000000000..4e389d62d90 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesAttributes.java @@ -0,0 +1,165 @@ +/* + * 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; + +/** Active Agent Health issues for a resource. */ +@JsonPropertyOrder({AgentHealthHostIssuesAttributes.JSON_PROPERTY_ISSUES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AgentHealthHostIssuesAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ISSUES = "issues"; + private List issues = new ArrayList<>(); + + public AgentHealthHostIssuesAttributes() {} + + @JsonCreator + public AgentHealthHostIssuesAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ISSUES) + List issues) { + this.issues = issues; + for (AgentHealthHostIssue item : issues) { + this.unparsed |= item.unparsed; + } + } + + public AgentHealthHostIssuesAttributes issues(List issues) { + this.issues = issues; + for (AgentHealthHostIssue item : issues) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AgentHealthHostIssuesAttributes addIssuesItem(AgentHealthHostIssue issuesItem) { + this.issues.add(issuesItem); + this.unparsed |= issuesItem.unparsed; + return this; + } + + /** + * The active issues and their reconciliation metadata. + * + * @return issues + */ + @JsonProperty(JSON_PROPERTY_ISSUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getIssues() { + return issues; + } + + public void setIssues(List issues) { + this.issues = issues; + if (issues != null) { + for (AgentHealthHostIssue item : issues) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 AgentHealthHostIssuesAttributes + */ + @JsonAnySetter + public AgentHealthHostIssuesAttributes 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 AgentHealthHostIssuesAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentHealthHostIssuesAttributes agentHealthHostIssuesAttributes = + (AgentHealthHostIssuesAttributes) o; + return Objects.equals(this.issues, agentHealthHostIssuesAttributes.issues) + && Objects.equals( + this.additionalProperties, agentHealthHostIssuesAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(issues, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentHealthHostIssuesAttributes {\n"); + sb.append(" issues: ").append(toIndentedString(issues)).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/AgentHealthHostIssuesData.java b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesData.java new file mode 100644 index 00000000000..6f9bb4f1cc0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesData.java @@ -0,0 +1,213 @@ +/* + * 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; + +/** Agent Health issue data for a resource. */ +@JsonPropertyOrder({ + AgentHealthHostIssuesData.JSON_PROPERTY_ATTRIBUTES, + AgentHealthHostIssuesData.JSON_PROPERTY_ID, + AgentHealthHostIssuesData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AgentHealthHostIssuesData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AgentHealthHostIssuesAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AgentHealthHostIssuesType type = AgentHealthHostIssuesType.AGENT_HEALTH_ISSUES; + + public AgentHealthHostIssuesData() {} + + @JsonCreator + public AgentHealthHostIssuesData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AgentHealthHostIssuesAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AgentHealthHostIssuesType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AgentHealthHostIssuesData attributes(AgentHealthHostIssuesAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Active Agent Health issues for a resource. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AgentHealthHostIssuesAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AgentHealthHostIssuesAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public AgentHealthHostIssuesData id(String id) { + this.id = id; + return this; + } + + /** + * The resource identifier. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AgentHealthHostIssuesData type(AgentHealthHostIssuesType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The Agent Health issue resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AgentHealthHostIssuesType getType() { + return type; + } + + public void setType(AgentHealthHostIssuesType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 AgentHealthHostIssuesData + */ + @JsonAnySetter + public AgentHealthHostIssuesData 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 AgentHealthHostIssuesData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentHealthHostIssuesData agentHealthHostIssuesData = (AgentHealthHostIssuesData) o; + return Objects.equals(this.attributes, agentHealthHostIssuesData.attributes) + && Objects.equals(this.id, agentHealthHostIssuesData.id) + && Objects.equals(this.type, agentHealthHostIssuesData.type) + && Objects.equals( + this.additionalProperties, agentHealthHostIssuesData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentHealthHostIssuesData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/AgentHealthHostIssuesResponse.java b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesResponse.java new file mode 100644 index 00000000000..8104f058948 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesResponse.java @@ -0,0 +1,149 @@ +/* + * 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; + +/** Response containing the active Agent Health issues for a resource. */ +@JsonPropertyOrder({AgentHealthHostIssuesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AgentHealthHostIssuesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AgentHealthHostIssuesData data; + + public AgentHealthHostIssuesResponse() {} + + @JsonCreator + public AgentHealthHostIssuesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AgentHealthHostIssuesData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AgentHealthHostIssuesResponse data(AgentHealthHostIssuesData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Agent Health issue data for a resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AgentHealthHostIssuesData getData() { + return data; + } + + public void setData(AgentHealthHostIssuesData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 AgentHealthHostIssuesResponse + */ + @JsonAnySetter + public AgentHealthHostIssuesResponse 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 AgentHealthHostIssuesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentHealthHostIssuesResponse agentHealthHostIssuesResponse = (AgentHealthHostIssuesResponse) o; + return Objects.equals(this.data, agentHealthHostIssuesResponse.data) + && Objects.equals( + this.additionalProperties, agentHealthHostIssuesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentHealthHostIssuesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/AgentHealthHostIssuesType.java b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesType.java new file mode 100644 index 00000000000..17524ad205e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AgentHealthHostIssuesType.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; + +/** The Agent Health issue resource type. */ +@JsonSerialize(using = AgentHealthHostIssuesType.AgentHealthHostIssuesTypeSerializer.class) +public class AgentHealthHostIssuesType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("agent_health_issues")); + + public static final AgentHealthHostIssuesType AGENT_HEALTH_ISSUES = + new AgentHealthHostIssuesType("agent_health_issues"); + + AgentHealthHostIssuesType(String value) { + super(value, allowedValues); + } + + public static class AgentHealthHostIssuesTypeSerializer + extends StdSerializer { + public AgentHealthHostIssuesTypeSerializer(Class t) { + super(t); + } + + public AgentHealthHostIssuesTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AgentHealthHostIssuesType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AgentHealthHostIssuesType fromValue(String value) { + return new AgentHealthHostIssuesType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/agent_health.feature b/src/test/resources/com/datadog/api/client/v2/api/agent_health.feature new file mode 100644 index 00000000000..0e0dc268c74 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/agent_health.feature @@ -0,0 +1,21 @@ +@endpoint(agent-health) @endpoint(agent-health-v2) +Feature: Agent Health + View Agent Health issues reported for node Agents and Cluster Agents. + + Background: + Given a valid "apiKeyAuth" key in the system + And an instance of "AgentHealth" API + And new "ListAgentHealthHostIssues" request + And request contains "resource_id" parameter with value "123e4567-e89b-12d3-a456-426614174000" + + @skip @team:ddoghq/fleet-remediation + Scenario: List active Agent Health issues returns "Bad Request" response + Given request contains "agent_type" parameter with value "process" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:ddoghq/fleet-remediation + Scenario: List active Agent Health issues returns "OK" response + Given request contains "agent_type" parameter with value "node" + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 44429f978f8..1e95b2e53fb 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -239,6 +239,12 @@ "type": "idempotent" } }, + "ListAgentHealthHostIssues": { + "tag": "Agent Health", + "undo": { + "type": "safe" + } + }, "ListAwsScanOptions": { "tag": "Agentless Scanning", "undo": {