Skip to content

Commit f36103f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 5c00d1b of spec repo (#4157)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f2a233b commit f36103f

7 files changed

Lines changed: 193 additions & 6 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186904,6 +186904,19 @@ paths:
186904186904
description: |-
186905186905
Returns a list of all permissions, including name, description, and ID.
186906186906
operationId: ListPermissions
186907+
parameters:
186908+
- description: |-
186909+
Set to `true` to return all permissions, including both permissions
186910+
that can be assigned to user roles and permissions that can only be
186911+
used as scopes for OAuth clients and scoped credentials. When `false`
186912+
(default), only permissions that can be assigned to user roles are
186913+
returned.
186914+
example: false
186915+
in: query
186916+
name: include_scopes
186917+
required: false
186918+
schema:
186919+
type: boolean
186907186920
responses:
186908186921
"200":
186909186922
content:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// List permissions including scopes returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.RolesApi;
6+
import com.datadog.api.client.v2.api.RolesApi.ListPermissionsOptionalParameters;
7+
import com.datadog.api.client.v2.model.PermissionsResponse;
8+
9+
public class Example {
10+
public static void main(String[] args) {
11+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
12+
RolesApi apiInstance = new RolesApi(defaultClient);
13+
14+
try {
15+
PermissionsResponse result =
16+
apiInstance.listPermissions(new ListPermissionsOptionalParameters().includeScopes(true));
17+
System.out.println(result);
18+
} catch (ApiException e) {
19+
System.err.println("Exception when calling RolesApi#listPermissions");
20+
System.err.println("Status code: " + e.getCode());
21+
System.err.println("Reason: " + e.getResponseBody());
22+
System.err.println("Response headers: " + e.getResponseHeaders());
23+
e.printStackTrace();
24+
}
25+
}
26+
}

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

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,25 @@ public CompletableFuture<ApiResponse<RoleResponse>> getRoleWithHttpInfoAsync(Str
928928
new GenericType<RoleResponse>() {});
929929
}
930930

931+
/** Manage optional parameters to listPermissions. */
932+
public static class ListPermissionsOptionalParameters {
933+
private Boolean includeScopes;
934+
935+
/**
936+
* Set includeScopes.
937+
*
938+
* @param includeScopes Set to <code>true</code> to return all permissions, including both
939+
* permissions that can be assigned to user roles and permissions that can only be used as
940+
* scopes for OAuth clients and scoped credentials. When <code>false</code> (default), only
941+
* permissions that can be assigned to user roles are returned. (optional)
942+
* @return ListPermissionsOptionalParameters
943+
*/
944+
public ListPermissionsOptionalParameters includeScopes(Boolean includeScopes) {
945+
this.includeScopes = includeScopes;
946+
return this;
947+
}
948+
}
949+
931950
/**
932951
* List permissions.
933952
*
@@ -937,7 +956,7 @@ public CompletableFuture<ApiResponse<RoleResponse>> getRoleWithHttpInfoAsync(Str
937956
* @throws ApiException if fails to make API call
938957
*/
939958
public PermissionsResponse listPermissions() throws ApiException {
940-
return listPermissionsWithHttpInfo().getData();
959+
return listPermissionsWithHttpInfo(new ListPermissionsOptionalParameters()).getData();
941960
}
942961

