Skip to main content

Update

Updates the specified dashboard.

import {
cloudApi,
decodeMessage,
serviceClients,
Session,
waitForOperation,
} from "@yandex-cloud/nodejs-sdk";

const ChartWidget_FreezeDuration =
cloudApi.monitoring.chart_widget.ChartWidget_FreezeDuration;
const Dashboard = cloudApi.loadtesting.api_regression_dashboard.Dashboard;
const Downsampling_GapFilling =
cloudApi.monitoring.downsampling.Downsampling_GapFilling;
const Downsampling_GridAggregation =
cloudApi.monitoring.downsampling.Downsampling_GridAggregation;
const SeriesOverrides_SeriesVisualizationType =
cloudApi.monitoring.chart_widget.SeriesOverrides_SeriesVisualizationType;
const SeriesOverrides_YaxisPosition =
cloudApi.monitoring.chart_widget.SeriesOverrides_YaxisPosition;
const TitleWidget_TitleSize =
cloudApi.monitoring.title_widget.TitleWidget_TitleSize;
const UnitFormat = cloudApi.monitoring.unit_format.UnitFormat;
const UpdateDashboardRequest =
cloudApi.monitoring.dashboard_service.UpdateDashboardRequest;
const VisualizationSettings_Interpolate =
cloudApi.monitoring.chart_widget.VisualizationSettings_Interpolate;
const VisualizationSettings_SeriesAggregation =
cloudApi.monitoring.chart_widget.VisualizationSettings_SeriesAggregation;
const VisualizationSettings_VisualizationType =
cloudApi.monitoring.chart_widget.VisualizationSettings_VisualizationType;
const VisualizationSettings_YaxisType =
cloudApi.monitoring.chart_widget.VisualizationSettings_YaxisType;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.DashboardServiceClient);

const operation = await client.update(
UpdateDashboardRequest.fromPartial({
dashboardId: "dashboardId",
// name: "name",
// description: "description",
// labels: {"key": "labels"},
// title: "title",
// widgets: [{
// position: {
// x: 0,
// y: 0,
// w: 0,
// h: 0
// },
// text: {
// text: "text"
// },
// title: {
// text: "text",
// size: TitleWidget_TitleSize.TITLE_SIZE_XS
// },
// chart: {
// id: "id",
// queries: {
// targets: [{
// query: "query",
// textMode: true,
// hidden: true,
// name: "name"
// }],
// downsampling: {
// maxPoints: 0,
// gridInterval: 0,
// disabled: true,
// gridAggregation: Downsampling_GridAggregation.GRID_AGGREGATION_MAX,
// gapFilling: Downsampling_GapFilling.GAP_FILLING_NULL
// }
// },
// visualizationSettings: {
// type: VisualizationSettings_VisualizationType.VISUALIZATION_TYPE_LINE,
// normalize: true,
// interpolate: VisualizationSettings_Interpolate.INTERPOLATE_LINEAR,
// aggregation: VisualizationSettings_SeriesAggregation.SERIES_AGGREGATION_AVG,
// colorSchemeSettings: {
// automatic: {

// },
// standard: {

// },
// gradient: {
// greenValue: "greenValue",
// yellowValue: "yellowValue",
// redValue: "redValue",
// violetValue: "violetValue"
// },
// hash: {

// }
// },
// heatmapSettings: {
// greenValue: "greenValue",
// yellowValue: "yellowValue",
// redValue: "redValue",
// violetValue: "violetValue"
// },
// yaxisSettings: {
// left: {
// type: VisualizationSettings_YaxisType.YAXIS_TYPE_LINEAR,
// title: "title",
// min: "min",
// max: "max",
// unitFormat: UnitFormat.UNIT_NONE,
// precision: {
// value: 0
// }
// },
// right: {
// type: VisualizationSettings_YaxisType.YAXIS_TYPE_LINEAR,
// title: "title",
// min: "min",
// max: "max",
// unitFormat: UnitFormat.UNIT_NONE,
// precision: {
// value: 0
// }
// }
// },
// title: "title",
// showLabels: true
// },
// seriesOverrides: [{
// name: "name",
// targetIndex: "targetIndex",
// settings: {
// name: "name",
// color: "color",
// type: SeriesOverrides_SeriesVisualizationType.SERIES_VISUALIZATION_TYPE_LINE,
// stackName: "stackName",
// growDown: true,
// yaxisPosition: SeriesOverrides_YaxisPosition.YAXIS_POSITION_LEFT
// }
// }],
// nameHidingSettings: {
// positive: true,
// names: ["names"]
// },
// description: "description",
// title: "title",
// displayLegend: true,
// freeze: ChartWidget_FreezeDuration.FREEZE_DURATION_HOUR,
// repeat: {
// repeatBy: ["repeatBy"],
// maxChartsInRow: 0
// }
// }
// }],
// parametrization: {
// parameters: [{
// name: "name",
// title: "title",
// labelValues: {
// folderId: "folderId",
// selectors: "selectors",
// labelKey: "labelKey",
// multiselectable: true,
// defaultValues: ["defaultValues"]
// },
// custom: {
// values: ["values"],
// multiselectable: true,
// defaultValues: ["defaultValues"]
// },
// text: {
// defaultValue: "defaultValue"
// },
// integerParameter: {
// defaultValue: 0,
// unitFormat: UnitFormat.UNIT_NONE
// },
// doubleParameter: {
// defaultValue: 0,
// unitFormat: UnitFormat.UNIT_NONE
// },
// textValues: {
// defaultValues: ["defaultValues"]
// },
// hidden: true,
// description: "description"
// }],
// selectors: "selectors"
// },
// etag: "etag",
// managedBy: "managedBy",
// managedLink: "managedLink"
})
);
const finishedOp = await waitForOperation(operation, session);

