Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 238 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24622,6 +24622,184 @@ components:
- findings
- project
type: object
CreateSnapshotAdditionalConfig:
description: Additional configuration options for snapshot creation.
properties:
template_variables:
$ref: "#/components/schemas/CreateSnapshotTemplateVariables"
timeseries_legend_type:
$ref: "#/components/schemas/CreateSnapshotTimeseriesLegendType"
timezone_offset_minutes:
description: Timezone offset in minutes from UTC. Positive values are west of UTC (for example, `300` for UTC-5). Use `0` for UTC.
example: 300
format: int64
type: integer
type: object
CreateSnapshotDataAttributesRequest:
description: Attributes for snapshot creation.
properties:
additional_config:
$ref: "#/components/schemas/CreateSnapshotAdditionalConfig"
end:
description: End of the time window for the snapshot, in milliseconds since Unix epoch.
example: 1692464800000
format: int64
type: integer
height:
description: The height of the rendered snapshot in pixels.
example: 185
format: int64
type: integer
is_authenticated:
description: Whether the snapshot requires authentication to view. Authenticated snapshots are scoped to the creating organization.
example: false
type: boolean
start:
description: Start of the time window for the snapshot, in milliseconds since Unix epoch.
example: 1692464000000
format: int64
type: integer
ttl:
$ref: "#/components/schemas/CreateSnapshotTTL"
widget_definition:
additionalProperties: {}
description: The widget definition to render as a snapshot. Must include a valid `type` field and non-empty `requests` array.
example:
requests:
- q: "avg:system.cpu.user{*}"
type: timeseries
type: object
width:
description: The width of the rendered snapshot in pixels.
example: 300
format: int64
type: integer
required:
- widget_definition
- start
- end
type: object
CreateSnapshotDataAttributesResponse:
description: Attributes of the created snapshot.
properties:
url:
description: The URL to access the rendered snapshot image.
example: https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png
type: string
required:
- url
type: object
CreateSnapshotDataRequest:
description: Data envelope for snapshot creation.
properties:
attributes:
$ref: "#/components/schemas/CreateSnapshotDataAttributesRequest"
type:
$ref: "#/components/schemas/CreateSnapshotType"
required:
- type
- attributes
type: object
CreateSnapshotDataResponse:
description: Data envelope for the snapshot creation response.
properties:
attributes:
$ref: "#/components/schemas/CreateSnapshotDataAttributesResponse"
id:
description: The unique identifier of the created snapshot.
example: 12345678-1234-5678-9abc-def123456789
type: string
type:
$ref: "#/components/schemas/CreateSnapshotType"
required:
- id
- type
- attributes
type: object
CreateSnapshotRequest:
description: Request body for creating a graph snapshot.
properties:
data:
$ref: "#/components/schemas/CreateSnapshotDataRequest"
required:
- data
type: object
CreateSnapshotResponse:
description: Response body for a snapshot creation request.
properties:
data:
$ref: "#/components/schemas/CreateSnapshotDataResponse"
required:
- data
type: object
CreateSnapshotTTL:
description: The time-to-live for the snapshot. This value corresponds to storage lifecycle policies that automatically delete the snapshot after the specified period.
enum:
- 30d
- 60d
- 90d
- 1y
- 2y
- inf
example: 60d
type: string
x-enum-varnames:
- THIRTY_DAYS
- SIXTY_DAYS
- NINETY_DAYS
- ONE_YEAR
- TWO_YEARS
- INFINITE
CreateSnapshotTemplateVariable:
description: A template variable definition for snapshot rendering.
properties:
name:
description: The template variable name.
example: host
type: string
prefix:
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`.
example: host
type: string
values:
description: The list of scoped values for this template variable.
example:
- web-server-1
- web-server-2
items:
description: A single scoped value for the template variable.
type: string
type: array
required:
- name
- prefix
- values
type: object
CreateSnapshotTemplateVariables:
description: List of template variable definitions for snapshot rendering.
items:
$ref: "#/components/schemas/CreateSnapshotTemplateVariable"
type: array
CreateSnapshotTimeseriesLegendType:
description: The legend display type for timeseries widgets. A value of `none` hides the legend entirely; omitting the field lets the frontend choose automatically.
enum:
- compact
- expanded
- none
example: expanded
type: string
x-enum-varnames:
- COMPACT
- EXPANDED
- NONE
CreateSnapshotType:
description: The type identifier for snapshot creation resources.
enum:
- create_snapshot
example: create_snapshot
type: string
x-enum-varnames:
- CREATE_SNAPSHOT
CreateStatusPageRequest:
description: Request object for creating a status page.
example:
Expand Down Expand Up @@ -182778,6 +182956,63 @@ paths:
x-unstable: |-
**Note**: This endpoint is in public beta and it's subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/snapshot:
post:
description: Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL can be polled until the image is ready.
operationId: CreateSnapshot
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateSnapshotRequest"
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
url: https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png
id: 12345678-1234-5678-9abc-def123456789
type: create_snapshot
schema:
$ref: "#/components/schemas/CreateSnapshotResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Bad Request
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Unauthorized
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Not Found
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
summary: Create a graph snapshot
tags:
- Reporting And Sharing
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/sourcemaps:
delete:
description: |-
Expand Down Expand Up @@ -197051,6 +197286,9 @@ tags:
dashboard on a recurring cadence and delivers it to a set of recipients over email, Slack,
or Microsoft Teams.
name: Report Schedules
- description: |-
The Reporting and Sharing endpoints allow you to create snapshots of graph widgets and other shareable resources.
name: Reporting And Sharing
- description: |-
A restriction policy defines the access control rules for a resource, mapping a set of relations
(such as editor and viewer) to a set of allowed principals (such as roles, teams, or users).
Expand Down
39 changes: 39 additions & 0 deletions examples/v2/reporting-and-sharing/CreateSnapshot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Create a graph snapshot returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.create_snapshot".to_sym] = true
end
api_instance = DatadogAPIClient::V2::ReportingAndSharingAPI.new

body = DatadogAPIClient::V2::CreateSnapshotRequest.new({
data: DatadogAPIClient::V2::CreateSnapshotDataRequest.new({
attributes: DatadogAPIClient::V2::CreateSnapshotDataAttributesRequest.new({
additional_config: DatadogAPIClient::V2::CreateSnapshotAdditionalConfig.new({
template_variables: [
DatadogAPIClient::V2::CreateSnapshotTemplateVariable.new({
name: "host",
prefix: "host",
values: [
"web-server-1",
"web-server-2",
],
}),
],
timeseries_legend_type: DatadogAPIClient::V2::CreateSnapshotTimeseriesLegendType::EXPANDED,
timezone_offset_minutes: 300,
}),
_end: 1692464800000,
height: 185,
is_authenticated: false,
start: 1692464000000,
ttl: DatadogAPIClient::V2::CreateSnapshotTTL::SIXTY_DAYS,
widget_definition: {
"requests": "[{'q': 'avg:system.cpu.user{*}'}]", "type": "timeseries",
},
width: 300,
}),
type: DatadogAPIClient::V2::CreateSnapshotType::CREATE_SNAPSHOT,
}),
})
p api_instance.create_snapshot(body)
3 changes: 3 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5385,6 +5385,9 @@
"to_ts" => "Integer",
"disable_corrections" => "Boolean",
},
"v2.CreateSnapshot" => {
"body" => "CreateSnapshotRequest",
},
"v2.GetSPARecommendations" => {
"bypass_cache" => "String",
"service" => "String",
Expand Down
27 changes: 27 additions & 0 deletions features/v2/reporting_and_sharing.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@endpoint(reporting-and-sharing) @endpoint(reporting-and-sharing-v2)
Feature: Reporting And Sharing
The Reporting and Sharing endpoints allow you to create snapshots of graph
widgets and other shareable resources.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "ReportingAndSharing" API
And operation "CreateSnapshot" enabled
And new "CreateSnapshot" request
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"}}

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Create a graph snapshot returns "Bad Request" response
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Create a graph snapshot returns "Not Found" response
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Create a graph snapshot returns "OK" response
When the request is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8184,6 +8184,12 @@
"type": "safe"
}
},
"CreateSnapshot": {
"tag": "Reporting And Sharing",
"undo": {
"type": "unsafe"
}
},
"GetSPARecommendations": {
"tag": "Spa",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ def initialize
"v2.get_slo_report": false,
"v2.get_slo_report_job_status": false,
"v2.get_slo_status": false,
"v2.create_snapshot": false,
"v2.get_spa_recommendations": false,
"v2.get_spa_recommendations_with_shard": false,
"v2.create_ai_custom_rule": false,
Expand Down
12 changes: 12 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,17 @@ def overrides
"v2.create_service_now_ticket_request_data" => "CreateServiceNowTicketRequestData",
"v2.create_service_now_ticket_request_data_attributes" => "CreateServiceNowTicketRequestDataAttributes",
"v2.create_service_now_ticket_request_data_relationships" => "CreateServiceNowTicketRequestDataRelationships",
"v2.create_snapshot_additional_config" => "CreateSnapshotAdditionalConfig",
"v2.create_snapshot_data_attributes_request" => "CreateSnapshotDataAttributesRequest",
"v2.create_snapshot_data_attributes_response" => "CreateSnapshotDataAttributesResponse",
"v2.create_snapshot_data_request" => "CreateSnapshotDataRequest",
"v2.create_snapshot_data_response" => "CreateSnapshotDataResponse",
"v2.create_snapshot_request" => "CreateSnapshotRequest",
"v2.create_snapshot_response" => "CreateSnapshotResponse",
"v2.create_snapshot_template_variable" => "CreateSnapshotTemplateVariable",
"v2.create_snapshot_timeseries_legend_type" => "CreateSnapshotTimeseriesLegendType",
"v2.create_snapshot_ttl" => "CreateSnapshotTTL",
"v2.create_snapshot_type" => "CreateSnapshotType",
"v2.create_status_page_request" => "CreateStatusPageRequest",
"v2.create_status_page_request_data" => "CreateStatusPageRequestData",
"v2.create_status_page_request_data_attributes" => "CreateStatusPageRequestDataAttributes",
Expand Down Expand Up @@ -7998,6 +8009,7 @@ def overrides
"v2.product_analytics_api" => "ProductAnalyticsAPI",
"v2.reference_tables_api" => "ReferenceTablesAPI",
"v2.report_schedules_api" => "ReportSchedulesAPI",
"v2.reporting_and_sharing_api" => "ReportingAndSharingAPI",
"v2.restriction_policies_api" => "RestrictionPoliciesAPI",
"v2.roles_api" => "RolesAPI",
"v2.rum_api" => "RUMAPI",
Expand Down
Loading
Loading