Skip to content

Commit c7cf006

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 849304a of spec repo
1 parent 196c793 commit c7cf006

File tree

20 files changed

+635
-0
lines changed

20 files changed

+635
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51062,6 +51062,49 @@ components:
5106251062
$ref: '#/components/schemas/ServiceDefinitionData'
5106351063
type: array
5106451064
type: object
51065+
ServiceList:
51066+
properties:
51067+
data:
51068+
$ref: '#/components/schemas/ServiceListData'
51069+
type: object
51070+
ServiceListData:
51071+
properties:
51072+
attributes:
51073+
$ref: '#/components/schemas/ServiceListDataAttributes'
51074+
id:
51075+
type: string
51076+
type:
51077+
$ref: '#/components/schemas/ServiceListDataType'
51078+
required:
51079+
- type
51080+
type: object
51081+
ServiceListDataAttributes:
51082+
properties:
51083+
metadata:
51084+
items:
51085+
$ref: '#/components/schemas/ServiceListDataAttributesMetadataItems'
51086+
type: array
51087+
services:
51088+
items:
51089+
type: string
51090+
type: array
51091+
type: object
51092+
ServiceListDataAttributesMetadataItems:
51093+
properties:
51094+
isTraced:
51095+
type: boolean
51096+
isUsm:
51097+
type: boolean
51098+
type: object
51099+
ServiceListDataType:
51100+
default: services_list
51101+
description: Services list resource type.
51102+
enum:
51103+
- services_list
51104+
example: services_list
51105+
type: string
51106+
x-enum-varnames:
51107+
- SERVICES_LIST
5106551108
ServiceNowBasicAuth:
5106651109
description: The definition of the `ServiceNowBasicAuth` object.
5106751110
properties:
@@ -61255,6 +61298,26 @@ paths:
6125561298
permissions:
6125661299
- apm_retention_filter_write
6125761300
- apm_pipelines_write
61301+
/api/v2/apm/services:
61302+
get:
61303+
operationId: GetServiceList
61304+
responses:
61305+
'200':
61306+
content:
61307+
application/json:
61308+
schema:
61309+
$ref: '#/components/schemas/ServiceList'
61310+
description: OK
61311+
'429':
61312+
$ref: '#/components/responses/TooManyRequestsResponse'
61313+
security:
61314+
- apiKeyAuth: []
61315+
appKeyAuth: []
61316+
- AuthZ:
61317+
- apm_read
61318+
summary: Get service list
61319+
tags:
61320+
- APM
6125861321
/api/v2/app-builder/apps:
6125961322
delete:
6126061323
description: Delete multiple apps in a single request from a list of app IDs.
@@ -87993,6 +88056,9 @@ servers:
8799388056
tags:
8799488057
- description: Configure your API endpoints through the Datadog API.
8799588058
name: API Management
88059+
- description: Observe, troubleshoot, and improve cloud-scale applications with all
88060+
telemetry in context
88061+
name: APM
8799688062
- description: Manage configuration of [APM retention filters](https://app.datadoghq.com/apm/traces/retention-filters)
8799788063
for your organization. You need an API and application key with Admin rights to
8799888064
interact with this endpoint. See [retention filters](https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/#retention-filters)

features/v2/apm.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@endpoint(apm) @endpoint(apm-v2)
2+
Feature: APM
3+
Observe, troubleshoot, and improve cloud-scale applications with all
4+
telemetry in context
5+
6+
@generated @skip @team:DataDog/apm-aoe
7+
Scenario: Get service list returns "OK" response
8+
Given a valid "apiKeyAuth" key in the system
9+
And a valid "appKeyAuth" key in the system
10+
And an instance of "APM" API
11+
And new "GetServiceList" request
12+
When the request is sent
13+
Then the response status is 200 OK

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@
516516
"type": "idempotent"
517517
}
518518
},
519+
"GetServiceList": {
520+
"tag": "APM",
521+
"undo": {
522+
"type": "safe"
523+
}
524+
},
519525
"DeleteApps": {
520526
"tag": "App Builder",
521527
"undo": {

packages/datadog-api-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ apiInstance
350350
| Actions Datastores | @datadog/datadog-api-client-actions-datastores | [README.md](../../services/actions-datastores/README.md) |
351351
| Agentless Scanning | @datadog/datadog-api-client-agentless-scanning | [README.md](../../services/agentless-scanning/README.md) |
352352
| API Management | @datadog/datadog-api-client-api-management | [README.md](../../services/api-management/README.md) |
353+
| APM | @datadog/datadog-api-client-apm | [README.md](../../services/apm/README.md) |
353354
| APM Retention Filters | @datadog/datadog-api-client-apm-retention-filters | [README.md](../../services/apm-retention-filters/README.md) |
354355
| App Builder | @datadog/datadog-api-client-app-builder | [README.md](../../services/app-builder/README.md) |
355356
| Application Security | @datadog/datadog-api-client-application-security | [README.md](../../services/application-security/README.md) |

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,6 +3102,9 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
31023102
},
31033103
operationResponseType: "{}",
31043104
},
3105+
"APMApi.V2.GetServiceList": {
3106+
operationResponseType: "ServiceList",
3107+
},
31053108
"AppBuilderApi.V2.ListApps": {
31063109
limit: {
31073110
type: "number",

services/apm/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

services/apm/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# @datadog/datadog-api-client-apm
2+
3+
## Description
4+
5+
Observe, troubleshoot, and improve cloud-scale applications with all telemetry in context
6+
7+
## Navigation
8+
9+
- [Installation](#installation)
10+
- [Getting Started](#getting-started)
11+
12+
## Installation
13+
14+
```sh
15+
# NPM
16+
npm install @datadog/datadog-api-client-apm
17+
# Yarn
18+
yarn add @datadog/datadog-api-client-apm
19+
```
20+
21+
## Getting Started
22+
```ts
23+
import { createConfiguration } from "@datadog/datadog-api-client";
24+
import { APMApiV2 } from "@datadog/datadog-api-client-apm";
25+
import { v2 } from "@datadog/datadog-api-client-apm";
26+
27+
const configuration = createConfiguration();
28+
const apiInstance = new APMApiV2(configuration);
29+
30+
apiInstance.getServiceList().then((data) => {
31+
console.log("API called successfully. Returned data: " + JSON.stringify(data));
32+
}).catch((error) => {
33+
console.error("Error calling API: " + error);
34+
});
35+
```

services/apm/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@datadog/datadog-api-client-apm",
3+
"description": "",
4+
"author": "",
5+
"keywords": [
6+
"api",
7+
"fetch",
8+
"typescript"
9+
],
10+
"license": "Apache-2.0",
11+
"licenses": [
12+
{
13+
"type": "Apache-2.0",
14+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
15+
}
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
20+
"directory": "services/apm"
21+
},
22+
"files": [
23+
"dist/**/*"
24+
],
25+
"main": "./dist/index.js",
26+
"typings": "./dist/index.d.ts",
27+
"scripts": {
28+
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
29+
"build": "yarn generate-version-files && tsc",
30+
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
31+
},
32+
"dependencies": {
33+
"@datadog/datadog-api-client": "^2.0.0-beta.0"
34+
},
35+
"devDependencies": {
36+
"typescript": "5.8.3"
37+
},
38+
"engines": {
39+
"node": ">=18.0.0"
40+
},
41+
"version": "0.0.1",
42+
"packageManager": "[email protected]"
43+
}

services/apm/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * as v2 from "./v2";
2+
3+
export { APMApi as APMApiV2 } from "./v2/APMApi";

services/apm/src/v2/APMApi.ts

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import {
2+
ApiException,
3+
BaseAPIRequestFactory,
4+
BaseServerConfiguration,
5+
buildUserAgent,
6+
Configuration,
7+
createConfiguration,
8+
deserialize,
9+
getPreferredMediaType,
10+
HttpMethod,
11+
isBrowser,
12+
logger,
13+
normalizeMediaType,
14+
parse,
15+
RequiredError,
16+
RequestContext,
17+
ResponseContext,
18+
serialize,
19+
ServerConfiguration,
20+
stringify,
21+
applySecurityAuthentication,
22+
} from "@datadog/datadog-api-client";
23+
24+
import { TypingInfo } from "./models/TypingInfo";
25+
import { APIErrorResponse } from "./models/APIErrorResponse";
26+
import { ServiceList } from "./models/ServiceList";
27+
import { version } from "../version";
28+
29+
export class APMApiRequestFactory extends BaseAPIRequestFactory {
30+
public userAgent: string | undefined;
31+
32+
public constructor(configuration: Configuration) {
33+
super(configuration);
34+
if (!isBrowser) {
35+
this.userAgent = buildUserAgent("apm", version);
36+
}
37+
}
38+
public async getServiceList(
39+
_options?: Configuration,
40+
): Promise<RequestContext> {
41+
const _config = _options || this.configuration;
42+
43+
// Path Params
44+
const localVarPath = "/api/v2/apm/services";
45+
46+
// Make Request Context
47+
const { server, overrides } = _config.getServerAndOverrides(
48+
"APMApi.v2.getServiceList",
49+
APMApi.operationServers,
50+
);
51+
const requestContext = server.makeRequestContext(
52+
localVarPath,
53+
HttpMethod.GET,
54+
overrides,
55+
);
56+
requestContext.setHeaderParam("Accept", "application/json");
57+
requestContext.setHttpConfig(_config.httpConfig);
58+
59+
// Set User-Agent
60+
if (this.userAgent) {
61+
requestContext.setHeaderParam("User-Agent", this.userAgent);
62+
}
63+
64+
// Apply auth methods
65+
applySecurityAuthentication(_config, requestContext, [
66+
"apiKeyAuth",
67+
"appKeyAuth",
68+
"AuthZ",
69+
]);
70+
71+
return requestContext;
72+
}
73+
}
74+
75+
export class APMApiResponseProcessor {
76+
/**
77+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
78+
* to the expected objects
79+
*
80+
* @params response Response returned by the server for a request to getServiceList
81+
* @throws ApiException if the response code was not in [200, 299]
82+
*/
83+
public async getServiceList(response: ResponseContext): Promise<ServiceList> {
84+
const contentType = normalizeMediaType(response.headers["content-type"]);
85+
if (response.httpStatusCode === 200) {
86+
const body: ServiceList = deserialize(
87+
parse(await response.body.text(), contentType),
88+
TypingInfo,
89+
"ServiceList",
90+
) as ServiceList;
91+
return body;
92+
}
93+
if (response.httpStatusCode === 429) {
94+
const bodyText = parse(await response.body.text(), contentType);
95+
let body: APIErrorResponse;
96+
try {
97+
body = deserialize(
98+
bodyText,
99+
TypingInfo,
100+
"APIErrorResponse",
101+
) as APIErrorResponse;
102+
} catch (error) {
103+
logger.debug(`Got error deserializing error: ${error}`);
104+
throw new ApiException<APIErrorResponse>(
105+
response.httpStatusCode,
106+
bodyText,
107+
);
108+
}
109+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
110+
}
111+
112+
// Work around for missing responses in specification, e.g. for petstore.yaml
113+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
114+
const body: ServiceList = deserialize(
115+
parse(await response.body.text(), contentType),
116+
TypingInfo,
117+
"ServiceList",
118+
"",
119+
) as ServiceList;
120+
return body;
121+
}
122+
123+
const body = (await response.body.text()) || "";
124+
throw new ApiException<string>(
125+
response.httpStatusCode,
126+
'Unknown API Status Code!\nBody: "' + body + '"',
127+
);
128+
}
129+
}
130+
131+
export class APMApi {
132+
private requestFactory: APMApiRequestFactory;
133+
private responseProcessor: APMApiResponseProcessor;
134+
private configuration: Configuration;
135+
136+
static operationServers: { [key: string]: BaseServerConfiguration[] } = {};
137+
138+
public constructor(
139+
configuration?: Configuration,
140+
requestFactory?: APMApiRequestFactory,
141+
responseProcessor?: APMApiResponseProcessor,
142+
) {
143+
this.configuration = configuration || createConfiguration();
144+
this.requestFactory =
145+
requestFactory || new APMApiRequestFactory(this.configuration);
146+
this.responseProcessor = responseProcessor || new APMApiResponseProcessor();
147+
}
148+
149+
/**
150+
* @param param The request object
151+
*/
152+
public getServiceList(options?: Configuration): Promise<ServiceList> {
153+
const requestContextPromise = this.requestFactory.getServiceList(options);
154+
return requestContextPromise.then((requestContext) => {
155+
return this.configuration.httpApi
156+
.send(requestContext)
157+
.then((responseContext) => {
158+
return this.responseProcessor.getServiceList(responseContext);
159+
});
160+
});
161+
}
162+
}

0 commit comments

Comments
 (0)