if (finishedOp.response) {
const result = decodeMessage<typeof Dashboard>(finishedOp.response);
console.log(result);
}
})();

UpdateDashboardRequest

dashboardId : string

Required. Dashboard ID.

name : string

Required. Dashboard name.

description : string

Dashboard description.

labels : string

Resource labels as key:value pairs.

Existing set of labels is completely replaced by the provided set.

title : string

Dashboard title.

widgets : Widget

List of dashboard widgets.

parametrization : Parametrization

Dashboard parametrization.

etag : string

The current etag of the dashboard.

managedBy : string

Entity that controls dashboard Must match the regular expression "[\w -][1]{1,100}"

Information about entity that controls dashboard Must be valid URI

Widget

Widget.

LayoutPosition

Layout item for widget item positioning.

x : int64

Required. X-axis top-left corner coordinate.

y : int64

Required. Y-axis top-left corner coordinate.

w : int64

Required. Weight.

h : int64

Required. Height.

position : LayoutPosition

Required. Widget layout position.

One of widget

Required. Widget data.

  • text : TextWidget

    Text widget.

  • title : TitleWidget

    Title widget.

  • chart : ChartWidget

    Chart widget.

Parametrization

Parametrization.

parameters : Parameter

Parameters.

selectors : string

Predefined selectors.

LayoutPosition

Layout item for widget item positioning.

x : int64

Required. X-axis top-left corner coordinate.

y : int64

Required. Y-axis top-left corner coordinate.

w : int64

Required. Weight.

h : int64

Required. Height.

TextWidget

Text widget.

text : string

Text.

TitleWidget

Title widget.

TitleSize

Title size.

  • TITLE_SIZE_UNSPECIFIED

    Title size.

  • TITLE_SIZE_XS

    Extra small size.

  • TITLE_SIZE_S

    Small size.

  • TITLE_SIZE_M

    Middle size.

  • TITLE_SIZE_L

    Large size.

text : string

Title text.

size : TitleSize

Title size.

ChartWidget

Chart widget.

Queries

Query settings.

Target

Query target.

query : string

Required. Query.

textMode : bool

Text mode.

hidden : bool

Checks that target is visible or invisible.

name : string

Name of the query.

targets : Target

Required. List of targets.

downsampling : Downsampling

Required. Downsampling settings.

VisualizationSettings

Visualization settings.

VisualizationType

