Skip to content

Commit e4b6791

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI documentation for cloud-auth-config service (#3343)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4862a94 commit e4b6791

File tree

13 files changed

+547
-0
lines changed

13 files changed

+547
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,65 @@ components:
18341834
required:
18351835
- role_name
18361836
type: object
1837+
AWSCloudAuthPersonaMappingAttributesResponse:
1838+
description: Attributes for AWS cloud authentication persona mapping response
1839+
properties:
1840+
account_identifier:
1841+
description: Datadog account identifier (email or handle) mapped to the
1842+
AWS principal
1843+
example: test@test.com
1844+
type: string
1845+
account_uuid:
1846+
description: Datadog account UUID
1847+
example: 12bbdc5c-5966-47e0-8733-285f9e44bcf4
1848+
type: string
1849+
arn_pattern:
1850+
description: AWS IAM ARN pattern to match for authentication
1851+
example: arn:aws:iam::123456789012:user/testuser
1852+
type: string
1853+
required:
1854+
- arn_pattern
1855+
- account_identifier
1856+
- account_uuid
1857+
type: object
1858+
AWSCloudAuthPersonaMappingDataResponse:
1859+
description: Data for AWS cloud authentication persona mapping response
1860+
properties:
1861+
attributes:
1862+
$ref: '#/components/schemas/AWSCloudAuthPersonaMappingAttributesResponse'
1863+
id:
1864+
description: Unique identifier for the persona mapping
1865+
example: c5c758c6-18c2-4484-ae3f-46b84128404a
1866+
type: string
1867+
type:
1868+
$ref: '#/components/schemas/AWSCloudAuthPersonaMappingType'
1869+
required:
1870+
- id
1871+
- type
1872+
- attributes
1873+
type: object
1874+
AWSCloudAuthPersonaMappingType:
1875+
description: Type identifier for AWS cloud authentication persona mapping
1876+
enum:
1877+
- aws_cloud_auth_config
1878+
example: aws_cloud_auth_config
1879+
type: string
1880+
x-enum-varnames:
1881+
- AWS_CLOUD_AUTH_CONFIG
1882+
AWSCloudAuthPersonaMappingsData:
1883+
description: List of AWS cloud authentication persona mappings
1884+
items:
1885+
$ref: '#/components/schemas/AWSCloudAuthPersonaMappingDataResponse'
1886+
type: array
1887+
AWSCloudAuthPersonaMappingsResponse:
1888+
description: Response containing a list of AWS cloud authentication persona
1889+
mappings
1890+
properties:
1891+
data:
1892+
$ref: '#/components/schemas/AWSCloudAuthPersonaMappingsData'
1893+
required:
1894+
- data
1895+
type: object
18371896
AWSCredentials:
18381897
description: The definition of `AWSCredentials` object.
18391898
oneOf:
@@ -74551,6 +74610,39 @@ paths:
7455174610
permissions:
7455274611
- ci_visibility_read
7455374612
- test_optimization_read
74613+
/api/v2/cloud_auth/aws/persona_mapping:
74614+
get:
74615+
description: List all AWS cloud authentication persona mappings. This endpoint
74616+
retrieves all configured persona mappings that associate AWS IAM principals
74617+
with Datadog users.
74618+
operationId: ListAWSCloudAuthPersonaMappings
74619+
responses:
74620+
'200':
74621+
content:
74622+
application/json:
74623+
schema:
74624+
$ref: '#/components/schemas/AWSCloudAuthPersonaMappingsResponse'
74625+
description: OK
74626+
'400':
74627+
content:
74628+
application/json:
74629+
schema:
74630+
$ref: '#/components/schemas/JSONAPIErrorResponse'
74631+
description: Bad Request
74632+
'403':
74633+
content:
74634+
application/json:
74635+
schema:
74636+
$ref: '#/components/schemas/JSONAPIErrorResponse'
74637+
description: Forbidden
74638+
'429':
74639+
$ref: '#/components/responses/TooManyRequestsResponse'
74640+
summary: List AWS cloud authentication persona mappings
74641+
tags:
74642+
- Cloud Authentication
74643+
x-unstable: '**Note**: This endpoint is in public beta and is subject to change.
74644+
74645+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
7455474646
/api/v2/cloud_security_management/custom_frameworks:
7455574647
post:
7455674648
description: Create a custom framework.
@@ -104331,6 +104423,9 @@ tags:
104331104423
Management page](https://docs.datadoghq.com/service_management/case_management/)
104332104424
for more information.
104333104425
name: Case Management Type
104426+
- description: Configure AWS cloud authentication mappings for persona and intake
104427+
authentication through the Datadog API.
104428+
name: Cloud Authentication
104334104429
- description: The Cloud Cost Management API allows you to set up, edit, and delete
104335104430
Cloud Cost Management accounts for AWS, Azure, and Google Cloud. You can query
104336104431
your cost data by using the [Metrics endpoint](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries-data-across-multiple-products)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* List AWS cloud authentication persona mappings returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.listAWSCloudAuthPersonaMappings"] = true;
9+
const apiInstance = new v2.CloudAuthenticationApi(configuration);
10+
11+
apiInstance
12+
.listAWSCloudAuthPersonaMappings()
13+
.then((data: v2.AWSCloudAuthPersonaMappingsResponse) => {
14+
console.log(
15+
"API called successfully. Returned data: " + JSON.stringify(data)
16+
);
17+
})
18+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3894,6 +3894,9 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
38943894
},
38953895
"operationResponseType": "CIAppTestEventsResponse",
38963896
},
3897+
"v2.ListAWSCloudAuthPersonaMappings": {
3898+
"operationResponseType": "AWSCloudAuthPersonaMappingsResponse",
3899+
},
38973900
"v2.CreateCustomFramework": {
38983901
"body": {
38993902
"type": "CreateCustomFrameworkRequest",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@endpoint(cloud-authentication) @endpoint(cloud-authentication-v2)
2+
Feature: Cloud Authentication
3+
Configure AWS cloud authentication mappings for persona and intake
4+
authentication through the Datadog API.
5+
6+
Background:
7+
Given a valid "apiKeyAuth" key in the system
8+
And a valid "appKeyAuth" key in the system
9+
And an instance of "CloudAuthentication" API
10+
And operation "ListAWSCloudAuthPersonaMappings" enabled
11+
And new "ListAWSCloudAuthPersonaMappings" request
12+
13+
@generated @skip @team:DataDog/team-aaaauthn
14+
Scenario: List AWS cloud authentication persona mappings returns "Bad Request" response
15+
When the request is sent
16+
Then the response status is 400 Bad Request
17+
18+
@generated @skip @team:DataDog/team-aaaauthn
19+
Scenario: List AWS cloud authentication persona mappings returns "OK" response
20+
When the request is sent
21+
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
@@ -1014,6 +1014,12 @@
10141014
"type": "safe"
10151015
}
10161016
},
1017+
"ListAWSCloudAuthPersonaMappings": {
1018+
"tag": "Cloud Authentication",
1019+
"undo": {
1020+
"type": "safe"
1021+
}
1022+
},
10171023
"CreateCustomFramework": {
10181024
"tag": "Security Monitoring",
10191025
"undo": {

packages/datadog-api-client-common/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export function createConfiguration(
248248
"v2.linkJiraIssueToCase": false,
249249
"v2.moveCaseToProject": false,
250250
"v2.unlinkJiraIssue": false,
251+
"v2.listAWSCloudAuthPersonaMappings": false,
251252
"v2.activateContentPack": false,
252253
"v2.cancelThreatHuntingJob": false,
253254
"v2.convertJobResultToSignal": false,
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi";
2+
import {
3+
Configuration,
4+
applySecurityAuthentication,
5+
} from "../../datadog-api-client-common/configuration";
6+
import {
7+
RequestContext,
8+
HttpMethod,
9+
ResponseContext,
10+
} from "../../datadog-api-client-common/http/http";
11+
12+
import { logger } from "../../../logger";
13+
import { ObjectSerializer } from "../models/ObjectSerializer";
14+
import { ApiException } from "../../datadog-api-client-common/exception";
15+
16+
import { APIErrorResponse } from "../models/APIErrorResponse";
17+
import { AWSCloudAuthPersonaMappingsResponse } from "../models/AWSCloudAuthPersonaMappingsResponse";
18+
import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse";
19+
20+
export class CloudAuthenticationApiRequestFactory extends BaseAPIRequestFactory {
21+
public async listAWSCloudAuthPersonaMappings(
22+
_options?: Configuration
23+
): Promise<RequestContext> {
24+
const _config = _options || this.configuration;
25+
26+
logger.warn("Using unstable operation 'listAWSCloudAuthPersonaMappings'");
27+
if (!_config.unstableOperations["v2.listAWSCloudAuthPersonaMappings"]) {
28+
throw new Error(
29+
"Unstable operation 'listAWSCloudAuthPersonaMappings' is disabled"
30+
);
31+
}
32+
33+
// Path Params
34+
const localVarPath = "/api/v2/cloud_auth/aws/persona_mapping";
35+
36+
// Make Request Context
37+
const requestContext = _config
38+
.getServer("v2.CloudAuthenticationApi.listAWSCloudAuthPersonaMappings")
39+
.makeRequestContext(localVarPath, HttpMethod.GET);
40+
requestContext.setHeaderParam("Accept", "application/json");
41+
requestContext.setHttpConfig(_config.httpConfig);
42+
43+
// Apply auth methods
44+
applySecurityAuthentication(_config, requestContext, [
45+
"apiKeyAuth",
46+
"appKeyAuth",
47+
]);
48+
49+
return requestContext;
50+
}
51+
}
52+
53+
export class CloudAuthenticationApiResponseProcessor {
54+
/**
55+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
56+
* to the expected objects
57+
*
58+
* @params response Response returned by the server for a request to listAWSCloudAuthPersonaMappings
59+
* @throws ApiException if the response code was not in [200, 299]
60+
*/
61+
public async listAWSCloudAuthPersonaMappings(
62+
response: ResponseContext
63+
): Promise<AWSCloudAuthPersonaMappingsResponse> {
64+
const contentType = ObjectSerializer.normalizeMediaType(
65+
response.headers["content-type"]
66+
);
67+
if (response.httpStatusCode === 200) {
68+
const body: AWSCloudAuthPersonaMappingsResponse =
69+
ObjectSerializer.deserialize(
70+
ObjectSerializer.parse(await response.body.text(), contentType),
71+
"AWSCloudAuthPersonaMappingsResponse"
72+
) as AWSCloudAuthPersonaMappingsResponse;
73+
return body;
74+
}
75+
if (response.httpStatusCode === 400 || response.httpStatusCode === 403) {
76+
const bodyText = ObjectSerializer.parse(
77+
await response.body.text(),
78+
contentType
79+
);
80+
let body: JSONAPIErrorResponse;
81+
try {
82+
body = ObjectSerializer.deserialize(
83+
bodyText,
84+
"JSONAPIErrorResponse"
85+
) as JSONAPIErrorResponse;
86+
} catch (error) {
87+
logger.debug(`Got error deserializing error: ${error}`);
88+
throw new ApiException<JSONAPIErrorResponse>(
89+
response.httpStatusCode,
90+
bodyText
91+
);
92+
}
93+
throw new ApiException<JSONAPIErrorResponse>(
94+
response.httpStatusCode,
95+
body
96+
);
97+
}
98+
if (response.httpStatusCode === 429) {
99+
const bodyText = ObjectSerializer.parse(
100+
await response.body.text(),
101+
contentType
102+
);
103+
let body: APIErrorResponse;
104+
try {
105+
body = ObjectSerializer.deserialize(
106+
bodyText,
107+
"APIErrorResponse"
108+
) as APIErrorResponse;
109+
} catch (error) {
110+
logger.debug(`Got error deserializing error: ${error}`);
111+
throw new ApiException<APIErrorResponse>(
112+
response.httpStatusCode,
113+
bodyText
114+
);
115+
}
116+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
117+
}
118+
119+
// Work around for missing responses in specification, e.g. for petstore.yaml
120+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
121+
const body: AWSCloudAuthPersonaMappingsResponse =
122+
ObjectSerializer.deserialize(
123+
ObjectSerializer.parse(await response.body.text(), contentType),
124+
"AWSCloudAuthPersonaMappingsResponse",
125+
""
126+
) as AWSCloudAuthPersonaMappingsResponse;
127+
return body;
128+
}
129+
130+
const body = (await response.body.text()) || "";
131+
throw new ApiException<string>(
132+
response.httpStatusCode,
133+
'Unknown API Status Code!\nBody: "' + body + '"'
134+
);
135+
}
136+
}
137+
138+
export class CloudAuthenticationApi {
139+
private requestFactory: CloudAuthenticationApiRequestFactory;
140+
private responseProcessor: CloudAuthenticationApiResponseProcessor;
141+
private configuration: Configuration;
142+
143+
public constructor(
144+
configuration: Configuration,
145+
requestFactory?: CloudAuthenticationApiRequestFactory,
146+
responseProcessor?: CloudAuthenticationApiResponseProcessor
147+
) {
148+
this.configuration = configuration;
149+
this.requestFactory =
150+
requestFactory || new CloudAuthenticationApiRequestFactory(configuration);
151+
this.responseProcessor =
152+
responseProcessor || new CloudAuthenticationApiResponseProcessor();
153+
}
154+
155+
/**
156+
* List all AWS cloud authentication persona mappings. This endpoint retrieves all configured persona mappings that associate AWS IAM principals with Datadog users.
157+
* @param param The request object
158+
*/
159+
public listAWSCloudAuthPersonaMappings(
160+
options?: Configuration
161+
): Promise<AWSCloudAuthPersonaMappingsResponse> {
162+
const requestContextPromise =
163+
this.requestFactory.listAWSCloudAuthPersonaMappings(options);
164+
return requestContextPromise.then((requestContext) => {
165+
return this.configuration.httpApi
166+
.send(requestContext)
167+
.then((responseContext) => {
168+
return this.responseProcessor.listAWSCloudAuthPersonaMappings(
169+
responseContext
170+
);
171+
});
172+
});
173+
}
174+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ export {
201201
CaseManagementTypeApi,
202202
} from "./apis/CaseManagementTypeApi";
203203

204+
export { CloudAuthenticationApi } from "./apis/CloudAuthenticationApi";
205+
204206
export {
205207
CloudCostManagementApiCreateCostAWSCURConfigRequest,
206208
CloudCostManagementApiCreateCostAzureUCConfigsRequest,
@@ -1402,6 +1404,10 @@ export { AWSAssumeRoleUpdate } from "./models/AWSAssumeRoleUpdate";
14021404
export { AWSAuthConfig } from "./models/AWSAuthConfig";
14031405
export { AWSAuthConfigKeys } from "./models/AWSAuthConfigKeys";
14041406
export { AWSAuthConfigRole } from "./models/AWSAuthConfigRole";
1407+
export { AWSCloudAuthPersonaMappingAttributesResponse } from "./models/AWSCloudAuthPersonaMappingAttributesResponse";
1408+
export { AWSCloudAuthPersonaMappingDataResponse } from "./models/AWSCloudAuthPersonaMappingDataResponse";
1409+
export { AWSCloudAuthPersonaMappingsResponse } from "./models/AWSCloudAuthPersonaMappingsResponse";
1410+
export { AWSCloudAuthPersonaMappingType } from "./models/AWSCloudAuthPersonaMappingType";
14051411
export { AWSCredentials } from "./models/AWSCredentials";
14061412
export { AWSCredentialsUpdate } from "./models/AWSCredentialsUpdate";
14071413
export { AwsCURConfig } from "./models/AwsCURConfig";

0 commit comments

Comments
 (0)