Skip to content

Commit e8f6ea0

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI spec for Dashboard Secure Embed endpoints (#3905)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3cecf13 commit e8f6ea0

40 files changed

+3478
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 697 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* Create a secure embed for a dashboard returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createDashboardSecureEmbed"] = true;
9+
const apiInstance = new v2.DashboardSecureEmbedApi(configuration);
10+
11+
const params: v2.DashboardSecureEmbedApiCreateDashboardSecureEmbedRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
globalTime: {
16+
liveSpan: "1h",
17+
},
18+
globalTimeSelectable: true,
19+
selectableTemplateVars: [
20+
{
21+
defaultValues: ["1"],
22+
name: "org_id",
23+
prefix: "org_id",
24+
visibleTags: ["1"],
25+
},
26+
],
27+
status: "active",
28+
title: "Q1 Metrics Dashboard",
29+
viewingPreferences: {
30+
highDensity: false,
31+
theme: "system",
32+
},
33+
},
34+
type: "secure_embed_request",
35+
},
36+
},
37+
dashboardId: "dashboard_id",
38+
};
39+
40+
apiInstance
41+
.createDashboardSecureEmbed(params)
42+
.then((data: v2.SecureEmbedCreateResponse) => {
43+
console.log(
44+
"API called successfully. Returned data: " + JSON.stringify(data)
45+
);
46+
})
47+
.catch((error: any) => console.error(error));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Delete a secure embed for a dashboard returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteDashboardSecureEmbed"] = true;
9+
const apiInstance = new v2.DashboardSecureEmbedApi(configuration);
10+
11+
const params: v2.DashboardSecureEmbedApiDeleteDashboardSecureEmbedRequest = {
12+
dashboardId: "dashboard_id",
13+
token: "token",
14+
};
15+
16+
apiInstance
17+
.deleteDashboardSecureEmbed(params)
18+
.then((data: any) => {
19+
console.log(
20+
"API called successfully. Returned data: " + JSON.stringify(data)
21+
);
22+
})
23+
.catch((error: any) => console.error(error));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Get a secure embed for a dashboard returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.getDashboardSecureEmbed"] = true;
9+
const apiInstance = new v2.DashboardSecureEmbedApi(configuration);
10+
11+
const params: v2.DashboardSecureEmbedApiGetDashboardSecureEmbedRequest = {
12+
dashboardId: "dashboard_id",
13+
token: "token",
14+
};
15+
16+
apiInstance
17+
.getDashboardSecureEmbed(params)
18+
.then((data: v2.SecureEmbedGetResponse) => {
19+
console.log(
20+
"API called successfully. Returned data: " + JSON.stringify(data)
21+
);
22+
})
23+
.catch((error: any) => console.error(error));
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Update a secure embed for a dashboard returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.updateDashboardSecureEmbed"] = true;
9+
const apiInstance = new v2.DashboardSecureEmbedApi(configuration);
10+
11+
const params: v2.DashboardSecureEmbedApiUpdateDashboardSecureEmbedRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
globalTime: {
16+
liveSpan: "1h",
17+
},
18+
globalTimeSelectable: true,
19+
selectableTemplateVars: [
20+
{
21+
defaultValues: ["1"],
22+
name: "org_id",
23+
prefix: "org_id",
24+
visibleTags: ["1"],
25+
},
26+
],
27+
status: "active",
28+
title: "Q1 Metrics Dashboard (Updated)",
29+
viewingPreferences: {
30+
highDensity: false,
31+
theme: "system",
32+
},
33+
},
34+
type: "secure_embed_update_request",
35+
},
36+
},
37+
dashboardId: "dashboard_id",
38+
token: "token",
39+
};
40+
41+
apiInstance
42+
.updateDashboardSecureEmbed(params)
43+
.then((data: v2.SecureEmbedUpdateResponse) => {
44+
console.log(
45+
"API called successfully. Returned data: " + JSON.stringify(data)
46+
);
47+
})
48+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5811,6 +5811,54 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
58115811
},
58125812
"operationResponseType": "DashboardListDeleteItemsResponse",
58135813
},
5814+
"v2.CreateDashboardSecureEmbed": {
5815+
"dashboardId": {
5816+
"type": "string",
5817+
"format": "",
5818+
},
5819+
"body": {
5820+
"type": "SecureEmbedCreateRequest",
5821+
"format": "",
5822+
},
5823+
"operationResponseType": "SecureEmbedCreateResponse",
5824+
},
5825+
"v2.GetDashboardSecureEmbed": {
5826+
"dashboardId": {
5827+
"type": "string",
5828+
"format": "",
5829+
},
5830+
"token": {
5831+
"type": "string",
5832+
"format": "",
5833+
},
5834+
"operationResponseType": "SecureEmbedGetResponse",
5835+
},
5836+
"v2.DeleteDashboardSecureEmbed": {
5837+
"dashboardId": {
5838+
"type": "string",
5839+
"format": "",
5840+
},
5841+
"token": {
5842+
"type": "string",
5843+
"format": "",
5844+
},
5845+
"operationResponseType": "{}",
5846+
},
5847+
"v2.UpdateDashboardSecureEmbed": {
5848+
"dashboardId": {
5849+
"type": "string",
5850+
"format": "",
5851+
},
5852+
"token": {
5853+
"type": "string",
5854+
"format": "",
5855+
},
5856+
"body": {
5857+
"type": "SecureEmbedUpdateRequest",
5858+
"format": "",
5859+
},
5860+
"operationResponseType": "SecureEmbedUpdateResponse",
5861+
},
58145862
"v2.GetAllDatasets": {
58155863
"operationResponseType": "DatasetResponseMulti",
58165864
},
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
@endpoint(dashboard-secure-embed) @endpoint(dashboard-secure-embed-v2) @endpoint(https://api.datadoghq.com) @endpoint(https://api.datadoghq.eu) @endpoint(https://api.ddog-gov.com) @endpoint(https://api.us5.datadoghq.com)
2+
Feature: Dashboard Secure Embed
3+
Manage securely embedded Datadog dashboards. Secure embeds use HMAC-SHA256
4+
signed sessions for authentication, enabling customers to embed dashboards
5+
in their own applications with server-side auth control. Unlike public
6+
dashboards (open URL) or invite dashboards (email-based access), secure
7+
embeds provide programmatic access control. **Requirements:** - Org
8+
setting: SharedDashboards > Embed sharing must be enabled. - AuthN:
9+
Datadog API key and application key. - Read operations require
10+
`dashboards_read` permission. - Write operations require
11+
`dashboards_embed_share` permission.
12+
13+
Background:
14+
Given a valid "apiKeyAuth" key in the system
15+
And a valid "appKeyAuth" key in the system
16+
And an instance of "DashboardSecureEmbed" API
17+
18+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
19+
Scenario: Create a secure embed for a dashboard returns "Conflict — max 1000 share URLs per dashboard exceeded" response
20+
Given operation "CreateDashboardSecureEmbed" enabled
21+
And new "CreateDashboardSecureEmbed" request
22+
And request contains "dashboard_id" parameter from "REPLACE.ME"
23+
And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_request"}}
24+
When the request is sent
25+
Then the response status is 409 Conflict — max 1000 share URLs per dashboard exceeded
26+
27+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
28+
Scenario: Create a secure embed for a dashboard returns "Dashboard Not Found" response
29+
Given operation "CreateDashboardSecureEmbed" enabled
30+
And new "CreateDashboardSecureEmbed" request
31+
And request contains "dashboard_id" parameter from "REPLACE.ME"
32+
And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_request"}}
33+
When the request is sent
34+
Then the response status is 404 Dashboard Not Found
35+
36+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
37+
Scenario: Create a secure embed for a dashboard returns "OK" response
38+
Given operation "CreateDashboardSecureEmbed" enabled
39+
And new "CreateDashboardSecureEmbed" request
40+
And request contains "dashboard_id" parameter from "REPLACE.ME"
41+
And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_request"}}
42+
When the request is sent
43+
Then the response status is 200 OK
44+
45+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
46+
Scenario: Delete a secure embed for a dashboard returns "No Content" response
47+
Given operation "DeleteDashboardSecureEmbed" enabled
48+
And new "DeleteDashboardSecureEmbed" request
49+
And request contains "dashboard_id" parameter from "REPLACE.ME"
50+
And request contains "token" parameter from "REPLACE.ME"
51+
When the request is sent
52+
Then the response status is 204 No Content
53+
54+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
55+
Scenario: Delete a secure embed for a dashboard returns "Not Found" response
56+
Given operation "DeleteDashboardSecureEmbed" enabled
57+
And new "DeleteDashboardSecureEmbed" request
58+
And request contains "dashboard_id" parameter from "REPLACE.ME"
59+
And request contains "token" parameter from "REPLACE.ME"
60+
When the request is sent
61+
Then the response status is 404 Not Found
62+
63+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
64+
Scenario: Get a secure embed for a dashboard returns "Not Found" response
65+
Given operation "GetDashboardSecureEmbed" enabled
66+
And new "GetDashboardSecureEmbed" request
67+
And request contains "dashboard_id" parameter from "REPLACE.ME"
68+
And request contains "token" parameter from "REPLACE.ME"
69+
When the request is sent
70+
Then the response status is 404 Not Found
71+
72+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
73+
Scenario: Get a secure embed for a dashboard returns "OK" response
74+
Given operation "GetDashboardSecureEmbed" enabled
75+
And new "GetDashboardSecureEmbed" request
76+
And request contains "dashboard_id" parameter from "REPLACE.ME"
77+
And request contains "token" parameter from "REPLACE.ME"
78+
When the request is sent
79+
Then the response status is 200 OK
80+
81+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
82+
Scenario: Update a secure embed for a dashboard returns "Not Found" response
83+
Given operation "UpdateDashboardSecureEmbed" enabled
84+
And new "UpdateDashboardSecureEmbed" request
85+
And request contains "dashboard_id" parameter from "REPLACE.ME"
86+
And request contains "token" parameter from "REPLACE.ME"
87+
And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard (Updated)", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_update_request"}}
88+
When the request is sent
89+
Then the response status is 404 Not Found
90+
91+
@generated @skip @team:DataDog/dashboardsnotebooks-backend
92+
Scenario: Update a secure embed for a dashboard returns "OK" response
93+
Given operation "UpdateDashboardSecureEmbed" enabled
94+
And new "UpdateDashboardSecureEmbed" request
95+
And request contains "dashboard_id" parameter from "REPLACE.ME"
96+
And request contains "token" parameter from "REPLACE.ME"
97+
And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard (Updated)", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_update_request"}}
98+
When the request is sent
99+
Then the response status is 200 OK