Chart visualization type.

  • VISUALIZATION_TYPE_UNSPECIFIED

    Not specified (line by default).

  • VISUALIZATION_TYPE_LINE

    Line chart.

  • VISUALIZATION_TYPE_STACK

    Stack chart.

  • VISUALIZATION_TYPE_COLUMN

    Points as columns chart.

  • VISUALIZATION_TYPE_POINTS

    Points.

  • VISUALIZATION_TYPE_PIE

    Pie aggregation chart.

  • VISUALIZATION_TYPE_BARS

    Bars aggregation chart.

  • VISUALIZATION_TYPE_DISTRIBUTION

    Distribution aggregation chart.

  • VISUALIZATION_TYPE_HEATMAP

    Heatmap aggregation chart.

Interpolate
  • INTERPOLATE_UNSPECIFIED

    Not specified (linear by default).

  • INTERPOLATE_LINEAR

    Linear.

  • INTERPOLATE_LEFT

    Left.

  • INTERPOLATE_RIGHT

    Right.

ColorSchemeSettings

####### AutomaticColorScheme {#colorschemesettings_automaticcolorscheme}

####### StandardColorScheme {#colorschemesettings_standardcolorscheme}

####### GradientColorScheme {#colorschemesettings_gradientcolorscheme}

greenValue : string

Gradient green value.

yellowValue : string

Gradient yellow value.

redValue : string

Gradient red value.

violetValue : string

Gradient violet_value.

####### HashColorScheme {#colorschemesettings_hashcolorscheme}

One of scheme

  • automatic : AutomaticColorScheme

    Automatic color scheme.

  • standard : StandardColorScheme

    Standard color scheme.

  • gradient : GradientColorScheme

    Gradient color scheme.

  • hash : HashColorScheme

    Hash color scheme. Based on line name or value.

HeatmapSettings
greenValue : string

Heatmap green value.

yellowValue : string

Heatmap yellow value.

redValue : string

Heatmap red value.

violetValue : string

Heatmap violet_value.

YaxisType

Y axis type. N.B. _TYPE prefix is necessary to expect name clash with Interpolate LINEAR value.

  • YAXIS_TYPE_UNSPECIFIED

    Not specified (linear by default).

  • YAXIS_TYPE_LINEAR

    Linear.

  • YAXIS_TYPE_LOGARITHMIC

    Logarithmic.

Yaxis

Y axis settings.

type : YaxisType

Type.

title : string

Title or empty.

min : string

Min value in extended number format or empty.

max : string

Max value in extended number format or empty.

unitFormat : UnitFormat

Unit format.

precision : google.protobuf.Int64Value

Tick value precision (null as default, 0-7 in other cases).

YaxisSettings
left : Yaxis

Left Y axis settings.

right : Yaxis

Right Y axis settings.

SeriesAggregation
  • SERIES_AGGREGATION_UNSPECIFIED

    Not specified (avg by default).

  • SERIES_AGGREGATION_AVG

    Average.

  • SERIES_AGGREGATION_MIN

    Minimum.

  • SERIES_AGGREGATION_MAX

    Maximum.

  • SERIES_AGGREGATION_LAST

    Last non-NaN value.

  • SERIES_AGGREGATION_SUM

    Sum.

type : VisualizationType

Visualization type.

normalize : bool

Normalize.

interpolate : Interpolate

Interpolate.

aggregation : SeriesAggregation

Aggregation.

colorSchemeSettings : ColorSchemeSettings

Color scheme settings.

heatmapSettings : HeatmapSettings

Heatmap settings.

yaxisSettings : YaxisSettings

Y axis settings.

title : string

Inside chart title.

showLabels : bool

Show chart labels.

SeriesOverrides

Series override settings.

YaxisPosition
  • YAXIS_POSITION_UNSPECIFIED

    Not specified (left by default).

  • YAXIS_POSITION_LEFT

    Left.

  • YAXIS_POSITION_RIGHT

    Right.

SeriesVisualizationType
  • SERIES_VISUALIZATION_TYPE_UNSPECIFIED

    Not specified (line by default).

  • SERIES_VISUALIZATION_TYPE_LINE

    Line chart.

  • SERIES_VISUALIZATION_TYPE_STACK

    Stack chart.

  • SERIES_VISUALIZATION_TYPE_COLUMN

    Points as columns chart.

  • SERIES_VISUALIZATION_TYPE_POINTS

    Points.

