HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/394/lib/surface/monitoring/dashboards/create.yaml
- 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