Skip to content

Commit 98aa80a

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

File tree

4 files changed

+49
-9
lines changed

4 files changed

+49
-9
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.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void main(String[] args) {
1111
ApmApi apiInstance = new ApmApi(defaultClient);
1212

1313
try {
14-
ServiceList result = apiInstance.getServiceList();
14+
ServiceList result = apiInstance.getServiceList("filter[env]");
1515
System.out.println(result);
1616
} catch (ApiException e) {
1717
System.err.println("Exception when calling ApmApi#getServiceList");

src/main/java/com/datadog/api/client/v2/api/ApmApi.java

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import jakarta.ws.rs.core.GenericType;
1010
import java.util.ArrayList;
1111
import java.util.HashMap;
12+
import java.util.List;
1213
import java.util.Map;
1314
import java.util.concurrent.CompletableFuture;
1415

@@ -48,29 +49,35 @@ public void setApiClient(ApiClient apiClient) {
4849
*
4950
* <p>See {@link #getServiceListWithHttpInfo}.
5051
*
52+
* @param filterEnv Filter services by environment. Can be set to <code>*</code> to return all
53+
* services across all environments. (required)
5154
* @return ServiceList
5255
* @throws ApiException if fails to make API call
5356
*/
54-
public ServiceList getServiceList() throws ApiException {
55-
return getServiceListWithHttpInfo().getData();
57+
public ServiceList getServiceList(String filterEnv) throws ApiException {
58+
return getServiceListWithHttpInfo(filterEnv).getData();
5659
}
5760

5861
/**
5962
* Get service list.
6063
*
6164
* <p>See {@link #getServiceListWithHttpInfoAsync}.
6265
*
66+
* @param filterEnv Filter services by environment. Can be set to <code>*</code> to return all
67+
* services across all environments. (required)
6368
* @return CompletableFuture&lt;ServiceList&gt;
6469
*/
65-
public CompletableFuture<ServiceList> getServiceListAsync() {
66-
return getServiceListWithHttpInfoAsync()
70+
public CompletableFuture<ServiceList> getServiceListAsync(String filterEnv) {
71+
return getServiceListWithHttpInfoAsync(filterEnv)
6772
.thenApply(
6873
response -> {
6974
return response.getData();
7075
});
7176
}
7277

7378
/**
79+
* @param filterEnv Filter services by environment. Can be set to <code>*</code> to return all
80+
* services across all environments. (required)
7481
* @return ApiResponse&lt;ServiceList&gt;
7582
* @throws ApiException if fails to make API call
7683
* @http.response.details
@@ -81,18 +88,27 @@ public CompletableFuture<ServiceList> getServiceListAsync() {
8188
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
8289
* </table>
8390
*/
84-
public ApiResponse<ServiceList> getServiceListWithHttpInfo() throws ApiException {
91+
public ApiResponse<ServiceList> getServiceListWithHttpInfo(String filterEnv) throws ApiException {
8592
Object localVarPostBody = null;
93+
94+
// verify the required parameter 'filterEnv' is set
95+
if (filterEnv == null) {
96+
throw new ApiException(
97+
400, "Missing the required parameter 'filterEnv' when calling getServiceList");
98+
}
8699
// create path and map variables
87100
String localVarPath = "/api/v2/apm/services";
88101

102+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
89103
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
90104

105+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[env]", filterEnv));
106+
91107
Invocation.Builder builder =
92108
apiClient.createBuilder(
93109
"v2.ApmApi.getServiceList",
94110
localVarPath,
95-
new ArrayList<Pair>(),
111+
localVarQueryParams,
96112
localVarHeaderParams,
97113
new HashMap<String, String>(),
98114
new String[] {"application/json"},
@@ -113,22 +129,37 @@ public ApiResponse<ServiceList> getServiceListWithHttpInfo() throws ApiException
113129
*
114130
* <p>See {@link #getServiceListWithHttpInfo}.
115131
*
132+
* @param filterEnv Filter services by environment. Can be set to <code>*</code> to return all
133+
* services across all environments. (required)
116134
* @return CompletableFuture&lt;ApiResponse&lt;ServiceList&gt;&gt;
117135
*/
118-
public CompletableFuture<ApiResponse<ServiceList>> getServiceListWithHttpInfoAsync() {
136+
public CompletableFuture<ApiResponse<ServiceList>> getServiceListWithHttpInfoAsync(
137+
String filterEnv) {
119138
Object localVarPostBody = null;
139+
140+
// verify the required parameter 'filterEnv' is set
141+
if (filterEnv == null) {
142+
CompletableFuture<ApiResponse<ServiceList>> result = new CompletableFuture<>();
143+
result.completeExceptionally(
144+
new ApiException(
145+
400, "Missing the required parameter 'filterEnv' when calling getServiceList"));
146+
return result;
147+
}
120148
// create path and map variables
121149
String localVarPath = "/api/v2/apm/services";
122150

151+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
123152
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
124153

154+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[env]", filterEnv));
155+
125156
Invocation.Builder builder;
126157
try {
127158
builder =
128159
apiClient.createBuilder(
129160
"v2.ApmApi.getServiceList",
130161
localVarPath,
131-
new ArrayList<Pair>(),
162+
localVarQueryParams,
132163
localVarHeaderParams,
133164
new HashMap<String, String>(),
134165
new String[] {"application/json"},

src/test/resources/com/datadog/api/client/v2/api/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

0 commit comments

Comments
 (0)