Skip to content
Open
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
63 changes: 63 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10354,6 +10354,16 @@ components:
type: string
status:
$ref: '#/components/schemas/NotebookStatus'
template_variables:
description: List of template variables for this notebook.
example:
- available_values: []
default: '*'
name: host
prefix: host
items:
$ref: '#/components/schemas/NotebookTemplateVariable'
type: array
time:
$ref: '#/components/schemas/NotebookGlobalTime'
required:
Expand Down Expand Up @@ -10657,6 +10667,39 @@ components:
type: string
x-enum-varnames:
- PUBLISHED
NotebookTemplateVariable:
description: Template variable for a notebook.
properties:
available_values:
description: The list of values that the template variable drop-down is
limited to.
example:
- my-host
- host1
- host2
items:
description: Template variable value.
type: string
nullable: true
type: array
default:
description: The default value for the template variable.
example: '*'
nullable: true
type: string
name:
description: The name of the variable.
example: host
type: string
prefix:
description: The tag prefix associated with the variable. Only tags with
this prefix appear in the variable drop-down.
example: host
nullable: true
type: string
required:
- name
type: object
NotebookTimeseriesCellAttributes:
description: The attributes of a notebook `timeseries` cell.
properties:
Expand Down Expand Up @@ -10760,6 +10803,16 @@ components:
type: string
status:
$ref: '#/components/schemas/NotebookStatus'
template_variables:
description: List of template variables for this notebook.
example:
- available_values: []
default: '*'
name: host
prefix: host
items:
$ref: '#/components/schemas/NotebookTemplateVariable'
type: array
time:
$ref: '#/components/schemas/NotebookGlobalTime'
required:
Expand Down Expand Up @@ -10836,6 +10889,16 @@ components:
type: string
status:
$ref: '#/components/schemas/NotebookStatus'
template_variables:
description: List of template variables for this notebook.
example:
- available_values: []
default: '*'
name: host
prefix: host
items:
$ref: '#/components/schemas/NotebookTemplateVariable'
type: array
time:
$ref: '#/components/schemas/NotebookGlobalTime'
required:
Expand Down
8 changes: 4 additions & 4 deletions features/v1/notebooks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Notebooks
@generated @skip @team:DataDog/notebooks
Scenario: Create a notebook returns "Bad Request" response
Given new "CreateNotebook" request
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}}
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}}
When the request is sent
Then the response status is 400 Bad Request

Expand Down Expand Up @@ -98,23 +98,23 @@ Feature: Notebooks
Scenario: Update a notebook returns "Bad Request" response
Given new "UpdateNotebook" request
And request contains "notebook_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}}
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/notebooks
Scenario: Update a notebook returns "Conflict" response
Given new "UpdateNotebook" request
And request contains "notebook_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}}
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:DataDog/notebooks
Scenario: Update a notebook returns "Not Found" response
Given new "UpdateNotebook" request
And request contains "notebook_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}}
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}}
When the request is sent
Then the response status is 404 Not Found

Expand Down
1 change: 1 addition & 0 deletions services/notebooks/src/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export { NotebooksResponseDataAttributes } from "./models/NotebooksResponseDataA
export { NotebooksResponseMeta } from "./models/NotebooksResponseMeta";
export { NotebooksResponsePage } from "./models/NotebooksResponsePage";
export { NotebookStatus } from "./models/NotebookStatus";
export { NotebookTemplateVariable } from "./models/NotebookTemplateVariable";
export { NotebookTimeseriesCellAttributes } from "./models/NotebookTimeseriesCellAttributes";
export { NotebookToplistCellAttributes } from "./models/NotebookToplistCellAttributes";
export { NotebookUpdateCell } from "./models/NotebookUpdateCell";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NotebookCellCreateRequest } from "./NotebookCellCreateRequest";
import { NotebookGlobalTime } from "./NotebookGlobalTime";
import { NotebookMetadata } from "./NotebookMetadata";
import { NotebookStatus } from "./NotebookStatus";
import { NotebookTemplateVariable } from "./NotebookTemplateVariable";

