Skip to content

Commit e55730b

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

File tree

6 files changed

+47
-4
lines changed

6 files changed

+47
-4
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:

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

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,6 +3103,10 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
31033103
operationResponseType: "{}",
31043104
},
31053105
"APMApi.V2.GetServiceList": {
3106+
filterEnv: {
3107+
type: "string",
3108+
format: "",
3109+
},
31063110
operationResponseType: "ServiceList",
31073111
},
31083112
"AppBuilderApi.V2.ListApps": {

services/apm/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import { v2 } from "@datadog/datadog-api-client-apm";
2626

2727
const configuration = createConfiguration();
2828
const apiInstance = new APMApiV2(configuration);
29+
const params = {/* parameters */};
2930

30-
apiInstance.getServiceList().then((data) => {
31+
apiInstance.getServiceList(params).then((data) => {
3132
console.log("API called successfully. Returned data: " + JSON.stringify(data));
3233
}).catch((error) => {
3334
console.error("Error calling API: " + error);

services/apm/src/v2/APMApi.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ export class APMApiRequestFactory extends BaseAPIRequestFactory {
3636
}
3737
}
3838
public async getServiceList(
39+
filterEnv: string,
3940
_options?: Configuration,
4041
): Promise<RequestContext> {
4142
const _config = _options || this.configuration;
4243

44+
// verify required parameter 'filterEnv' is not null or undefined
45+
if (filterEnv === null || filterEnv === undefined) {
46+
throw new RequiredError("filterEnv", "getServiceList");
47+
}
48+
4349
// Path Params
4450
const localVarPath = "/api/v2/apm/services";
4551

@@ -61,6 +67,15 @@ export class APMApiRequestFactory extends BaseAPIRequestFactory {
6167
requestContext.setHeaderParam("User-Agent", this.userAgent);
6268
}
6369

70+
// Query Params
71+
if (filterEnv !== undefined) {
72+
requestContext.setQueryParam(
73+
"filter[env]",
74+
serialize(filterEnv, TypingInfo, "string", ""),
75+
"",
76+
);
77+
}
78+
6479
// Apply auth methods
6580
applySecurityAuthentication(_config, requestContext, [
6681
"apiKeyAuth",
@@ -128,6 +143,14 @@ export class APMApiResponseProcessor {
128143
}
129144
}
130145

146+
export interface APMApiGetServiceListRequest {
147+
/**
148+
* Filter services by environment. Can be set to `*` to return all services across all environments.
149+
* @type string
150+
*/
151+
filterEnv: string;
152+
}
153+
131154
export class APMApi {
132155
private requestFactory: APMApiRequestFactory;
133156
private responseProcessor: APMApiResponseProcessor;
@@ -149,8 +172,14 @@ export class APMApi {
149172
/**
150173
* @param param The request object
151174
*/
152-
public getServiceList(options?: Configuration): Promise<ServiceList> {
153-
const requestContextPromise = this.requestFactory.getServiceList(options);
175+
public getServiceList(
176+
param: APMApiGetServiceListRequest,
177+
options?: Configuration,
178+
): Promise<ServiceList> {
179+
const requestContextPromise = this.requestFactory.getServiceList(
180+
param.filterEnv,
181+
options,
182+
);
154183
return requestContextPromise.then((requestContext) => {
155184
return this.configuration.httpApi
156185
.send(requestContext)

services/apm/src/v2/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { APMApi } from "./APMApi";
1+
export { APMApiGetServiceListRequest, APMApi } from "./APMApi";
22

33
export { APIErrorResponse } from "./models/APIErrorResponse";
44
export { ServiceList } from "./models/ServiceList";

0 commit comments

Comments
 (0)