943962
/**
@@ -948,7 +967,38 @@ public PermissionsResponse listPermissions() throws ApiException {
948967
* @return CompletableFuture&lt;PermissionsResponse&gt;
949968
*/
950969
public CompletableFuture<PermissionsResponse> listPermissionsAsync() {
951-
return listPermissionsWithHttpInfoAsync()
970+
return listPermissionsWithHttpInfoAsync(new ListPermissionsOptionalParameters())
971+
.thenApply(
972+
response -> {
973+
return response.getData();
974+
});
975+
}
976+
977+
/**
978+
* List permissions.
979+
*
980+
* <p>See {@link #listPermissionsWithHttpInfo}.
981+
*
982+
* @param parameters Optional parameters for the request.
983+
* @return PermissionsResponse
984+
* @throws ApiException if fails to make API call
985+
*/
986+
public PermissionsResponse listPermissions(ListPermissionsOptionalParameters parameters)
987+
throws ApiException {
988+
return listPermissionsWithHttpInfo(parameters).getData();
989+
}
990+
991+
/**
992+
* List permissions.
993+
*
994+
* <p>See {@link #listPermissionsWithHttpInfoAsync}.
995+
*
996+
* @param parameters Optional parameters for the request.
997+
* @return CompletableFuture&lt;PermissionsResponse&gt;
998+
*/
999+
public CompletableFuture<PermissionsResponse> listPermissionsAsync(
1000+
ListPermissionsOptionalParameters parameters) {
1001+
return listPermissionsWithHttpInfoAsync(parameters)
9521002
.thenApply(
9531003
response -> {
9541004
return response.getData();
@@ -958,6 +1008,7 @@ public CompletableFuture<PermissionsResponse> listPermissionsAsync() {
9581008
/**
9591009
* Returns a list of all permissions, including name, description, and ID.
9601010
*
1011+
* @param parameters Optional parameters for the request.
9611012
* @return ApiResponse&lt;PermissionsResponse&gt;
9621013
* @throws ApiException if fails to make API call
9631014
* @http.response.details
@@ -970,18 +1021,23 @@ public CompletableFuture<PermissionsResponse> listPermissionsAsync() {
9701021
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
9711022
* </table>
9721023
*/
973-
public ApiResponse<PermissionsResponse> listPermissionsWithHttpInfo() throws ApiException {
1024+
public ApiResponse<PermissionsResponse> listPermissionsWithHttpInfo(
1025+
ListPermissionsOptionalParameters parameters) throws ApiException {
9741026
Object localVarPostBody = null;
1027+
Boolean includeScopes = parameters.includeScopes;
9751028
// create path and map variables
9761029
String localVarPath = "/api/v2/permissions";
9771030

1031+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
9781032
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
9791033

1034+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_scopes", includeScopes));
1035+
9801036
Invocation.Builder builder =
9811037
apiClient.createBuilder(
9821038
"v2.RolesApi.listPermissions",
9831039
localVarPath,
984-
new ArrayList<Pair>(),
1040+
localVarQueryParams,
9851041
localVarHeaderParams,
9861042
new HashMap<String, String>(),
9871043
new String[] {"application/json"},
@@ -1002,22 +1058,28 @@ public ApiResponse<PermissionsResponse> listPermissionsWithHttpInfo() throws Api
10021058
*
10031059
* <p>See {@link #listPermissionsWithHttpInfo}.
10041060
*
1061+
* @param parameters Optional parameters for the request.
10051062
* @return CompletableFuture&lt;ApiResponse&lt;PermissionsResponse&gt;&gt;
10061063
*/
1007-
public CompletableFuture<ApiResponse<PermissionsResponse>> listPermissionsWithHttpInfoAsync() {
1064+
public CompletableFuture<ApiResponse<PermissionsResponse>> listPermissionsWithHttpInfoAsync(
1065+
ListPermissionsOptionalParameters parameters) {
10081066
Object localVarPostBody = null;
1067+
Boolean includeScopes = parameters.includeScopes;
10091068
// create path and map variables
10101069
String localVarPath = "/api/v2/permissions";
10111070

1071+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
10121072
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
10131073

1074+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_scopes", includeScopes));
1075+
10141076
Invocation.Builder builder;
10151077
try {
10161078
builder =
10171079
apiClient.createBuilder(
10181080
"v2.RolesApi.listPermissions",
10191081
localVarPath,
1020-
new ArrayList<Pair>(),
1082+
localVarQueryParams,
10211083
localVarHeaderParams,
10221084
new HashMap<String, String>(),
10231085
new String[] {"application/json"},

src/test/resources/com/datadog/api/client/v2/api/roles.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ Feature: Roles
203203
And the response "data[0].type" is equal to "{{ permission.type }}"
204204
And the response "data" has item with field "id" with value "{{ permission.id }}"
205205

206+
@team:DataDog/aaa-core-access @team:DataDog/access-policies-lifecycle
207+
Scenario: List permissions including scopes returns "OK" response
208+
Given new "ListPermissions" request
209+
And request contains "include_scopes" parameter with value true
210+
When the request is sent
211+
Then the response status is 200 OK
212+
And the response "data" has item with field "attributes.name" with value "admin"
213+
206214
@generated @skip @team:DataDog/aaa-core-access @team:DataDog/access-policies-lifecycle
207215
Scenario: List permissions returns "Bad Request" response
208216
Given new "ListPermissions" request

src/test/resources/generated-test/test-runner-data/manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8596,6 +8596,13 @@
85968596
"scenario": "List permissions for a role returns \"OK\" response",
85978597
"version": "v2"
85988598
},
8599+
{
8600+
"feature": "Roles",
8601+
"feature_file": "../../com/datadog/api/client/v2/api/roles.feature",
8602+
"file": "v2/roles/list-permissions-including-scopes-returns-ok-response.json",
8603+
"scenario": "List permissions including scopes returns \"OK\" response",
8604+
"version": "v2"
8605+
},
85998606
{
86008607
"feature": "Roles",
86018608
"feature_file": "../../com/datadog/api/client/v2/api/roles.feature",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"api": "Roles",
3+
"expected_status": 200,
4+
"feature": "Roles",
5+
"id": "v2/Roles/List permissions including scopes returns \"OK\" response",
6+
"operation_id": "ListPermissions",
7+
"request": {
8+
"body": null,
9+
"content_type": null,
10+
"method": "GET",
11+
"pagination": false,
12+
"parameters": [
13+
{
14+
"explode": null,
15+
"in": "query",
16+
"name": "include_scopes",
17+
"required": false,
18+
"schema": {
19+
"format": null,
20+
"ref": null,
21+
"type": "boolean"
22+
},
23+
"source": {
24+
"type": "literal",
25+
"value": true
26+
},
27+
"style": null
28+
}
29+
],
30+
"path": "/api/v2/permissions"
31+
},
32+
"scenario": "List permissions including scopes returns \"OK\" response",
33+
"schema_version": 1,
34+
"version": "v2"
35+
}

src/test/resources/generated-test/test-server-data/v2/roles.json

Lines changed: 36 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)