- release_tracks: [ALPHA, BETA, GA] help_text: brief: Create a new Cloud Monitoring dashboard. description: | Create a new Monitoring dashboard. A dashboard can be specified as a JSON/YAML value passed in as a string through the `--config` flag or as a file through the `--config-from-file` flag. Validate a dashboard config without saving by setting the `--validate-only` flag. For information about the format of a dashboard: https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards examples: | To create a dashboard with a YAML config, run: $ {command} --config=''' displayName: New Dashboard gridLayout: widgets: - text: content: Hello World ''' To validate a dashboard and not save it, run: $ {command} --validate-only --config=''' displayName: New Dashboard gridLayout: widgets: - text: content: Hello World ''' To create a dashboard with a JSON config, run: $ {command} --config=''' { "displayName": "New Dashboard", "gridLayout": { "widgets": [ { "text": { "content": "Hello World", } } ] }, } ''' To create a dashboard with a specific dashboard ID, run: $ {command} --config=''' name: projects/MY-PROJECT/dashboards/MY-DASHBOARD displayName: New Dashboard gridLayout: widgets: - text: content: Hello World ''' To create a dashboard within a specific project, run: $ {command} --project=MY-PROJECT --config=''' displayName: New Dashboard gridLayout: widgets: - text: content: Hello World ''' To create a dashboard with a file, run: $ {command} --config-from-file=MY-FILE Sample contents of MY-FILE: displayName: New Dashboard gridLayout: widgets: - text: content: Hello World arguments: resource: help_text: | The dashboard to create. is_parent_resource: true spec: !REF googlecloudsdk.command_lib.monitoring.resources:project params: - group: mutex: true required: true params: - arg_name: config processor: googlecloudsdk.core.yaml:load api_field: dashboard help_text: | Dashboard configuration, in either JSON or YAML format, as a string. - arg_name: config-from-file type: "googlecloudsdk.calliope.arg_parsers:FileContents:" processor: googlecloudsdk.core.yaml:load api_field: dashboard help_text: | Path to a JSON or YAML file containing the dashboard configuration. - arg_name: validate-only type: bool default: false api_field: validateOnly help_text: | When set, validate the dashboard but do not save it. request: collection: monitoring.projects.dashboards api_version: v1