grafana-client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/lib/grafana/client.rb +1 -1
- data/lib/grafana/client/version.rb +1 -1
- data/lib/grafana/modules/dashboard.rb +28 -0
- data/lib/grafana/modules/folder.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f855fcd107829fe6a38608b160867dab591272da9fec63f8aba6b20b3cec35e
|
4
|
+
data.tar.gz: b1a62e82cb2ce97528be51e0a099fcfc835de974a9ec776fbce392e171120306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05bb6912d1040b15caf4631a667cbed87f299279fb93a6e72d4e49d7143c7e2393922dd8d5d3828106b2b5e24808a63cd841bd4ef9c7e535bb2def5e8ea7ca9d
|
7
|
+
data.tar.gz: a5766d1cc020f7d8fa24857cd167064501f3660440136828c610265ab32788bbb473cd504051aa7ebdcfe6df35ba0e19c263ea9ca082587365dab87d147b0e82
|
data/.github/workflows/main.yml
CHANGED
@@ -10,6 +10,8 @@ jobs:
|
|
10
10
|
# due to https://github.com/actions/runner/issues/849, we need quotes for '3.0'
|
11
11
|
ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
|
12
12
|
runs-on: ${{ matrix.os }}
|
13
|
+
# Don't duplicate test runs for both push and PR for internal PRs
|
14
|
+
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository }}
|
13
15
|
steps:
|
14
16
|
- name: "Checkout"
|
15
17
|
uses: actions/checkout@v2
|
data/CHANGELOG.md
CHANGED
data/lib/grafana/client.rb
CHANGED
@@ -37,6 +37,34 @@ module Grafana
|
|
37
37
|
post('/api/dashboards/db', req_body)
|
38
38
|
end
|
39
39
|
|
40
|
+
def overwrite_dashboard(dashboard:, **options)
|
41
|
+
req_body = {
|
42
|
+
dashboard: dashboard,
|
43
|
+
message: options[:message],
|
44
|
+
folderId: options[:folder_id],
|
45
|
+
overwrite: true # Overwriting dashboard (if exists)
|
46
|
+
}
|
47
|
+
|
48
|
+
post('/api/dashboards/db', req_body)
|
49
|
+
end
|
50
|
+
|
51
|
+
def dashboard_search(**options)
|
52
|
+
options = options.slice(:query, :tag, :dashboard_ids, :folder_ids, :starred, :limit, :page)
|
53
|
+
|
54
|
+
options[:folderIds] = Array.wrap(options.delete(:folder_ids)) if options[:folder_ids].present?
|
55
|
+
options[:dashboardIds] = Array.wrap(options.delete(:dashboard_ids)) if options[:dashboard_ids].present?
|
56
|
+
|
57
|
+
options.delete(:starred) unless options[:starred].is_a?(Boolean)
|
58
|
+
options.delete(:limit) unless options[:limit].is_a?(Integer) && options[:limit] <= 5000
|
59
|
+
options.delete(:page) unless options[:page].is_a?(Integer)
|
60
|
+
|
61
|
+
options.merge({ type: 'dash-db' })
|
62
|
+
|
63
|
+
search_url = '/api/search'
|
64
|
+
search_url = "?#{URI.encode_www_form(options)}"
|
65
|
+
get(search_url)
|
66
|
+
end
|
67
|
+
|
40
68
|
def dashboard(uid:)
|
41
69
|
get("/api/dashboards/uid/#{uid}")
|
42
70
|
end
|
@@ -1,6 +1,22 @@
|
|
1
1
|
module Grafana
|
2
2
|
module Modules
|
3
3
|
module Folder
|
4
|
+
def folder_search(**options)
|
5
|
+
options = options.slice(:query, :tag, :dashboard_ids, :folder_ids, :starred, :limit, :page)
|
6
|
+
|
7
|
+
options[:folderIds] = Array.wrap(options.delete(:folder_ids)) if options[:folder_ids].present?
|
8
|
+
options[:dashboardIds] = Array.wrap(options.delete(:dashboard_ids)) if options[:dashboard_ids].present?
|
9
|
+
|
10
|
+
options.delete(:starred) unless options[:starred].is_a?(Boolean)
|
11
|
+
options.delete(:limit) unless options[:limit].is_a?(Integer) && options[:limit] <= 5000
|
12
|
+
options.delete(:page) unless options[:page].is_a?(Integer)
|
13
|
+
|
14
|
+
options.merge({ type: 'dash-folder' })
|
15
|
+
|
16
|
+
search_url = '/api/search'
|
17
|
+
search_url = "?#{URI.encode_www_form(options)}"
|
18
|
+
get(search_url)
|
19
|
+
end
|
4
20
|
def folders
|
5
21
|
get('/api/folders')
|
6
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grafana-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Tanous
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|