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
66 changes: 66 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51062,6 +51062,49 @@ components:
$ref: '#/components/schemas/ServiceDefinitionData'
type: array
type: object
ServiceList:
properties:
data:
$ref: '#/components/schemas/ServiceListData'
type: object
ServiceListData:
properties:
attributes:
$ref: '#/components/schemas/ServiceListDataAttributes'
id:
type: string
type:
$ref: '#/components/schemas/ServiceListDataType'
required:
- type
type: object
ServiceListDataAttributes:
properties:
metadata:
items:
$ref: '#/components/schemas/ServiceListDataAttributesMetadataItems'
type: array
services:
items:
type: string
type: array
type: object
ServiceListDataAttributesMetadataItems:
properties:
isTraced:
type: boolean
isUsm:
type: boolean
type: object
ServiceListDataType:
default: services_list
description: Services list resource type.
enum:
- services_list
example: services_list
type: string
x-enum-varnames:
- SERVICES_LIST
ServiceNowBasicAuth:
description: The definition of the `ServiceNowBasicAuth` object.
properties:
Expand Down Expand Up @@ -61255,6 +61298,26 @@ paths:
permissions:
- apm_retention_filter_write
- apm_pipelines_write
/api/v2/apm/services:
get:
operationId: GetServiceList
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceList'
description: OK
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- apm_read
summary: Get service list
tags:
- APM
/api/v2/app-builder/apps:
delete:
description: Delete multiple apps in a single request from a list of app IDs.
Expand Down Expand Up @@ -87993,6 +88056,9 @@ servers:
tags:
- description: Configure your API endpoints through the Datadog API.
name: API Management
- description: Observe, troubleshoot, and improve cloud-scale applications with all
telemetry in context
name: APM
- description: Manage configuration of [APM retention filters](https://app.datadoghq.com/apm/traces/retention-filters)
for your organization. You need an API and application key with Admin rights to
interact with this endpoint. See [retention filters](https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/#retention-filters)
Expand Down
13 changes: 13 additions & 0 deletions features/v2/apm.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@endpoint(apm) @endpoint(apm-v2)
Feature: APM
Observe, troubleshoot, and improve cloud-scale applications with all
telemetry in context

@generated @skip @team:DataDog/apm-aoe
Scenario: Get service list returns "OK" response
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "APM" API
And new "GetServiceList" request
When the request is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@
"type": "idempotent"
}
},
"GetServiceList": {
"tag": "APM",
"undo": {
"type": "safe"
}
},
"DeleteApps": {
"tag": "App Builder",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ apiInstance
| Actions Datastores | @datadog/datadog-api-client-actions-datastores | [README.md](../../services/actions-datastores/README.md) |
| Agentless Scanning | @datadog/datadog-api-client-agentless-scanning | [README.md](../../services/agentless-scanning/README.md) |
| API Management | @datadog/datadog-api-client-api-management | [README.md](../../services/api-management/README.md) |
| APM | @datadog/datadog-api-client-apm | [README.md](../../services/apm/README.md) |
| APM Retention Filters | @datadog/datadog-api-client-apm-retention-filters | [README.md](../../services/apm-retention-filters/README.md) |
| App Builder | @datadog/datadog-api-client-app-builder | [README.md](../../services/app-builder/README.md) |
| Application Security | @datadog/datadog-api-client-application-security | [README.md](../../services/application-security/README.md) |
Expand Down
3 changes: 3 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3102,6 +3102,9 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
},
operationResponseType: "{}",
},
"APMApi.V2.GetServiceList": {
operationResponseType: "ServiceList",
},
"AppBuilderApi.V2.ListApps": {
limit: {
type: "number",
Expand Down
1 change: 1 addition & 0 deletions services/apm/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
35 changes: 35 additions & 0 deletions services/apm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# @datadog/datadog-api-client-apm

## Description

Observe, troubleshoot, and improve cloud-scale applications with all telemetry in context

## Navigation

- [Installation](#installation)
- [Getting Started](#getting-started)

## Installation

```sh
# NPM
npm install @datadog/datadog-api-client-apm
# Yarn
yarn add @datadog/datadog-api-client-apm
```

## Getting Started
```ts
import { createConfiguration } from "@datadog/datadog-api-client";
import { APMApiV2 } from "@datadog/datadog-api-client-apm";
import { v2 } from "@datadog/datadog-api-client-apm";

const configuration = createConfiguration();
const apiInstance = new APMApiV2(configuration);

apiInstance.getServiceList().then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}).catch((error) => {
console.error("Error calling API: " + error);
});
```
43 changes: 43 additions & 0 deletions services/apm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@datadog/datadog-api-client-apm",
"description": "",
"author": "",
"keywords": [
"api",
"fetch",
"typescript"
],
"license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"repository": {
"type": "git",
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
"directory": "services/apm"
},
"files": [
"dist/**/*"
],
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
"build": "yarn generate-version-files && tsc",
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
},
"dependencies": {
"@datadog/datadog-api-client": "^2.0.0-beta.0"
},
"devDependencies": {
"typescript": "5.8.3"
},
"engines": {
"node": ">=18.0.0"
},
"version": "0.0.1",
"packageManager": "[email protected]"
}
3 changes: 3 additions & 0 deletions services/apm/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * as v2 from "./v2";

export { APMApi as APMApiV2 } from "./v2/APMApi";
162 changes: 162 additions & 0 deletions services/apm/src/v2/APMApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
import {
ApiException,
BaseAPIRequestFactory,
BaseServerConfiguration,
buildUserAgent,
Configuration,
createConfiguration,
deserialize,
getPreferredMediaType,
HttpMethod,
isBrowser,
logger,
normalizeMediaType,
parse,
RequiredError,
RequestContext,
ResponseContext,
serialize,
ServerConfiguration,
stringify,
applySecurityAuthentication,
} from "@datadog/datadog-api-client";

import { TypingInfo } from "./models/TypingInfo";
import { APIErrorResponse } from "./models/APIErrorResponse";
import { ServiceList } from "./models/ServiceList";
import { version } from "../version";

export class APMApiRequestFactory extends BaseAPIRequestFactory {
public userAgent: string | undefined;

public constructor(configuration: Configuration) {
super(configuration);
if (!isBrowser) {
this.userAgent = buildUserAgent("apm", version);
}
}
public async getServiceList(
_options?: Configuration,
): Promise<RequestContext> {
const _config = _options || this.configuration;

// Path Params
const localVarPath = "/api/v2/apm/services";

// Make Request Context
const { server, overrides } = _config.getServerAndOverrides(
"APMApi.v2.getServiceList",
APMApi.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",
"AuthZ",
]);

return requestContext;
}
}

