Skip to content

Commit d06a2d1

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 4a60f0e of spec repo
1 parent 6770461 commit d06a2d1

File tree

20 files changed

+633
-0
lines changed

20 files changed

+633
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50937,6 +50937,49 @@ components:
5093750937
$ref: '#/components/schemas/ServiceDefinitionData'
5093850938
type: array
5093950939
type: object
50940+
ServiceList:
50941+
properties:
50942+
data:
50943+
$ref: '#/components/schemas/ServiceListData'
50944+
type: object
50945+
ServiceListData:
50946+
properties:
50947+
attributes:
50948+
$ref: '#/components/schemas/ServiceListDataAttributes'
50949+
id:
50950+
type: string
50951+
type:
50952+
$ref: '#/components/schemas/ServiceListDataType'
50953+
required:
50954+
- type
50955+
type: object
50956+
ServiceListDataAttributes:
50957+
properties:
50958+
metadata:
50959+
items:
50960+
$ref: '#/components/schemas/ServiceListDataAttributesMetadataItems'
50961+
type: array
50962+
services:
50963+
items:
50964+
type: string
50965+
type: array
50966+
type: object
50967+
ServiceListDataAttributesMetadataItems:
50968+
properties:
50969+
isTraced:
50970+
type: boolean
50971+
isUsm:
50972+
type: boolean
50973+
type: object
50974+
ServiceListDataType:
50975+
default: services_list
50976+
description: Services list resource type.
50977+
enum:
50978+
- services_list
50979+
example: services_list
50980+
type: string
50981+
x-enum-varnames:
50982+
- SERVICES_LIST
5094050983
ServiceNowBasicAuth:
5094150984
description: The definition of the `ServiceNowBasicAuth` object.
5094250985
properties:
@@ -61130,6 +61173,26 @@ paths:
6113061173
permissions:
6113161174
- apm_retention_filter_write
6113261175
- apm_pipelines_write
61176+
/api/v2/apm/services:
61177+
get:
61178+
operationId: GetServiceList
61179+
responses:
61180+
'200':
61181+
content:
61182+
application/json:
61183+
schema:
61184+
$ref: '#/components/schemas/ServiceList'
61185+
description: OK
61186+
'429':
61187+
$ref: '#/components/responses/TooManyRequestsResponse'
61188+
security:
61189+
- apiKeyAuth: []
61190+
appKeyAuth: []
61191+
- AuthZ:
61192+
- apm_read
61193+
summary: Get service list
61194+
tags:
61195+
- Apm
6113361196
/api/v2/app-builder/apps:
6113461197
delete:
6113561198
description: Delete multiple apps in a single request from a list of app IDs.
@@ -87764,6 +87827,8 @@ tags:
8776487827
offers also Sensitive Data Scanning capabilities on your storage.\nGo to https://www.datadoghq.com/blog/agentless-scanning/
8776587828
to learn more."
8776687829
name: Agentless Scanning
87830+
- description: Auto-generated tag Apm
87831+
name: Apm
8776787832
- description: Datadog App Builder provides a low-code solution to rapidly develop
8776887833
and integrate secure, customized applications into your monitoring stack that
8776987834
are built to accelerate remediation at scale. These API endpoints allow you to

features/v2/apm.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@endpoint(apm) @endpoint(apm-v2)
2+
Feature: Apm
3+
Auto-generated tag Apm
4+
5+
@generated @skip @team:DataDog/apm-aoe
6+
Scenario: Get service list returns "OK" response
7+
Given a valid "apiKeyAuth" key in the system
8+
And a valid "appKeyAuth" key in the system
9+
And an instance of "Apm" API
10+
And new "GetServiceList" request
11+
When the request is sent
12+
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+
Auto-generated tag Apm
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)