SeriesOverrideSettings
name : string

Series name or empty.

color : string

Series color or empty.

type : SeriesVisualizationType

Type.

stackName : string

Stack name or empty.

growDown : bool

Stack grow down.

yaxisPosition : YaxisPosition

Yaxis position.

One of type

Required. Series selection type.

  • name : string

    Series name.

  • targetIndex : string

    Target index.

settings : SeriesOverrideSettings

Required. Override settings.

NameHidingSettings

Name hiding settings.

positive : bool

True if we want to show concrete series names only, false if we want to hide concrete series names.

names : string

Series names to show or hide.

FreezeDuration
  • FREEZE_DURATION_UNSPECIFIED

  • FREEZE_DURATION_HOUR

    Last hour.

  • FREEZE_DURATION_DAY

    Last day = last 24 hours.

  • FREEZE_DURATION_WEEK

    Last 7 days.

  • FREEZE_DURATION_MONTH

    Last 31 days.

RepeatSettings
repeatBy : string

Parameters to repeat by.

maxChartsInRow : int64

Max number of chart in one row.

id : string

Required. Chart ID.

queries : Queries

Queries.

visualizationSettings : VisualizationSettings

Visualization settings.

seriesOverrides : SeriesOverrides

Override settings.

nameHidingSettings : NameHidingSettings

Name hiding settings.

description : string

Chart description in dashboard (not enabled in UI).

title : string

Chart widget title.

displayLegend : bool

Enable legend under chart.

freeze : FreezeDuration

Fixed time interval for chart.

repeat : RepeatSettings

Setting for repeat panel / repeat row

Parameter

Parameter.

name : string

Parameter identifier.

title : string

UI-visible title of the parameter.

One of data

Parameter data.

  • labelValues : LabelValuesParameter

    Label values parameter.

  • custom : CustomParameter

    Custom parameter.

  • text : TextParameter

    Text parameter.

  • integerParameter : IntegerParameter

    Integer parameter.

  • doubleParameter : DoubleParameter

    Double parameter.

  • textValues : TextValuesParameter

    Integer parameter.

hidden : bool

UI-visibility.

description : string

Parameter description.

Target

Query target.

query : string

Required. Query.

textMode : bool

Text mode.

hidden : bool

Checks that target is visible or invisible.

name : string

Name of the query.

Downsampling

List of available aggregate functions for downsampling.

GridAggregation

List of available aggregate functions for downsampling.

  • GRID_AGGREGATION_UNSPECIFIED

    List of available aggregate functions for downsampling.

  • GRID_AGGREGATION_MAX

    Max value.

  • GRID_AGGREGATION_MIN

    Min value.

  • GRID_AGGREGATION_SUM

    Sum of values.

  • GRID_AGGREGATION_AVG

    Average value.

  • GRID_AGGREGATION_LAST

    Last value.

  • GRID_AGGREGATION_COUNT

    Total count of points.

GapFilling

List of available gap filling policy for downsampling.

  • GAP_FILLING_UNSPECIFIED

    List of available gap filling policy for downsampling.

  • GAP_FILLING_NULL

    Returns null as a metric value and timestamp as a time series value.

  • GAP_FILLING_NONE

    Returns no value and no timestamp.

  • GAP_FILLING_PREVIOUS

    Returns the value from the previous time interval.

One of mode

  • maxPoints : int64

    Maximum number of points to be returned.

  • gridInterval : int64
    Time interval (grid) for downsampling in milliseconds.

    Points in the specified range are aggregated into one time point.

  • disabled : bool

    Disable downsampling.

gridAggregation : GridAggregation

Function that is used for downsampling.

gapFilling : GapFilling

Parameters for filling gaps in data.

AutomaticColorScheme

StandardColorScheme

GradientColorScheme

greenValue : string

Gradient green value.

yellowValue : string

Gradient yellow value.

redValue : string

Gradient red value.

violetValue : string