export class APMApiResponseProcessor {
/**
* 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 getServiceList
* @throws ApiException if the response code was not in [200, 299]
*/
public async getServiceList(response: ResponseContext): Promise<ServiceList> {
const contentType = normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body: ServiceList = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"ServiceList",
) as ServiceList;
return body;
}
if (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: ServiceList = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"ServiceList",
"",
) as ServiceList;
return body;
}

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

export class APMApi {
private requestFactory: APMApiRequestFactory;
private responseProcessor: APMApiResponseProcessor;
private configuration: Configuration;

static operationServers: { [key: string]: BaseServerConfiguration[] } = {};

public constructor(
configuration?: Configuration,
requestFactory?: APMApiRequestFactory,
responseProcessor?: APMApiResponseProcessor,
) {
this.configuration = configuration || createConfiguration();
this.requestFactory =
requestFactory || new APMApiRequestFactory(this.configuration);
this.responseProcessor = responseProcessor || new APMApiResponseProcessor();
}

/**
* @param param The request object
*/
public getServiceList(options?: Configuration): Promise<ServiceList> {
const requestContextPromise = this.requestFactory.getServiceList(options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.getServiceList(responseContext);
});
});
}
}
8 changes: 8 additions & 0 deletions services/apm/src/v2/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { APMApi } from "./APMApi";

export { APIErrorResponse } from "./models/APIErrorResponse";
export { ServiceList } from "./models/ServiceList";
export { ServiceListData } from "./models/ServiceListData";
export { ServiceListDataAttributes } from "./models/ServiceListDataAttributes";
export { ServiceListDataAttributesMetadataItems } from "./models/ServiceListDataAttributesMetadataItems";
export { ServiceListDataType } from "./models/ServiceListDataType";
Loading