Manages Stackdriver dashboards. A dashboard is an arrangement of data display widgets in a specific layout. v1
Package
@google-cloud/monitoring-dashboardsConstructors
(constructor)(opts)
constructor(opts?: ClientOptions);
Construct an instance of DashboardsServiceClient.
Name | Description |
opts |
ClientOptions
|
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth: gax.GoogleAuth;
dashboardsServiceStub
dashboardsServiceStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
alertPolicyPath(project, alertPolicy)
alertPolicyPath(project: string, alertPolicy: string): string;
Return a fully-qualified alertPolicy resource name string.
Name | Description |
project |
string
|
alertPolicy |
string
|
Type | Description |
string | {string} Resource name string. |
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
createDashboard(request, options)
createDashboard(request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, options?: CallOptions): Promise<[protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.ICreateDashboardRequest | undefined, {} | undefined]>;
Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the monitoring.dashboards.create
permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
Name | Description |
request |
protos.google.monitoring.dashboard.v1.ICreateDashboardRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.ICreateDashboardRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Dashboard]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project on which to execute the request. The format is:
* projects/[PROJECT_ID_OR_NUMBER]
* The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name.
*/
// const parent = 'abc123'
/**
* Required. The initial dashboard specification.
*/
// const dashboard = {}
/**
* If set, validate the request and preview the review, but do not actually
* save it.
*/
// const validateOnly = true
// Imports the Dashboard library
const {DashboardsServiceClient} =
require('@google-cloud/monitoring-dashboards').v1;
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
async function callCreateDashboard() {
// Construct request
const request = {
parent,
dashboard,
};
// Run request
const response = await dashboardClient.createDashboard(request);
console.log(response);
}
callCreateDashboard();
createDashboard(request, options, callback)
createDashboard(request: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, options: CallOptions, callback: Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.ICreateDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.ICreateDashboardRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.ICreateDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
createDashboard(request, callback)
createDashboard(request: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest, callback: Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.ICreateDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.ICreateDashboardRequest
|
callback |
Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.ICreateDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
dashboardPath(project, dashboard)
dashboardPath(project: string, dashboard: string): string;
Return a fully-qualified dashboard resource name string.
Name | Description |
project |
string
|
dashboard |
string
|
Type | Description |
string | {string} Resource name string. |
deleteDashboard(request, options)
deleteDashboard(request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest | undefined, {} | undefined]>;
Deletes an existing custom dashboard.
This method requires the monitoring.dashboards.delete
permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.protobuf.IEmpty, protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the Dashboard. The format is:
* projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]
*/
// const name = 'abc123'
// Imports the Dashboard library
const {DashboardsServiceClient} =
require('@google-cloud/monitoring-dashboards').v1;
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
async function callDeleteDashboard() {
// Construct request
const request = {
name,
};
// Run request
const response = await dashboardClient.deleteDashboard(request);
console.log(response);
}
callDeleteDashboard();
deleteDashboard(request, options, callback)
deleteDashboard(request: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
deleteDashboard(request, callback)
deleteDashboard(request: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getDashboard(request, options)
getDashboard(request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, options?: CallOptions): Promise<[protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IGetDashboardRequest | undefined, {} | undefined]>;
Fetches a specific dashboard.
This method requires the monitoring.dashboards.get
permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IGetDashboardRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IGetDashboardRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Dashboard]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the Dashboard. The format is one of:
* - `dashboards/[DASHBOARD_ID]` (for system dashboards)
* - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]`
* (for custom dashboards).
*/
// const name = 'abc123'
// Imports the Dashboard library
const {DashboardsServiceClient} =
require('@google-cloud/monitoring-dashboards').v1;
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
async function callGetDashboard() {
// Construct request
const request = {
name,
};
// Run request
const response = await dashboardClient.getDashboard(request);
console.log(response);
}
callGetDashboard();
getDashboard(request, options, callback)
getDashboard(request: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, options: CallOptions, callback: Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IGetDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IGetDashboardRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IGetDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getDashboard(request, callback)
getDashboard(request: protos.google.monitoring.dashboard.v1.IGetDashboardRequest, callback: Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IGetDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IGetDashboardRequest
|
callback |
Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IGetDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getProjectId()
getProjectId(): Promise<string>;
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Type | Description |
Promise<{ [name: string]: Function; }> | {Promise} A promise that resolves to an authenticated service stub. |
listDashboards(request, options)
listDashboards(request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, options?: CallOptions): Promise<[protos.google.monitoring.dashboard.v1.IDashboard[], protos.google.monitoring.dashboard.v1.IListDashboardsRequest | null, protos.google.monitoring.dashboard.v1.IListDashboardsResponse]>;
Lists the existing dashboards.
This method requires the monitoring.dashboards.list
permission on the specified project. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IListDashboardsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.monitoring.dashboard.v1.IDashboard[], protos.google.monitoring.dashboard.v1.IListDashboardsRequest | null, protos.google.monitoring.dashboard.v1.IListDashboardsResponse]> | {Promise} - The promise which resolves to an array. The first element of the array is Array of [Dashboard]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listDashboards(request, options, callback)
listDashboards(request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, options: CallOptions, callback: PaginationCallback<protos.google.monitoring.dashboard.v1.IListDashboardsRequest, protos.google.monitoring.dashboard.v1.IListDashboardsResponse | null | undefined, protos.google.monitoring.dashboard.v1.IDashboard>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IListDashboardsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.monitoring.dashboard.v1.IListDashboardsRequest, protos.google.monitoring.dashboard.v1.IListDashboardsResponse | null | undefined, protos.google.monitoring.dashboard.v1.IDashboard>
|
Type | Description |
void |
listDashboards(request, callback)
listDashboards(request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, callback: PaginationCallback<protos.google.monitoring.dashboard.v1.IListDashboardsRequest, protos.google.monitoring.dashboard.v1.IListDashboardsResponse | null | undefined, protos.google.monitoring.dashboard.v1.IDashboard>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IListDashboardsRequest
|
callback |
PaginationCallback<protos.google.monitoring.dashboard.v1.IListDashboardsRequest, protos.google.monitoring.dashboard.v1.IListDashboardsResponse | null | undefined, protos.google.monitoring.dashboard.v1.IDashboard>
|
Type | Description |
void |
listDashboardsAsync(request, options)
listDashboardsAsync(request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, options?: CallOptions): AsyncIterable<protos.google.monitoring.dashboard.v1.IDashboard>;
Equivalent to listDashboards
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IListDashboardsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
AsyncIterable<protos.google.monitoring.dashboard.v1.IDashboard> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Dashboard]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The scope of the dashboards to list. The format is:
* projects/[PROJECT_ID_OR_NUMBER]
*/
// const parent = 'abc123'
/**
* A positive number that is the maximum number of results to return.
* If unspecified, a default of 1000 is used.
*/
// const pageSize = 1234
/**
* If this field is not empty then it must contain the `nextPageToken` value
* returned by a previous call to this method. Using this field causes the
* method to return additional results from the previous method call.
*/
// const pageToken = 'abc123'
// Imports the Dashboard library
const {DashboardsServiceClient} =
require('@google-cloud/monitoring-dashboards').v1;
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
async function callListDashboards() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = await dashboardClient.listDashboardsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListDashboards();
listDashboardsStream(request, options)
listDashboardsStream(request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IListDashboardsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Transform | {Stream} An object stream which emits an object representing [Dashboard] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
matchAlertPolicyFromAlertPolicyName(alertPolicyName)
matchAlertPolicyFromAlertPolicyName(alertPolicyName: string): string | number;
Parse the alert_policy from AlertPolicy resource.
Name | Description |
alertPolicyName |
string
A fully-qualified path representing AlertPolicy resource. |
Type | Description |
string | number | {string} A string representing the alert_policy. |
matchDashboardFromDashboardName(dashboardName)
matchDashboardFromDashboardName(dashboardName: string): string | number;
Parse the dashboard from Dashboard resource.
Name | Description |
dashboardName |
string
A fully-qualified path representing Dashboard resource. |
Type | Description |
string | number | {string} A string representing the dashboard. |
matchProjectFromAlertPolicyName(alertPolicyName)
matchProjectFromAlertPolicyName(alertPolicyName: string): string | number;
Parse the project from AlertPolicy resource.
Name | Description |
alertPolicyName |
string
A fully-qualified path representing AlertPolicy resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromDashboardName(dashboardName)
matchProjectFromDashboardName(dashboardName: string): string | number;
Parse the project from Dashboard resource.
Name | Description |
dashboardName |
string
A fully-qualified path representing Dashboard resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;
Parse the project from Project resource.
Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
Type | Description |
string | number | {string} A string representing the project. |
projectPath(project)
projectPath(project: string): string;
Return a fully-qualified project resource name string.
Name | Description |
project |
string
|
Type | Description |
string | {string} Resource name string. |
updateDashboard(request, options)
updateDashboard(request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, options?: CallOptions): Promise<[protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest | undefined, {} | undefined]>;
Replaces an existing custom dashboard with a new definition.
This method requires the monitoring.dashboards.update
permission on the specified dashboard. For more information, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Dashboard]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The dashboard that will replace the existing dashboard.
*/
// const dashboard = {}
/**
* If set, validate the request and preview the review, but do not actually
* save it.
*/
// const validateOnly = true
// Imports the Dashboard library
const {DashboardsServiceClient} =
require('@google-cloud/monitoring-dashboards').v1;
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
async function callUpdateDashboard() {
// Construct request
const request = {
dashboard,
};
// Run request
const response = await dashboardClient.updateDashboard(request);
console.log(response);
}
callUpdateDashboard();
updateDashboard(request, options, callback)
updateDashboard(request: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, options: CallOptions, callback: Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
updateDashboard(request, callback)
updateDashboard(request: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest, callback: Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest
|
callback |
Callback<protos.google.monitoring.dashboard.v1.IDashboard, protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |