Skip to content
Open
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
418 changes: 418 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions features/v2/fleet_automation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,30 @@ Feature: Fleet Automation
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/fleet-automation
Scenario: Get detailed information about an agent returns "Bad Request" response
Given operation "GetFleetAgentInfo" enabled
And new "GetFleetAgentInfo" request
And request contains "agent_key" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/fleet-automation
Scenario: Get detailed information about an agent returns "Not Found" response
Given operation "GetFleetAgentInfo" enabled
And new "GetFleetAgentInfo" request
And request contains "agent_key" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/fleet-automation
Scenario: Get detailed information about an agent returns "OK" response
Given operation "GetFleetAgentInfo" enabled
And new "GetFleetAgentInfo" request
And request contains "agent_key" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/fleet-automation
Scenario: List all available Agent versions returns "Bad Request" response
Given operation "ListFleetAgentVersions" enabled
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"type": "safe"
}
},
"GetFleetAgentInfo": {
"tag": "Fleet Automation",
"undo": {
"type": "safe"
}
},
"ListFleetDeployments": {
"tag": "Fleet Automation",
"undo": {
Expand Down
7 changes: 7 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
"FleetAutomationApi.V2.ListFleetAgentVersions": {
operationResponseType: "FleetAgentVersionsResponse",
},
"FleetAutomationApi.V2.GetFleetAgentInfo": {
agentKey: {
type: "string",
format: "",
},
operationResponseType: "FleetAgentInfoResponse",
},
"FleetAutomationApi.V2.ListFleetDeployments": {
pageSize: {
type: "number",
Expand Down
149 changes: 149 additions & 0 deletions services/fleet_automation/src/v2/FleetAutomationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {

import { TypingInfo } from "./models/TypingInfo";
import { APIErrorResponse } from "./models/APIErrorResponse";
import { FleetAgentInfoResponse } from "./models/FleetAgentInfoResponse";
import { FleetAgentVersionsResponse } from "./models/FleetAgentVersionsResponse";
import { FleetDeploymentConfigureCreateRequest } from "./models/FleetDeploymentConfigureCreateRequest";
import { FleetDeploymentPackageUpgradeCreateRequest } from "./models/FleetDeploymentPackageUpgradeCreateRequest";
Expand Down Expand Up @@ -331,6 +332,58 @@ export class FleetAutomationApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

public async getFleetAgentInfo(
agentKey: string,
_options?: Configuration,
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations["FleetAutomationApi.v2.getFleetAgentInfo"]
) {
throw new Error(
"Unstable operation 'getFleetAgentInfo' is disabled. Enable it by setting `configuration.unstableOperations['FleetAutomationApi.v2.getFleetAgentInfo'] = true`",
);
}

// verify required parameter 'agentKey' is not null or undefined
if (agentKey === null || agentKey === undefined) {
throw new RequiredError("agentKey", "getFleetAgentInfo");
}

// Path Params
const localVarPath = "/api/unstable/fleet/agents/{agent_key}".replace(
"{agent_key}",
encodeURIComponent(String(agentKey)),
);

// Make Request Context
const { server, overrides } = _config.getServerAndOverrides(
"FleetAutomationApi.v2.getFleetAgentInfo",
FleetAutomationApi.operationServers,
);
const requestContext = server.makeRequestContext(
localVarPath,
HttpMethod.GET,
overrides,
);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);

// Set User-Agent
if (this.userAgent) {
requestContext.setHeaderParam("User-Agent", this.userAgent);
}

// Apply auth methods
applySecurityAuthentication(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);

return requestContext;
}

public async getFleetDeployment(
deploymentId: string,
limit?: number,
Expand Down Expand Up @@ -1004,6 +1057,68 @@ export class FleetAutomationApiResponseProcessor {
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getFleetAgentInfo
* @throws ApiException if the response code was not in [200, 299]
*/
public async getFleetAgentInfo(
response: ResponseContext,
): Promise<FleetAgentInfoResponse> {
const contentType = normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body: FleetAgentInfoResponse = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"FleetAgentInfoResponse",
) as FleetAgentInfoResponse;
return body;
}
if (
response.httpStatusCode === 400 ||
response.httpStatusCode === 401 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 429
) {
const bodyText = parse(await response.body.text(), contentType);
let body: APIErrorResponse;
try {
body = deserialize(
bodyText,
TypingInfo,
"APIErrorResponse",
) as APIErrorResponse;
} catch (error) {
logger.debug(`Got error deserializing error: ${error}`);
throw new ApiException<APIErrorResponse>(
response.httpStatusCode,
bodyText,
);
}
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: FleetAgentInfoResponse = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"FleetAgentInfoResponse",
"",
) as FleetAgentInfoResponse;
return body;
}

const body = (await response.body.text()) || "";
throw new ApiException<string>(
response.httpStatusCode,
'Unknown API Status Code!\nBody: "' + body + '"',
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down Expand Up @@ -1477,6 +1592,14 @@ export interface FleetAutomationApiDeleteFleetScheduleRequest {
id: string;
}

export interface FleetAutomationApiGetFleetAgentInfoRequest {
/**
* The unique identifier (agent key) for the Datadog Agent.
* @type string
*/
agentKey: string;
}

export interface FleetAutomationApiGetFleetDeploymentRequest {
/**
* The unique identifier of the deployment to retrieve.
Expand Down Expand Up @@ -1705,6 +1828,32 @@ export class FleetAutomationApi {
});
}

/**
* Retrieve detailed information about a specific Datadog Agent.
* This endpoint returns comprehensive information about an agent including:
* - Agent details and metadata
* - Configured integrations organized by status (working, warning, error, missing)
* - Detected integrations
* - Configuration files and layers
* @param param The request object
*/
public getFleetAgentInfo(
param: FleetAutomationApiGetFleetAgentInfoRequest,
options?: Configuration,
): Promise<FleetAgentInfoResponse> {
const requestContextPromise = this.requestFactory.getFleetAgentInfo(
param.agentKey,
options,
);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.getFleetAgentInfo(responseContext);
});
});
}

/**
* Retrieve detailed information about a specific deployment using its unique identifier.
* This endpoint returns comprehensive information about a deployment, including:
Expand Down
11 changes: 11 additions & 0 deletions services/fleet_automation/src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export {
FleetAutomationApiCreateFleetDeploymentUpgradeRequest,
FleetAutomationApiCreateFleetScheduleRequest,
FleetAutomationApiDeleteFleetScheduleRequest,
FleetAutomationApiGetFleetAgentInfoRequest,
FleetAutomationApiGetFleetDeploymentRequest,
FleetAutomationApiGetFleetScheduleRequest,
FleetAutomationApiListFleetDeploymentsRequest,
Expand All @@ -13,10 +14,17 @@ export {
} from "./FleetAutomationApi";

export { APIErrorResponse } from "./models/APIErrorResponse";
export { FleetAgentInfo } from "./models/FleetAgentInfo";
export { FleetAgentInfoAttributes } from "./models/FleetAgentInfoAttributes";
export { FleetAgentInfoDetails } from "./models/FleetAgentInfoDetails";
export { FleetAgentInfoResourceType } from "./models/FleetAgentInfoResourceType";
export { FleetAgentInfoResponse } from "./models/FleetAgentInfoResponse";
export { FleetAgentVersion } from "./models/FleetAgentVersion";
export { FleetAgentVersionAttributes } from "./models/FleetAgentVersionAttributes";
export { FleetAgentVersionResourceType } from "./models/FleetAgentVersionResourceType";
export { FleetAgentVersionsResponse } from "./models/FleetAgentVersionsResponse";
export { FleetConfigurationFile } from "./models/FleetConfigurationFile";
export { FleetConfigurationLayer } from "./models/FleetConfigurationLayer";
export { FleetDeployment } from "./models/FleetDeployment";
export { FleetDeploymentAttributes } from "./models/FleetDeploymentAttributes";
export { FleetDeploymentConfigureAttributes } from "./models/FleetDeploymentConfigureAttributes";
Expand All @@ -37,6 +45,9 @@ export { FleetDeploymentResponseMeta } from "./models/FleetDeploymentResponseMet
export { FleetDeploymentsPage } from "./models/FleetDeploymentsPage";
export { FleetDeploymentsResponse } from "./models/FleetDeploymentsResponse";
export { FleetDeploymentsResponseMeta } from "./models/FleetDeploymentsResponseMeta";
export { FleetDetectedIntegration } from "./models/FleetDetectedIntegration";
export { FleetIntegrationDetails } from "./models/FleetIntegrationDetails";
export { FleetIntegrationsByStatus } from "./models/FleetIntegrationsByStatus";
export { FleetSchedule } from "./models/FleetSchedule";
export { FleetScheduleAttributes } from "./models/FleetScheduleAttributes";
export { FleetScheduleCreate } from "./models/FleetScheduleCreate";
Expand Down
66 changes: 66 additions & 0 deletions services/fleet_automation/src/v2/models/FleetAgentInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { AttributeTypeMap } from "@datadog/datadog-api-client";

import { FleetAgentInfoAttributes } from "./FleetAgentInfoAttributes";
import { FleetAgentInfoResourceType } from "./FleetAgentInfoResourceType";

/**
* Represents detailed information about a specific Datadog Agent.
*/
export class FleetAgentInfo {
/**
* Attributes for agent information.
*/
"attributes": FleetAgentInfoAttributes;
/**
* The unique agent key identifier.
*/
"id": string;
/**
* The type of Agent info resource.
*/
"type": FleetAgentInfoResourceType;
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
"additionalProperties"?: { [key: string]: any };
/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
attributes: {
baseName: "attributes",
type: "FleetAgentInfoAttributes",
required: true,
},
id: {
baseName: "id",
type: "string",
required: true,
},
type: {
baseName: "type",
type: "FleetAgentInfoResourceType",
required: true,
},
additionalProperties: {
baseName: "additionalProperties",
type: "{ [key: string]: any; }",
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return FleetAgentInfo.attributeTypeMap;
}

public constructor() {}
}
Loading