diff --git a/.drone.star b/.drone.star index db76fbd9dee1..3387b6b187d4 100644 --- a/.drone.star +++ b/.drone.star @@ -31,6 +31,10 @@ load( ) load("scripts/drone/pipelines/github.star", "publish_github_pipeline") load("scripts/drone/pipelines/aws_marketplace.star", "publish_aws_marketplace_pipeline") +load( + "scripts/drone/pipelines/windows.star", + "windows_test_backend", +) load("scripts/drone/version.star", "version_branch_pipelines") load("scripts/drone/events/cron.star", "cronjobs") load("scripts/drone/vault.star", "secrets") @@ -42,10 +46,6 @@ def main(_ctx): oss_pipelines() + enterprise_pipelines() + enterprise2_pipelines() + - enterprise2_pipelines( - prefix = "custom-", - trigger = {"event": ["custom"]}, - ) + publish_image_pipelines_public() + publish_image_pipelines_security() + publish_github_pipeline("public") + @@ -55,6 +55,10 @@ def main(_ctx): publish_artifacts_pipelines("public") + publish_npm_pipelines() + publish_packages_pipeline() + + [windows_test_backend({ + "event": ["promote"], + "target": ["test-windows"], + }, "oss", "testing")] + artifacts_page_pipeline() + version_branch_pipelines() + integration_test_pipelines() + diff --git a/.drone.yml b/.drone.yml index 7e7e84e4ea39..9edaab22ee1f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -120,7 +120,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -362,56 +362,6 @@ environment: image_pull_secrets: - dockerconfigjson kind: pipeline -name: pr-oss-test-backend-windows -platform: - arch: amd64 - os: windows - version: "1809" -services: [] -steps: -- commands: [] - image: grafana/grafana-ci-windows-test:0.1.0 - name: windows-init -- commands: - - go install github.com/google/wire/cmd/wire@v0.5.0 - - wire gen -tags oss ./pkg/server - depends_on: - - windows-init - image: grafana/grafana-ci-windows-test:0.1.0 - name: wire-install -- commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - depends_on: - - wire-install - failure: ignore - image: grafana/grafana-ci-windows-test:0.1.0 - name: test-backend -trigger: - event: - - pull_request - paths: - exclude: - - docs/** - - '*.md' - - pkg/** - - packaging/** - - go.sum - - go.mod - include: [] -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- dockerconfigjson -kind: pipeline name: pr-lint-backend node: type: no-parallel @@ -476,6 +426,7 @@ trigger: include: - pkg/** - packaging/** + - .drone.yml - conf/** - go.sum - go.mod @@ -510,7 +461,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -781,6 +732,41 @@ steps: volumes: - name: docker path: /var/run/docker.sock +- commands: + - ./bin/build build-docker --edition oss --ubuntu -archs amd64 + depends_on: + - copy-packages-for-docker + - compile-build-cmd + environment: + GCP_KEY: + from_secret: gcp_key + image: google/cloud-sdk + name: build-docker-images-ubuntu + volumes: + - name: docker + path: /var/run/docker.sock +- commands: + - ./bin/grabpl artifacts docker publish --dockerhub-repo grafana/grafana + depends_on: + - build-docker-images + - build-docker-images-ubuntu + environment: + DOCKER_PASSWORD: + from_secret: docker_password_pr + DOCKER_USER: + from_secret: docker_username_pr + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key + failure: ignore + image: google/cloud-sdk + name: publish-images-grafana + volumes: + - name: docker + path: /var/run/docker.sock trigger: event: - pull_request @@ -853,7 +839,7 @@ steps: name: clone-enterprise - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1143,7 +1129,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1385,7 +1371,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1681,6 +1667,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-grafana/grafana volumes: @@ -1701,6 +1693,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-grafana/grafana-oss volumes: @@ -1808,7 +1806,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1916,7 +1914,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/windows/grabpl.exe -OutFile grabpl.exe image: grafana/ci-wix:0.1.1 name: windows-init @@ -1963,127 +1961,6 @@ volumes: clone: retries: 3 depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: main-oss-test-backend-windows -platform: - arch: amd64 - os: windows - version: "1809" -services: [] -steps: -- commands: [] - image: grafana/grafana-ci-windows-test:0.1.0 - name: windows-init -- commands: - - go install github.com/google/wire/cmd/wire@v0.5.0 - - wire gen -tags oss ./pkg/server - depends_on: - - windows-init - image: grafana/grafana-ci-windows-test:0.1.0 - name: wire-install -- commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - depends_on: - - wire-install - failure: ignore - image: grafana/grafana-ci-windows-test:0.1.0 - name: test-backend -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- -clone: - disable: true -depends_on: [] -environment: - EDITION: enterprise -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: main-enterprise-test-backend-windows -platform: - arch: amd64 - os: windows - version: "1809" -services: [] -steps: -- commands: - - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe - -OutFile grabpl.exe - image: grafana/ci-wix:0.1.1 - name: grabpl -- commands: - - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - - cd grafana-enterprise - - git checkout main - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/ci-wix:0.1.1 - name: clone -- commands: - - cp -r grafana-enterprise C:\App\grafana-enterprise - - rm -r -force grafana-enterprise - - cp grabpl.exe C:\App\grabpl.exe - - rm -force grabpl.exe - - C:\App\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\App\grafana-enterprise - main - - cp C:\App\grabpl.exe grabpl.exe - depends_on: - - clone - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/ci-wix:0.1.1 - name: windows-init -- commands: - - go install github.com/google/wire/cmd/wire@v0.5.0 - - wire gen -tags enterprise ./pkg/server - depends_on: - - windows-init - image: grafana/grafana-ci-windows-test:0.1.0 - name: wire-install -- commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - depends_on: - - wire-install - failure: ignore - image: grafana/grafana-ci-windows-test:0.1.0 - name: test-backend -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- -clone: - retries: 3 -depends_on: [] kind: pipeline name: notify-drone-changes platform: @@ -2216,7 +2093,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -2519,7 +2396,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -2626,59 +2503,11 @@ volumes: path: /var/run/docker.sock name: docker --- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: release-oss-test-backend-windows -platform: - arch: amd64 - os: windows - version: "1809" -services: [] -steps: -- commands: [] - image: grafana/grafana-ci-windows-test:0.1.0 - name: windows-init -- commands: - - go install github.com/google/wire/cmd/wire@v0.5.0 - - wire gen -tags oss ./pkg/server - depends_on: - - windows-init - image: grafana/grafana-ci-windows-test:0.1.0 - name: wire-install -- commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - depends_on: - - wire-install - failure: ignore - image: grafana/grafana-ci-windows-test:0.1.0 - name: test-backend -trigger: - event: - exclude: - - promote - ref: - exclude: - - refs/tags/*-cloud* - include: - - refs/tags/v* -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- clone: retries: 3 depends_on: - release-oss-build-e2e-publish - release-oss-test-frontend -- release-oss-test-backend-windows environment: EDITION: oss image_pull_secrets: @@ -2697,7 +2526,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/windows/grabpl.exe -OutFile grabpl.exe image: grafana/ci-wix:0.1.1 name: windows-init @@ -2757,7 +2586,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3043,7 +2872,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3141,7 +2970,7 @@ steps: name: clone-enterprise - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3236,307 +3065,59 @@ platform: services: [] steps: - commands: - - echo $env:DRONE_RUNNER_NAME - image: mcr.microsoft.com/windows:1809 - name: identify-runner -- commands: - - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe - -OutFile grabpl.exe - - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - - cd grafana-enterprise - - git checkout ${DRONE_TAG} - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/ci-wix:0.1.1 - name: clone -- commands: - - cp -r grafana-enterprise C:\App\grafana-enterprise - - rm -r -force grafana-enterprise - - cp grabpl.exe C:\App\grabpl.exe - - rm -force grabpl.exe - - C:\App\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\App\grafana-enterprise - ${DRONE_TAG} - - cp C:\App\grabpl.exe grabpl.exe - depends_on: - - clone - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/ci-wix:0.1.1 - name: windows-init -- commands: - - $$gcpKey = $$env:GCP_KEY - - '[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) - > gcpkey.json' - - dos2unix gcpkey.json - - gcloud auth activate-service-account --key-file=gcpkey.json - - rm gcpkey.json - - cp C:\App\nssm-2.24.zip . - - .\grabpl.exe windows-installer --edition enterprise ${DRONE_TAG} - - $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0] - - gsutil cp $$fname gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/enterprise/release/ - - gsutil cp "$$fname.sha256" gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/enterprise/release/ - depends_on: - - windows-init - environment: - GCP_KEY: - from_secret: gcp_key - GITHUB_TOKEN: - from_secret: github_token - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/ci-wix:0.1.1 - name: build-windows-installer -trigger: - event: - exclude: - - promote - ref: - exclude: - - refs/tags/*-cloud* - include: - - refs/tags/v* -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- -clone: - disable: true -depends_on: [] -environment: - EDITION: enterprise2 -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: release-enterprise2-build-e2e-publish -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.17.1 - name: identify-runner -- commands: - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - - cd grafana-enterprise - - git checkout ${DRONE_TAG} - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/build-container:1.7.4 - name: clone-enterprise -- commands: - - mv bin/grabpl /tmp/ - - rmdir bin - - mv grafana-enterprise /tmp/ - - /tmp/grabpl init-enterprise --github-token $${GITHUB_TOKEN} /tmp/grafana-enterprise - ${DRONE_TAG} - - mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json - - mkdir bin - - mv /tmp/grabpl bin/ - depends_on: - - clone-enterprise - - grabpl - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/build-container:1.7.4 - name: init-enterprise -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: - - init-enterprise - environment: - CGO_ENABLED: 0 - image: golang:1.20.4 - name: compile-build-cmd -- commands: - - make gen-go - depends_on: - - init-enterprise - image: grafana/build-container:1.7.4 - name: wire-install -- commands: - - yarn install --immutable - depends_on: - - init-enterprise - image: grafana/build-container:1.7.4 - name: yarn-install -- commands: - - '# It is required that code generated from Thema/CUE be committed and in sync - with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - CODEGEN_VERIFY=1 make gen-cue - depends_on: - - init-enterprise - image: grafana/build-container:1.7.4 - name: verify-gen-cue -- commands: - - ./bin/build build-frontend --jobs 8 --edition enterprise ${DRONE_TAG} - depends_on: - - compile-build-cmd - - yarn-install - environment: - NODE_OPTIONS: --max_old_space_size=8192 - image: grafana/build-container:1.7.4 - name: build-frontend -- commands: - - ./bin/build build-frontend-packages --jobs 8 --edition enterprise ${DRONE_TAG} - depends_on: - - compile-build-cmd - - yarn-install - environment: - NODE_OPTIONS: --max_old_space_size=8192 - image: grafana/build-container:1.7.4 - name: build-frontend-packages -- commands: - - ./bin/build build-plugins --jobs 8 --edition enterprise - depends_on: - - compile-build-cmd - - yarn-install - environment: - GRAFANA_API_KEY: - from_secret: grafana_api_key - image: grafana/build-container:1.7.4 - name: build-plugins -- commands: - - ./bin/build build-backend --jobs 8 --edition enterprise2 ${DRONE_TAG} - depends_on: - - wire-install - - compile-build-cmd - image: grafana/build-container:1.7.4 - name: build-backend-enterprise2 -- commands: - - ./bin/build package --jobs 8 --edition enterprise2 --sign ${DRONE_TAG} - depends_on: - - build-plugins - - build-backend-enterprise2 - - build-frontend - - build-frontend-packages - environment: - GPG_KEY_PASSWORD: - from_secret: packages_gpg_passphrase - GPG_PRIV_KEY: - from_secret: packages_gpg_private_key - GPG_PUB_KEY: - from_secret: packages_gpg_public_key - GRAFANA_API_KEY: - from_secret: grafana_api_key - image: grafana/build-container:1.7.4 - name: package-enterprise2 -- commands: - - ./bin/build upload-cdn --edition enterprise2 - depends_on: - - package-enterprise2 - environment: - ENTERPRISE2_CDN_PATH: - from_secret: enterprise2-cdn-path - GCP_KEY: - from_secret: gcp_key - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: upload-cdn-assets-enterprise2 -- commands: - - ls dist/*.tar.gz* - - cp dist/*.tar.gz* packaging/docker/ - depends_on: - - package-enterprise2 - image: grafana/build-container:1.7.4 - name: copy-packages-for-docker -- commands: - - ./bin/build build-docker --edition enterprise2 --shouldSave - depends_on: - - copy-packages-for-docker - - compile-build-cmd - environment: - DOCKER_ENTERPRISE2_REPO: - from_secret: docker_enterprise2_repo - GCP_KEY: - from_secret: gcp_key - image: google/cloud-sdk - name: build-docker-images - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - ./bin/build build-docker --edition enterprise2 --shouldSave --ubuntu - depends_on: - - copy-packages-for-docker - - compile-build-cmd - environment: - DOCKER_ENTERPRISE2_REPO: - from_secret: docker_enterprise2_repo - GCP_KEY: - from_secret: gcp_key - image: google/cloud-sdk - name: build-docker-images-ubuntu - volumes: - - name: docker - path: /var/run/docker.sock + - echo $env:DRONE_RUNNER_NAME + image: mcr.microsoft.com/windows:1809 + name: identify-runner - commands: - - ./bin/build artifacts docker fetch --edition enterprise2 - depends_on: - - build-docker-images - - build-docker-images-ubuntu + - $$ProgressPreference = "SilentlyContinue" + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/windows/grabpl.exe + -OutFile grabpl.exe + - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" + - cd grafana-enterprise + - git checkout ${DRONE_TAG} environment: - DOCKER_ENTERPRISE2_REPO: - from_secret: docker_enterprise2_repo - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_key - image: google/cloud-sdk - name: fetch-images-enterprise2 - volumes: - - name: docker - path: /var/run/docker.sock + GITHUB_TOKEN: + from_secret: github_token + image: grafana/ci-wix:0.1.1 + name: clone - commands: - - ./bin/build artifacts docker publish-enterprise2 --dockerhub-repo $${DOCKER_ENTERPRISE2_REPO} + - cp -r grafana-enterprise C:\App\grafana-enterprise + - rm -r -force grafana-enterprise + - cp grabpl.exe C:\App\grabpl.exe + - rm -force grabpl.exe + - C:\App\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\App\grafana-enterprise + ${DRONE_TAG} + - cp C:\App\grabpl.exe grabpl.exe depends_on: - - fetch-images-enterprise2 + - clone environment: - DOCKER_ENTERPRISE2_REPO: - from_secret: docker_enterprise2_repo - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_key_hg - image: google/cloud-sdk - name: publish-images-enterprise2 - volumes: - - name: docker - path: /var/run/docker.sock + GITHUB_TOKEN: + from_secret: github_token + image: grafana/ci-wix:0.1.1 + name: windows-init - commands: - - ./bin/build upload-packages --edition enterprise2 + - $$gcpKey = $$env:GCP_KEY + - '[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) + > gcpkey.json' + - dos2unix gcpkey.json + - gcloud auth activate-service-account --key-file=gcpkey.json + - rm gcpkey.json + - cp C:\App\nssm-2.24.zip . + - .\grabpl.exe windows-installer --edition enterprise ${DRONE_TAG} + - $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0] + - gsutil cp $$fname gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/enterprise/release/ + - gsutil cp "$$fname.sha256" gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/enterprise/release/ depends_on: - - package-enterprise2 + - windows-init environment: GCP_KEY: from_secret: gcp_key + GITHUB_TOKEN: + from_secret: github_token PRERELEASE_BUCKET: from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: upload-packages-enterprise2 + image: grafana/ci-wix:0.1.1 + name: build-windows-installer trigger: event: exclude: @@ -3549,14 +3130,8 @@ trigger: type: docker volumes: - host: - path: /var/run/docker.sock + path: //./pipe/docker_engine/ name: docker -- name: postgres - temp: - medium: memory -- name: mysql - temp: - medium: memory --- clone: disable: true @@ -3566,7 +3141,7 @@ environment: image_pull_secrets: - dockerconfigjson kind: pipeline -name: custom-release-enterprise2-build-e2e-publish +name: release-enterprise2-build-e2e-publish node: type: no-parallel platform: @@ -3576,7 +3151,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3587,7 +3162,7 @@ steps: - commands: - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - - git checkout ${DRONE_TARGET_BRANCH} + - git checkout ${DRONE_TAG} environment: GITHUB_TOKEN: from_secret: github_token @@ -3775,6 +3350,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key_hg + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-enterprise2 volumes: @@ -3793,7 +3374,13 @@ steps: name: upload-packages-enterprise2 trigger: event: - - custom + exclude: + - promote + ref: + exclude: + - refs/tags/*-cloud* + include: + - refs/tags/v* type: docker volumes: - host: @@ -3828,7 +3415,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3869,6 +3456,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-grafana/grafana volumes: @@ -3886,6 +3479,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-grafana/grafana-oss volumes: @@ -3924,7 +3523,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3965,6 +3564,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-grafana/grafana-enterprise volumes: @@ -4003,7 +3608,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -4044,6 +3649,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-grafana/grafana-enterprise volumes: @@ -4621,6 +4232,58 @@ volumes: clone: disable: true depends_on: [] +environment: + EDITION: oss +image_pull_secrets: +- dockerconfigjson +kind: pipeline +name: testing-oss-test-backend-windows +platform: + arch: amd64 + os: windows + version: "1809" +services: [] +steps: +- commands: + - git clone "https://$$env:GITHUB_TOKEN@github.com/$$env:DRONE_REPO.git" . + - git checkout -f $$env:DRONE_COMMIT + environment: + GITHUB_TOKEN: + from_secret: github_token + image: grafana/ci-wix:0.1.1 + name: clone +- commands: [] + depends_on: + - clone + image: grafana/grafana-ci-windows-test:0.1.0 + name: windows-init +- commands: + - go install github.com/google/wire/cmd/wire@v0.5.0 + - wire gen -tags oss ./pkg/server + depends_on: + - windows-init + image: grafana/grafana-ci-windows-test:0.1.0 + name: wire-install +- commands: + - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... + depends_on: + - wire-install + image: grafana/grafana-ci-windows-test:0.1.0 + name: test-backend +trigger: + event: + - promote + target: + - test-windows +type: docker +volumes: +- host: + path: //./pipe/docker_engine/ + name: docker +--- +clone: + disable: true +depends_on: [] environment: EDITION: enterprise image_pull_secrets: @@ -4636,7 +4299,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -4715,7 +4378,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -4994,7 +4657,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -5097,115 +4760,6 @@ environment: image_pull_secrets: - dockerconfigjson kind: pipeline -name: release-branch-oss-test-backend-windows -platform: - arch: amd64 - os: windows - version: "1809" -services: [] -steps: -- commands: [] - image: grafana/grafana-ci-windows-test:0.1.0 - name: windows-init -- commands: - - go install github.com/google/wire/cmd/wire@v0.5.0 - - wire gen -tags oss ./pkg/server - depends_on: - - windows-init - image: grafana/grafana-ci-windows-test:0.1.0 - name: wire-install -- commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - depends_on: - - wire-install - failure: ignore - image: grafana/grafana-ci-windows-test:0.1.0 - name: test-backend -trigger: - ref: - - refs/heads/v[0-9]* -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- -clone: - disable: true -depends_on: [] -environment: - EDITION: enterprise -image_pull_secrets: -- dockerconfigjson -kind: pipeline -name: release-branch-enterprise-test-backend-windows -platform: - arch: amd64 - os: windows - version: "1809" -services: [] -steps: -- commands: - - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe - -OutFile grabpl.exe - image: grafana/ci-wix:0.1.1 - name: grabpl -- commands: - - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - - cd grafana-enterprise - - git checkout $$env:DRONE_BRANCH - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/ci-wix:0.1.1 - name: clone -- commands: - - cp -r grafana-enterprise C:\App\grafana-enterprise - - rm -r -force grafana-enterprise - - cp grabpl.exe C:\App\grabpl.exe - - rm -force grabpl.exe - - C:\App\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\App\grafana-enterprise - $$env:DRONE_BRANCH - - cp C:\App\grabpl.exe grabpl.exe - depends_on: - - clone - environment: - GITHUB_TOKEN: - from_secret: github_token - image: grafana/ci-wix:0.1.1 - name: windows-init -- commands: - - go install github.com/google/wire/cmd/wire@v0.5.0 - - wire gen -tags enterprise ./pkg/server - depends_on: - - windows-init - image: grafana/grafana-ci-windows-test:0.1.0 - name: wire-install -- commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - depends_on: - - wire-install - failure: ignore - image: grafana/grafana-ci-windows-test:0.1.0 - name: test-backend -trigger: - ref: - - refs/heads/v[0-9]* -type: docker -volumes: -- host: - path: //./pipe/docker_engine/ - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- dockerconfigjson -kind: pipeline name: release-branch-oss-integration-tests node: type: no-parallel @@ -5236,7 +4790,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -5311,7 +4865,6 @@ clone: depends_on: - release-branch-oss-build-e2e-publish - release-branch-oss-test-frontend -- release-branch-oss-test-backend-windows environment: EDITION: oss image_pull_secrets: @@ -5330,7 +4883,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/windows/grabpl.exe -OutFile grabpl.exe image: grafana/ci-wix:0.1.1 name: windows-init @@ -5380,7 +4933,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -5672,7 +5225,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -5763,7 +5316,7 @@ steps: name: clone-enterprise - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -5876,7 +5429,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -6018,7 +5571,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/windows/grabpl.exe -OutFile grabpl.exe - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise @@ -6089,7 +5642,7 @@ services: [] steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -6289,6 +5842,12 @@ steps: from_secret: docker_username GCP_KEY: from_secret: gcp_key_hg + GITHUB_APP_ID: + from_secret: delivery-bot-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: delivery-bot-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: delivery-bot-app-private-key image: google/cloud-sdk name: publish-images-enterprise2 volumes: @@ -6358,7 +5917,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -6473,7 +6032,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.37/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -6926,7 +6485,25 @@ get: kind: secret name: enterprise2_security_prefix --- +get: + name: app-id + path: infra/data/ci/grafana-release-eng/grafana-delivery-bot +kind: secret +name: delivery-bot-app-id +--- +get: + name: app-installation-id + path: infra/data/ci/grafana-release-eng/grafana-delivery-bot +kind: secret +name: delivery-bot-app-installation-id +--- +get: + name: app-private-key + path: infra/data/ci/grafana-release-eng/grafana-delivery-bot +kind: secret +name: delivery-bot-app-private-key +--- kind: signature -hmac: 74d07313b535ea68d5cbc704b3bd0d88cb2a100b627fd34cf5c43fc5fb90d06e +hmac: 462fc8e153052bdb786a26a31e1f5884cf9ad55999da14e7f5db315568c7f882 ... \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5b3546d204f9..ab6368eb9e1e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -218,13 +218,6 @@ WORKFLOW.md @torkelo /packaging/ @DanCech -# Backend code, developers environment -/devenv/docker/blocks/auth @grafana/grafana-authnz-team - -# Logs code, developers environment -/devenv/docker/blocks/loki* @grafana/observability-logs -/devenv/docker/blocks/elastic* @grafana/observability-logs - # Continuous Integration .drone.yml @grafana/grafana-delivery .drone.star @grafana/grafana-delivery diff --git a/CHANGELOG.md b/CHANGELOG.md index 227e9dcaaf98..9ed7b6678117 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,11 @@ - **Tooltips:** Make tooltips in FormField and FormLabel interactive and keyboard friendly. [#57706](https://github.com/grafana/grafana/pull/57706), [@asimpson](https://github.com/asimpson) + + +# 9.2.18 (2023-05-08) + + # 9.2.4 (2022-11-07) diff --git a/docs/sources/visualizations/configure-legend/index.md b/docs/sources/visualizations/configure-legend/index.md index 9ff1cf0f8824..6694068f96e9 100644 --- a/docs/sources/visualizations/configure-legend/index.md +++ b/docs/sources/visualizations/configure-legend/index.md @@ -1,17 +1,9 @@ --- aliases: -<<<<<<<< HEAD:docs/sources/visualizations/configure-legend/index.md - - /docs/grafana/latest/panels/working-with-panels/configure-legend/ - - /docs/grafana/latest/visualizations/configure-legend/ - - /docs/grafana/latest/panels-visualizations/visualizations/configure-legend/ -title: Configure a legend -weight: 1300 -======== - ../panels/working-with-panels/configure-legend/ - visualizations/configure-legend/ title: Configure a legend weight: 400 ->>>>>>>> release-9.2.18:docs/sources/panels-visualizations/configure-legend/index.md --- # Configure a legend @@ -38,12 +30,12 @@ When you apply your changes, the visualization changes appear to all users of th This topic currently applies to the following visualizations: -- [Bar chart]({{< relref "../bar-chart/" >}}) -- [Histogram]({{< relref "../histogram/" >}}) -- [Pie chart]({{< relref "../pie-chart/" >}}) -- [State timeline]({{< relref "../state-timeline/" >}}) -- [Status history]({{< relref "../status-history/" >}}) -- [Time series]({{< relref "../time-series/" >}}) +- [Bar chart]({{< relref "../visualizations/bar-chart/" >}}) +- [Histogram]({{< relref "../visualizations/histogram/" >}}) +- [Pie chart]({{< relref "../visualizations/pie-chart/" >}}) +- [State timeline]({{< relref "../visualizations/state-timeline/" >}}) +- [Status history]({{< relref "../visualizations/status-history/" >}}) +- [Time series]({{< relref "../visualizations/time-series/" >}}) ## Add values to a legend @@ -75,10 +67,10 @@ By default, Grafana specifies the color of your series data, which you can chang ## Sort series -You can change legend mode to **Table** and choose [calculations]({{< relref "../../calculation-types/" >}}) to be displayed in the legend. Click the calculation name header in the legend table to sort the values in the table in ascending or descending order. - -The sort order affects the positions of the bars in the Bar chart panel as well as the order of stacked series in the Time series and Bar chart panels. +You can change legend mode to **Table** and choose [calculations]({{< relref "../calculation-types/" >}}) to be displayed in the legend. Click the calculation name header in the legend table to sort the values in the table in ascending or descending order. -> **Note:** This feature is only supported in these panels: Bar chart, Histogram, Time series, XY Chart. +{{% admonition type="note" %}} +This feature is only supported in these panels: Bar chart, Histogram, Time series. +{{% /admonition %}} ![Sort legend series](/static/img/docs/legend/legend-series-sort-8-3.png). diff --git a/lerna.json b/lerna.json index ac8b674f6956..2a3f41c963a5 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "npmClient": "yarn", "useWorkspaces": true, "packages": ["packages/*"], - "version": "9.2.18" + "version": "9.2.20" } diff --git a/package.json b/package.json index 05d2bcea0e0b..11a3fe2d426c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "license": "AGPL-3.0-only", "private": true, "name": "grafana", - "version": "9.2.18", + "version": "9.2.20", "repository": "github:grafana/grafana", "scripts": { "api-tests": "jest --notify --watch --config=devenv/e2e-api-tests/jest.js", diff --git a/packages/grafana-data/package.json b/packages/grafana-data/package.json index e9b3e64ed82a..37140f90b1c2 100644 --- a/packages/grafana-data/package.json +++ b/packages/grafana-data/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/data", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana Data Library", "keywords": [ "typescript" @@ -34,7 +34,7 @@ }, "dependencies": { "@braintree/sanitize-url": "6.0.0", - "@grafana/schema": "9.2.18", + "@grafana/schema": "9.2.20", "@types/d3-interpolate": "^1.4.0", "d3-interpolate": "1.4.0", "date-fns": "2.29.1", diff --git a/packages/grafana-e2e-selectors/package.json b/packages/grafana-e2e-selectors/package.json index 8eb70eba0956..b4443ecd391b 100644 --- a/packages/grafana-e2e-selectors/package.json +++ b/packages/grafana-e2e-selectors/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/e2e-selectors", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana End-to-End Test Selectors Library", "keywords": [ "cli", diff --git a/packages/grafana-e2e/package.json b/packages/grafana-e2e/package.json index 73ca699b2333..60da7f3a734e 100644 --- a/packages/grafana-e2e/package.json +++ b/packages/grafana-e2e/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/e2e", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana End-to-End Test Library", "keywords": [ "cli", @@ -61,7 +61,7 @@ "@babel/core": "7.19.0", "@babel/preset-env": "7.19.0", "@cypress/webpack-preprocessor": "5.12.0", - "@grafana/e2e-selectors": "9.2.18", + "@grafana/e2e-selectors": "9.2.20", "@grafana/tsconfig": "^1.2.0-rc1", "@mochajs/json-file-reporter": "^1.2.0", "babel-loader": "8.2.5", diff --git a/packages/grafana-runtime/package.json b/packages/grafana-runtime/package.json index 0936d23a933f..9a45b559949f 100644 --- a/packages/grafana-runtime/package.json +++ b/packages/grafana-runtime/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/runtime", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana Runtime Library", "keywords": [ "grafana", @@ -36,9 +36,9 @@ }, "dependencies": { "@grafana/agent-web": "^0.4.0", - "@grafana/data": "9.2.18", - "@grafana/e2e-selectors": "9.2.18", - "@grafana/ui": "9.2.18", + "@grafana/data": "9.2.20", + "@grafana/e2e-selectors": "9.2.20", + "@grafana/ui": "9.2.20", "@sentry/browser": "6.19.7", "history": "4.10.1", "lodash": "4.17.21", diff --git a/packages/grafana-schema/package.json b/packages/grafana-schema/package.json index 2b265ef9864d..2548dac5f4ec 100644 --- a/packages/grafana-schema/package.json +++ b/packages/grafana-schema/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/schema", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana Schema Library", "keywords": [ "typescript" diff --git a/packages/grafana-toolkit/package.json b/packages/grafana-toolkit/package.json index 9d867393ce0b..02072d8d30d3 100644 --- a/packages/grafana-toolkit/package.json +++ b/packages/grafana-toolkit/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/toolkit", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana Toolkit", "keywords": [ "grafana", @@ -50,10 +50,10 @@ "@babel/preset-env": "7.18.9", "@babel/preset-react": "7.18.6", "@babel/preset-typescript": "7.18.6", - "@grafana/data": "9.2.18", + "@grafana/data": "9.2.20", "@grafana/eslint-config": "5.0.0", "@grafana/tsconfig": "^1.2.0-rc1", - "@grafana/ui": "9.2.18", + "@grafana/ui": "9.2.20", "@jest/core": "27.5.1", "@types/command-exists": "^1.2.0", "@types/eslint": "8.4.1", diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index 549ec6cee170..d6d98806119d 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/ui", - "version": "9.2.18", + "version": "9.2.20", "description": "Grafana Components Library", "keywords": [ "grafana", @@ -47,9 +47,9 @@ "dependencies": { "@emotion/css": "11.9.0", "@emotion/react": "11.9.3", - "@grafana/data": "9.2.18", - "@grafana/e2e-selectors": "9.2.18", - "@grafana/schema": "9.2.18", + "@grafana/data": "9.2.20", + "@grafana/e2e-selectors": "9.2.20", + "@grafana/schema": "9.2.20", "@monaco-editor/react": "4.4.5", "@popperjs/core": "2.11.5", "@react-aria/button": "3.6.1", diff --git a/packages/jaeger-ui-components/package.json b/packages/jaeger-ui-components/package.json index f15967054066..51692772d081 100644 --- a/packages/jaeger-ui-components/package.json +++ b/packages/jaeger-ui-components/package.json @@ -1,6 +1,6 @@ { "name": "@jaegertracing/jaeger-ui-components", - "version": "9.2.18", + "version": "9.2.20", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ }, "dependencies": { "@emotion/css": "11.9.0", - "@grafana/data": "9.2.18", - "@grafana/e2e-selectors": "9.2.18", - "@grafana/runtime": "9.2.18", - "@grafana/ui": "9.2.18", + "@grafana/data": "9.2.20", + "@grafana/e2e-selectors": "9.2.20", + "@grafana/runtime": "9.2.20", + "@grafana/ui": "9.2.20", "chance": "^1.0.10", "classnames": "^2.2.5", "combokeys": "^3.0.0", diff --git a/pkg/api/login_oauth.go b/pkg/api/login_oauth.go index 44692eea894d..13c2f4c4bc07 100644 --- a/pkg/api/login_oauth.go +++ b/pkg/api/login_oauth.go @@ -302,16 +302,17 @@ func (hs *HTTPServer) SyncUser( connect social.SocialConnector, ) (*user.User, error) { oauthLogger.Debug("Syncing Grafana user with corresponding OAuth profile") + lookupParams := models.UserLookupParams{} + if hs.Cfg.OAuthAllowInsecureEmailLookup { + lookupParams.Email = &extUser.Email + } + // add/update user in Grafana cmd := &models.UpsertUserCommand{ - ReqContext: ctx, - ExternalUser: extUser, - SignupAllowed: connect.IsSignupAllowed(), - UserLookupParams: models.UserLookupParams{ - Email: &extUser.Email, - UserID: nil, - Login: nil, - }, + ReqContext: ctx, + ExternalUser: extUser, + SignupAllowed: connect.IsSignupAllowed(), + UserLookupParams: lookupParams, } if err := hs.Login.UpsertUser(ctx.Req.Context(), cmd); err != nil { diff --git a/pkg/build/packaging/deb.go b/pkg/build/packaging/deb.go index 1781b345fff5..094207b02701 100644 --- a/pkg/build/packaging/deb.go +++ b/pkg/build/packaging/deb.go @@ -170,7 +170,11 @@ func UpdateDebRepo(cfg PublishConfig, workDir string) error { return cli.Exit(fmt.Sprintf("failed to update Debian %q repository: %s", tp, output), 1) } } + + // Update database in GCS + u = fmt.Sprintf("gs://%s/%s", cfg.DebDBBucket, strings.ToLower(string(cfg.Edition))) if cfg.DryRun { + log.Printf("Simulating upload of Debian repo database to GCS (%s)\n", u) } else { log.Printf("Uploading Debian repo database to GCS (%s)...\n", u) //nolint:gosec diff --git a/pkg/services/alerting/store_test.go b/pkg/services/alerting/store_test.go index 0d04c52f55cc..21364aa9c8a0 100644 --- a/pkg/services/alerting/store_test.go +++ b/pkg/services/alerting/store_test.go @@ -160,7 +160,6 @@ func TestIntegrationAlertingDataAccess(t *testing.T) { t.Run("Viewer can read alerts", func(t *testing.T) { setup(t) - // @Percona TODO: ??? viewerUser := &user.SignedInUser{OrgRole: org.RoleViewer, OrgID: 1} alertQuery := models.GetAlertsQuery{DashboardIDs: []int64{testDash.Id}, PanelId: 1, OrgId: 1, User: viewerUser} err2 := store.HandleAlertsQuery(context.Background(), &alertQuery) diff --git a/pkg/services/ngalert/api/authorization.go b/pkg/services/ngalert/api/authorization.go index 49e95481c28e..afc58f8034e6 100644 --- a/pkg/services/ngalert/api/authorization.go +++ b/pkg/services/ngalert/api/authorization.go @@ -158,7 +158,7 @@ func (api *API) authorize(method, path string) web.Handler { eval = ac.EvalPermission(ac.ActionAlertingNotificationsRead) case http.MethodPost + "/api/alertmanager/grafana/config/api/v1/receivers/test": fallback = middleware.ReqEditorRole - eval = ac.EvalPermission(ac.ActionAlertingNotificationsRead) + eval = ac.EvalPermission(ac.ActionAlertingNotificationsWrite) // External Alertmanager Paths case http.MethodDelete + "/api/alertmanager/{DatasourceUID}/config/api/v1/alerts": diff --git a/pkg/services/ngalert/api/tooling/api.json b/pkg/services/ngalert/api/tooling/api.json index 3ba09a98fc6e..0a7fe10c2d5c 100644 --- a/pkg/services/ngalert/api/tooling/api.json +++ b/pkg/services/ngalert/api/tooling/api.json @@ -187,6 +187,9 @@ "AlertStateType": { "type": "string" }, + "AlertStateType": { + "type": "string" + }, "AlertingRule": { "description": "adapted from cortex", "properties": { @@ -3645,6 +3648,37 @@ ], "type": "object" }, + "integration": { + "description": "Integration integration", + "properties": { + "lastNotifyAttempt": { + "description": "A timestamp indicating the last attempt to deliver a notification regardless of the outcome.\nFormat: date-time", + "format": "date-time", + "type": "string" + }, + "lastNotifyAttemptDuration": { + "description": "Duration of the last attempt to deliver a notification in humanized format (`1s` or `15ms`, etc).", + "type": "string" + }, + "lastNotifyAttemptError": { + "description": "Error string for the last attempt to deliver a notification. Empty if the last attempt was successful.", + "type": "string" + }, + "name": { + "description": "name", + "type": "string" + }, + "sendResolved": { + "description": "send resolved", + "type": "boolean" + } + }, + "required": [ + "name", + "sendResolved" + ], + "type": "object" + }, "labelSet": { "additionalProperties": { "type": "string" diff --git a/pkg/services/ngalert/api/tooling/post.json b/pkg/services/ngalert/api/tooling/post.json index 57e26c180347..c8a336a9e75e 100644 --- a/pkg/services/ngalert/api/tooling/post.json +++ b/pkg/services/ngalert/api/tooling/post.json @@ -187,6 +187,9 @@ "AlertStateType": { "type": "string" }, + "AlertStateType": { + "type": "string" + }, "AlertingRule": { "description": "adapted from cortex", "properties": { diff --git a/pkg/services/ngalert/api/tooling/spec.json b/pkg/services/ngalert/api/tooling/spec.json index b7d863844479..9c6a7d3dc5b4 100644 --- a/pkg/services/ngalert/api/tooling/spec.json +++ b/pkg/services/ngalert/api/tooling/spec.json @@ -3289,6 +3289,9 @@ "AlertStateType": { "type": "string" }, + "AlertStateType": { + "type": "string" + }, "AlertingRule": { "description": "adapted from cortex", "type": "object", diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 20e8f78a2f55..03aa5c17d868 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -318,7 +318,8 @@ type Cfg struct { AuthProxySyncTTL int // OAuth - OAuthCookieMaxAge int + OAuthCookieMaxAge int + OAuthAllowInsecureEmailLookup bool // JWT Auth JWTAuthEnabled bool @@ -1305,6 +1306,8 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) { return err } + cfg.OAuthAllowInsecureEmailLookup = auth.Key("oauth_allow_insecure_email_lookup").MustBool(false) + const defaultMaxLifetime = "30d" maxLifetimeDurationVal := valueAsString(auth, "login_maximum_lifetime_duration", defaultMaxLifetime) cfg.LoginMaxLifetime, err = gtime.ParseDuration(maxLifetimeDurationVal) diff --git a/plugins-bundled/internal/input-datasource/package.json b/plugins-bundled/internal/input-datasource/package.json index eafc010c24a3..9ec1aa629b4e 100644 --- a/plugins-bundled/internal/input-datasource/package.json +++ b/plugins-bundled/internal/input-datasource/package.json @@ -1,6 +1,6 @@ { "name": "@grafana-plugins/input-datasource", - "version": "9.2.18", + "version": "9.2.20", "description": "Input Datasource", "private": true, "repository": { @@ -15,15 +15,15 @@ }, "author": "Grafana Labs", "devDependencies": { - "@grafana/toolkit": "9.2.18", + "@grafana/toolkit": "9.2.20", "@types/jest": "26.0.15", "@types/lodash": "4.14.149", "@types/react": "17.0.30", "lodash": "4.17.21" }, "dependencies": { - "@grafana/data": "9.2.18", - "@grafana/ui": "9.2.18", + "@grafana/data": "9.2.20", + "@grafana/ui": "9.2.20", "jquery": "3.5.1", "react": "17.0.1", "react-dom": "17.0.1", diff --git a/public/api-merged.json b/public/api-merged.json index 8f5f60e3f494..afde593da62c 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -26,25 +26,25 @@ }, "basePath": "/api", "paths": { - "/admin/ldap/reload": { - "post": { - "security": [ + "/access-control/roles": { + "get": { + "description": "Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in.\n\nYou need to have a permission with action `roles:read` and scope `roles:*`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get all roles.", + "operationId": "listRoles", + "parameters": [ { - "basic": [] + "type": "boolean", + "name": "delegatable", + "in": "query" } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", - "tags": [ - "admin_ldap" - ], - "summary": "Reloads the LDAP configuration.", - "operationId": "reloadLDAPCfg", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/listRolesResponse" }, "403": { "$ref": "#/responses/forbiddenError" @@ -53,27 +53,31 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/status": { - "get": { - "security": [ + }, + "post": { + "description": "Creates a new custom role and maps given permissions to that role. Note that roles with the same prefix as Fixed Roles can’t be created.\n\nYou need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.\nFor example, if a user does not have required permissions for creating users, they won’t be able to create a custom role which allows to do that. This is done to prevent escalation of privileges.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Create a new custom role.", + "operationId": "createRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRoleForm" + } } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", - "tags": [ - "admin_ldap" - ], - "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", - "operationId": "getLDAPStatus", "responses": { - "200": { - "$ref": "#/responses/okResponse" + "201": { + "$ref": "#/responses/createRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -84,61 +88,99 @@ } } }, - "/admin/ldap/sync/{user_id}": { - "post": { - "security": [ + "/access-control/roles/{roleUID}": { + "get": { + "description": "Get a role for the given UID.\n\nYou need to have a permission with action `roles:read` and scope `roles:*`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get a role.", + "operationId": "getRole", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", + "responses": { + "200": { + "$ref": "#/responses/getRoleResponse" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "You need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", "tags": [ - "admin_ldap" + "access_control", + "enterprise" ], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "postSyncUserWithLDAP", + "summary": "Update a custom role.", + "operationId": "updateRole", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateRoleCommand" + } + }, + { + "type": "string", + "name": "roleUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/{user_name}": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", + }, + "delete": { + "description": "Delete a role with the given UID, and it’s permissions. If the role is assigned to a built-in role, the deletion operation will fail, unless force query param is set to true, and in that case all assignments will also be deleted.\n\nYou need to have a permission with action `roles:delete` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only delete a custom role with the same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to delete a custom role which allows to do that.", "tags": [ - "admin_ldap" + "access_control", + "enterprise" ], - "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", - "operationId": "getUserFromLDAP", + "summary": "Delete a custom role.", + "operationId": "deleteRole", "parameters": [ + { + "type": "boolean", + "name": "force", + "in": "query" + }, + { + "type": "boolean", + "name": "global", + "in": "query" + }, { "type": "string", - "name": "user_name", + "name": "roleUID", "in": "path", "required": true } @@ -147,8 +189,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -159,121 +201,127 @@ } } }, - "/admin/pause-all-alerts": { - "post": { - "security": [ - { - "basic": [] - } - ], + "/access-control/roles/{roleUID}/assignments": { + "get": { + "description": "Get role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:list` and scope `teams:id:*` and `users.roles:list` and scope `users:id:*`.", "tags": [ - "admin" + "access_control", + "enterprise" ], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "summary": "Get role assignments.", + "operationId": "getRoleAssignments", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" - } + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/dashboards/reload": { - "post": { - "security": [ + }, + "put": { + "description": "Set role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate`, and `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Set role assignments.", + "operationId": "setRoleAssignments", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SetRoleAssignmentsCommand" + } } ], - "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", - "tags": [ - "admin_provisioning" - ], - "summary": "Reload dashboard provisioning configurations.", - "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/setRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/datasources/reload": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", + "/access-control/status": { + "get": { + "description": "Returns an indicator to check if fine-grained access control is enabled or not.\n\nYou need to have a permission with action `status:accesscontrol` and scope `services:accesscontrol`.", "tags": [ - "admin_provisioning" + "access_control", + "enterprise" ], - "summary": "Reload datasource provisioning configurations.", - "operationId": "adminProvisioningReloadDatasources", + "summary": "Get status.", + "operationId": "getAccessControlStatus", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getAccessControlStatusResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/notifications/reload": { - "post": { - "security": [ + "/access-control/teams/{teamId}/roles": { + "get": { + "description": "You need to have a permission with action `teams.roles:read` and scope `teams:id:\u003cteam ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get team roles.", + "operationId": "listTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", - "tags": [ - "admin_provisioning" - ], - "summary": "Reload legacy alert notifier provisioning configurations.", - "operationId": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -282,150 +330,226 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/plugins/reload": { - "post": { - "security": [ + }, + "put": { + "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate` for each.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Update team role.", + "operationId": "setTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", - "tags": [ - "admin_provisioning" - ], - "summary": "Reload plugin provisioning configurations.", - "operationId": "adminProvisioningReloadPlugins", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/settings": { - "get": { - "security": [ + }, + "post": { + "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Add team role.", + "operationId": "addTeamRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTeamRoleCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", - "tags": [ - "admin" - ], - "summary": "Fetch settings.", - "operationId": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/adminGetSettingsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/admin/stats": { - "get": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", + "/access-control/teams/{teamId}/roles/{roleUID}": { + "delete": { + "description": "You need to have a permission with action `teams.roles:remove` and scope `permissions:type:delegate`.", "tags": [ - "admin" + "access_control", + "enterprise" + ], + "summary": "Remove team role.", + "operationId": "removeTeamRole", + "parameters": [ + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } ], - "summary": "Fetch Grafana Stats.", - "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/adminGetStatsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users": { - "post": { - "security": [ + "/access-control/users/{userId}/roles": { + "get": { + "description": "Lists the roles that have been directly assigned to a given user. The list does not include built-in roles (Viewer, Editor, Admin or Grafana Admin), and it does not include roles that have been inherited from a team.\n\nYou need to have a permission with action `users.roles:read` and scope `users:id:\u003cuser ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "List roles assigned to a user.", + "operationId": "listUserRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", + "responses": { + "200": { + "$ref": "#/responses/getAllRolesResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Update the user’s role assignments to match the provided set of UIDs. This will remove any assigned roles that aren’t in the request and add roles that are in the set but are not already assigned to the user.\nIf you want to add or remove a single role, consider using Add a user role assignment or Remove a user role assignment instead.\n\nYou need to have a permission with action `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate` for each. `permissions:type:delegate` scope ensures that users can only assign or unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign or unassign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Create new user.", - "operationId": "adminCreateUser", + "summary": "Set user role assignments.", + "operationId": "setUserRoles", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/SetUserRolesCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminCreateUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}": { - "delete": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global.users:*`.", + }, + "post": { + "description": "Assign a role to a specific user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:add` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only assign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Delete global User.", - "operationId": "adminDeleteUser", + "summary": "Add a user role assignment.", + "operationId": "addUserRole", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddUserRoleCommand" + } + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -434,9 +558,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -449,31 +570,66 @@ } } }, - "/admin/users/{user_id}/auth-tokens": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global.users:*`.", + "/access-control/users/{userId}/roles/{roleUID}": { + "delete": { + "description": "Revoke a role from a user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:remove` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to unassign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "adminGetUserAuthTokens", + "summary": "Remove a user role assignment.", + "operationId": "removeUserRole", "parameters": [ + { + "type": "boolean", + "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", + "name": "global", + "in": "query" + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminGetUserAuthTokensResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/ldap-sync-status": { + "get": { + "description": "You need to have a permission with action `ldap.status:read`.", + "tags": [ + "ldap_debug" + ], + "summary": "Returns the current state of the LDAP background sync integration.", + "operationId": "getSyncStatus", + "responses": { + "200": { + "$ref": "#/responses/getSyncStatusResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -487,28 +643,19 @@ } } }, - "/admin/users/{user_id}/disable": { + "/admin/ldap/reload": { "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global.users:1` (userIDScope).", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", "tags": [ - "admin_users" - ], - "summary": "Disable user.", - "operationId": "adminDisableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_ldap" ], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAPCfg", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -519,37 +666,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/enable": { - "post": { + "/admin/ldap/status": { + "get": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global.users:1` (userIDScope).", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", "tags": [ - "admin_users" - ], - "summary": "Enable user.", - "operationId": "adminEnableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_ldap" ], + "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", + "operationId": "getLDAPStatus", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -560,28 +695,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/logout": { + "/admin/ldap/sync/{user_id}": { "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global.users:*`.", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", "tags": [ - "admin_users" + "admin_ldap" ], - "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", - "operationId": "adminLogoutUser", + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "postSyncUserWithLDAP", "parameters": [ { "type": "integer", @@ -595,50 +727,35 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/password": { - "put": { + "/admin/ldap/{user_name}": { + "get": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global.users:*`.", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", "tags": [ - "admin_users" + "admin_ldap" ], - "summary": "Set password for user.", - "operationId": "adminUpdateUserPassword", + "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", + "operationId": "getUserFromLDAP", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "user_name", "in": "path", "required": true } @@ -647,9 +764,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -662,37 +776,31 @@ } } }, - "/admin/users/{user_id}/permissions": { - "put": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global.users:*`.", + "/admin/pause-all-alerts": { + "post": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "admin_users" + "admin" ], - "summary": "Set permissions for user.", - "operationId": "adminUpdateUserPermissions", + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + "$ref": "#/definitions/PauseAllAlertsCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/pauseAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -706,31 +814,43 @@ } } }, - "/admin/users/{user_id}/quotas": { - "get": { + "/admin/provisioning/access-control/reload": { + "post": { + "tags": [ + "access_control_provisioning", + "enterprise" + ], + "summary": "You need to have a permission with action `provisioning:reload` with scope `provisioners:accesscontrol`.", + "operationId": "adminProvisioningReloadAccessControl", + "responses": { + "202": { + "$ref": "#/responses/acceptedResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + } + } + } + }, + "/admin/provisioning/dashboards/reload": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global.users:1` (userIDScope).", + "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", "tags": [ - "admin_users" - ], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload dashboard provisioning configurations.", + "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -738,51 +858,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/quotas/{quota_target}": { - "put": { + "/admin/provisioning/datasources/reload": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global.users:1` (userIDScope).", + "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", "tags": [ - "admin_users" - ], - "summary": "Update user quota.", - "operationId": "updateUserQuota", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload datasource provisioning configurations.", + "operationId": "adminProvisioningReloadDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -793,78 +887,57 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/revoke-auth-token": { + "/admin/provisioning/notifications/reload": { "post": { "security": [ { "basic": [] } ], - "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global.users:*`.", + "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", "tags": [ - "admin_users" - ], - "summary": "Revoke auth token for user.", - "operationId": "adminRevokeUserAuthToken", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload legacy alert notifier provisioning configurations.", + "operationId": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications": { - "get": { - "description": "Returns all notification channels that the authenticated user has permission to view.", + "/admin/provisioning/plugins/reload": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_provisioning" ], - "summary": "Get all notification channels.", - "operationId": "getAlertNotificationChannels", + "summary": "Reload plugin provisioning configurations.", + "operationId": "adminProvisioningReloadPlugins", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -876,54 +949,45 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Create notification channel.", - "operationId": "createAlertNotificationChannel", - "parameters": [ + } + }, + "/admin/settings": { + "get": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" - } + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", + "tags": [ + "admin" + ], + "summary": "Fetch settings.", + "operationId": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/adminGetSettingsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications/lookup": { + "/admin/stats": { "get": { - "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", "tags": [ - "legacy_alerts_notification_channels" + "admin" ], - "summary": "Get all notification channels (lookup).", - "operationId": "getAlertNotificationLookup", + "summary": "Fetch Grafana Stats.", + "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" + "$ref": "#/responses/adminGetStatsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -937,27 +1001,32 @@ } } }, - "/alert-notifications/test": { + "/admin/users": { "post": { - "description": "Sends a test notification to the channel.", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "summary": "Create new user.", + "operationId": "adminCreateUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/NotificationTestCommand" + "$ref": "#/definitions/AdminCreateUserForm" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminCreateUserResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -969,7 +1038,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -977,25 +1046,31 @@ } } }, - "/alert-notifications/uid/{notification_channel_uid}": { - "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": [ - "legacy_alerts_notification_channels" + "/admin/users/{user_id}": { + "delete": { + "security": [ + { + "basic": [] + } ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global.users:*`.", + "tags": [ + "admin_users" + ], + "summary": "Delete global User.", + "operationId": "adminDeleteUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1010,33 +1085,71 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", + } + }, + "/admin/users/{user_id}/auth-tokens": { + "get": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelByUID", + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "adminGetUserAuthTokens", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/adminGetUserAuthTokensResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/disable": { + "post": { + "security": [ { - "type": "string", - "name": "notification_channel_uid", + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global.users:1` (userIDScope).", + "tags": [ + "admin_users" + ], + "summary": "Disable user.", + "operationId": "adminDisableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1051,25 +1164,33 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by UID.", + } + }, + "/admin/users/{user_id}/enable": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global.users:1` (userIDScope).", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", + "summary": "Enable user.", + "operationId": "adminEnableUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1086,26 +1207,34 @@ } } }, - "/alert-notifications/{notification_channel_id}": { - "get": { - "description": "Returns the notification channel given the notification channel ID.", + "/admin/users/{user_id}/logout": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", + "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", + "operationId": "adminLogoutUser", "parameters": [ { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1120,34 +1249,44 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/admin/users/{user_id}/password": { "put": { - "description": "Updates an existing notification channel identified by ID.", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", + "summary": "Set password for user.", + "operationId": "adminUpdateUserPassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" + "$ref": "#/definitions/AdminUpdateUserPasswordForm" } }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1155,26 +1294,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by ID.", + } + }, + "/admin/users/{user_id}/permissions": { + "put": { + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", + "summary": "Set permissions for user.", + "operationId": "adminUpdateUserPermissions", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + } + }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } @@ -1183,170 +1329,221 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts": { + "/admin/users/{user_id}/quotas": { "get": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global.users:1` (userIDScope).", "tags": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", + "summary": "Fetch user quota.", + "operationId": "getUserQuota", "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" - }, { "type": "integer", "format": "int64", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getQuotaResponse" }, - { - "type": "string", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "enum": [ - "all", - "no_data", - "paused", - "alerting", - "ok", - "pending", - "unknown" - ], - "type": "string", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/quotas/{quota_target}": { + "put": { + "security": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "in": "query" + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global.users:1` (userIDScope).", + "tags": [ + "admin_users" + ], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } }, { "type": "string", - "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", - "name": "dashboardQuery", - "in": "query" + "name": "quota_target", + "in": "path", + "required": true }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", - "name": "dashboardTag", - "in": "query" + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/states-for-dashboard": { - "get": { + "/admin/users/{user_id}/revoke-auth-token": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global.users:*`.", "tags": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", + "summary": "Revoke auth token for user.", + "operationId": "adminRevokeUserAuthToken", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, { "type": "integer", "format": "int64", - "name": "dashboardId", - "in": "query", + "name": "user_id", + "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardStatesResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/test": { + "/alert-notifications": { + "get": { + "description": "Returns all notification channels that the authenticated user has permission to view.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Get all notification channels.", + "operationId": "getAlertNotificationChannels", + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, "post": { + "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", "tags": [ - "legacy_alerts" + "legacy_alerts_notification_channels" ], - "summary": "Test alert.", - "operationId": "testAlert", + "summary": "Create notification channel.", + "operationId": "createAlertNotificationChannel", "parameters": [ { "name": "body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/AlertTestCommand" + "$ref": "#/definitions/CreateAlertNotificationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/testAlertResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1354,61 +1551,54 @@ } } }, - "/alerts/{alert_id}": { + "/alert-notifications/lookup": { "get": { - "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", + "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", "tags": [ - "legacy_alerts" - ], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", - "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - } + "legacy_alerts_notification_channels" ], + "summary": "Get all notification channels (lookup).", + "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/getAlertResponse" + "$ref": "#/responses/getAlertNotificationLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/{alert_id}/pause": { + "/alert-notifications/test": { "post": { + "description": "Sends a test notification to the channel.", "tags": [ - "legacy_alerts" + "legacy_alerts_notification_channels" ], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAlertCommand" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1416,8 +1606,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1425,169 +1615,66 @@ } } }, - "/annotations": { + "/alert-notifications/uid/{notification_channel_uid}": { "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "description": "Returns the notification channel given the notification channel UID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Find Annotations.", - "operationId": "getAnnotations", + "summary": "Get notification channel by UID.", + "operationId": "getAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "in": "query" - }, - { - "type": "string", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardUID", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific panel", - "name": "panelId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Use this to filter organization annotations. Organization annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", - "name": "tags", - "in": "query" - }, - { - "enum": [ - "alert", - "annotation" - ], - "type": "string", - "description": "Return alerts or user created annotations", - "name": "type", - "in": "query" - }, - { - "type": "boolean", - "description": "Match any or all tags", - "name": "matchAny", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAnnotationsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then an organization annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", + "put": { + "description": "Updates an existing notification channel identified by uid.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Create Annotation.", - "operationId": "postAnnotation", + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelByUID", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/graphite": { - "post": { - "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", - "tags": [ - "annotations" - ], - "summary": "Create Annotation in Graphite format.", - "operationId": "postGraphiteAnnotation", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1595,134 +1682,110 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/mass-delete": { - "post": { - "tags": [ - "annotations" - ], - "summary": "Delete multiple annotations.", - "operationId": "massDeleteAnnotations", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MassDeleteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/tags": { - "get": { - "description": "Find all the event tags created in the annotations.", + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Find Annotations Tags.", - "operationId": "getAnnotationTags", + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", "parameters": [ { "type": "string", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" - }, - { - "type": "string", - "default": "100", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationTagsResponse" + "$ref": "#/responses/deleteAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/annotations/{annotation_id}": { + "/alert-notifications/{notification_channel_id}": { "get": { + "description": "Returns the notification channel given the notification channel ID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Get Annotation by ID.", - "operationId": "getAnnotationByID", + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", "parameters": [ { - "type": "string", - "name": "annotation_id", + "type": "integer", + "format": "int64", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationByIDResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "put": { - "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + "description": "Updates an existing notification channel identified by ID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Update Annotation.", - "operationId": "updateAnnotation", + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", "parameters": [ - { - "type": "string", - "name": "annotation_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAnnotationsCmd" + "$ref": "#/definitions/UpdateAlertNotificationCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1730,22 +1793,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Deletes the annotation that matches the specified ID.", + "description": "Deletes an existing notification channel identified by ID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Delete Annotation By ID.", - "operationId": "deleteAnnotationByID", + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", "parameters": [ { - "type": "string", - "name": "annotation_id", + "type": "integer", + "format": "int64", + "name": "notification_channel_id", "in": "path", "required": true } @@ -1760,22 +1827,211 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", + } + }, + "/alerts": { + "get": { "tags": [ - "annotations" + "legacy_alerts" ], - "summary": "Patch Annotation.", - "operationId": "patchAnnotation", - "parameters": [ + "summary": "Get legacy alerts.", + "operationId": "getAlerts", + "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to alert for a specified panel on a dashboard.", + "name": "panelId", + "in": "query" + }, { "type": "string", - "name": "annotation_id", + "description": "Limit response to alerts having a name like this value.", + "name": "query", + "in": "query" + }, + { + "enum": [ + "all", + "no_data", + "paused", + "alerting", + "ok", + "pending", + "unknown" + ], + "type": "string", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to X number of alerts.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", + "in": "query" + }, + { + "type": "string", + "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", + "name": "dashboardQuery", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", + "name": "dashboardTag", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/states-for-dashboard": { + "get": { + "tags": [ + "legacy_alerts" + ], + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "dashboardId", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardStatesResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/test": { + "post": { + "tags": [ + "legacy_alerts" + ], + "summary": "Test alert.", + "operationId": "testAlert", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertTestCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/testAlertResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/{alert_id}": { + "get": { + "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", + "tags": [ + "legacy_alerts" + ], + "summary": "Get alert by ID.", + "operationId": "getAlertByID", + "parameters": [ + { + "type": "string", + "name": "alert_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/{alert_id}/pause": { + "post": { + "tags": [ + "legacy_alerts" + ], + "summary": "Pause/unpause alert by id.", + "operationId": "pauseAlert", + "parameters": [ + { + "type": "string", + "name": "alert_id", "in": "path", "required": true }, @@ -1784,696 +2040,2244 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchAnnotationsCmd" + "$ref": "#/definitions/PauseAlertCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/pauseAlertResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations": { + "get": { + "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "tags": [ + "annotations" + ], + "summary": "Find Annotations.", + "operationId": "getAnnotations", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" + }, + { + "type": "string", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardUID", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Use this to filter organization annotations. Organization annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", + "name": "tags", + "in": "query" + }, + { + "enum": [ + "alert", + "annotation" + ], + "type": "string", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" + }, + { + "type": "boolean", + "description": "Match any or all tags", + "name": "matchAny", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then an organization annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", + "tags": [ + "annotations" + ], + "summary": "Create Annotation.", + "operationId": "postAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/graphite": { + "post": { + "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", + "tags": [ + "annotations" + ], + "summary": "Create Annotation in Graphite format.", + "operationId": "postGraphiteAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/mass-delete": { + "post": { + "tags": [ + "annotations" + ], + "summary": "Delete multiple annotations.", + "operationId": "massDeleteAnnotations", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MassDeleteAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/tags": { + "get": { + "description": "Find all the event tags created in the annotations.", + "tags": [ + "annotations" + ], + "summary": "Find Annotations Tags.", + "operationId": "getAnnotationTags", + "parameters": [ + { + "type": "string", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationTagsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/{annotation_id}": { + "get": { + "tags": [ + "annotations" + ], + "summary": "Get Annotation by ID.", + "operationId": "getAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationByIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + "tags": [ + "annotations" + ], + "summary": "Update Annotation.", + "operationId": "updateAnnotation", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Deletes the annotation that matches the specified ID.", + "tags": [ + "annotations" + ], + "summary": "Delete Annotation By ID.", + "operationId": "deleteAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "patch": { + "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", + "tags": [ + "annotations" + ], + "summary": "Patch Annotation.", + "operationId": "patchAnnotation", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/api/v1/provisioning/alert-rules": { + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a new alert rule.", + "operationId": "RoutePostAlertRule", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + } + ], + "responses": { + "201": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/alert-rules/{UID}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a specific alert rule by UID.", + "operationId": "RouteGetAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Update an existing alert rule.", + "operationId": "RoutePutAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + } + ], + "responses": { + "200": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a specific alert rule by UID.", + "operationId": "RouteDeleteAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The alert rule was deleted successfully." + } + } + } + }, + "/api/v1/provisioning/contact-points": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get all the contact points.", + "operationId": "RouteGetContactpoints", + "parameters": [ + { + "type": "string", + "description": "Filter by name", + "name": "name", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ContactPoints", + "schema": { + "$ref": "#/definitions/ContactPoints" + } + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a contact point.", + "operationId": "RoutePostContactpoints", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + } + ], + "responses": { + "202": { + "description": "EmbeddedContactPoint", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/contact-points/{UID}": { + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Update an existing contact point.", + "operationId": "RoutePutContactpoint", + "parameters": [ + { + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Delete a contact point.", + "operationId": "RouteDeleteContactpoints", + "parameters": [ + { + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The contact point was deleted successfully." + } + } + } + }, + "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a rule group.", + "operationId": "RouteGetAlertRuleGroup", + "parameters": [ + { + "type": "string", + "name": "FolderUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "Group", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Update the interval of a rule group.", + "operationId": "RoutePutAlertRuleGroup", + "parameters": [ + { + "type": "string", + "name": "FolderUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "Group", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + } + ], + "responses": { + "200": { + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/mute-timings": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get all the mute timings.", + "operationId": "RouteGetMuteTimings", + "responses": { + "200": { + "description": "MuteTimings", + "schema": { + "$ref": "#/definitions/MuteTimings" + } + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a new mute timing.", + "operationId": "RoutePostMuteTiming", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + } + ], + "responses": { + "201": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/mute-timings/{name}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a mute timing.", + "operationId": "RouteGetMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Replace an existing mute timing.", + "operationId": "RoutePutMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + } + ], + "responses": { + "200": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a mute timing.", + "operationId": "RouteDeleteMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The mute timing was deleted successfully." + } + } + } + }, + "/api/v1/provisioning/policies": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get the notification policy tree.", + "operationId": "RouteGetPolicyTree", + "responses": { + "200": { + "description": "Route", + "schema": { + "$ref": "#/definitions/Route" + } + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Sets the notification policy tree.", + "operationId": "RoutePutPolicyTree", + "parameters": [ + { + "description": "The new notification routing tree to use", + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/Route" + } + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Clears the notification policy tree.", + "operationId": "RouteResetPolicyTree", + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + } + } + } + }, + "/api/v1/provisioning/templates": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get all message templates.", + "operationId": "RouteGetTemplates", + "responses": { + "200": { + "description": "MessageTemplates", + "schema": { + "$ref": "#/definitions/MessageTemplates" + } + }, + "404": { + "description": " Not found." + } + } + } + }, + "/api/v1/provisioning/templates/{name}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a message template.", + "operationId": "RouteGetTemplate", + "parameters": [ + { + "type": "string", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Updates an existing template.", + "operationId": "RoutePutTemplate", + "parameters": [ + { + "type": "string", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MessageTemplateContent" + } + } + ], + "responses": { + "202": { + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a template.", + "operationId": "RouteDeleteTemplate", + "parameters": [ + { + "type": "string", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The template was deleted successfully." + } + } + } + }, + "/auth/keys": { + "get": { + "description": "Will return auth keys.", + "tags": [ + "api_keys" + ], + "summary": "Get auth keys.", + "operationId": "getAPIkeys", + "parameters": [ + { + "type": "boolean", + "default": false, + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAPIkeyResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Will return details of the created API key.", + "tags": [ + "api_keys" + ], + "summary": "Creates an API key.", + "operationId": "addAPIkey", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAPIkeyResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/auth/keys/{id}": { + "delete": { + "tags": [ + "api_keys" + ], + "summary": "Delete API key.", + "operationId": "deleteAPIkey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboard/snapshots": { + "get": { + "tags": [ + "snapshots" + ], + "summary": "List snapshots.", + "operationId": "searchDashboardSnapshots", + "parameters": [ + { + "type": "string", + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchDashboardSnapshotsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": [ + "application/json", + "text/html" + ], + "tags": [ + "dashboards" + ], + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "base": { + "$ref": "#/definitions/CalculateDiffTarget" + }, + "diffType": { + "description": "The type of diff to return\nDescription:\n`basic`\n`json`", + "type": "string", + "enum": [ + "basic", + "json" + ] + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/calculateDashboardDiffResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/db": { + "post": { + "description": "Creates a new dashboard or updates an existing dashboard.", + "tags": [ + "dashboards" + ], + "summary": "Create / Update dashboard", + "operationId": "postDashboard", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/home": { + "get": { + "tags": [ + "dashboards" + ], + "summary": "Get home dashboard.", + "operationId": "getHomeDashboard", + "responses": { + "200": { + "$ref": "#/responses/getHomeDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/permissions": { + "get": { + "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "tags": [ + "dashboard_permissions" + ], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "tags": [ + "dashboard_permissions" + ], + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/restore": { + "post": { + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersionByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/versions": { + "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardVersionsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardVersionResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/import": { + "post": { + "tags": [ + "dashboards" + ], + "summary": "Import dashboard.", + "operationId": "importDashboard", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ImportDashboardRequest" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/importDashboardResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/tags": { + "get": { + "tags": [ + "dashboards" + ], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", + "responses": { + "200": { + "$ref": "#/responses/getDashboardsTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/alert-rules": { + "/dashboards/trim": { "post": { - "consumes": [ - "application/json" - ], "tags": [ - "provisioning" + "dashboards" ], - "summary": "Create a new alert rule.", - "operationId": "RoutePostAlertRule", + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" + "$ref": "#/definitions/TrimDashboardCommand" } } ], "responses": { - "201": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } + "200": { + "$ref": "#/responses/trimDashboardResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/alert-rules/{UID}": { + "/dashboards/uid/{uid}": { "get": { + "description": "Will return the dashboard given the dashboard unique identifier (uid).", "tags": [ - "provisioning" + "dashboards" ], - "summary": "Get a specific alert rule by UID.", - "operationId": "RouteGetAlertRule", + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ { "type": "string", - "description": "Alert rule UID", - "name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } + "$ref": "#/responses/dashboardResponse" }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Update an existing alert rule.", - "operationId": "RoutePutAlertRule", - "parameters": [ - { - "type": "string", - "description": "Alert rule UID", - "name": "UID", - "in": "path", - "required": true + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - } - ], - "responses": { - "200": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } + "403": { + "$ref": "#/responses/forbiddenError" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", "tags": [ - "provisioning" + "dashboards" ], - "summary": "Delete a specific alert rule by UID.", - "operationId": "RouteDeleteAlertRule", + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ { "type": "string", - "description": "Alert rule UID", - "name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The alert rule was deleted successfully." + "200": { + "$ref": "#/responses/deleteDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/contact-points": { + "/dashboards/uid/{uid}/permissions": { "get": { "tags": [ - "provisioning" + "dashboard_permissions" ], - "summary": "Get all the contact points.", - "operationId": "RouteGetContactpoints", + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", "parameters": [ { "type": "string", - "description": "Filter by name", - "name": "name", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "description": "ContactPoints", - "schema": { - "$ref": "#/definitions/ContactPoints" - } + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "post": { - "consumes": [ - "application/json" - ], + "description": "This operation will remove existing permissions if they’re not included in the request.", "tags": [ - "provisioning" + "dashboard_permissions" ], - "summary": "Create a contact point.", - "operationId": "RoutePostContactpoints", + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByUID", "parameters": [ { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } - } - ], - "responses": { - "202": { - "description": "EmbeddedContactPoint", - "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" + "$ref": "#/definitions/UpdateDashboardACLCommand" } }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/api/v1/provisioning/contact-points/{UID}": { - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Update an existing contact point.", - "operationId": "RoutePutContactpoint", - "parameters": [ { "type": "string", - "description": "UID is the contact point unique identifier", - "name": "UID", + "name": "uid", "in": "path", "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } } ], "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } + "200": { + "$ref": "#/responses/okResponse" }, "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "consumes": [ - "application/json" - ], + } + }, + "/dashboards/uid/{uid}/restore": { + "post": { "tags": [ - "provisioning" + "dashboard_versions" ], - "summary": "Delete a contact point.", - "operationId": "RouteDeleteContactpoints", + "summary": "Restore a dashboard to a given dashboard version using UID.", + "operationId": "restoreDashboardVersionByUID", "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, { "type": "string", - "description": "UID is the contact point unique identifier", - "name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The contact point was deleted successfully." + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { + "/dashboards/uid/{uid}/versions": { "get": { "tags": [ - "provisioning" + "dashboard_versions" ], - "summary": "Get a rule group.", - "operationId": "RouteGetAlertRuleGroup", + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", "parameters": [ { "type": "string", - "name": "FolderUID", + "name": "uid", "in": "path", "required": true }, { - "type": "string", - "name": "Group", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 0, + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Version to start from when returning queries", + "name": "start", + "in": "query" } ], "responses": { "200": { - "description": "AlertRuleGroup", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } + "$ref": "#/responses/dashboardVersionsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { - "description": " Not found." + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - }, - "put": { - "consumes": [ - "application/json" - ], + } + }, + "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "get": { "tags": [ - "provisioning" + "dashboard_versions" ], - "summary": "Update the interval of a rule group.", - "operationId": "RoutePutAlertRuleGroup", + "summary": "Get a specific dashboard version using UID.", + "operationId": "getDashboardVersionByUID", "parameters": [ { - "type": "string", - "name": "FolderUID", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true }, { "type": "string", - "name": "Group", + "name": "uid", "in": "path", "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } } ], "responses": { "200": { - "description": "AlertRuleGroup", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } + "$ref": "#/responses/dashboardVersionResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/mute-timings": { + "/datasources": { "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", "tags": [ - "provisioning" + "datasources" ], - "summary": "Get all the mute timings.", - "operationId": "RouteGetMuteTimings", + "summary": "Get all data sources.", + "operationId": "getDataSources", "responses": { "200": { - "description": "MuteTimings", - "schema": { - "$ref": "#/definitions/MuteTimings" - } + "$ref": "#/responses/getDataSourcesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "post": { - "consumes": [ - "application/json" - ], + "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", "tags": [ - "provisioning" + "datasources" ], - "summary": "Create a new mute timing.", - "operationId": "RoutePostMuteTiming", + "summary": "Create a data source.", + "operationId": "addDataSource", "parameters": [ { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/MuteTimeInterval" + "$ref": "#/definitions/AddDataSourceCommand" } } ], "responses": { - "201": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } + "200": { + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/mute-timings/{name}": { + "/datasources/correlations": { "get": { "tags": [ - "provisioning" - ], - "summary": "Get a mute timing.", - "operationId": "RouteGetMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true - } + "correlations" ], + "summary": "Gets all correlations.", + "operationId": "getCorrelations", "responses": { "200": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } + "$ref": "#/responses/getCorrelationsResponse" }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Replace an existing mute timing.", - "operationId": "RoutePutMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - } - ], - "responses": { - "200": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } + "404": { + "$ref": "#/responses/notFoundError" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "500": { + "$ref": "#/responses/internalServerError" } } - }, - "delete": { + } + }, + "/datasources/id/{name}": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", "tags": [ - "provisioning" + "datasources" ], - "summary": "Delete a mute timing.", - "operationId": "RouteDeleteMuteTiming", + "summary": "Get data source Id by Name.", + "operationId": "getDataSourceIdByName", "parameters": [ { "type": "string", - "description": "Mute timing name", "name": "name", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The mute timing was deleted successfully." + "200": { + "$ref": "#/responses/getDataSourceIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/policies": { + "/datasources/name/{name}": { "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", "tags": [ - "provisioning" - ], - "summary": "Get the notification policy tree.", - "operationId": "RouteGetPolicyTree", - "responses": { - "200": { - "description": "Route", - "schema": { - "$ref": "#/definitions/Route" - } - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" + "datasources" ], - "summary": "Sets the notification policy tree.", - "operationId": "RoutePutPolicyTree", + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "parameters": [ { - "description": "The new notification routing tree to use", - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/Route" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } + "200": { + "$ref": "#/responses/getDataSourceResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { - "consumes": [ - "application/json" - ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", "tags": [ - "provisioning" + "datasources" ], - "summary": "Clears the notification policy tree.", - "operationId": "RouteResetPolicyTree", - "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", + "parameters": [ + { + "type": "string", + "name": "name", + "in": "path", + "required": true } - } - } - }, - "/api/v1/provisioning/templates": { - "get": { - "tags": [ - "provisioning" ], - "summary": "Get all message templates.", - "operationId": "RouteGetTemplates", "responses": { "200": { - "description": "MessageTemplates", - "schema": { - "$ref": "#/definitions/MessageTemplates" - } + "$ref": "#/responses/deleteDataSourceByNameResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { - "description": " Not found." + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/templates/{name}": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { "get": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "provisioning" + "datasources" ], - "summary": "Get a message template.", - "operationId": "RouteGetTemplate", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { "type": "string", - "description": "Template Name", - "name": "name", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "MessageTemplate", - "schema": { - "$ref": "#/definitions/MessageTemplate" - } + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { - "description": " Not found." + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, - "put": { - "consumes": [ - "application/json" - ], + "post": { + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", "tags": [ - "provisioning" + "datasources" ], - "summary": "Updates an existing template.", - "operationId": "RoutePutTemplate", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "description": "Template Name", - "name": "name", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MessageTemplateContent" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { + "201": { + "description": "(empty)" + }, "202": { - "description": "MessageTemplate", - "schema": { - "$ref": "#/definitions/MessageTemplate" - } + "description": "(empty)" }, "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "provisioning" + "datasources" ], - "summary": "Delete a template.", - "operationId": "RouteDeleteTemplate", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { "type": "string", - "description": "Template Name", - "name": "name", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The template was deleted successfully." + "202": { + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/auth/keys": { + "/datasources/proxy/{id}/{datasource_proxy_route}": { "get": { - "description": "Will return auth keys.", + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "api_keys" + "datasources" ], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "deprecated": true, "parameters": [ { - "type": "boolean", - "default": false, - "description": "Show expired keys", - "name": "includeExpired", - "in": "query" + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAPIkeyResponse" + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2490,25 +4294,39 @@ } }, "post": { - "description": "Will return details of the created API key.", + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "api_keys" + "datasources" ], - "summary": "Creates an API key.", - "operationId": "addAPIkey", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", + "deprecated": true, "parameters": [ { - "name": "Body", + "name": "DatasourceProxyParam", "in": "body", "required": true, - "schema": { - "$ref": "#/definitions/AddCommand" - } + "schema": {} + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/postAPIkeyResponse" + "201": { + "description": "(empty)" + }, + "202": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -2519,34 +4337,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/auth/keys/{id}": { + }, "delete": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "api_keys" + "datasources" ], - "summary": "Delete API key.", - "operationId": "deleteAPIkey", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", + "type": "string", "name": "id", "in": "path", "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2563,79 +4389,64 @@ } } }, - "/dashboard/snapshots": { + "/datasources/uid/{sourceUID}/correlations": { "get": { "tags": [ - "snapshots" + "correlations" ], - "summary": "List snapshots.", - "operationId": "searchDashboardSnapshots", + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", "parameters": [ { "type": "string", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchDashboardSnapshotsResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/calculate-diff": { + }, "post": { - "produces": [ - "application/json", - "text/html" - ], "tags": [ - "dashboards" + "correlations" ], - "summary": "Perform diff on two dashboards.", - "operationId": "calculateDashboardDiff", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "base": { - "$ref": "#/definitions/CalculateDiffTarget" - }, - "diffType": { - "description": "The type of diff to return\nDescription:\n`basic`\n`json`", - "type": "string", - "enum": [ - "basic", - "json" - ] - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } + "$ref": "#/definitions/CreateCorrelationCommand" } + }, + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/calculateDashboardDiffResponse" + "$ref": "#/responses/createCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2643,99 +4454,122 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/db": { - "post": { - "description": "Creates a new dashboard or updates an existing dashboard.", + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "get": { "tags": [ - "dashboards" + "correlations" ], - "summary": "Create / Update dashboard", - "operationId": "postDashboard", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SaveDashboardCommand" - } + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/home": { - "get": { + }, + "patch": { "tags": [ - "dashboards" + "correlations" + ], + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", + "parameters": [ + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateCorrelationCommand" + } + } ], - "summary": "Get home dashboard.", - "operationId": "getHomeDashboard", "responses": { "200": { - "$ref": "#/responses/getHomeDashboardResponse" + "$ref": "#/responses/updateCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/permissions": { + "/datasources/uid/{uid}": { "get": { - "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByID", - "deprecated": true, + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2751,37 +4585,62 @@ } } }, - "post": { - "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "put": { + "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByID", - "deprecated": true, + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": [ + "datasources" + ], + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2798,35 +4657,30 @@ } } }, - "/dashboards/id/{DashboardID}/restore": { - "post": { - "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "dashboard_versions" + "correlations" ], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersionByID", - "deprecated": true, + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2843,27 +4697,27 @@ } } }, - "/dashboards/id/{DashboardID}/versions": { + "/datasources/uid/{uid}/health": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersionsByID", - "deprecated": true, + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2871,43 +4725,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersionByID", - "deprecated": true, + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2924,26 +4774,26 @@ } } }, - "/dashboards/import": { + "/datasources/{datasourceId}/disable-permissions": { "post": { + "description": "Disables permissions for the data source with the given id. All existing permissions will be removed and anyone will be able to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Import dashboard.", - "operationId": "importDashboard", + "summary": "Disable permissions for a data source.", + "operationId": "disablePermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ImportDashboardRequest" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/importDashboardResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2951,11 +4801,11 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "403": { + "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -2963,75 +4813,122 @@ } } }, - "/dashboards/tags": { - "get": { + "/datasources/{datasourceId}/enable-permissions": { + "post": { + "description": "Enables permissions for the data source with the given id.\nNo one except Org Admins will be able to query the data source until permissions have been added\nwhich permit certain users or teams to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" + ], + "summary": "Enable permissions for a data source.", + "operationId": "enablePermissions", + "parameters": [ + { + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true + } ], - "summary": "Get all dashboards tags of an organisation.", - "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/getDashboardsTagsResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/trim": { - "post": { + "/datasources/{datasourceId}/permissions": { + "get": { + "description": "Gets all existing permissions for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", + "summary": "Get permissions for a data source.", + "operationId": "getAllPermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TrimDashboardCommand" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/trimDashboardResponse" + "$ref": "#/responses/getAllPermissionseResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}": { - "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", + }, + "post": { + "description": "You need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "summary": "Add permissions for a data source.", + "operationId": "addPermission", "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "query" + }, { "type": "string", - "name": "uid", + "name": "builtinRole", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "permission", + "in": "query" + }, + { + "type": "string", + "name": "datasourceId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardResponse" + "$ref": "#/responses/addPermissionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3046,25 +4943,34 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/datasources/{datasourceId}/permissions/{permissionId}": { "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", + "description": "Removes the permission with the given permissionId for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:delete` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + "summary": "Remove permission for a data source.", + "operationId": "deletePermissions", "parameters": [ { "type": "string", - "name": "uid", + "name": "datasourceId", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "permissionId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3074,31 +4980,33 @@ }, "404": { "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/permissions": { + "/datasources/{id}": { "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Get a single data source by Id.", + "operationId": "getDataSourceByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3114,35 +5022,33 @@ } } }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", + "put": { + "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "summary": "Update an existing data source by its sequential ID.", + "operationId": "updateDataSourceByID", + "deprecated": true, "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3150,41 +5056,30 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}/restore": { - "post": { + }, + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3201,40 +5096,29 @@ } } }, - "/dashboards/uid/{uid}/versions": { + "/datasources/{id}/health": { "get": { + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Sends a health check request to the plugin datasource identified by the ID.", + "operationId": "checkDatasourceHealthByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3242,40 +5126,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "/datasources/{id}/resources/{datasource_proxy_route}": { "get": { + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3292,81 +5177,39 @@ } } }, - "/datasources": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", - "tags": [ - "datasources" - ], - "summary": "Get all data sources.", - "operationId": "getDataSources", - "responses": { - "200": { - "$ref": "#/responses/getDataSourcesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/ds/query": { "post": { - "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", "tags": [ - "datasources" + "ds" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddDataSourceCommand" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "409": { - "$ref": "#/responses/conflictError" + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", - "responses": { - "200": { - "$ref": "#/responses/getCorrelationsResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3374,25 +5217,35 @@ } } }, - "/datasources/id/{name}": { + "/folders": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "datasources" + "folders" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "Get all folders.", + "operationId": "getFolders", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceIDResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3400,34 +5253,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/name/{name}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + }, + "post": { "tags": [ - "datasources" + "folders" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateFolderCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/folderResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3435,29 +5287,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + } + }, + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", "tags": [ - "datasources" + "folders" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "type": "string", - "name": "name", + "type": "integer", + "format": "int64", + "name": "folder_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3474,34 +5332,24 @@ } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/folders/{folder_uid}": { "get": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3517,39 +5365,32 @@ } } }, - "post": { - "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", + "put": { "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateFolderCommand" + } } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3563,35 +5404,39 @@ "404": { "$ref": "#/responses/notFoundError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Proxies all calls to the actual data source.", + "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", + "name": "forceDeleteRules", + "in": "query" } ], "responses": { - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3611,35 +5456,24 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/folders/{folder_uid}/permissions": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getFolderPermissionListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3656,42 +5490,30 @@ } }, "post": { - "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3706,106 +5528,111 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/library-elements": { + "get": { + "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "name": "id", - "in": "path", - "required": true + "description": "Part of the name or description searched for.", + "name": "searchString", + "in": "query" }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - } - ], - "responses": { - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "enum": [ + 1, + 2 + ], + "type": "integer", + "format": "int64", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "enum": [ + "alpha-asc", + "alpha-desc" + ], + "type": "string", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "string", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" + }, + { + "type": "string", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/uid/{sourceUID}/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", - "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 100, + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationsBySourceUIDResponse" + "$ref": "#/responses/getLibraryElementsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { + "description": "Creates a new library element.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } - }, - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3825,30 +5652,25 @@ } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "/library-elements/name/{library_element_name}": { "get": { + "description": "Returns a library element with the given name.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3860,47 +5682,31 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_uid", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3908,27 +5714,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{uid}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + }, + "delete": { + "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3947,32 +5751,35 @@ } } }, - "put": { - "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:1` (single data source).", + "patch": { + "description": "Updates an existing library element identified by uid.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Update an existing data source.", - "operationId": "updateDataSourceByUID", + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } }, { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3980,36 +5787,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + } + }, + "/library-elements/{library_element_uid}/connections/": { + "get": { + "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4019,64 +5831,144 @@ } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/licensing/check": { + "get": { "tags": [ - "correlations" + "licensing", + "enterprise" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true + "summary": "Check license availability.", + "operationId": "getStatus", + "responses": { + "200": { + "$ref": "#/responses/getStatusResponse" } + } + } + }, + "/licensing/custom-permissions": { + "get": { + "description": "You need to have a permission with action `licensing.reports:read`.", + "tags": [ + "licensing", + "enterprise" ], + "summary": "Get custom permissions report.", + "operationId": "getCustomPermissionsReport", "responses": { "200": { - "$ref": "#/responses/deleteCorrelationResponse" + "$ref": "#/responses/getCustomPermissionsReportResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/licensing/custom-permissions-csv": { + "get": { + "description": "You need to have a permission with action `licensing.reports:read`.", + "produces": [ + "text/csv" + ], + "tags": [ + "licensing", + "enterprise" + ], + "summary": "Get custom permissions report in CSV format.", + "operationId": "getCustomPermissionsCSV", + "responses": { + "200": { + "$ref": "#/responses/getCustomPermissionsReportResponse" }, - "404": { - "$ref": "#/responses/notFoundError" + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/licensing/refresh-stats": { + "get": { + "description": "You need to have a permission with action `licensing:read`.", + "tags": [ + "licensing", + "enterprise" + ], + "summary": "Refresh license stats.", + "operationId": "refreshLicenseStats", + "responses": { + "200": { + "$ref": "#/responses/refreshLicenseStatsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{uid}/health": { - "get": { + } + }, + "/licensing/token": { + "get": { + "description": "You need to have a permission with action `licensing:read`.", + "tags": [ + "licensing", + "enterprise" + ], + "summary": "Get license token.", + "operationId": "getLicenseToken", + "responses": { + "200": { + "$ref": "#/responses/getLicenseTokenResponse" + } + } + }, + "post": { + "description": "You need to have a permission with action `licensing:update`.", + "tags": [ + "licensing", + "enterprise" + ], + "summary": "Create license token.", + "operationId": "postLicenseToken", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteTokenCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/getLicenseTokenResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + } + } + }, + "delete": { + "description": "Removes the license stored in the Grafana database. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:delete`.", "tags": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", + "summary": "Remove license from database.", + "operationId": "deleteLicenseToken", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteTokenCommand" + } } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "$ref": "#/responses/acceptedResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4087,45 +5979,58 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { - "get": { + "/licensing/token/renew": { + "post": { + "description": "Manually ask license issuer for a new token. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:update`.", "tags": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Fetch data source resources.", - "operationId": "callDatasourceResourceWithUID", + "summary": "Manually force license refresh.", + "operationId": "postRenewLicenseToken", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/postRenewLicenseTokenResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" + } + } + } + }, + "/logout/saml": { + "get": { + "tags": [ + "saml", + "enterprise" + ], + "summary": "GetLogout initiates single logout process.", + "operationId": "getSAMLLogout", + "responses": { + "302": { + "description": "(empty)" }, "404": { "$ref": "#/responses/notFoundError" @@ -4136,29 +6041,16 @@ } } }, - "/datasources/{id}": { + "/org": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "datasources" - ], - "summary": "Get a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "org" ], + "summary": "Get current Organization.", + "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4166,41 +6058,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "put": { - "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "datasources" + "org" ], - "summary": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/UpdateOrgForm" } - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4212,65 +6096,54 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", + } + }, + "/org/address": { + "put": { "tags": [ - "datasources" + "org" ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{id}/health": { + "/org/invites": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "datasources" - ], - "summary": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4282,29 +6155,21 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{id}/resources/{datasource_proxy_route}": { - "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", + }, + "post": { "tags": [ - "datasources" + "org_invites" ], - "summary": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", - "deprecated": true, + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddInviteForm" + } } ], "responses": { @@ -4320,8 +6185,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4329,33 +6194,24 @@ } } }, - "/ds/query": { - "post": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", + "/org/invites/{invitation_code}/revoke": { + "delete": { "tags": [ - "ds" + "org_invites" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MetricRequest" - } + "type": "string", + "name": "invitation_code", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4363,41 +6219,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders": { - "get": { - "description": "Returns all folders that the authenticated user has permission to view.", - "tags": [ - "folders" - ], - "summary": "Get all folders.", - "operationId": "getFolders", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" - } + "/org/preferences": { + "get": { + "tags": [ + "org_preferences" ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4410,25 +6250,25 @@ } } }, - "post": { + "put": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/UpdatePrefsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4439,35 +6279,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", + }, + "patch": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "folder_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchPrefsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4475,33 +6313,23 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}": { + "/org/users": { "get": { + "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", "tags": [ - "folders" - ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - } + "org" ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4509,43 +6337,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { + "post": { + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", "tags": [ - "folders" + "org" ], - "summary": "Update folder.", - "operationId": "updateFolder", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateFolderCommand" + "$ref": "#/definitions/AddOrgUserCommand" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4553,45 +6369,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", + } + }, + "/org/users/lookup": { + "get": { + "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", "tags": [ - "folders" + "org" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", "parameters": [ { "type": "string", - "name": "folder_uid", - "in": "path", - "required": true + "name": "query", + "in": "query" }, { - "type": "boolean", - "default": false, - "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", - "name": "forceDeleteRules", + "type": "integer", + "format": "int64", + "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4599,33 +6406,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}/permissions": { - "get": { + "/org/users/{user_id}": { + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", "tags": [ - "folder_permissions" + "org" ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4633,161 +6442,132 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", "tags": [ - "folder_permissions" + "org" ], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "summary": "Updates the given user.", + "operationId": "updateOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements": { + "/orgs": { "get": { - "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "parameters": [ { - "type": "string", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [ - 1, - 2 - ], "type": "integer", "format": "int64", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" - }, - { - "enum": [ - "alpha-asc", - "alpha-desc" - ], - "type": "string", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" - }, - { - "type": "string", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", + "default": 1, + "name": "page", "in": "query" }, { "type": "integer", "format": "int64", - "default": 100, - "description": "The number of results per page.", - "name": "perPage", + "default": 1000, + "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", + "name": "perpage", "in": "query" }, { - "type": "integer", - "format": "int64", - "default": 1, - "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", - "name": "page", + "type": "string", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", + "name": "query", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Creates a new library element.", + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "library_elements" + "orgs" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "$ref": "#/definitions/CreateOrgCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4795,8 +6575,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4804,31 +6584,35 @@ } } }, - "/library-elements/name/{library_element_name}": { + "/orgs/name/{org_name}": { "get": { - "description": "Returns a library element with the given name.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { "type": "string", - "name": "library_element_name", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getOrgByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4836,48 +6620,66 @@ } } }, - "/library-elements/{library_element_uid}": { + "/orgs/{org_id}": { "get": { - "description": "Returns a library element with the given UID.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", "parameters": [ { - "type": "string", - "name": "library_element_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getOrgByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { - "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", + "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { - "type": "string", - "name": "library_element_uid", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } @@ -4895,40 +6697,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", + "delete": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" - } - }, - { - "type": "string", - "name": "library_element_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4942,57 +6738,42 @@ "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements/{library_element_uid}/connections/": { - "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", + "/orgs/{org_id}/address": { + "put": { "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ { - "type": "string", - "name": "library_element_uid", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/okResponse" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org": { - "get": { - "tags": [ - "org" - ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", - "responses": { - "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5004,29 +6785,28 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { + } + }, + "/orgs/{org_id}/quotas": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).", "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgForm" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5034,58 +6814,95 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/address": { + "/orgs/{org_id}/quotas/{quota_target}": { "put": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/UpdateOrgQuotaCmd" } + }, + { + "type": "string", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { + "/orgs/{org_id}/users": { "get": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", "tags": [ - "org_invites" + "orgs" + ], + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5099,54 +6916,65 @@ } }, "post": { + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", "tags": [ - "org_invites" + "orgs" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddInviteForm" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites/{invitation_code}/revoke": { + "/orgs/{org_id}/users/{user_id}": { "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", "tags": [ - "org_invites" + "orgs" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUser", "parameters": [ { - "type": "string", - "name": "invitation_code", + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } @@ -5155,31 +6983,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org/preferences": { - "get": { - "tags": [ - "org_preferences" - ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", - "responses": { - "200": { - "$ref": "#/responses/getPreferencesResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5192,20 +6997,35 @@ } } }, - "put": { + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", "tags": [ - "org_preferences" + "orgs" ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -5225,29 +7045,57 @@ "$ref": "#/responses/internalServerError" } } + } + }, + "/playlists": { + "get": { + "tags": [ + "playlists" + ], + "summary": "Get playlists.", + "operationId": "searchPlaylists", + "parameters": [ + { + "type": "string", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "in:limit", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchPlaylistsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } }, - "patch": { + "post": { "tags": [ - "org_preferences" + "playlists" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Create playlist.", + "operationId": "createPlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchPrefsCmd" + "$ref": "#/definitions/CreatePlaylistCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5255,23 +7103,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users": { + "/playlists/{uid}": { "get": { - "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", "tags": [ - "org" + "playlists" + ], + "summary": "Get playlist.", + "operationId": "getPlaylist", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5279,31 +7137,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "put": { "tags": [ - "org" + "playlists" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Update playlist.", + "operationId": "updatePlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdatePlaylistCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5311,36 +7177,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/users/lookup": { - "get": { - "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", + }, + "delete": { "tags": [ - "org" + "playlists" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "parameters": [ { "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "limit", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5348,35 +7209,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users/{user_id}": { - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", + "/playlists/{uid}/dashboards": { + "get": { "tags": [ - "org" + "playlists" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5384,41 +7243,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + } + }, + "/playlists/{uid}/items": { + "get": { "tags": [ - "org" + "playlists" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5426,99 +7277,158 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs": { + "/query-history": { "get": { - "security": [ - { - "basic": [] - } - ], + "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", "tags": [ - "orgs" + "query_history" ], - "summary": "Search all Organizations.", - "operationId": "searchOrgs", + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", + "in": "query" + }, + { + "type": "string", + "description": "Text inside query or comments that is searched for", + "name": "searchString", + "in": "query" + }, + { + "type": "boolean", + "description": "Flag indicating if only starred queries should be returned", + "name": "onlyStarred", + "in": "query" + }, + { + "enum": [ + "time-desc", + "time-asc" + ], + "type": "string", + "default": "time-desc", + "description": "Sort method", + "name": "sort", + "in": "query" + }, { "type": "integer", "format": "int64", - "default": 1, + "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", "name": "page", "in": "query" }, { "type": "integer", "format": "int64", - "default": 1000, - "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", - "name": "perpage", + "description": "Limit the number of returned results", + "name": "limit", "in": "query" }, { - "type": "string", - "name": "name", + "type": "integer", + "format": "int64", + "description": "From range for the query history search", + "name": "from", "in": "query" }, { - "type": "string", - "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", - "name": "query", + "type": "integer", + "format": "int64", + "description": "To range for the query history search", + "name": "to", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/searchOrgsResponse" + "$ref": "#/responses/getQueryHistorySearchResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", + "description": "Adds new query to query history.", "tags": [ - "orgs" + "query_history" ], - "summary": "Create Organization.", - "operationId": "createOrg", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrgCommand" + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/getQueryHistoryResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/query-history/migrate": { + "post": { + "description": "Adds multiple queries to query history.", + "tags": [ + "query_history" + ], + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, - "409": { - "$ref": "#/responses/conflictError" + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5526,109 +7436,116 @@ } } }, - "/orgs/name/{org_name}": { - "get": { - "security": [ + "/query-history/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", + "tags": [ + "query_history" + ], + "summary": "Add star to query in query history.", + "operationId": "starQuery", + "parameters": [ { - "basic": [] + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true } ], + "responses": { + "200": { + "$ref": "#/responses/getQueryHistoryResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ { "type": "string", - "name": "org_name", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByNameResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}": { - "get": { - "security": [ - { - "basic": [] - } - ], + "/query-history/{query_history_uid}": { + "delete": { + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "orgs" + "query_history" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", + "summary": "Delete query in query history.", + "operationId": "deleteQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByIDResponse" + "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" }, "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { - "security": [ - { - "basic": [] - } - ], + "patch": { + "description": "Updates comment for query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Update comment for query in query history.", + "operationId": "patchQueryComment", "parameters": [ + { + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" + "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5636,40 +7553,23 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "security": [ - { - "basic": [] - } - ], + } + }, + "/recording-rules": { + "get": { "tags": [ - "orgs" - ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Lists all rules in the database: active or deleted.", + "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/listRecordingRulesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5684,38 +7584,27 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/address": { + }, "put": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", + "summary": "Update the active status of a rule.", + "operationId": "updateRecordingRule", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/RecordingRuleJSON" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/recordingRuleResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5723,32 +7612,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/quotas": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).", + }, + "post": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Create a recording rule that is then registered and started.", + "operationId": "createRecordingRule", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RecordingRuleJSON" + } } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/recordingRuleResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5765,40 +7656,22 @@ } } }, - "/orgs/{org_id}/quotas/{quota_target}": { - "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", + "/recording-rules/test": { + "post": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Test a recording rule.", + "operationId": "testCreateRecordingRule", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" + "$ref": "#/definitions/RecordingRuleJSON" } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -5814,37 +7687,26 @@ "404": { "$ref": "#/responses/notFoundError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/users": { + "/recording-rules/writer": { "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", "tags": [ - "orgs" - ], - "summary": "Get Users in Organization.", - "operationId": "getOrgUsers", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Return the prometheus remote write target.", + "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5852,38 +7714,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "description": "It returns a 422 if there is not an existing prometheus data source configured.", "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", + "summary": "Create a remote write target.", + "operationId": "createRecordingRuleWriteTarget", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5891,81 +7750,56 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/users/{user_id}": { + }, "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", "tags": [ - "orgs" - ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Delete the remote write target.", + "operationId": "deleteRecordingRuleWriteTarget", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + } + }, + "/recording-rules/{recordingRuleID}": { + "delete": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", + "summary": "Delete removes the rule from the registry and stops it.", + "operationId": "deleteRecordingRule", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "recordingRuleID", "in": "path", "required": true } @@ -5974,45 +7808,39 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists": { - "get": { - "tags": [ - "playlists" - ], - "summary": "Get playlists.", - "operationId": "searchPlaylists", - "parameters": [ - { - "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "in:limit", - "name": "limit", - "in": "query" - } + "/reports": { + "get": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports:read` with scope `reports:*`.", + "tags": [ + "reports", + "enterprise" ], + "summary": "List reports.", + "operationId": "getReports", "responses": { "200": { - "$ref": "#/responses/searchPlaylistsResponse" + "$ref": "#/responses/getReportsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6020,24 +7848,29 @@ } }, "post": { + "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports.admin:create`.", "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Create playlist.", - "operationId": "createPlaylist", + "summary": "Create a report.", + "operationId": "createReport", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } } ], "responses": { "200": { - "$ref": "#/responses/createPlaylistResponse" + "$ref": "#/responses/createReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6054,24 +7887,31 @@ } } }, - "/playlists/{uid}": { - "get": { + "/reports/email": { + "post": { + "description": "Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds. Available to org admins only and with a valid license.\n\nOnly available in Grafana Enterprise v7.0+.\nThis API endpoint is experimental and may be deprecated in a future release. On deprecation, a migration strategy will be provided and the endpoint will remain functional until the next major release of Grafana.\n\nYou need to have a permission with action `reports:send`.", "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist.", - "operationId": "getPlaylist", + "summary": "Send a report.", + "operationId": "sendReport", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReportEmailDTO" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6086,98 +7926,176 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { + } + }, + "/reports/render/pdf/{dashboardID}": { + "get": { + "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", + "produces": [ + "application/pdf" + ], "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", + "summary": "Render report for dashboard.", + "operationId": "renderReportPDF", + "deprecated": true, "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" - } + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true }, { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "dashboardID", "in": "path", "required": true + }, + { + "type": "string", + "name": "title", + "in": "query" + }, + { + "type": "string", + "name": "variables", + "in": "query" + }, + { + "type": "string", + "name": "from", + "in": "query" + }, + { + "type": "string", + "name": "to", + "in": "query" + }, + { + "type": "string", + "name": "orientation", + "in": "query" + }, + { + "type": "string", + "name": "layout", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/updatePlaylistResponse" + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { + } + }, + "/reports/render/pdfs": { + "get": { + "description": "Available to all users and with a valid license.", + "produces": [ + "application/pdf" + ], "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Render report for multiple dashboards.", + "operationId": "renderReportPDFs", "parameters": [ { "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "dashboardID", + "in": "query" + }, + { + "type": "string", + "name": "orientation", + "in": "query" + }, + { + "type": "string", + "name": "layout", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/dashboards": { + "/reports/settings": { "get": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.settings:read`x.", "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "summary": "Get settings.", + "operationId": "getReportSettings", + "responses": { + "200": { + "$ref": "#/responses/getReportSettingsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.settings:write`xx.", + "tags": [ + "reports", + "enterprise" + ], + "summary": "Save settings.", + "operationId": "saveReportSettings", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SettingsDTO" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6185,33 +8103,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/items": { - "get": { + "/reports/test-email": { + "post": { + "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports:send`.", "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist items.", - "operationId": "getPlaylistItems", + "summary": "Send test report via email.", + "operationId": "sendTestEmail", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrUpdateConfigCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistItemsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6228,109 +8150,73 @@ } } }, - "/query-history": { + "/reports/{id}": { "get": { - "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports:read` with scope `reports:id:\u003creport ID\u003e`.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Get a report.", + "operationId": "getReport", "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "List of data source UIDs to search for", - "name": "datasourceUid", - "in": "query" - }, - { - "type": "string", - "description": "Text inside query or comments that is searched for", - "name": "searchString", - "in": "query" - }, - { - "type": "boolean", - "description": "Flag indicating if only starred queries should be returned", - "name": "onlyStarred", - "in": "query" - }, - { - "enum": [ - "time-desc", - "time-asc" - ], - "type": "string", - "default": "time-desc", - "description": "Sort method", - "name": "sort", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", - "in": "query" - }, { "type": "integer", "format": "int64", - "description": "To range for the query history search", - "name": "to", - "in": "query" + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistorySearchResponse" + "$ref": "#/responses/getReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Adds new query to query history.", + "put": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.admin:write` with scope `reports:id:\u003creport ID\u003e`.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Update a report.", + "operationId": "updateReport", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } + }, + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6338,33 +8224,37 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/query-history/migrate": { - "post": { - "description": "Adds multiple queries to query history.", + }, + "delete": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.delete` with scope `reports:id:\u003creport ID\u003e`.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Delete a report.", + "operationId": "deleteReport", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" - } + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6372,128 +8262,117 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/star/{query_history_uid}": { + "/saml/acs": { "post": { - "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "It performs assertion Consumer Service (ACS).", + "operationId": "postACS", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "RelayState", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "(empty)" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Removes star from query in query history as specified by the UID.", - "tags": [ - "query_history" + } + }, + "/saml/metadata": { + "get": { + "produces": [ + "application/xml;application/samlmetadata+xml" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", - "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - } + "tags": [ + "saml", + "enterprise" ], + "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", + "operationId": "getMetadata", "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "$ref": "#/responses/contentResponse" } } } }, - "/query-history/{query_history_uid}": { - "delete": { - "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", + "/saml/slo": { + "get": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", "tags": [ - "query_history" - ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", - "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - } + "saml", + "enterprise" ], + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "getSLO", "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" + "302": { + "description": "(empty)" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + "post": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "postSLO", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "SAMLRequest", + "in": "query" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" - } + "type": "string", + "name": "SAMLResponse", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -7196,7 +9075,133 @@ ], "responses": { "200": { - "$ref": "#/responses/searchTeamsResponse" + "$ref": "#/responses/searchTeamsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/teams/{teamId}/groups": { + "get": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Get External Groups.", + "operationId": "getTeamGroupsApi", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getTeamGroupsApiResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Add External Group.", + "operationId": "addTeamGroupApi", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TeamGroupMapping" + } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/teams/{teamId}/groups/{groupId}": { + "delete": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Remove External Group.", + "operationId": "removeTeamGroupApi", + "parameters": [ + { + "type": "string", + "name": "groupId", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7204,6 +9209,9 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } @@ -8286,6 +10294,63 @@ "Ack": { "type": "object" }, + "ActiveSyncStatusDTO": { + "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "nextSync": { + "type": "string", + "format": "date-time" + }, + "prevSync": { + "$ref": "#/definitions/SyncResult" + }, + "schedule": { + "type": "string" + } + } + }, + "ActiveUserStats": { + "type": "object", + "properties": { + "active_admins_and_editors": { + "type": "integer", + "format": "int64" + }, + "active_users": { + "type": "integer", + "format": "int64" + }, + "active_viewers": { + "type": "integer", + "format": "int64" + } + } + }, + "AddBuiltInRoleCommand": { + "type": "object", + "properties": { + "builtInRole": { + "type": "string", + "enum": [ + "Viewer", + " Editor", + " Admin", + " Grafana Admin" + ] + }, + "global": { + "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to create organization local assignment. Refer to the Built-in role assignments for more information.", + "type": "boolean" + }, + "roleUid": { + "type": "string" + } + } + }, "AddCommand": { "type": "object", "properties": { @@ -8392,6 +10457,25 @@ } } }, + "AddPermissionDTO": { + "type": "object", + "properties": { + "builtinRole": { + "type": "string" + }, + "permission": { + "$ref": "#/definitions/DsPermissionType" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "AddServiceAccountTokenCommand": { "type": "object", "properties": { @@ -8834,8 +10918,7 @@ "type": "array", "items": { "$ref": "#/definitions/ProvisionedAlertRule" - }, - "x-go-name": "Rules" + } }, "title": { "type": "string", @@ -13298,6 +15381,51 @@ } } }, + "RecordingRuleJSON": { + "description": "RecordingRuleJSON is the external representation of a recording rule", + "type": "object", + "properties": { + "active": { + "type": "boolean" + }, + "count": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "dest_data_source_uid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "interval": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "prom_name": { + "type": "string" + }, + "queries": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false + } + }, + "range": { + "type": "integer", + "format": "int64" + }, + "target_ref_id": { + "type": "string" + } + } + }, "Regexp": { "description": "A Regexp is safe for concurrent use by multiple goroutines,\nexcept for configuration methods, such as Longest.", "type": "object", @@ -13349,6 +15477,79 @@ } } }, + "RoleAssignmentsDTO": { + "type": "object", + "properties": { + "role_uid": { + "type": "string" + }, + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "RoleDTO": { + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "delegatable": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "uid": { + "type": "string" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "Route": { "description": "A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.", "type": "object", @@ -13821,6 +16022,49 @@ } } }, + "SetRoleAssignmentsCommand": { + "type": "object", + "properties": { + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "SetUserRolesCommand": { + "type": "object", + "properties": { + "global": { + "type": "boolean" + }, + "includeHidden": { + "type": "boolean" + }, + "roleUids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -15301,7 +17545,6 @@ } }, "alertGroups": { - "description": "AlertGroups alert groups", "type": "array", "items": { "$ref": "#/definitions/alertGroup" @@ -15710,8 +17953,6 @@ "description": "Receiver receiver", "type": "object", "required": [ - "active", - "integrations", "name" ], "properties": { @@ -16243,6 +18484,30 @@ } } }, + "getCurrentOrgResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/Correlation" + } + }, + "getCorrelationsBySourceUIDResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Correlation" + } + } + }, + "getCorrelationsResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Correlation" + } + } + }, "getCurrentOrgResponse": { "description": "(empty)", "schema": { @@ -16458,6 +18723,39 @@ } } }, + "getReportResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/ConfigDTO" + } + }, + "getReportSettingsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/SettingsDTO" + } + }, + "getReportsResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ConfigDTO" + } + } + }, + "getRoleAssignmentsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, + "getRoleResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleDTO" + } + }, "getSharingOptionsResponse": { "description": "(empty)", "schema": { @@ -16797,6 +19095,12 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, + "setRoleAssignmentsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, "testAlertResponse": { "description": "(empty)", "schema": { diff --git a/public/api-spec.json b/public/api-spec.json index 594e73115941..f2543decfcb3 100644 --- a/public/api-spec.json +++ b/public/api-spec.json @@ -26,25 +26,25 @@ }, "basePath": "/api", "paths": { - "/admin/ldap/reload": { - "post": { - "security": [ + "/access-control/roles": { + "get": { + "description": "Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in.\n\nYou need to have a permission with action `roles:read` and scope `roles:*`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get all roles.", + "operationId": "listRoles", + "parameters": [ { - "basic": [] + "type": "boolean", + "name": "delegatable", + "in": "query" } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", - "tags": [ - "admin_ldap" - ], - "summary": "Reloads the LDAP configuration.", - "operationId": "reloadLDAPCfg", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/listRolesResponse" }, "403": { "$ref": "#/responses/forbiddenError" @@ -53,27 +53,31 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/status": { - "get": { - "security": [ + }, + "post": { + "description": "Creates a new custom role and maps given permissions to that role. Note that roles with the same prefix as Fixed Roles can’t be created.\n\nYou need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.\nFor example, if a user does not have required permissions for creating users, they won’t be able to create a custom role which allows to do that. This is done to prevent escalation of privileges.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Create a new custom role.", + "operationId": "createRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRoleForm" + } } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", - "tags": [ - "admin_ldap" - ], - "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", - "operationId": "getLDAPStatus", "responses": { - "200": { - "$ref": "#/responses/okResponse" + "201": { + "$ref": "#/responses/createRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -84,61 +88,99 @@ } } }, - "/admin/ldap/sync/{user_id}": { - "post": { - "security": [ + "/access-control/roles/{roleUID}": { + "get": { + "description": "Get a role for the given UID.\n\nYou need to have a permission with action `roles:read` and scope `roles:*`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get a role.", + "operationId": "getRole", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", + "responses": { + "200": { + "$ref": "#/responses/getRoleResponse" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "You need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", "tags": [ - "admin_ldap" + "access_control", + "enterprise" ], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "postSyncUserWithLDAP", + "summary": "Update a custom role.", + "operationId": "updateRole", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateRoleCommand" + } + }, + { + "type": "string", + "name": "roleUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/{user_name}": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", + }, + "delete": { + "description": "Delete a role with the given UID, and it’s permissions. If the role is assigned to a built-in role, the deletion operation will fail, unless force query param is set to true, and in that case all assignments will also be deleted.\n\nYou need to have a permission with action `roles:delete` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only delete a custom role with the same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to delete a custom role which allows to do that.", "tags": [ - "admin_ldap" + "access_control", + "enterprise" ], - "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", - "operationId": "getUserFromLDAP", + "summary": "Delete a custom role.", + "operationId": "deleteRole", "parameters": [ + { + "type": "boolean", + "name": "force", + "in": "query" + }, + { + "type": "boolean", + "name": "global", + "in": "query" + }, { "type": "string", - "name": "user_name", + "name": "roleUID", "in": "path", "required": true } @@ -147,8 +189,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -159,121 +201,127 @@ } } }, - "/admin/pause-all-alerts": { - "post": { - "security": [ - { - "basic": [] - } - ], + "/access-control/roles/{roleUID}/assignments": { + "get": { + "description": "Get role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:list` and scope `teams:id:*` and `users.roles:list` and scope `users:id:*`.", "tags": [ - "admin" + "access_control", + "enterprise" ], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "summary": "Get role assignments.", + "operationId": "getRoleAssignments", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" - } + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/dashboards/reload": { - "post": { - "security": [ + }, + "put": { + "description": "Set role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate`, and `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Set role assignments.", + "operationId": "setRoleAssignments", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SetRoleAssignmentsCommand" + } } ], - "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", - "tags": [ - "admin_provisioning" - ], - "summary": "Reload dashboard provisioning configurations.", - "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/setRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/datasources/reload": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", + "/access-control/status": { + "get": { + "description": "Returns an indicator to check if fine-grained access control is enabled or not.\n\nYou need to have a permission with action `status:accesscontrol` and scope `services:accesscontrol`.", "tags": [ - "admin_provisioning" + "access_control", + "enterprise" ], - "summary": "Reload datasource provisioning configurations.", - "operationId": "adminProvisioningReloadDatasources", + "summary": "Get status.", + "operationId": "getAccessControlStatus", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getAccessControlStatusResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/notifications/reload": { - "post": { - "security": [ + "/access-control/teams/{teamId}/roles": { + "get": { + "description": "You need to have a permission with action `teams.roles:read` and scope `teams:id:\u003cteam ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get team roles.", + "operationId": "listTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", - "tags": [ - "admin_provisioning" - ], - "summary": "Reload legacy alert notifier provisioning configurations.", - "operationId": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -282,150 +330,226 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/plugins/reload": { - "post": { - "security": [ + }, + "put": { + "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate` for each.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Update team role.", + "operationId": "setTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", - "tags": [ - "admin_provisioning" - ], - "summary": "Reload plugin provisioning configurations.", - "operationId": "adminProvisioningReloadPlugins", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/settings": { - "get": { - "security": [ + }, + "post": { + "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Add team role.", + "operationId": "addTeamRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTeamRoleCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", - "tags": [ - "admin" - ], - "summary": "Fetch settings.", - "operationId": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/adminGetSettingsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/admin/stats": { - "get": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", + "/access-control/teams/{teamId}/roles/{roleUID}": { + "delete": { + "description": "You need to have a permission with action `teams.roles:remove` and scope `permissions:type:delegate`.", "tags": [ - "admin" + "access_control", + "enterprise" + ], + "summary": "Remove team role.", + "operationId": "removeTeamRole", + "parameters": [ + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } ], - "summary": "Fetch Grafana Stats.", - "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/adminGetStatsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users": { - "post": { - "security": [ + "/access-control/users/{userId}/roles": { + "get": { + "description": "Lists the roles that have been directly assigned to a given user. The list does not include built-in roles (Viewer, Editor, Admin or Grafana Admin), and it does not include roles that have been inherited from a team.\n\nYou need to have a permission with action `users.roles:read` and scope `users:id:\u003cuser ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "List roles assigned to a user.", + "operationId": "listUserRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", + "responses": { + "200": { + "$ref": "#/responses/getAllRolesResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Update the user’s role assignments to match the provided set of UIDs. This will remove any assigned roles that aren’t in the request and add roles that are in the set but are not already assigned to the user.\nIf you want to add or remove a single role, consider using Add a user role assignment or Remove a user role assignment instead.\n\nYou need to have a permission with action `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate` for each. `permissions:type:delegate` scope ensures that users can only assign or unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign or unassign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Create new user.", - "operationId": "adminCreateUser", + "summary": "Set user role assignments.", + "operationId": "setUserRoles", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/SetUserRolesCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminCreateUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}": { - "delete": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global.users:*`.", + }, + "post": { + "description": "Assign a role to a specific user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:add` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only assign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Delete global User.", - "operationId": "adminDeleteUser", + "summary": "Add a user role assignment.", + "operationId": "addUserRole", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddUserRoleCommand" + } + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -434,9 +558,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -449,31 +570,66 @@ } } }, - "/admin/users/{user_id}/auth-tokens": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global.users:*`.", + "/access-control/users/{userId}/roles/{roleUID}": { + "delete": { + "description": "Revoke a role from a user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:remove` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to unassign a role which will allow to do that. This is done to prevent escalation of privileges.", "tags": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "adminGetUserAuthTokens", + "summary": "Remove a user role assignment.", + "operationId": "removeUserRole", "parameters": [ + { + "type": "boolean", + "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", + "name": "global", + "in": "query" + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminGetUserAuthTokensResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/ldap-sync-status": { + "get": { + "description": "You need to have a permission with action `ldap.status:read`.", + "tags": [ + "ldap_debug" + ], + "summary": "Returns the current state of the LDAP background sync integration.", + "operationId": "getSyncStatus", + "responses": { + "200": { + "$ref": "#/responses/getSyncStatusResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -487,28 +643,19 @@ } } }, - "/admin/users/{user_id}/disable": { + "/admin/ldap/reload": { "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global.users:1` (userIDScope).", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", "tags": [ - "admin_users" - ], - "summary": "Disable user.", - "operationId": "adminDisableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_ldap" ], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAPCfg", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -519,37 +666,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/enable": { - "post": { + "/admin/ldap/status": { + "get": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global.users:1` (userIDScope).", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", "tags": [ - "admin_users" - ], - "summary": "Enable user.", - "operationId": "adminEnableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_ldap" ], + "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", + "operationId": "getLDAPStatus", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -560,28 +695,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/logout": { + "/admin/ldap/sync/{user_id}": { "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global.users:*`.", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", "tags": [ - "admin_users" + "admin_ldap" ], - "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", - "operationId": "adminLogoutUser", + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "postSyncUserWithLDAP", "parameters": [ { "type": "integer", @@ -595,50 +727,35 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/password": { - "put": { + "/admin/ldap/{user_name}": { + "get": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global.users:*`.", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", "tags": [ - "admin_users" + "admin_ldap" ], - "summary": "Set password for user.", - "operationId": "adminUpdateUserPassword", + "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", + "operationId": "getUserFromLDAP", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "user_name", "in": "path", "required": true } @@ -647,9 +764,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -662,37 +776,31 @@ } } }, - "/admin/users/{user_id}/permissions": { - "put": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global.users:*`.", + "/admin/pause-all-alerts": { + "post": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "admin_users" + "admin" ], - "summary": "Set permissions for user.", - "operationId": "adminUpdateUserPermissions", + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + "$ref": "#/definitions/PauseAllAlertsCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/pauseAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -706,31 +814,43 @@ } } }, - "/admin/users/{user_id}/quotas": { - "get": { + "/admin/provisioning/access-control/reload": { + "post": { + "tags": [ + "access_control_provisioning", + "enterprise" + ], + "summary": "You need to have a permission with action `provisioning:reload` with scope `provisioners:accesscontrol`.", + "operationId": "adminProvisioningReloadAccessControl", + "responses": { + "202": { + "$ref": "#/responses/acceptedResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + } + } + } + }, + "/admin/provisioning/dashboards/reload": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global.users:1` (userIDScope).", + "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", "tags": [ - "admin_users" - ], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload dashboard provisioning configurations.", + "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -738,51 +858,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/quotas/{quota_target}": { - "put": { + "/admin/provisioning/datasources/reload": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global.users:1` (userIDScope).", + "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", "tags": [ - "admin_users" - ], - "summary": "Update user quota.", - "operationId": "updateUserQuota", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload datasource provisioning configurations.", + "operationId": "adminProvisioningReloadDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -793,78 +887,57 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/revoke-auth-token": { + "/admin/provisioning/notifications/reload": { "post": { "security": [ { "basic": [] } ], - "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global.users:*`.", + "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", "tags": [ - "admin_users" - ], - "summary": "Revoke auth token for user.", - "operationId": "adminRevokeUserAuthToken", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload legacy alert notifier provisioning configurations.", + "operationId": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications": { - "get": { - "description": "Returns all notification channels that the authenticated user has permission to view.", + "/admin/provisioning/plugins/reload": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_provisioning" ], - "summary": "Get all notification channels.", - "operationId": "getAlertNotificationChannels", + "summary": "Reload plugin provisioning configurations.", + "operationId": "adminProvisioningReloadPlugins", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -876,54 +949,45 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Create notification channel.", - "operationId": "createAlertNotificationChannel", - "parameters": [ + } + }, + "/admin/settings": { + "get": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" - } + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", + "tags": [ + "admin" + ], + "summary": "Fetch settings.", + "operationId": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/adminGetSettingsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications/lookup": { + "/admin/stats": { "get": { - "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", "tags": [ - "legacy_alerts_notification_channels" + "admin" ], - "summary": "Get all notification channels (lookup).", - "operationId": "getAlertNotificationLookup", + "summary": "Fetch Grafana Stats.", + "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" + "$ref": "#/responses/adminGetStatsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -937,27 +1001,32 @@ } } }, - "/alert-notifications/test": { + "/admin/users": { "post": { - "description": "Sends a test notification to the channel.", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "summary": "Create new user.", + "operationId": "adminCreateUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/NotificationTestCommand" + "$ref": "#/definitions/AdminCreateUserForm" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminCreateUserResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -969,7 +1038,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -977,25 +1046,31 @@ } } }, - "/alert-notifications/uid/{notification_channel_uid}": { - "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": [ - "legacy_alerts_notification_channels" + "/admin/users/{user_id}": { + "delete": { + "security": [ + { + "basic": [] + } ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global.users:*`.", + "tags": [ + "admin_users" + ], + "summary": "Delete global User.", + "operationId": "adminDeleteUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1010,33 +1085,71 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", + } + }, + "/admin/users/{user_id}/auth-tokens": { + "get": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelByUID", + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "adminGetUserAuthTokens", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/adminGetUserAuthTokensResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/disable": { + "post": { + "security": [ { - "type": "string", - "name": "notification_channel_uid", + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global.users:1` (userIDScope).", + "tags": [ + "admin_users" + ], + "summary": "Disable user.", + "operationId": "adminDisableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1051,25 +1164,33 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by UID.", + } + }, + "/admin/users/{user_id}/enable": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global.users:1` (userIDScope).", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", + "summary": "Enable user.", + "operationId": "adminEnableUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1086,26 +1207,34 @@ } } }, - "/alert-notifications/{notification_channel_id}": { - "get": { - "description": "Returns the notification channel given the notification channel ID.", + "/admin/users/{user_id}/logout": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", + "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", + "operationId": "adminLogoutUser", "parameters": [ { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1120,34 +1249,44 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/admin/users/{user_id}/password": { "put": { - "description": "Updates an existing notification channel identified by ID.", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", + "summary": "Set password for user.", + "operationId": "adminUpdateUserPassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" + "$ref": "#/definitions/AdminUpdateUserPasswordForm" } }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1155,26 +1294,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by ID.", + } + }, + "/admin/users/{user_id}/permissions": { + "put": { + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global.users:*`.", "tags": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", + "summary": "Set permissions for user.", + "operationId": "adminUpdateUserPermissions", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + } + }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } @@ -1183,170 +1329,221 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts": { + "/admin/users/{user_id}/quotas": { "get": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global.users:1` (userIDScope).", "tags": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", + "summary": "Fetch user quota.", + "operationId": "getUserQuota", "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" - }, { "type": "integer", "format": "int64", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getQuotaResponse" }, - { - "type": "string", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "enum": [ - "all", - "no_data", - "paused", - "alerting", - "ok", - "pending", - "unknown" - ], - "type": "string", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/quotas/{quota_target}": { + "put": { + "security": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "in": "query" + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global.users:1` (userIDScope).", + "tags": [ + "admin_users" + ], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } }, { "type": "string", - "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", - "name": "dashboardQuery", - "in": "query" + "name": "quota_target", + "in": "path", + "required": true }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", - "name": "dashboardTag", - "in": "query" + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/states-for-dashboard": { - "get": { + "/admin/users/{user_id}/revoke-auth-token": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global.users:*`.", "tags": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", + "summary": "Revoke auth token for user.", + "operationId": "adminRevokeUserAuthToken", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, { "type": "integer", "format": "int64", - "name": "dashboardId", - "in": "query", + "name": "user_id", + "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardStatesResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/test": { + "/alert-notifications": { + "get": { + "description": "Returns all notification channels that the authenticated user has permission to view.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Get all notification channels.", + "operationId": "getAlertNotificationChannels", + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, "post": { + "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", "tags": [ - "legacy_alerts" + "legacy_alerts_notification_channels" ], - "summary": "Test alert.", - "operationId": "testAlert", + "summary": "Create notification channel.", + "operationId": "createAlertNotificationChannel", "parameters": [ { "name": "body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/AlertTestCommand" + "$ref": "#/definitions/CreateAlertNotificationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/testAlertResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1354,61 +1551,54 @@ } } }, - "/alerts/{alert_id}": { + "/alert-notifications/lookup": { "get": { - "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", + "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", "tags": [ - "legacy_alerts" - ], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", - "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - } + "legacy_alerts_notification_channels" ], + "summary": "Get all notification channels (lookup).", + "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/getAlertResponse" + "$ref": "#/responses/getAlertNotificationLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/{alert_id}/pause": { + "/alert-notifications/test": { "post": { + "description": "Sends a test notification to the channel.", "tags": [ - "legacy_alerts" + "legacy_alerts_notification_channels" ], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAlertCommand" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1416,8 +1606,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1425,67 +1615,276 @@ } } }, - "/annotations": { + "/alert-notifications/uid/{notification_channel_uid}": { "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "description": "Returns the notification channel given the notification channel UID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Find Annotations.", - "operationId": "getAnnotations", + "summary": "Get notification channel by UID.", + "operationId": "getAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, - { + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Updates an existing notification channel identified by uid.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelByUID", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" + } + }, + { "type": "string", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardUID", + "name": "notification_channel_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", + "parameters": [ + { + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/deleteAlertNotificationChannelResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alert-notifications/{notification_channel_id}": { + "get": { + "description": "Returns the notification channel given the notification channel ID.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Updates an existing notification channel identified by ID.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Deletes an existing notification channel identified by ID.", + "tags": [ + "legacy_alerts_notification_channels" + ], + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts": { + "get": { + "tags": [ + "legacy_alerts" + ], + "summary": "Get legacy alerts.", + "operationId": "getAlerts", + "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", "in": "query" }, { "type": "integer", "format": "int64", - "description": "Find annotations that are scoped to a specific panel", + "description": "Limit response to alert for a specified panel on a dashboard.", "name": "panelId", "in": "query" }, + { + "type": "string", + "description": "Limit response to alerts having a name like this value.", + "name": "query", + "in": "query" + }, + { + "enum": [ + "all", + "no_data", + "paused", + "alerting", + "ok", + "pending", + "unknown" + ], + "type": "string", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" + }, { "type": "integer", "format": "int64", - "description": "Max limit for results returned.", + "description": "Limit response to X number of alerts.", "name": "limit", "in": "query" }, @@ -1495,62 +1894,1531 @@ "type": "string" }, "collectionFormat": "multi", - "description": "Use this to filter organization annotations. Organization annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", - "name": "tags", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", "in": "query" }, { - "enum": [ - "alert", - "annotation" - ], "type": "string", - "description": "Return alerts or user created annotations", - "name": "type", + "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", + "name": "dashboardQuery", "in": "query" }, { - "type": "boolean", - "description": "Match any or all tags", - "name": "matchAny", + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", + "name": "dashboardTag", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationsResponse" + "$ref": "#/responses/getAlertsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/states-for-dashboard": { + "get": { + "tags": [ + "legacy_alerts" + ], + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "dashboardId", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardStatesResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/test": { + "post": { + "tags": [ + "legacy_alerts" + ], + "summary": "Test alert.", + "operationId": "testAlert", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertTestCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/testAlertResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/{alert_id}": { + "get": { + "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", + "tags": [ + "legacy_alerts" + ], + "summary": "Get alert by ID.", + "operationId": "getAlertByID", + "parameters": [ + { + "type": "string", + "name": "alert_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/alerts/{alert_id}/pause": { + "post": { + "tags": [ + "legacy_alerts" + ], + "summary": "Pause/unpause alert by id.", + "operationId": "pauseAlert", + "parameters": [ + { + "type": "string", + "name": "alert_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PauseAlertCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/pauseAlertResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations": { + "get": { + "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "tags": [ + "annotations" + ], + "summary": "Find Annotations.", + "operationId": "getAnnotations", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" + }, + { + "type": "string", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardUID", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Use this to filter organization annotations. Organization annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", + "name": "tags", + "in": "query" + }, + { + "enum": [ + "alert", + "annotation" + ], + "type": "string", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" + }, + { + "type": "boolean", + "description": "Match any or all tags", + "name": "matchAny", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then an organization annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", + "tags": [ + "annotations" + ], + "summary": "Create Annotation.", + "operationId": "postAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/graphite": { + "post": { + "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", + "tags": [ + "annotations" + ], + "summary": "Create Annotation in Graphite format.", + "operationId": "postGraphiteAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/mass-delete": { + "post": { + "tags": [ + "annotations" + ], + "summary": "Delete multiple annotations.", + "operationId": "massDeleteAnnotations", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MassDeleteAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/tags": { + "get": { + "description": "Find all the event tags created in the annotations.", + "tags": [ + "annotations" + ], + "summary": "Find Annotations Tags.", + "operationId": "getAnnotationTags", + "parameters": [ + { + "type": "string", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationTagsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/annotations/{annotation_id}": { + "get": { + "tags": [ + "annotations" + ], + "summary": "Get Annotation by ID.", + "operationId": "getAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationByIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + "tags": [ + "annotations" + ], + "summary": "Update Annotation.", + "operationId": "updateAnnotation", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Deletes the annotation that matches the specified ID.", + "tags": [ + "annotations" + ], + "summary": "Delete Annotation By ID.", + "operationId": "deleteAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "patch": { + "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", + "tags": [ + "annotations" + ], + "summary": "Patch Annotation.", + "operationId": "patchAnnotation", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/auth/keys": { + "get": { + "description": "Will return auth keys.", + "tags": [ + "api_keys" + ], + "summary": "Get auth keys.", + "operationId": "getAPIkeys", + "parameters": [ + { + "type": "boolean", + "default": false, + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAPIkeyResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Will return details of the created API key.", + "tags": [ + "api_keys" + ], + "summary": "Creates an API key.", + "operationId": "addAPIkey", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAPIkeyResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/auth/keys/{id}": { + "delete": { + "tags": [ + "api_keys" + ], + "summary": "Delete API key.", + "operationId": "deleteAPIkey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboard/snapshots": { + "get": { + "tags": [ + "snapshots" + ], + "summary": "List snapshots.", + "operationId": "searchDashboardSnapshots", + "parameters": [ + { + "type": "string", + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchDashboardSnapshotsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": [ + "application/json", + "text/html" + ], + "tags": [ + "dashboards" + ], + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "base": { + "$ref": "#/definitions/CalculateDiffTarget" + }, + "diffType": { + "description": "The type of diff to return\nDescription:\n`basic`\n`json`", + "type": "string", + "enum": [ + "basic", + "json" + ] + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/calculateDashboardDiffResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/db": { + "post": { + "description": "Creates a new dashboard or updates an existing dashboard.", + "tags": [ + "dashboards" + ], + "summary": "Create / Update dashboard", + "operationId": "postDashboard", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/home": { + "get": { + "tags": [ + "dashboards" + ], + "summary": "Get home dashboard.", + "operationId": "getHomeDashboard", + "responses": { + "200": { + "$ref": "#/responses/getHomeDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/permissions": { + "get": { + "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "tags": [ + "dashboard_permissions" + ], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "tags": [ + "dashboard_permissions" + ], + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/restore": { + "post": { + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersionByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/versions": { + "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardVersionsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardVersionResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/import": { + "post": { + "tags": [ + "dashboards" + ], + "summary": "Import dashboard.", + "operationId": "importDashboard", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ImportDashboardRequest" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/importDashboardResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/tags": { + "get": { + "tags": [ + "dashboards" + ], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", + "responses": { + "200": { + "$ref": "#/responses/getDashboardsTagsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/trim": { + "post": { + "tags": [ + "dashboards" + ], + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TrimDashboardCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/trimDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/uid/{uid}": { + "get": { + "description": "Will return the dashboard given the dashboard unique identifier (uid).", + "tags": [ + "dashboards" + ], + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", + "tags": [ + "dashboards" + ], + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/deleteDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/uid/{uid}/permissions": { + "get": { + "tags": [ + "dashboard_permissions" + ], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "This operation will remove existing permissions if they’re not included in the request.", + "tags": [ + "dashboard_permissions" + ], + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByUID", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/uid/{uid}/restore": { + "post": { + "tags": [ + "dashboard_versions" + ], + "summary": "Restore a dashboard to a given dashboard version using UID.", + "operationId": "restoreDashboardVersionByUID", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/uid/{uid}/versions": { + "get": { + "tags": [ + "dashboard_versions" + ], + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Version to start from when returning queries", + "name": "start", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardVersionsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "get": { + "tags": [ + "dashboard_versions" + ], + "summary": "Get a specific dashboard version using UID.", + "operationId": "getDashboardVersionByUID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardVersionResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", + "tags": [ + "datasources" + ], + "summary": "Get all data sources.", + "operationId": "getDataSources", + "responses": { + "200": { + "$ref": "#/responses/getDataSourcesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", + "tags": [ + "datasources" + ], + "summary": "Create a data source.", + "operationId": "addDataSource", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddDataSourceCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/createOrUpdateDatasourceResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/correlations": { + "get": { + "tags": [ + "correlations" + ], + "summary": "Gets all correlations.", + "operationId": "getCorrelations", + "responses": { + "200": { + "$ref": "#/responses/getCorrelationsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/id/{name}": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": [ + "datasources" + ], + "summary": "Get data source Id by Name.", + "operationId": "getDataSourceIdByName", + "parameters": [ + { + "type": "string", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDataSourceIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then an organization annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", + } + }, + "/datasources/name/{name}": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", "tags": [ - "annotations" + "datasources" ], - "summary": "Create Annotation.", - "operationId": "postAnnotation", + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1562,32 +3430,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/graphite": { - "post": { - "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", + }, + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", "tags": [ - "annotations" + "datasources" ], - "summary": "Create Annotation in Graphite format.", - "operationId": "postGraphiteAnnotation", + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteDataSourceByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1595,131 +3456,178 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/annotations/mass-delete": { - "post": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "get": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "annotations" + "datasources" ], - "summary": "Delete multiple annotations.", - "operationId": "massDeleteAnnotations", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MassDeleteAnnotationsCmd" - } + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/tags": { - "get": { - "description": "Find all the event tags created in the annotations.", + }, + "post": { + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", "tags": [ - "annotations" + "datasources" ], - "summary": "Find Annotations Tags.", - "operationId": "getAnnotationTags", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" + "name": "datasource_proxy_route", + "in": "path", + "required": true }, { "type": "string", - "default": "100", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/getAnnotationTagsResponse" + "201": { + "description": "" + }, + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/{annotation_id}": { - "get": { + }, + "delete": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "annotations" + "datasources" ], - "summary": "Get Annotation by ID.", - "operationId": "getAnnotationByID", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { "type": "string", - "name": "annotation_id", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/getAnnotationByIDResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + } + }, + "/datasources/proxy/{id}/{datasource_proxy_route}": { + "get": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "annotations" + "datasources" ], - "summary": "Update Annotation.", - "operationId": "updateAnnotation", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "annotation_id", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAnnotationsCmd" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -1730,29 +3638,51 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { - "description": "Deletes the annotation that matches the specified ID.", + "post": { + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "annotations" + "datasources" ], - "summary": "Delete Annotation By ID.", - "operationId": "deleteAnnotationByID", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", + "deprecated": true, "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "name": "annotation_id", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "201": { + "description": "" + }, + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1760,37 +3690,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", + "delete": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "annotations" + "datasources" ], - "summary": "Patch Annotation.", - "operationId": "patchAnnotation", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "annotation_id", + "name": "id", "in": "path", "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchAnnotationsCmd" - } + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1807,33 +3742,28 @@ } } }, - "/auth/keys": { + "/datasources/uid/{sourceUID}/correlations": { "get": { - "description": "Will return auth keys.", "tags": [ - "api_keys" + "correlations" ], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", "parameters": [ { - "type": "boolean", - "default": false, - "description": "Show expired keys", - "name": "includeExpired", - "in": "query" + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAPIkeyResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -1843,25 +3773,30 @@ } }, "post": { - "description": "Will return details of the created API key.", "tags": [ - "api_keys" + "correlations" ], - "summary": "Creates an API key.", - "operationId": "addAPIkey", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddCommand" + "$ref": "#/definitions/CreateCorrelationCommand" } + }, + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAPIkeyResponse" + "$ref": "#/responses/createCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -1872,8 +3807,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1881,32 +3816,34 @@ } } }, - "/auth/keys/{id}": { - "delete": { + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "get": { "tags": [ - "api_keys" + "correlations" ], - "summary": "Delete API key.", - "operationId": "deleteAPIkey", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "id", + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -1914,115 +3851,37 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboard/snapshots": { - "get": { + }, + "patch": { "tags": [ - "snapshots" + "correlations" ], - "summary": "List snapshots.", - "operationId": "searchDashboardSnapshots", + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", "parameters": [ { "type": "string", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/searchDashboardSnapshotsResponse" + "name": "sourceUID", + "in": "path", + "required": true }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/calculate-diff": { - "post": { - "produces": [ - "application/json", - "text/html" - ], - "tags": [ - "dashboards" - ], - "summary": "Perform diff on two dashboards.", - "operationId": "calculateDashboardDiff", - "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "base": { - "$ref": "#/definitions/CalculateDiffTarget" - }, - "diffType": { - "description": "The type of diff to return\nDescription:\n`basic`\n`json`", - "type": "string", - "enum": [ - "basic", - "json" - ] - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/calculateDashboardDiffResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "type": "string", + "name": "correlationUID", + "in": "path", + "required": true }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/db": { - "post": { - "description": "Creates a new dashboard or updates an existing dashboard.", - "tags": [ - "dashboards" - ], - "summary": "Create / Update dashboard", - "operationId": "postDashboard", - "parameters": [ { - "name": "Body", + "name": "body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/SaveDashboardCommand" + "$ref": "#/definitions/UpdateCorrelationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/updateCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2036,59 +3895,34 @@ "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/home": { - "get": { - "tags": [ - "dashboards" - ], - "summary": "Get home dashboard.", - "operationId": "getHomeDashboard", - "responses": { - "200": { - "$ref": "#/responses/getHomeDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/permissions": { + "/datasources/uid/{uid}": { "get": { - "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", "tags": [ - "dashboard_permissions" - ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByID", - "deprecated": true, + "datasources" + ], + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2104,37 +3938,62 @@ } } }, - "post": { - "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "put": { + "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByID", - "deprecated": true, + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": [ + "datasources" + ], + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2151,35 +4010,30 @@ } } }, - "/dashboards/id/{DashboardID}/restore": { - "post": { - "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "dashboard_versions" + "correlations" ], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersionByID", - "deprecated": true, + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2196,27 +4050,27 @@ } } }, - "/dashboards/id/{DashboardID}/versions": { + "/datasources/uid/{uid}/health": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersionsByID", - "deprecated": true, + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2224,43 +4078,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersionByID", - "deprecated": true, + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2277,26 +4127,26 @@ } } }, - "/dashboards/import": { + "/datasources/{datasourceId}/disable-permissions": { "post": { + "description": "Disables permissions for the data source with the given id. All existing permissions will be removed and anyone will be able to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Import dashboard.", - "operationId": "importDashboard", + "summary": "Disable permissions for a data source.", + "operationId": "disablePermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ImportDashboardRequest" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/importDashboardResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2304,11 +4154,11 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "403": { + "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -2316,75 +4166,122 @@ } } }, - "/dashboards/tags": { - "get": { + "/datasources/{datasourceId}/enable-permissions": { + "post": { + "description": "Enables permissions for the data source with the given id.\nNo one except Org Admins will be able to query the data source until permissions have been added\nwhich permit certain users or teams to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" + ], + "summary": "Enable permissions for a data source.", + "operationId": "enablePermissions", + "parameters": [ + { + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true + } ], - "summary": "Get all dashboards tags of an organisation.", - "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/getDashboardsTagsResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/trim": { - "post": { + "/datasources/{datasourceId}/permissions": { + "get": { + "description": "Gets all existing permissions for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", + "summary": "Get permissions for a data source.", + "operationId": "getAllPermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TrimDashboardCommand" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/trimDashboardResponse" + "$ref": "#/responses/getAllPermissionseResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}": { - "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", + }, + "post": { + "description": "You need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "summary": "Add permissions for a data source.", + "operationId": "addPermission", "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "query" + }, { "type": "string", - "name": "uid", + "name": "builtinRole", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "permission", + "in": "query" + }, + { + "type": "string", + "name": "datasourceId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardResponse" + "$ref": "#/responses/addPermissionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2399,25 +4296,34 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/datasources/{datasourceId}/permissions/{permissionId}": { "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", + "description": "Removes the permission with the given permissionId for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:delete` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + "summary": "Remove permission for a data source.", + "operationId": "deletePermissions", "parameters": [ { "type": "string", - "name": "uid", + "name": "datasourceId", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "permissionId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2427,31 +4333,33 @@ }, "404": { "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/permissions": { + "/datasources/{id}": { "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Get a single data source by Id.", + "operationId": "getDataSourceByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2467,35 +4375,33 @@ } } }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", + "put": { + "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "summary": "Update an existing data source by its sequential ID.", + "operationId": "updateDataSourceByID", + "deprecated": true, "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2503,41 +4409,30 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}/restore": { - "post": { + }, + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2554,40 +4449,29 @@ } } }, - "/dashboards/uid/{uid}/versions": { + "/datasources/{id}/health": { "get": { + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Sends a health check request to the plugin datasource identified by the ID.", + "operationId": "checkDatasourceHealthByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2595,40 +4479,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "/datasources/{id}/resources/{datasource_proxy_route}": { "get": { + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2645,81 +4530,39 @@ } } }, - "/datasources": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", - "tags": [ - "datasources" - ], - "summary": "Get all data sources.", - "operationId": "getDataSources", - "responses": { - "200": { - "$ref": "#/responses/getDataSourcesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/ds/query": { "post": { - "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", "tags": [ - "datasources" + "ds" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddDataSourceCommand" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "409": { - "$ref": "#/responses/conflictError" + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", - "responses": { - "200": { - "$ref": "#/responses/getCorrelationsResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -2727,25 +4570,35 @@ } } }, - "/datasources/id/{name}": { + "/folders": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "datasources" + "folders" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "Get all folders.", + "operationId": "getFolders", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceIDResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2753,34 +4606,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/name/{name}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + }, + "post": { "tags": [ - "datasources" + "folders" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateFolderCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/folderResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2788,29 +4640,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + } + }, + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", "tags": [ - "datasources" + "folders" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "type": "string", - "name": "name", + "type": "integer", + "format": "int64", + "name": "folder_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2827,34 +4685,24 @@ } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/folders/{folder_uid}": { "get": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2870,39 +4718,32 @@ } } }, - "post": { - "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", + "put": { "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateFolderCommand" + } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" + "200": { + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2916,35 +4757,39 @@ "404": { "$ref": "#/responses/notFoundError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Proxies all calls to the actual data source.", + "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", + "name": "forceDeleteRules", + "in": "query" } ], "responses": { - "202": { - "description": "" + "200": { + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2964,35 +4809,24 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/folders/{folder_uid}/permissions": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getFolderPermissionListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3009,42 +4843,30 @@ } }, "post": { - "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3059,106 +4881,111 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/library-elements": { + "get": { + "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "name": "id", - "in": "path", - "required": true + "description": "Part of the name or description searched for.", + "name": "searchString", + "in": "query" }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - } - ], - "responses": { - "202": { - "description": "" + "enum": [ + 1, + 2 + ], + "type": "integer", + "format": "int64", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" }, - "400": { - "$ref": "#/responses/badRequestError" + { + "enum": [ + "alpha-asc", + "alpha-desc" + ], + "type": "string", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "type": "string", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "string", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "string", + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/uid/{sourceUID}/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", - "parameters": [ { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 100, + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationsBySourceUIDResponse" + "$ref": "#/responses/getLibraryElementsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { + "description": "Creates a new library element.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } - }, - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3178,30 +5005,25 @@ } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "/library-elements/name/{library_element_name}": { "get": { + "description": "Returns a library element with the given name.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3213,47 +5035,31 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_uid", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3261,27 +5067,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{uid}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + }, + "delete": { + "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3300,32 +5104,35 @@ } } }, - "put": { - "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:1` (single data source).", + "patch": { + "description": "Updates an existing library element identified by uid.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Update an existing data source.", - "operationId": "updateDataSourceByUID", + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } }, { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3333,36 +5140,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + } + }, + "/library-elements/{library_element_uid}/connections/": { + "get": { + "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3372,39 +5184,33 @@ } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/licensing/check": { + "get": { "tags": [ - "correlations" + "licensing", + "enterprise" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true + "summary": "Check license availability.", + "operationId": "getStatus", + "responses": { + "200": { + "$ref": "#/responses/getStatusResponse" } + } + } + }, + "/licensing/custom-permissions": { + "get": { + "description": "You need to have a permission with action `licensing.reports:read`.", + "tags": [ + "licensing", + "enterprise" ], + "summary": "Get custom permissions report.", + "operationId": "getCustomPermissionsReport", "responses": { "200": { - "$ref": "#/responses/deleteCorrelationResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/getCustomPermissionsReportResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -3412,33 +5218,21 @@ } } }, - "/datasources/uid/{uid}/health": { + "/licensing/custom-permissions-csv": { "get": { - "tags": [ - "datasources" + "description": "You need to have a permission with action `licensing.reports:read`.", + "produces": [ + "text/csv" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "tags": [ + "licensing", + "enterprise" ], + "summary": "Get custom permissions report in CSV format.", + "operationId": "getCustomPermissionsCSV", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/getCustomPermissionsReportResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -3446,42 +5240,18 @@ } } }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { + "/licensing/refresh-stats": { "get": { + "description": "You need to have a permission with action `licensing:read`.", "tags": [ - "datasources" - ], - "summary": "Fetch data source resources.", - "operationId": "callDatasourceResourceWithUID", - "parameters": [ - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "licensing", + "enterprise" ], + "summary": "Refresh license stats.", + "operationId": "refreshLicenseStats", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/refreshLicenseStatsResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -3489,71 +5259,72 @@ } } }, - "/datasources/{id}": { + "/licensing/token": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", + "description": "You need to have a permission with action `licensing:read`.", + "tags": [ + "licensing", + "enterprise" + ], + "summary": "Get license token.", + "operationId": "getLicenseToken", + "responses": { + "200": { + "$ref": "#/responses/getLicenseTokenResponse" + } + } + }, + "post": { + "description": "You need to have a permission with action `licensing:update`.", "tags": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Get a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, + "summary": "Create license token.", + "operationId": "postLicenseToken", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteTokenCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/getLicenseTokenResponse" }, "400": { "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } }, - "put": { - "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", + "delete": { + "description": "Removes the license stored in the Grafana database. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:delete`.", "tags": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Remove license from database.", + "operationId": "deleteLicenseToken", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/DeleteTokenCommand" } - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true } ], "responses": { - "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "202": { + "$ref": "#/responses/acceptedResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3561,36 +5332,58 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", + } + }, + "/licensing/token/renew": { + "post": { + "description": "Manually ask license issuer for a new token. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:update`.", "tags": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, + "summary": "Manually force license refresh.", + "operationId": "postRenewLicenseToken", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/postRenewLicenseTokenResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" + } + } + } + }, + "/logout/saml": { + "get": { + "tags": [ + "saml", + "enterprise" + ], + "summary": "GetLogout initiates single logout process.", + "operationId": "getSAMLLogout", + "responses": { + "302": { + "description": "" }, "404": { "$ref": "#/responses/notFoundError" @@ -3601,29 +5394,16 @@ } } }, - "/datasources/{id}/health": { + "/org": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "datasources" - ], - "summary": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "org" ], + "summary": "Get current Organization.", + "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3635,29 +5415,21 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{id}/resources/{datasource_proxy_route}": { - "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", + }, + "put": { "tags": [ - "datasources" + "org" ], - "summary": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", - "deprecated": true, + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgForm" + } } ], "responses": { @@ -3673,39 +5445,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/ds/query": { - "post": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", + "/org/address": { + "put": { "tags": [ - "ds" + "org" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MetricRequest" + "$ref": "#/definitions/UpdateOrgAddressForm" } } ], "responses": { "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3722,35 +5487,16 @@ } } }, - "/folders": { + "/org/invites": { "get": { - "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "folders" - ], - "summary": "Get all folders.", - "operationId": "getFolders", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3765,23 +5511,23 @@ }, "post": { "tags": [ - "folders" + "org_invites" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/AddInviteForm" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3792,8 +5538,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3801,26 +5547,24 @@ } } }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", + "/org/invites/{invitation_code}/revoke": { + "delete": { "tags": [ - "folders" + "org_invites" ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "folder_id", + "type": "string", + "name": "invitation_code", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3837,24 +5581,16 @@ } } }, - "/folders/{folder_uid}": { + "/org/preferences": { "get": { "tags": [ - "folders" - ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - } + "org_preferences" ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3862,9 +5598,6 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } @@ -3872,30 +5605,23 @@ }, "put": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Update folder.", - "operationId": "updateFolder", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", + "parameters": [ { - "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateFolderCommand" + "$ref": "#/definitions/UpdatePrefsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3906,42 +5632,30 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { - "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", + "patch": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "type": "boolean", - "default": false, - "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", - "name": "forceDeleteRules", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchPrefsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3952,33 +5666,23 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}/permissions": { + "/org/users": { "get": { + "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", "tags": [ - "folder_permissions" - ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - } + "org" ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3986,33 +5690,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", "tags": [ - "folder_permissions" + "org" ], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/AddOrgUserCommand" } } ], @@ -4026,118 +5722,69 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements": { + "/org/users/lookup": { "get": { - "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", + "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", "tags": [ - "library_elements" + "org" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", "parameters": [ { "type": "string", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [ - 1, - 2 - ], - "type": "integer", - "format": "int64", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" - }, - { - "enum": [ - "alpha-asc", - "alpha-desc" - ], - "type": "string", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" - }, - { - "type": "string", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 100, - "description": "The number of results per page.", - "name": "perPage", + "name": "query", "in": "query" }, { "type": "integer", "format": "int64", - "default": 1, - "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", - "name": "page", + "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "Creates a new library element.", + } + }, + "/org/users/{user_id}": { + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", "tags": [ - "library_elements" + "org" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4148,40 +5795,47 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/name/{library_element_name}": { - "get": { - "description": "Returns a library element with the given name.", + }, + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", "tags": [ - "library_elements" + "org" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Updates the given user.", + "operationId": "updateOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "library_element_name", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgUserCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4189,58 +5843,49 @@ } } }, - "/library-elements/{library_element_uid}": { + "/orgs": { "get": { - "description": "Returns a library element with the given UID.", - "tags": [ - "library_elements" - ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", - "parameters": [ + "security": [ { - "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", + "name": "perpage", + "in": "query" + }, { "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", + "name": "query", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4248,43 +5893,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", + "post": { + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "library_elements" + "orgs" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" + "$ref": "#/definitions/CreateOrgCommand" } - }, - { - "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4292,11 +5928,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4304,31 +5937,35 @@ } } }, - "/library-elements/{library_element_uid}/connections/": { + "/orgs/name/{org_name}": { "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "$ref": "#/responses/getOrgByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4336,16 +5973,30 @@ } } }, - "/org": { + "/orgs/{org_id}": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "org" + "orgs" + ], + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "$ref": "#/responses/getOrgByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4359,11 +6010,16 @@ } }, "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { "name": "body", @@ -4372,6 +6028,13 @@ "schema": { "$ref": "#/definitions/UpdateOrgForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { @@ -4391,23 +6054,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/org/address": { - "put": { + }, + "delete": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { @@ -4423,22 +6088,45 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { - "get": { + "/orgs/{org_id}/address": { + "put": { "tags": [ - "org_invites" + "orgs" + ], + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4450,29 +6138,28 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/orgs/{org_id}/quotas": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).", "tags": [ - "org_invites" + "orgs" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddInviteForm" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4480,8 +6167,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4489,17 +6176,38 @@ } } }, - "/org/invites/{invitation_code}/revoke": { - "delete": { + "/orgs/{org_id}/quotas/{quota_target}": { + "put": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", "tags": [ - "org_invites" + "orgs" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgQuotaCmd" + } + }, { "type": "string", - "name": "invitation_code", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } @@ -4523,16 +6231,31 @@ } } }, - "/org/preferences": { + "/orgs/{org_id}/users": { "get": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", "tags": [ - "org_preferences" + "orgs" + ], + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getPreferencesResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4545,29 +6268,34 @@ } } }, - "put": { + "post": { + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", "tags": [ - "org_preferences" + "orgs" ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -4578,21 +6306,30 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/orgs/{org_id}/users/{user_id}": { + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", "tags": [ - "org_preferences" + "orgs" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUser", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchPrefsCmd" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -4612,52 +6349,45 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/org/users": { - "get": { - "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", - "tags": [ - "org" - ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", - "responses": { - "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } }, - "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", "tags": [ - "org" + "orgs" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -4670,14 +6400,13 @@ } } }, - "/org/users/lookup": { + "/playlists": { "get": { - "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", "tags": [ - "org" + "playlists" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Get playlists.", + "operationId": "searchPlaylists", "parameters": [ { "type": "string", @@ -4687,49 +6416,39 @@ { "type": "integer", "format": "int64", + "description": "in:limit", "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/searchPlaylistsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/users/{user_id}": { - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", + }, + "post": { "tags": [ - "org" + "playlists" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Create playlist.", + "operationId": "createPlaylist", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePlaylistCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4737,41 +6456,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + } + }, + "/playlists/{uid}": { + "get": { "tags": [ - "org" + "playlists" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Get playlist.", + "operationId": "getPlaylist", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4779,55 +6490,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs": { - "get": { - "security": [ - { - "basic": [] - } - ], + }, + "put": { "tags": [ - "orgs" + "playlists" ], - "summary": "Search all Organizations.", - "operationId": "searchOrgs", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", - "name": "perpage", - "in": "query" - }, + "summary": "Update playlist.", + "operationId": "updatePlaylist", + "parameters": [ { - "type": "string", - "name": "name", - "in": "query" + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdatePlaylistCommand" + } }, { "type": "string", - "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", - "name": "query", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchOrgsResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4835,34 +6530,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", + "delete": { "tags": [ - "orgs" + "playlists" ], - "summary": "Create Organization.", - "operationId": "createOrg", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrgCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4870,8 +6562,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4879,29 +6571,24 @@ } } }, - "/orgs/name/{org_name}": { + "/playlists/{uid}/dashboards": { "get": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "playlists" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "parameters": [ { "type": "string", - "name": "org_name", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByNameResponse" + "$ref": "#/responses/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4909,36 +6596,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}": { + "/playlists/{uid}/items": { "get": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "playlists" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByIDResponse" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4946,80 +6630,118 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "security": [ - { - "basic": [] - } - ], + } + }, + "/query-history": { + "get": { + "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgForm" - } + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", + "in": "query" + }, + { + "type": "string", + "description": "Text inside query or comments that is searched for", + "name": "searchString", + "in": "query" + }, + { + "type": "boolean", + "description": "Flag indicating if only starred queries should be returned", + "name": "onlyStarred", + "in": "query" + }, + { + "enum": [ + "time-desc", + "time-asc" + ], + "type": "string", + "default": "time-desc", + "description": "Sort method", + "name": "sort", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "From range for the query history search", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "To range for the query history search", + "name": "to", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQueryHistorySearchResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { - "security": [ - { - "basic": [] - } - ], + "post": { + "description": "Adds new query to query history.", "tags": [ - "orgs" + "query_history" ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5027,45 +6749,33 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/address": { - "put": { + "/query-history/migrate": { + "post": { + "description": "Adds multiple queries to query history.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5073,213 +6783,146 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/quotas": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).", + "/query-history/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Add star to query in query history.", + "operationId": "starQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/quotas/{quota_target}": { - "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", + }, + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" - } - }, { "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/users": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", + "/query-history/{query_history_uid}": { + "delete": { + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "orgs" + "query_history" ], - "summary": "Get Users in Organization.", - "operationId": "getOrgUsers", + "summary": "Delete query in query history.", + "operationId": "deleteQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "patch": { + "description": "Updates comment for query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", + "summary": "Update comment for query in query history.", + "operationId": "patchQueryComment", "parameters": [ + { + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/users/{user_id}": { - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", + "/recording-rules": { + "get": { "tags": [ - "orgs" - ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Lists all rules in the database: active or deleted.", + "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/listRecordingRulesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5287,48 +6930,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + "put": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", + "summary": "Update the active status of a rule.", + "operationId": "updateRecordingRule", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" + "$ref": "#/definitions/RecordingRuleJSON" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/recordingRuleResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5336,61 +6965,71 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/playlists": { - "get": { + }, + "post": { "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Get playlists.", - "operationId": "searchPlaylists", + "summary": "Create a recording rule that is then registered and started.", + "operationId": "createRecordingRule", "parameters": [ { - "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "in:limit", - "name": "limit", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RecordingRuleJSON" + } } ], "responses": { "200": { - "$ref": "#/responses/searchPlaylistsResponse" + "$ref": "#/responses/recordingRuleResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/recording-rules/test": { "post": { "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Create playlist.", - "operationId": "createPlaylist", + "summary": "Test a recording rule.", + "operationId": "testCreateRecordingRule", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" + "$ref": "#/definitions/RecordingRuleJSON" } } ], "responses": { "200": { - "$ref": "#/responses/createPlaylistResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5401,30 +7040,26 @@ "404": { "$ref": "#/responses/notFoundError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}": { + "/recording-rules/writer": { "get": { "tags": [ - "playlists" - ], - "summary": "Get playlist.", - "operationId": "getPlaylist", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Return the prometheus remote write target.", + "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/getPlaylistResponse" + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5440,31 +7075,55 @@ } } }, - "put": { + "post": { + "description": "It returns a 422 if there is not an existing prometheus data source configured.", "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", + "summary": "Create a remote write target.", + "operationId": "createRecordingRuleWriteTarget", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" + "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" } + } + ], + "responses": { + "200": { + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, + "500": { + "$ref": "#/responses/internalServerError" } + } + }, + "delete": { + "tags": [ + "recording_rules", + "enterprise" ], + "summary": "Delete the remote write target.", + "operationId": "deleteRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/updatePlaylistResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5479,17 +7138,21 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/recording-rules/{recordingRuleID}": { "delete": { "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Delete removes the rule from the registry and stops it.", + "operationId": "deleteRecordingRule", "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "recordingRuleID", "in": "path", "required": true } @@ -5513,24 +7176,54 @@ } } }, - "/playlists/{uid}/dashboards": { + "/reports": { "get": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports:read` with scope `reports:*`.", "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "summary": "List reports.", + "operationId": "getReports", + "responses": { + "200": { + "$ref": "#/responses/getReportsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports.admin:create`.", + "tags": [ + "reports", + "enterprise" + ], + "summary": "Create a report.", + "operationId": "createReport", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrUpdateConfigCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/createReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5547,24 +7240,31 @@ } } }, - "/playlists/{uid}/items": { - "get": { + "/reports/email": { + "post": { + "description": "Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds. Available to org admins only and with a valid license.\n\nOnly available in Grafana Enterprise v7.0+.\nThis API endpoint is experimental and may be deprecated in a future release. On deprecation, a migration strategy will be provided and the endpoint will remain functional until the next major release of Grafana.\n\nYou need to have a permission with action `reports:send`.", "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist items.", - "operationId": "getPlaylistItems", + "summary": "Send a report.", + "operationId": "sendReport", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReportEmailDTO" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistItemsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5581,109 +7281,171 @@ } } }, - "/query-history": { + "/reports/render/pdf/{dashboardID}": { "get": { - "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", + "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", + "produces": [ + "application/pdf" + ], "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Render report for dashboard.", + "operationId": "renderReportPDF", + "deprecated": true, "parameters": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "List of data source UIDs to search for", - "name": "datasourceUid", + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "dashboardID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "title", "in": "query" }, { "type": "string", - "description": "Text inside query or comments that is searched for", - "name": "searchString", + "name": "variables", "in": "query" }, { - "type": "boolean", - "description": "Flag indicating if only starred queries should be returned", - "name": "onlyStarred", + "type": "string", + "name": "from", "in": "query" }, { - "enum": [ - "time-desc", - "time-asc" - ], "type": "string", - "default": "time-desc", - "description": "Sort method", - "name": "sort", + "name": "to", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", - "name": "page", + "type": "string", + "name": "orientation", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "Limit the number of returned results", - "name": "limit", + "type": "string", + "name": "layout", "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/reports/render/pdfs": { + "get": { + "description": "Available to all users and with a valid license.", + "produces": [ + "application/pdf" + ], + "tags": [ + "reports", + "enterprise" + ], + "summary": "Render report for multiple dashboards.", + "operationId": "renderReportPDFs", + "parameters": [ { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", + "type": "string", + "name": "dashboardID", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "To range for the query history search", - "name": "to", + "type": "string", + "name": "orientation", + "in": "query" + }, + { + "type": "string", + "name": "layout", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistorySearchResponse" + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/reports/settings": { + "get": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.settings:read`x.", + "tags": [ + "reports", + "enterprise" + ], + "summary": "Get settings.", + "operationId": "getReportSettings", + "responses": { + "200": { + "$ref": "#/responses/getReportSettingsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Adds new query to query history.", + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.settings:write`xx.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Save settings.", + "operationId": "saveReportSettings", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + "$ref": "#/definitions/SettingsDTO" } } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5691,33 +7453,37 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/migrate": { + "/reports/test-email": { "post": { - "description": "Adds multiple queries to query history.", + "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports:send`.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Send test report via email.", + "operationId": "sendTestEmail", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5725,128 +7491,241 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/star/{query_history_uid}": { - "post": { - "description": "Adds star to query in query history as specified by the UID.", + "/reports/{id}": { + "get": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports:read` with scope `reports:id:\u003creport ID\u003e`.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "Get a report.", + "operationId": "getReport", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.admin:write` with scope `reports:id:\u003creport ID\u003e`.", + "tags": [ + "reports", + "enterprise" + ], + "summary": "Update a report.", + "operationId": "updateReport", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrUpdateConfigCmd" + } + }, + { + "type": "integer", + "format": "int64", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Removes star from query in query history as specified by the UID.", + "description": "Available to org admins only and with a valid or expired license.\n\nYou need to have a permission with action `reports.delete` with scope `reports:id:\u003creport ID\u003e`.", "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", + "summary": "Delete a report.", + "operationId": "deleteReport", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "type": "integer", + "format": "int64", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/{query_history_uid}": { - "delete": { - "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", + "/saml/acs": { + "post": { "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", + "summary": "It performs assertion Consumer Service (ACS).", + "operationId": "postACS", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "RelayState", + "in": "query" + } + ], + "responses": { + "302": { + "description": "" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } + } + } + }, + "/saml/metadata": { + "get": { + "produces": [ + "application/xml;application/samlmetadata+xml" ], + "tags": [ + "saml", + "enterprise" + ], + "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", + "operationId": "getMetadata", "responses": { "200": { - "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" + "$ref": "#/responses/contentResponse" + } + } + } + }, + "/saml/slo": { + "get": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", + "tags": [ + "saml", + "enterprise" + ], + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "getSLO", + "responses": { + "302": { + "description": "" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + "post": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "postSLO", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "SAMLRequest", + "in": "query" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" - } + "type": "string", + "name": "SAMLResponse", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6563,6 +8442,135 @@ } } }, + "/teams/{teamId}/groups": { + "get": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Get External Groups.", + "operationId": "getTeamGroupsApi", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getTeamGroupsApiResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Add External Group.", + "operationId": "addTeamGroupApi", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TeamGroupMapping" + } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/teams/{teamId}/groups/{groupId}": { + "delete": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Remove External Group.", + "operationId": "removeTeamGroupApi", + "parameters": [ + { + "type": "string", + "name": "groupId", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/teams/{team_id}": { "get": { "tags": [ @@ -7633,9 +9641,66 @@ } } } - } - }, - "definitions": { + } + }, + "definitions": { + "ActiveSyncStatusDTO": { + "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "nextSync": { + "type": "string", + "format": "date-time" + }, + "prevSync": { + "$ref": "#/definitions/SyncResult" + }, + "schedule": { + "type": "string" + } + } + }, + "ActiveUserStats": { + "type": "object", + "properties": { + "active_admins_and_editors": { + "type": "integer", + "format": "int64" + }, + "active_users": { + "type": "integer", + "format": "int64" + }, + "active_viewers": { + "type": "integer", + "format": "int64" + } + } + }, + "AddBuiltInRoleCommand": { + "type": "object", + "properties": { + "builtInRole": { + "type": "string", + "enum": [ + "Viewer", + " Editor", + " Admin", + " Grafana Admin" + ] + }, + "global": { + "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to create organization local assignment. Refer to the Built-in role assignments for more information.", + "type": "boolean" + }, + "roleUid": { + "type": "string" + } + } + }, "AddCommand": { "type": "object", "properties": { @@ -7742,6 +9807,25 @@ } } }, + "AddPermissionDTO": { + "type": "object", + "properties": { + "builtinRole": { + "type": "string" + }, + "permission": { + "$ref": "#/definitions/DsPermissionType" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "AddServiceAccountTokenCommand": { "type": "object", "properties": { @@ -8166,6 +10250,26 @@ } } }, + "BrandingOptionsDTO": { + "type": "object", + "properties": { + "emailFooterLink": { + "type": "string" + }, + "emailFooterMode": { + "type": "string" + }, + "emailFooterText": { + "type": "string" + }, + "emailLogoUrl": { + "type": "string" + }, + "reportLogoUrl": { + "type": "string" + } + } + }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -9081,6 +11185,18 @@ } } }, + "FailedUser": { + "description": "FailedUser holds the information of an user that failed", + "type": "object", + "properties": { + "Error": { + "type": "string" + }, + "Login": { + "type": "string" + } + } + }, "Field": { "description": "A Field is essentially a slice of various types with extra properties and methods.\nSee NewField() for supported types.\n\nThe slice data in the Field is a not exported, so methods on the Field are used to to manipulate its data.", "type": "object", @@ -10695,6 +12811,86 @@ } } }, + "RecordingRuleJSON": { + "description": "RecordingRuleJSON is the external representation of a recording rule", + "type": "object", + "properties": { + "active": { + "type": "boolean" + }, + "count": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "dest_data_source_uid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "interval": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "prom_name": { + "type": "string" + }, + "queries": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": {} + } + }, + "range": { + "type": "integer", + "format": "int64" + }, + "target_ref_id": { + "type": "string" + } + } + }, + "ReportEmailDTO": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "emails": { + "description": "Comma-separated list of emails to which to send the report to.", + "type": "string" + }, + "id": { + "description": "Send the report to the emails specified in the report. Required if emails is not present.", + "type": "string", + "format": "int64" + }, + "useEmailsFromReport": { + "description": "Send the report to the emails specified in the report. Required if emails is not present.", + "type": "boolean" + } + } + }, + "ReportOptionsDTO": { + "type": "object", + "properties": { + "layout": { + "type": "string" + }, + "orientation": { + "type": "string" + }, + "timeRange": { + "$ref": "#/definitions/TimeRangeDTO" + } + } + }, "Responses": { "description": "The QueryData method the QueryDataHandler method will set the RefId\nproperty on the DataResponses' frames based on these RefIDs.", "type": "object", @@ -10721,6 +12917,79 @@ } } }, + "RoleAssignmentsDTO": { + "type": "object", + "properties": { + "role_uid": { + "type": "string" + }, + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "RoleDTO": { + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "delegatable": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "uid": { + "type": "string" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "SaveDashboardCommand": { "type": "object", "properties": { @@ -10937,6 +13206,49 @@ } } }, + "SetRoleAssignmentsCommand": { + "type": "object", + "properties": { + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "SetUserRolesCommand": { + "type": "object", + "properties": { + "global": { + "type": "boolean" + }, + "includeHidden": { + "type": "boolean" + }, + "roleUids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -12250,6 +14562,30 @@ } } }, + "getCurrentOrgResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/Correlation" + } + }, + "getCorrelationsBySourceUIDResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Correlation" + } + } + }, + "getCorrelationsResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Correlation" + } + } + }, "getCurrentOrgResponse": { "description": "", "schema": { @@ -12465,6 +14801,39 @@ } } }, + "getReportResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/ConfigDTO" + } + }, + "getReportSettingsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/SettingsDTO" + } + }, + "getReportsResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ConfigDTO" + } + } + }, + "getRoleAssignmentsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, + "getRoleResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleDTO" + } + }, "getSharingOptionsResponse": { "description": "", "schema": { @@ -12795,6 +15164,12 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, + "setRoleAssignmentsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, "testAlertResponse": { "description": "", "schema": { diff --git a/public/app/percona/backup/components/StorageLocations/StorageLocationDetails/StorageLocationDetails.tsx b/public/app/percona/backup/components/StorageLocations/StorageLocationDetails/StorageLocationDetails.tsx index c09d445b06dd..4b2fa795c710 100644 --- a/public/app/percona/backup/components/StorageLocations/StorageLocationDetails/StorageLocationDetails.tsx +++ b/public/app/percona/backup/components/StorageLocations/StorageLocationDetails/StorageLocationDetails.tsx @@ -20,6 +20,7 @@ export const StorageLocationDetails: FC = ({ locati {isS3Location(location) ? ( <> + {/* eslint-disable-next-line jsx-a11y/no-access-key */} ) : null} diff --git a/scripts/drone/events/main.star b/scripts/drone/events/main.star index 1d43da3f8c6f..f3228431503c 100644 --- a/scripts/drone/events/main.star +++ b/scripts/drone/events/main.star @@ -32,7 +32,6 @@ load( load( "scripts/drone/pipelines/windows.star", "windows", - "windows_test_backend", ) load( "scripts/drone/pipelines/trigger_downstream.star", @@ -90,8 +89,6 @@ def main_pipelines(): build_e2e(trigger, ver_mode), integration_tests(trigger, prefix = ver_mode, ver_mode = ver_mode), windows(trigger, edition = "oss", ver_mode = ver_mode), - windows_test_backend(trigger, "oss", ver_mode), - windows_test_backend(trigger, "enterprise", ver_mode), notify_pipeline( name = "notify-drone-changes", slack_channel = "slack-webhooks-test", diff --git a/scripts/drone/events/pr.star b/scripts/drone/events/pr.star index 9e1ba26a046a..14605cd79099 100644 --- a/scripts/drone/events/pr.star +++ b/scripts/drone/events/pr.star @@ -15,10 +15,6 @@ load( "scripts/drone/pipelines/integration_tests.star", "integration_tests", ) -load( - "scripts/drone/pipelines/windows.star", - "windows_test_backend", -) load( "scripts/drone/pipelines/build.star", "build_e2e", @@ -104,18 +100,12 @@ def pr_pipelines(): ), ver_mode, ), - windows_test_backend( - get_pr_trigger( - exclude_paths = ["pkg/**", "packaging/**", "go.sum", "go.mod"], - ), - "oss", - ver_mode, - ), lint_backend_pipeline( get_pr_trigger( include_paths = [ "pkg/**", "packaging/**", + ".drone.yml", "conf/**", "go.sum", "go.mod", diff --git a/scripts/drone/events/release.star b/scripts/drone/events/release.star index 61a242475c21..8dcbcb4f95c3 100644 --- a/scripts/drone/events/release.star +++ b/scripts/drone/events/release.star @@ -60,10 +60,6 @@ load( "test_backend", "test_backend_enterprise", ) -load( - "scripts/drone/pipelines/windows.star", - "windows_test_backend", -) load("scripts/drone/vault.star", "from_secret", "prerelease_bucket") ver_mode = "release" @@ -214,20 +210,10 @@ def oss_pipelines(ver_mode = ver_mode, trigger = release_trigger): integration_test_steps = [] volumes = [] - windows_pipeline = pipeline( - name = "{}-oss-windows".format(ver_mode), - edition = "oss", - trigger = trigger, - steps = get_windows_steps(edition = "oss", ver_mode = ver_mode), - platform = "windows", - depends_on = [ - "{}-oss-build-e2e-publish".format(ver_mode), - "{}-oss-test-frontend".format(ver_mode), - "{}-oss-test-backend-windows".format(ver_mode), - ], - environment = environment, - ) - + windows_pipeline_dependencies = [ + "{}-oss-build-e2e-publish".format(ver_mode), + "{}-oss-test-frontend".format(ver_mode), + ] pipelines = [ pipeline( name = "{}-oss-build-e2e-publish".format(ver_mode), @@ -240,8 +226,6 @@ def oss_pipelines(ver_mode = ver_mode, trigger = release_trigger): ), test_frontend(trigger, ver_mode), test_backend(trigger, ver_mode), - windows_test_backend(trigger, "oss", ver_mode), - windows_test_backend(trigger, "enterprise", ver_mode), ] if ver_mode not in ("release"): @@ -261,6 +245,16 @@ def oss_pipelines(ver_mode = ver_mode, trigger = release_trigger): volumes = volumes, )) + windows_pipeline = pipeline( + name = "{}-oss-windows".format(ver_mode), + edition = "oss", + trigger = trigger, + steps = get_windows_steps(edition = "oss", ver_mode = ver_mode), + platform = "windows", + depends_on = windows_pipeline_dependencies, + environment = environment, + ) + pipelines.append(windows_pipeline) return pipelines diff --git a/scripts/drone/pipelines/build.star b/scripts/drone/pipelines/build.star index 8b37a176a2e9..ef4c85d7918a 100644 --- a/scripts/drone/pipelines/build.star +++ b/scripts/drone/pipelines/build.star @@ -143,6 +143,20 @@ def build_e2e(trigger, ver_mode): ], edition = edition, ), + build_docker_images_step( + archs = [ + "amd64", + ], + edition = edition, + ubuntu = True, + ), + publish_images_step( + docker_repo = "grafana", + edition = edition, + mode = "", + trigger = trigger_oss, + ver_mode = ver_mode, + ), ], ) diff --git a/scripts/drone/pipelines/test_backend.star b/scripts/drone/pipelines/test_backend.star index b75277139cfc..a3abb40e6675 100644 --- a/scripts/drone/pipelines/test_backend.star +++ b/scripts/drone/pipelines/test_backend.star @@ -58,9 +58,6 @@ def test_backend(trigger, ver_mode): if ver_mode in ("release-branch", "release"): pipeline_name = "{}-{}-test-backend".format(ver_mode, "oss") - pipeline_name = '{}-test-backend'.format(ver_mode) - if ver_mode in ("release-branch", "release"): - pipeline_name = '{}-{}-test-backend'.format(ver_mode, edition) return pipeline( name = pipeline_name, edition = "oss", diff --git a/scripts/drone/pipelines/windows.star b/scripts/drone/pipelines/windows.star index 3669cfb9986e..f00b0a16fd1b 100644 --- a/scripts/drone/pipelines/windows.star +++ b/scripts/drone/pipelines/windows.star @@ -9,6 +9,7 @@ load( load( "scripts/drone/steps/lib.star", "get_windows_steps", + "windows_clone_step", "windows_go_image", "windows_init_enterprise_steps", "windows_test_backend_step", @@ -26,7 +27,9 @@ def windows_test_backend(trigger, edition, ver_mode): A single pipeline running backend tests for Windows """ environment = {"EDITION": edition} - steps = [] + steps = [ + windows_clone_step(), + ] if edition == "enterprise": steps.extend(windows_init_enterprise_steps(ver_mode)) @@ -34,6 +37,7 @@ def windows_test_backend(trigger, edition, ver_mode): steps.extend([{ "name": "windows-init", "image": windows_go_image, + "depends_on": ["clone"], "commands": [], }]) @@ -41,7 +45,7 @@ def windows_test_backend(trigger, edition, ver_mode): windows_wire_install_step(edition), windows_test_backend_step(), ]) - return pipeline( + pl = pipeline( name = "{}-{}-test-backend-windows".format(ver_mode, edition), edition = edition, trigger = trigger, @@ -50,6 +54,10 @@ def windows_test_backend(trigger, edition, ver_mode): platform = "windows", environment = environment, ) + pl["clone"] = { + "disable": True, + } + return pl def windows(trigger, edition, ver_mode): """Generates the pipeline used for building Grafana on Windows. diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index ee484a6b6990..185d9bad894e 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -8,7 +8,7 @@ load( "prerelease_bucket", ) -grabpl_version = "v3.0.30" +grabpl_version = "v3.0.37" build_image = "grafana/build-container:1.7.4" publish_image = "grafana/grafana-ci-deploy:1.3.3" deploy_docker_image = "us.gcr.io/kubernetes-dev/drone/plugins/deploy-image" @@ -686,7 +686,6 @@ def test_backend_step(image = build_image): def windows_test_backend_step(): step = test_backend_step(image = windows_go_image) - step["failure"] = "ignore" return step def test_backend_integration_step(): @@ -1125,6 +1124,9 @@ def publish_images_step(edition, ver_mode, mode, docker_repo, trigger = None): "GCP_KEY": from_secret("gcp_key"), "DOCKER_USER": from_secret("docker_username"), "DOCKER_PASSWORD": from_secret("docker_password"), + "GITHUB_APP_ID": from_secret("delivery-bot-app-id"), + "GITHUB_APP_INSTALLATION_ID": from_secret("delivery-bot-app-installation-id"), + "GITHUB_APP_PRIVATE_KEY": from_secret("delivery-bot-app-private-key"), } cmd = "./bin/grabpl artifacts docker publish {}--dockerhub-repo {}".format( @@ -1150,6 +1152,15 @@ def publish_images_step(edition, ver_mode, mode, docker_repo, trigger = None): docker_repo, ) + if ver_mode == "pr": + environment = { + "DOCKER_USER": from_secret("docker_username_pr"), + "DOCKER_PASSWORD": from_secret("docker_password_pr"), + "GITHUB_APP_ID": from_secret("delivery-bot-app-id"), + "GITHUB_APP_INSTALLATION_ID": from_secret("delivery-bot-app-installation-id"), + "GITHUB_APP_PRIVATE_KEY": from_secret("delivery-bot-app-private-key"), + } + step = { "name": "publish-images-{}".format(name), "image": "google/cloud-sdk", @@ -1160,6 +1171,8 @@ def publish_images_step(edition, ver_mode, mode, docker_repo, trigger = None): } if trigger and ver_mode in ("release-branch", "main"): step = dict(step, when = trigger) + if ver_mode == "pr": + step = dict(step, failure = "ignore") return step @@ -1361,6 +1374,19 @@ def publish_linux_packages_step(edition, package_manager = "deb"): }, } +def windows_clone_step(): + return { + "name": "clone", + "image": wix_image, + "environment": { + "GITHUB_TOKEN": from_secret("github_token"), + }, + "commands": [ + 'git clone "https://$$env:GITHUB_TOKEN@github.com/$$env:DRONE_REPO.git" .', + "git checkout -f $$env:DRONE_COMMIT", + ], + } + def get_windows_steps(edition, ver_mode): """Generate the list of Windows steps. diff --git a/scripts/drone/vault.star b/scripts/drone/vault.star index e6aa40db100d..d1a08bf7e414 100644 --- a/scripts/drone/vault.star +++ b/scripts/drone/vault.star @@ -120,4 +120,20 @@ def secrets(): "infra/data/ci/grafana-release-eng/enterprise2", "security_prefix", ), + # grafana-delivery-bot secrets + vault_secret( + "delivery-bot-app-id", + "infra/data/ci/grafana-release-eng/grafana-delivery-bot", + "app-id", + ), + vault_secret( + "delivery-bot-app-installation-id", + "infra/data/ci/grafana-release-eng/grafana-delivery-bot", + "app-installation-id", + ), + vault_secret( + "delivery-bot-app-private-key", + "infra/data/ci/grafana-release-eng/grafana-delivery-bot", + "app-private-key", + ), ] diff --git a/yarn.lock b/yarn.lock index 5bb657224f1a..938f1b3e841c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5334,9 +5334,9 @@ __metadata: version: 0.0.0-use.local resolution: "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource" dependencies: - "@grafana/data": 9.2.18 - "@grafana/toolkit": 9.2.18 - "@grafana/ui": 9.2.18 + "@grafana/data": 9.2.20 + "@grafana/toolkit": 9.2.20 + "@grafana/ui": 9.2.20 "@types/jest": 26.0.15 "@types/lodash": 4.14.149 "@types/react": 17.0.30 @@ -5380,12 +5380,12 @@ __metadata: languageName: node linkType: hard -"@grafana/data@9.2.18, @grafana/data@workspace:*, @grafana/data@workspace:packages/grafana-data": +"@grafana/data@9.2.20, @grafana/data@workspace:*, @grafana/data@workspace:packages/grafana-data": version: 0.0.0-use.local resolution: "@grafana/data@workspace:packages/grafana-data" dependencies: "@braintree/sanitize-url": 6.0.0 - "@grafana/schema": 9.2.18 + "@grafana/schema": 9.2.20 "@grafana/tsconfig": ^1.2.0-rc1 "@rollup/plugin-commonjs": 22.0.1 "@rollup/plugin-json": 4.1.0 @@ -5444,7 +5444,7 @@ __metadata: languageName: unknown linkType: soft -"@grafana/e2e-selectors@9.2.18, @grafana/e2e-selectors@workspace:*, @grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors": +"@grafana/e2e-selectors@9.2.20, @grafana/e2e-selectors@workspace:*, @grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors": version: 0.0.0-use.local resolution: "@grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors" dependencies: @@ -5470,7 +5470,7 @@ __metadata: "@babel/core": 7.19.0 "@babel/preset-env": 7.19.0 "@cypress/webpack-preprocessor": 5.12.0 - "@grafana/e2e-selectors": 9.2.18 + "@grafana/e2e-selectors": 9.2.20 "@grafana/tsconfig": ^1.2.0-rc1 "@mochajs/json-file-reporter": ^1.2.0 "@rollup/plugin-node-resolve": 13.3.0 @@ -5557,15 +5557,15 @@ __metadata: languageName: node linkType: hard -"@grafana/runtime@9.2.18, @grafana/runtime@workspace:*, @grafana/runtime@workspace:packages/grafana-runtime": +"@grafana/runtime@9.2.20, @grafana/runtime@workspace:*, @grafana/runtime@workspace:packages/grafana-runtime": version: 0.0.0-use.local resolution: "@grafana/runtime@workspace:packages/grafana-runtime" dependencies: "@grafana/agent-web": ^0.4.0 - "@grafana/data": 9.2.18 - "@grafana/e2e-selectors": 9.2.18 + "@grafana/data": 9.2.20 + "@grafana/e2e-selectors": 9.2.20 "@grafana/tsconfig": ^1.2.0-rc1 - "@grafana/ui": 9.2.18 + "@grafana/ui": 9.2.20 "@rollup/plugin-commonjs": 22.0.1 "@rollup/plugin-node-resolve": 13.3.0 "@sentry/browser": 6.19.7 @@ -5601,7 +5601,7 @@ __metadata: languageName: unknown linkType: soft -"@grafana/schema@9.2.18, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema": +"@grafana/schema@9.2.20, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema": version: 0.0.0-use.local resolution: "@grafana/schema@workspace:packages/grafana-schema" dependencies: @@ -5621,7 +5621,7 @@ __metadata: languageName: unknown linkType: soft -"@grafana/toolkit@9.2.18, @grafana/toolkit@workspace:*, @grafana/toolkit@workspace:packages/grafana-toolkit": +"@grafana/toolkit@9.2.20, @grafana/toolkit@workspace:*, @grafana/toolkit@workspace:packages/grafana-toolkit": version: 0.0.0-use.local resolution: "@grafana/toolkit@workspace:packages/grafana-toolkit" dependencies: @@ -5637,10 +5637,10 @@ __metadata: "@babel/preset-env": 7.18.9 "@babel/preset-react": 7.18.6 "@babel/preset-typescript": 7.18.6 - "@grafana/data": 9.2.18 + "@grafana/data": 9.2.20 "@grafana/eslint-config": 5.0.0 "@grafana/tsconfig": ^1.2.0-rc1 - "@grafana/ui": 9.2.18 + "@grafana/ui": 9.2.20 "@jest/core": 27.5.1 "@types/command-exists": ^1.2.0 "@types/eslint": 8.4.1 @@ -5721,16 +5721,16 @@ __metadata: languageName: node linkType: hard -"@grafana/ui@9.2.18, @grafana/ui@workspace:*, @grafana/ui@workspace:packages/grafana-ui": +"@grafana/ui@9.2.20, @grafana/ui@workspace:*, @grafana/ui@workspace:packages/grafana-ui": version: 0.0.0-use.local resolution: "@grafana/ui@workspace:packages/grafana-ui" dependencies: "@babel/core": 7.19.0 "@emotion/css": 11.9.0 "@emotion/react": 11.9.3 - "@grafana/data": 9.2.18 - "@grafana/e2e-selectors": 9.2.18 - "@grafana/schema": 9.2.18 + "@grafana/data": 9.2.20 + "@grafana/e2e-selectors": 9.2.20 + "@grafana/schema": 9.2.20 "@grafana/tsconfig": ^1.2.0-rc1 "@mdx-js/react": 1.6.22 "@monaco-editor/react": 4.4.5 @@ -6013,11 +6013,11 @@ __metadata: resolution: "@jaegertracing/jaeger-ui-components@workspace:packages/jaeger-ui-components" dependencies: "@emotion/css": 11.9.0 - "@grafana/data": 9.2.18 - "@grafana/e2e-selectors": 9.2.18 - "@grafana/runtime": 9.2.18 + "@grafana/data": 9.2.20 + "@grafana/e2e-selectors": 9.2.20 + "@grafana/runtime": 9.2.20 "@grafana/tsconfig": ^1.2.0-rc1 - "@grafana/ui": 9.2.18 + "@grafana/ui": 9.2.20 "@testing-library/jest-dom": 5.16.4 "@testing-library/react": 12.1.4 "@testing-library/user-event": 14.4.3 @@ -9218,7 +9218,7 @@ __metadata: linkType: hard "@reactour/tour@npm:^3.0.0": - version: 3.0.0 + version: 3.4.0 resolution: "@reactour/tour@npm:3.4.0" dependencies: "@reactour/mask": "*" @@ -33776,14 +33776,14 @@ __metadata: linkType: hard "schema-utils@npm:>1.0.0": - version: 4.0.1 - resolution: "schema-utils@npm:4.0.1" + version: 4.2.0 + resolution: "schema-utils@npm:4.2.0" dependencies: "@types/json-schema": ^7.0.9 ajv: ^8.9.0 ajv-formats: ^2.1.1 ajv-keywords: ^5.1.0 - checksum: 745e7293c6b6c84940de16753c207311da821aa9911b9e2d158cfd9ffc5bf1f880147abbbe775b96cb8cd3c7f48890950fe0164f54eed9a8aabb948ebf8a3fdd + checksum: 26a0463d47683258106e6652e9aeb0823bf0b85843039e068b57da1892f7ae6b6b1094d48e9ed5ba5cbe9f7166469d880858b9d91abe8bd249421eb813850cde languageName: node linkType: hard