Skip to content

feat: add CRUD operations for dashboards and synthetics#61

Merged
piekstra merged 3 commits intomainfrom
piekstra/58-add-crud-operations
Jan 23, 2026
Merged

feat: add CRUD operations for dashboards and synthetics#61
piekstra merged 3 commits intomainfrom
piekstra/58-add-crud-operations

Conversation

@piekstra
Copy link
Copy Markdown
Collaborator

@piekstra piekstra commented Jan 23, 2026

[#58]

Add full CRUD operations for dashboards and synthetics.

New Commands

Dashboards

# Create a dashboard from JSON file
newrelic-cli dashboards create --from-file dashboard.json

# Update an existing dashboard
newrelic-cli dashboards update <guid> --from-file dashboard.json

# Delete a dashboard (with confirmation prompt)
newrelic-cli dashboards delete <guid>
newrelic-cli dashboards delete <guid> --force  # skip confirmation

Synthetics

# Create a synthetic monitor from JSON file
newrelic-cli synthetics create --from-file monitor.json

# Update an existing monitor
newrelic-cli synthetics update <monitor-id> --from-file monitor.json

# Delete a monitor (with confirmation prompt)
newrelic-cli synthetics delete <monitor-id>
newrelic-cli synthetics delete <monitor-id> --force  # skip confirmation

JSON File Examples

Dashboard JSON

{
  "name": "My Dashboard",
  "description": "Optional description",
  "permissions": "PUBLIC_READ_WRITE",
  "pages": [
    {
      "name": "Page 1",
      "widgets": [
        {
          "title": "Transaction Count",
          "visualization": {"id": "viz.line"},
          "layout": {"column": 1, "row": 1, "width": 4, "height": 3},
          "rawConfiguration": {
            "nrqlQueries": [{"accountId": 123, "query": "SELECT count(*) FROM Transaction"}]
          }
        }
      ]
    }
  ]
}

Synthetic Monitor JSON

{
  "name": "Homepage Check",
  "type": "SIMPLE",
  "frequency": 10,
  "status": "ENABLED",
  "uri": "https://example.com",
  "locations": ["AWS_US_EAST_1", "AWS_US_WEST_1"]
}

Safety Features (Delete Commands)

Both delete commands include:

  1. Confirmation prompt by default - Shows resource name before deletion
  2. --force flag - Skip confirmation for automation
  3. Resource lookup first - Fetches the resource to display its name

Test Plan

  • Build passes: make build
  • Tests pass: make test
  • dashboards create --help shows JSON structure and examples
  • dashboards update --help shows usage
  • dashboards delete --help shows usage
  • synthetics create --help shows JSON structure, monitor types, and locations
  • synthetics update --help shows usage
  • synthetics delete --help shows usage

Closes #58

@piekstra piekstra changed the title feat: add delete commands for dashboards and synthetics feat: add CRUD operations for dashboards and synthetics Jan 23, 2026
Add delete operations with safety features:
- `dashboards delete <guid>` - Delete a dashboard
- `synthetics delete <id>` - Delete a synthetic monitor

Safety features:
- Confirmation prompt by default (shows resource name)
- --force flag to skip confirmation for automation
- Fetches resource first to display name in confirmation

[#58]
[#58]

Add JSON file-based create and update operations:
- dashboards create --from-file
- dashboards update <guid> --from-file
- synthetics create --from-file
- synthetics update <monitor-id> --from-file

The --from-file flag accepts a JSON file containing the resource definition.
This enables AI agents and scripts to manage these resources programmatically.
@piekstra piekstra force-pushed the piekstra/58-add-crud-operations branch from 57cf431 to 54c6dea Compare January 23, 2026 16:57
@piekstra piekstra merged commit ede5e06 into main Jan 23, 2026
2 checks passed
@piekstra piekstra deleted the piekstra/58-add-crud-operations branch January 23, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add missing CRUD operations for dashboards, synthetics, and alerts

2 participants