Gradient violet_value.

HashColorScheme

Yaxis

Y axis settings.

type : YaxisType

Type.

title : string

Title or empty.

min : string

Min value in extended number format or empty.

max : string

Max value in extended number format or empty.

unitFormat : UnitFormat

Unit format.

precision : google.protobuf.Int64Value

Tick value precision (null as default, 0-7 in other cases).

ColorSchemeSettings

AutomaticColorScheme
StandardColorScheme
GradientColorScheme
greenValue : string

Gradient green value.

yellowValue : string

Gradient yellow value.

redValue : string

Gradient red value.

violetValue : string

Gradient violet_value.

HashColorScheme
  • automatic : AutomaticColorScheme

    Automatic color scheme.

  • standard : StandardColorScheme

    Standard color scheme.

  • gradient : GradientColorScheme

    Gradient color scheme.

  • hash : HashColorScheme

    Hash color scheme. Based on line name or value.

HeatmapSettings

greenValue : string

Heatmap green value.

yellowValue : string

Heatmap yellow value.

redValue : string

Heatmap red value.

violetValue : string

Heatmap violet_value.

YaxisSettings

left : Yaxis

Left Y axis settings.

right : Yaxis

Right Y axis settings.

SeriesOverrideSettings

name : string

Series name or empty.

color : string

Series color or empty.

type : SeriesVisualizationType

Type.

stackName : string

Stack name or empty.

growDown : bool

Stack grow down.

yaxisPosition : YaxisPosition

Yaxis position.

Queries

Query settings.

Target

Query target.

query : string

Required. Query.

textMode : bool

Text mode.

hidden : bool

Checks that target is visible or invisible.

name : string

Name of the query.

targets : Target

Required. List of targets.

downsampling : Downsampling

Required. Downsampling settings.

VisualizationSettings

Visualization settings.

VisualizationType

Chart visualization type.

  • VISUALIZATION_TYPE_UNSPECIFIED

    Not specified (line by default).

  • VISUALIZATION_TYPE_LINE

    Line chart.

  • VISUALIZATION_TYPE_STACK

    Stack chart.

  • VISUALIZATION_TYPE_COLUMN

    Points as columns chart.

  • VISUALIZATION_TYPE_POINTS

    Points.

  • VISUALIZATION_TYPE_PIE

    Pie aggregation chart.

  • VISUALIZATION_TYPE_BARS

    Bars aggregation chart.

  • VISUALIZATION_TYPE_DISTRIBUTION

    Distribution aggregation chart.

  • VISUALIZATION_TYPE_HEATMAP

    Heatmap aggregation chart.

Interpolate
  • INTERPOLATE_UNSPECIFIED

    Not specified (linear by default).

  • INTERPOLATE_LINEAR

    Linear.

  • INTERPOLATE_LEFT

    Left.

  • INTERPOLATE_RIGHT

    Right.

ColorSchemeSettings
AutomaticColorScheme
StandardColorScheme
GradientColorScheme
greenValue : string

Gradient green value.

yellowValue : string

Gradient yellow value.

redValue : string

Gradient red value.

violetValue : string

Gradient violet_value.

HashColorScheme
  • automatic : AutomaticColorScheme

    Automatic color scheme.

  • standard : StandardColorScheme

    Standard color scheme.

  • gradient : GradientColorScheme

    Gradient color scheme.

  • hash : HashColorScheme

    Hash color scheme. Based on line name or value.

HeatmapSettings
greenValue : string

Heatmap green value.

yellowValue : string

Heatmap yellow value.

redValue : string

Heatmap red value.

violetValue : string

Heatmap violet_value.

YaxisType

Y axis type. N.B. _TYPE prefix is necessary to expect name clash with Interpolate LINEAR value.

  • YAXIS_TYPE_UNSPECIFIED

    Not specified (linear by default).

  • YAXIS_TYPE_LINEAR

    Linear.

  • YAXIS_TYPE_LOGARITHMIC

    Logarithmic.

Yaxis

Y axis settings.

type : YaxisType

Type.

title : string

Title or empty.

min : string

Min value in extended number format or empty.

max : string

Max value in extended number format or empty.