features/v2/undo.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,41 @@
15001500
"type": "safe"
15011501
}
15021502
},
1503+
"CreateDashboardSecureEmbed": {
1504+
"tag": "Dashboard Secure Embed",
1505+
"undo": {
1506+
"operationId": "DeleteDashboardSecureEmbed",
1507+
"parameters": [
1508+
{
1509+
"name": "dashboard_id",
1510+
"source": "data.attributes.dashboard_id"
1511+
},
1512+
{
1513+
"name": "token",
1514+
"source": "data.attributes.token"
1515+
}
1516+
],
1517+
"type": "unsafe"
1518+
}
1519+
},
1520+
"DeleteDashboardSecureEmbed": {
1521+
"tag": "Dashboard Secure Embed",
1522+
"undo": {
1523+
"type": "idempotent"
1524+
}
1525+
},
1526+
"GetDashboardSecureEmbed": {
1527+
"tag": "Dashboard Secure Embed",
1528+
"undo": {
1529+
"type": "safe"
1530+
}
1531+
},
1532+
"UpdateDashboardSecureEmbed": {
1533+
"tag": "Dashboard Secure Embed",
1534+
"undo": {
1535+
"type": "idempotent"
1536+
}
1537+
},
15031538
"GetAllDatasets": {
15041539
"tag": "Datasets",
15051540
"undo": {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ export function createConfiguration(
292292
"v2.searchSecurityMonitoringHistsignals": false,
293293
"v2.getCodeCoverageBranchSummary": false,
294294
"v2.getCodeCoverageCommitSummary": false,
295+
"v2.createDashboardSecureEmbed": false,
296+
"v2.deleteDashboardSecureEmbed": false,
297+
"v2.getDashboardSecureEmbed": false,
298+
"v2.updateDashboardSecureEmbed": false,
295299
"v2.createDataset": false,
296300
"v2.deleteDataset": false,
297301
"v2.getAllDatasets": false,

0 commit comments

Comments
 (0)