Skip to content

Commit 10fec30

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add mandatory filter env parameter to APM services endpoint (#3477)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent d6d7c2d commit 10fec30

File tree

6 files changed

+54
-5
lines changed

6 files changed

+54
-5
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71059,6 +71059,14 @@ paths:
7105971059
/api/v2/apm/services:
7106071060
get:
7106171061
operationId: GetServiceList
71062+
parameters:
71063+
- description: Filter services by environment. Can be set to `*` to return all
71064+
services across all environments.
71065+
in: query
71066+
name: filter[env]
71067+
required: true
71068+
schema:
71069+
type: string
7106271070
responses:
7106371071
'200':
7106471072
content:

examples/v2/apm/GetServiceList.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ import { client, v2 } from "@datadog/datadog-api-client";
77
const configuration = client.createConfiguration();
88
const apiInstance = new v2.APMApi(configuration);
99

10+
const params: v2.APMApiGetServiceListRequest = {
11+
filterEnv: "filter[env]",
12+
};
13+
1014
apiInstance
11-
.getServiceList()
15+
.getServiceList(params)
1216
.then((data: v2.ServiceList) => {
1317
console.log(
1418
"API called successfully. Returned data: " + JSON.stringify(data)

features/support/scenarios_model_mapping.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,6 +3093,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
30933093
"operationResponseType": "{}",
30943094
},
30953095
"v2.GetServiceList": {
3096+
"filterEnv": {
3097+
"type": "string",
3098+
"format": "",
3099+
},
30963100
"operationResponseType": "ServiceList",
30973101
},
30983102
"v2.ListApps": {

features/v2/apm.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ Feature: APM
99
And a valid "appKeyAuth" key in the system
1010
And an instance of "APM" API
1111
And new "GetServiceList" request
12+
And request contains "filter[env]" parameter from "REPLACE.ME"
1213
When the request is sent
1314
Then the response status is 200 OK

packages/datadog-api-client-v2/apis/APMApi.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi";
1+
import {
2+
BaseAPIRequestFactory,
3+
RequiredError,
4+
} from "../../datadog-api-client-common/baseapi";
25
import {
36
Configuration,
47
applySecurityAuthentication,
@@ -18,10 +21,16 @@ import { ServiceList } from "../models/ServiceList";
1821

1922
export class APMApiRequestFactory extends BaseAPIRequestFactory {
2023
public async getServiceList(
24+
filterEnv: string,
2125
_options?: Configuration
2226
): Promise<RequestContext> {
2327
const _config = _options || this.configuration;
2428

29+
// verify required parameter 'filterEnv' is not null or undefined
30+
if (filterEnv === null || filterEnv === undefined) {
31+
throw new RequiredError("filterEnv", "getServiceList");
32+
}
33+
2534
// Path Params
2635
const localVarPath = "/api/v2/apm/services";
2736

@@ -32,6 +41,15 @@ export class APMApiRequestFactory extends BaseAPIRequestFactory {
3241
requestContext.setHeaderParam("Accept", "application/json");
3342
requestContext.setHttpConfig(_config.httpConfig);
3443

44+
// Query Params
45+
if (filterEnv !== undefined) {
46+
requestContext.setQueryParam(
47+
"filter[env]",
48+
ObjectSerializer.serialize(filterEnv, "string", ""),
49+
""
50+
);
51+
}
52+
3553
// Apply auth methods
3654
applySecurityAuthentication(_config, requestContext, [
3755
"apiKeyAuth",
@@ -101,6 +119,14 @@ export class APMApiResponseProcessor {
101119
}
102120
}
103121

122+
export interface APMApiGetServiceListRequest {
123+
/**
124+
* Filter services by environment. Can be set to `*` to return all services across all environments.
125+
* @type string
126+
*/
127+
filterEnv: string;
128+
}
129+
104130
export class APMApi {
105131
private requestFactory: APMApiRequestFactory;
106132
private responseProcessor: APMApiResponseProcessor;
@@ -120,8 +146,14 @@ export class APMApi {
120146
/**
121147
* @param param The request object
122148
*/
123-
public getServiceList(options?: Configuration): Promise<ServiceList> {
124-
const requestContextPromise = this.requestFactory.getServiceList(options);
149+
public getServiceList(
150+
param: APMApiGetServiceListRequest,
151+
options?: Configuration
152+
): Promise<ServiceList> {
153+
const requestContextPromise = this.requestFactory.getServiceList(
154+
param.filterEnv,
155+
options
156+
);
125157
return requestContextPromise.then((requestContext) => {
126158
return this.configuration.httpApi
127159
.send(requestContext)

packages/datadog-api-client-v2/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export {
77
APIManagementApi,
88
} from "./apis/APIManagementApi";
99

10-
export { APMApi } from "./apis/APMApi";
10+
export { APMApiGetServiceListRequest, APMApi } from "./apis/APMApi";
1111

1212
export {
1313
APMRetentionFiltersApiCreateApmRetentionFilterRequest,

0 commit comments

Comments
 (0)