unitFormat : UnitFormat

Unit format.

precision : google.protobuf.Int64Value

Tick value precision (null as default, 0-7 in other cases).

YaxisSettings
left : Yaxis

Left Y axis settings.

right : Yaxis

Right Y axis settings.

SeriesAggregation
  • SERIES_AGGREGATION_UNSPECIFIED

    Not specified (avg by default).

  • SERIES_AGGREGATION_AVG

    Average.

  • SERIES_AGGREGATION_MIN

    Minimum.

  • SERIES_AGGREGATION_MAX

    Maximum.

  • SERIES_AGGREGATION_LAST

    Last non-NaN value.

  • SERIES_AGGREGATION_SUM

    Sum.

type : VisualizationType

Visualization type.

normalize : bool

Normalize.

interpolate : Interpolate

Interpolate.

aggregation : SeriesAggregation

Aggregation.

colorSchemeSettings : ColorSchemeSettings

Color scheme settings.

heatmapSettings : HeatmapSettings

Heatmap settings.

yaxisSettings : YaxisSettings

Y axis settings.

title : string

Inside chart title.

showLabels : bool

Show chart labels.

SeriesOverrides

Series override settings.

YaxisPosition
  • YAXIS_POSITION_UNSPECIFIED

    Not specified (left by default).

  • YAXIS_POSITION_LEFT

    Left.

  • YAXIS_POSITION_RIGHT

    Right.

SeriesVisualizationType
  • SERIES_VISUALIZATION_TYPE_UNSPECIFIED

    Not specified (line by default).

  • SERIES_VISUALIZATION_TYPE_LINE

    Line chart.

  • SERIES_VISUALIZATION_TYPE_STACK

    Stack chart.

  • SERIES_VISUALIZATION_TYPE_COLUMN

    Points as columns chart.

  • SERIES_VISUALIZATION_TYPE_POINTS

    Points.

SeriesOverrideSettings
name : string

Series name or empty.

color : string

Series color or empty.

type : SeriesVisualizationType

Type.

stackName : string

Stack name or empty.

growDown : bool

Stack grow down.

yaxisPosition : YaxisPosition

Yaxis position.

  • name : string

    Series name.

  • targetIndex : string

    Target index.

settings : SeriesOverrideSettings

Required. Override settings.

NameHidingSettings

Name hiding settings.

positive : bool

True if we want to show concrete series names only, false if we want to hide concrete series names.

names : string

Series names to show or hide.

RepeatSettings

repeatBy : string

Parameters to repeat by.

maxChartsInRow : int64

Max number of chart in one row.

LabelValuesParameter

Label values parameter.

One of container

Container id

  • folderId : string

    Required. Folder ID.

selectors : string

Required. Selectors to select metric label values.

labelKey : string

Required. Label key to list label values.

multiselectable : bool

Specifies the multiselectable values of parameter.

defaultValues : string

Default values.

CustomParameter

Custom parameter.

values : string

Required. List of parameter values.

multiselectable : bool

Specifies the multiselectable values of parameter.

defaultValues : string

Default values.

TextParameter

Text parameter.

defaultValue : string

Default value.

IntegerParameter

Integer parameter.

defaultValue : int64

Default value.

unitFormat : UnitFormat

Parameter unit.

DoubleParameter

Double parameter.

defaultValue : double

Default value.

unitFormat : UnitFormat

Parameter unit.

TextValuesParameter

Text multiple values parameter.

defaultValues : string

Default value.

Operation

An Operation resource. For more information, see Operation.

id : string

ID of the operation.

description : string

Description of the operation. 0-256 characters long.

createdAt : google.protobuf.Timestamp

Creation timestamp.

createdBy : string

ID of the user or service account who initiated the operation.

modifiedAt : google.protobuf.Timestamp

The time when the Operation resource was last modified.

done : bool

If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.

metadata : google.protobuf.Any

Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.

One of result

The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.

  • error : google.rpc.Status

    The error result of the operation in case of failure or cancellation.

  • response : google.protobuf.Any
    The normal response of the operation in case of success.

    If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.


[1]: #updatedashboardrequest\w -