Skip to content

Commit 69341d5

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 0d20bc7 of spec repo (#4576)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent cfa3fc2 commit 69341d5

20 files changed

Lines changed: 1184 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24622,6 +24622,184 @@ components:
2462224622
- findings
2462324623
- project
2462424624
type: object
24625+
CreateSnapshotAdditionalConfig:
24626+
description: Additional configuration options for snapshot creation.
24627+
properties:
24628+
template_variables:
24629+
$ref: "#/components/schemas/CreateSnapshotTemplateVariables"
24630+
timeseries_legend_type:
24631+
$ref: "#/components/schemas/CreateSnapshotTimeseriesLegendType"
24632+
timezone_offset_minutes:
24633+
description: Timezone offset in minutes from UTC. Positive values are west of UTC (for example, `300` for UTC-5). Use `0` for UTC.
24634+
example: 300
24635+
format: int64
24636+
type: integer
24637+
type: object
24638+
CreateSnapshotDataAttributesRequest:
24639+
description: Attributes for snapshot creation.
24640+
properties:
24641+
additional_config:
24642+
$ref: "#/components/schemas/CreateSnapshotAdditionalConfig"
24643+
end:
24644+
description: End of the time window for the snapshot, in milliseconds since Unix epoch.
24645+
example: 1692464800000
24646+
format: int64
24647+
type: integer
24648+
height:
24649+
description: The height of the rendered snapshot in pixels.
24650+
example: 185
24651+
format: int64
24652+
type: integer
24653+
is_authenticated:
24654+
description: Whether the snapshot requires authentication to view. Authenticated snapshots are scoped to the creating organization.
24655+
example: false
24656+
type: boolean
24657+
start:
24658+
description: Start of the time window for the snapshot, in milliseconds since Unix epoch.
24659+
example: 1692464000000
24660+
format: int64
24661+
type: integer
24662+
ttl:
24663+
$ref: "#/components/schemas/CreateSnapshotTTL"
24664+
widget_definition:
24665+
additionalProperties: {}
24666+
description: The widget definition to render as a snapshot. Must include a valid `type` field and non-empty `requests` array.
24667+
example:
24668+
requests:
24669+
- q: "avg:system.cpu.user{*}"
24670+
type: timeseries
24671+
type: object
24672+
width:
24673+
description: The width of the rendered snapshot in pixels.
24674+
example: 300
24675+
format: int64
24676+
type: integer
24677+
required:
24678+
- widget_definition
24679+
- start
24680+
- end
24681+
type: object
24682+
CreateSnapshotDataAttributesResponse:
24683+
description: Attributes of the created snapshot.
24684+
properties:
24685+
url:
24686+
description: The URL to access the rendered snapshot image.
24687+
example: https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png
24688+
type: string
24689+
required:
24690+
- url
24691+
type: object
24692+
CreateSnapshotDataRequest:
24693+
description: Data envelope for snapshot creation.
24694+
properties:
24695+
attributes:
24696+
$ref: "#/components/schemas/CreateSnapshotDataAttributesRequest"
24697+
type:
24698+
$ref: "#/components/schemas/CreateSnapshotType"
24699+
required:
24700+
- type
24701+
- attributes
24702+
type: object
24703+
CreateSnapshotDataResponse:
24704+
description: Data envelope for the snapshot creation response.
24705+
properties:
24706+
attributes:
24707+
$ref: "#/components/schemas/CreateSnapshotDataAttributesResponse"
24708+
id:
24709+
description: The unique identifier of the created snapshot.
24710+
example: 12345678-1234-5678-9abc-def123456789
24711+
type: string
24712+
type:
24713+
$ref: "#/components/schemas/CreateSnapshotType"
24714+
required:
24715+
- id
24716+
- type
24717+
- attributes
24718+
type: object
24719+
CreateSnapshotRequest:
24720+
description: Request body for creating a graph snapshot.
24721+
properties:
24722+
data:
24723+
$ref: "#/components/schemas/CreateSnapshotDataRequest"
24724+
required:
24725+
- data
24726+
type: object
24727+
CreateSnapshotResponse:
24728+
description: Response body for a snapshot creation request.
24729+
properties:
24730+
data:
24731+
$ref: "#/components/schemas/CreateSnapshotDataResponse"
24732+
required:
24733+
- data
24734+
type: object
24735+
CreateSnapshotTTL:
24736+
description: The time-to-live for the snapshot. This value corresponds to storage lifecycle policies that automatically delete the snapshot after the specified period.
24737+
enum:
24738+
- 30d
24739+
- 60d
24740+
- 90d
24741+
- 1y
24742+
- 2y
24743+
- inf
24744+
example: 60d
24745+
type: string
24746+
x-enum-varnames:
24747+
- THIRTY_DAYS
24748+
- SIXTY_DAYS
24749+
- NINETY_DAYS
24750+
- ONE_YEAR
24751+
- TWO_YEARS
24752+
- INFINITE
24753+
CreateSnapshotTemplateVariable:
24754+
description: A template variable definition for snapshot rendering.
24755+
properties:
24756+
name:
24757+
description: The template variable name.
24758+
example: host
24759+
type: string
24760+
prefix:
24761+
description: The tag prefix associated with the template variable. For example, a prefix of `host` with a value of `web-server-1` scopes the snapshot to `host:web-server-1`.
24762+
example: host
24763+
type: string
24764+
values:
24765+
description: The list of scoped values for this template variable.
24766+
example:
24767+
- web-server-1
24768+
- web-server-2
24769+
items:
24770+
description: A single scoped value for the template variable.
24771+
type: string
24772+
type: array
24773+
required:
24774+
- name
24775+
- prefix
24776+
- values
24777+
type: object
24778+
CreateSnapshotTemplateVariables:
24779+
description: List of template variable definitions for snapshot rendering.
24780+
items:
24781+
$ref: "#/components/schemas/CreateSnapshotTemplateVariable"
24782+
type: array
24783+
CreateSnapshotTimeseriesLegendType:
24784+
description: The legend display type for timeseries widgets. A value of `none` hides the legend entirely; omitting the field lets the frontend choose automatically.
24785+
enum:
24786+
- compact
24787+
- expanded
24788+
- none
24789+
example: expanded
24790+
type: string
24791+
x-enum-varnames:
24792+
- COMPACT
24793+
- EXPANDED
24794+
- NONE
24795+
CreateSnapshotType:
24796+
description: The type identifier for snapshot creation resources.
24797+
enum:
24798+
- create_snapshot
24799+
example: create_snapshot
24800+
type: string
24801+
x-enum-varnames:
24802+
- CREATE_SNAPSHOT
2462524803
CreateStatusPageRequest:
2462624804
description: Request object for creating a status page.
2462724805
example:
@@ -182778,6 +182956,63 @@ paths:
182778182956
x-unstable: |-
182779182957
**Note**: This endpoint is in public beta and it's subject to change.
182780182958
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
182959+
/api/v2/snapshot:
182960+
post:
182961+
description: Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL can be polled until the image is ready.
182962+
operationId: CreateSnapshot
182963+
requestBody:
182964+
content:
182965+
application/json:
182966+
schema:
182967+
$ref: "#/components/schemas/CreateSnapshotRequest"
182968+
required: true
182969+
responses:
182970+
"200":
182971+
content:
182972+
application/json:
182973+
examples:
182974+
default:
182975+
value:
182976+
data:
182977+
attributes:
182978+
url: https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png
182979+
id: 12345678-1234-5678-9abc-def123456789
182980+
type: create_snapshot
182981+
schema:
182982+
$ref: "#/components/schemas/CreateSnapshotResponse"
182983+
description: OK
182984+
"400":
182985+
content:
182986+
application/json:
182987+
schema:
182988+
$ref: "#/components/schemas/JSONAPIErrorResponse"
182989+
description: Bad Request
182990+
"401":
182991+
content:
182992+
application/json:
182993+
schema:
182994+
$ref: "#/components/schemas/JSONAPIErrorResponse"
182995+
description: Unauthorized
182996+
"403":
182997+
content:
182998+
application/json:
182999+
schema:
183000+
$ref: "#/components/schemas/JSONAPIErrorResponse"
183001+
description: Forbidden
183002+
"404":
183003+
content:
183004+
application/json:
183005+
schema:
183006+
$ref: "#/components/schemas/JSONAPIErrorResponse"
183007+
description: Not Found
183008+
"429":
183009+
$ref: "#/components/responses/TooManyRequestsResponse"
183010+
summary: Create a graph snapshot
183011+
tags:
183012+
- Reporting And Sharing
183013+
x-unstable: |-
183014+
**Note**: This endpoint is in preview and is subject to change.
183015+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
182781183016
/api/v2/sourcemaps:
182782183017
delete:
182783183018
description: |-
@@ -197051,6 +197286,9 @@ tags:
197051197286
dashboard on a recurring cadence and delivers it to a set of recipients over email, Slack,
197052197287
or Microsoft Teams.
197053197288
name: Report Schedules
197289+
- description: |-
197290+
The Reporting and Sharing endpoints allow you to create snapshots of graph widgets and other shareable resources.
197291+
name: Reporting And Sharing
197054197292
- description: |-
197055197293
A restriction policy defines the access control rules for a resource, mapping a set of relations
197056197294
(such as editor and viewer) to a set of allowed principals (such as roles, teams, or users).
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Create a graph snapshot returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createSnapshot"] = true;
9+
const apiInstance = new v2.ReportingAndSharingApi(configuration);
10+
11+
const params: v2.ReportingAndSharingApiCreateSnapshotRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
additionalConfig: {
16+
templateVariables: [
17+
{
18+
name: "host",
19+
prefix: "host",
20+
values: ["web-server-1", "web-server-2"],
21+
},
22+
],
23+
timeseriesLegendType: "expanded",
24+
timezoneOffsetMinutes: 300,
25+
},
26+
end: 1692464800000,
27+
height: 185,
28+
isAuthenticated: false,
29+
start: 1692464000000,
30+
ttl: "60d",
31+
widgetDefinition: {
32+
requests: "[{'q': 'avg:system.cpu.user{*}'}]",
33+
type: "timeseries",
34+
},
35+
width: 300,
36+
},
37+
type: "create_snapshot",
38+
},
39+
},
40+
};
41+
42+
apiInstance
43+
.createSnapshot(params)
44+
.then((data: v2.CreateSnapshotResponse) => {
45+
console.log(
46+
"API called successfully. Returned data: " + JSON.stringify(data)
47+
);
48+
})
49+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15267,6 +15267,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
1526715267
},
1526815268
"operationResponseType": "SloStatusResponse",
1526915269
},
15270+
"v2.CreateSnapshot": {
15271+
"body": {
15272+
"type": "CreateSnapshotRequest",
15273+
"format": "",
15274+
},
15275+
"operationResponseType": "CreateSnapshotResponse",
15276+
},
1527015277
"v2.GetSPARecommendations": {
1527115278
"bypassCache": {
1527215279
"type": "string",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@endpoint(reporting-and-sharing) @endpoint(reporting-and-sharing-v2)
2+
Feature: Reporting And Sharing
3+
The Reporting and Sharing endpoints allow you to create snapshots of graph
4+
widgets and other shareable resources.
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 "ReportingAndSharing" API
10+
And operation "CreateSnapshot" enabled
11+
And new "CreateSnapshot" request
12+
And body with value {"data": {"attributes": {"additional_config": {"template_variables": [{"name": "host", "prefix": "host", "values": ["web-server-1", "web-server-2"]}], "timeseries_legend_type": "expanded", "timezone_offset_minutes": 300}, "end": 1692464800000, "height": 185, "is_authenticated": false, "start": 1692464000000, "ttl": "60d", "widget_definition": {"requests": [{"q": "avg:system.cpu.user{*}"}], "type": "timeseries"}, "width": 300}, "type": "create_snapshot"}}
13+
14+
@generated @skip @team:DataDog/reporting-and-sharing
15+
Scenario: Create a graph snapshot returns "Bad Request" response
16+
When the request is sent
17+
Then the response status is 400 Bad Request
18+
19+
@generated @skip @team:DataDog/reporting-and-sharing
20+
Scenario: Create a graph snapshot returns "Not Found" response
21+
When the request is sent
22+
Then the response status is 404 Not Found
23+
24+
@generated @skip @team:DataDog/reporting-and-sharing
25+
Scenario: Create a graph snapshot returns "OK" response
26+
When the request is sent
27+
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
@@ -8184,6 +8184,12 @@
81848184
"type": "safe"
81858185
}
81868186
},
8187+
"CreateSnapshot": {
8188+
"tag": "Reporting And Sharing",
8189+
"undo": {
8190+
"type": "unsafe"
8191+
}
8192+
},
81878193
"GetSPARecommendations": {
81888194
"tag": "Spa",
81898195
"undo": {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ export function createConfiguration(
703703
"v2.getSLOReport": false,
704704
"v2.getSLOReportJobStatus": false,
705705
"v2.getSloStatus": false,
706+
"v2.createSnapshot": false,
706707
"v2.getSPARecommendations": false,
707708
"v2.getSPARecommendationsWithShard": false,
708709
"v2.createAiCustomRule": false,

0 commit comments

Comments
 (0)