/**
* The data attributes of a notebook.
Expand All @@ -25,6 +26,10 @@ export class NotebookCreateDataAttributes {
* Publication status of the notebook. For now, always "published".
*/
"status"?: NotebookStatus;
/**
* List of template variables for this notebook.
*/
"templateVariables"?: Array<NotebookTemplateVariable>;
/**
* Notebook global timeframe.
*/
Expand Down Expand Up @@ -62,6 +67,10 @@ export class NotebookCreateDataAttributes {
baseName: "status",
type: "NotebookStatus",
},
templateVariables: {
baseName: "template_variables",
type: "Array<NotebookTemplateVariable>",
},
time: {
baseName: "time",
type: "NotebookGlobalTime",
Expand Down
69 changes: 69 additions & 0 deletions services/notebooks/src/v1/models/NotebookTemplateVariable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { AttributeTypeMap } from "@datadog/datadog-api-client";

/**
* Template variable for a notebook.
*/
export class NotebookTemplateVariable {
/**
* The list of values that the template variable drop-down is limited to.
*/
"availableValues"?: Array<string>;
/**
* The default value for the template variable.
*/
"_default"?: string;
/**
* The name of the variable.
*/
"name": string;
/**
* The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
*/
"prefix"?: string;
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
"additionalProperties"?: { [key: string]: any };
/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
availableValues: {
baseName: "available_values",
type: "Array<string>",
},
_default: {
baseName: "default",
type: "string",
},
name: {
baseName: "name",
type: "string",
required: true,
},
prefix: {
baseName: "prefix",
type: "string",
},
additionalProperties: {
baseName: "additionalProperties",
type: "{ [key: string]: any; }",
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return NotebookTemplateVariable.attributeTypeMap;
}

public constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client";
import { NotebookGlobalTime } from "./NotebookGlobalTime";
import { NotebookMetadata } from "./NotebookMetadata";
import { NotebookStatus } from "./NotebookStatus";
import { NotebookTemplateVariable } from "./NotebookTemplateVariable";
import { NotebookUpdateCell } from "./NotebookUpdateCell";

/**
Expand All @@ -25,6 +26,10 @@ export class NotebookUpdateDataAttributes {
* Publication status of the notebook. For now, always "published".
*/
"status"?: NotebookStatus;
/**
* List of template variables for this notebook.
*/
"templateVariables"?: Array<NotebookTemplateVariable>;
/**
* Notebook global timeframe.
*/
Expand Down Expand Up @@ -62,6 +67,10 @@ export class NotebookUpdateDataAttributes {
baseName: "status",
type: "NotebookStatus",
},
templateVariables: {
baseName: "template_variables",
type: "Array<NotebookTemplateVariable>",
},
time: {
baseName: "time",
type: "NotebookGlobalTime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NotebookCellResponse } from "./NotebookCellResponse";
import { NotebookGlobalTime } from "./NotebookGlobalTime";
import { NotebookMetadata } from "./NotebookMetadata";
import { NotebookStatus } from "./NotebookStatus";
import { NotebookTemplateVariable } from "./NotebookTemplateVariable";

/**
* The attributes of a notebook in get all response.
Expand Down Expand Up @@ -38,6 +39,10 @@ export class NotebooksResponseDataAttributes {
* Publication status of the notebook. For now, always "published".
*/
"status"?: NotebookStatus;
/**
* List of template variables for this notebook.
*/
"templateVariables"?: Array<NotebookTemplateVariable>;
/**
* Notebook global timeframe.
*/
Expand Down Expand Up @@ -88,6 +93,10 @@ export class NotebooksResponseDataAttributes {
baseName: "status",
type: "NotebookStatus",
},
templateVariables: {
baseName: "template_variables",
type: "Array<NotebookTemplateVariable>",
},
time: {
baseName: "time",
type: "NotebookGlobalTime",
Expand Down
2 changes: 2 additions & 0 deletions services/notebooks/src/v1/models/TypingInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { NotebookResponse } from "./NotebookResponse";
import { NotebookResponseData } from "./NotebookResponseData";
import { NotebookResponseDataAttributes } from "./NotebookResponseDataAttributes";
import { NotebookSplitBy } from "./NotebookSplitBy";
import { NotebookTemplateVariable } from "./NotebookTemplateVariable";
import { NotebookTimeseriesCellAttributes } from "./NotebookTimeseriesCellAttributes";
import { NotebookToplistCellAttributes } from "./NotebookToplistCellAttributes";
import { NotebookUpdateData } from "./NotebookUpdateData";
Expand Down Expand Up @@ -369,6 +370,7 @@ export const TypingInfo: ModelTypingInfo = {
NotebookResponseData: NotebookResponseData,
NotebookResponseDataAttributes: NotebookResponseDataAttributes,
NotebookSplitBy: NotebookSplitBy,
NotebookTemplateVariable: NotebookTemplateVariable,
NotebookTimeseriesCellAttributes: NotebookTimeseriesCellAttributes,
NotebookToplistCellAttributes: NotebookToplistCellAttributes,
NotebookUpdateData: NotebookUpdateData,
Expand Down