gazer 0.2.48 → 0.2.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/scripts/parse_version.sh +16 -0
- data/.github/workflows/release.yml +2 -0
- data/.github/workflows/ruby-ci.yml +29 -5
- data/CHANGELOG.md +38 -0
- data/Gemfile.lock +18 -14
- data/README.md +1 -1
- data/gzr.gemspec +6 -6
- data/lib/gzr/cli.rb +4 -0
- data/lib/gzr/commands/dashboard/cat.rb +1 -23
- data/lib/gzr/commands/dashboard/import.rb +10 -1
- data/lib/gzr/commands/look/cat.rb +1 -8
- data/lib/gzr/commands/look/import.rb +11 -0
- data/lib/gzr/commands/space/export.rb +4 -28
- data/lib/gzr/commands/space.rb +2 -0
- data/lib/gzr/modules/dashboard.rb +27 -0
- data/lib/gzr/modules/look.rb +12 -0
- data/lib/gzr/modules/plan.rb +6 -0
- data/lib/gzr/modules/session.rb +1 -1
- data/lib/gzr/version.rb +1 -1
- metadata +34 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62185449c733517e6e3354b2faeb39e9a3b1bfbf61211c9296db1554979006fb
|
4
|
+
data.tar.gz: 5fe6d548b01e9fbb5bebf5807614a28b24f64bdd7bfdc1dd0e4fd1d50079a8ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92692a5332311129b1cc7d49f73ec03170a4ab17b0f8c7b4c941ac022c11e73e8fdfa9ad520e349953aebbaa37d07c3ce6f2119f49ca4563064dbceaddd2bdfe
|
7
|
+
data.tar.gz: 0daba3450b0a3fe6ca302675c7730c14993b79a4a57f7a2c73b9b2c062698ede1e8d46e2c6efbbe3b1a7f29212918ceb16fe0a77c47f60c2ec404e2ffdabff4c
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
BEFORE_MAJ=21
|
4
|
+
BEFORE_MIN=18
|
5
|
+
IFS=_ read -r maj min
|
6
|
+
if [ "$maj" -lt "$BEFORE_MAJ" ]; then
|
7
|
+
echo "${maj}_${min}"
|
8
|
+
elif [ "$maj" -eq "$BEFORE_MAJ" ]; then
|
9
|
+
if [ "$min" -lt "$BEFORE_MIN" ]; then
|
10
|
+
echo "${maj}_${min}"
|
11
|
+
else
|
12
|
+
echo "21_18"
|
13
|
+
fi
|
14
|
+
else
|
15
|
+
echo "21_18"
|
16
|
+
fi
|
@@ -17,7 +17,9 @@ jobs:
|
|
17
17
|
release-type: ruby
|
18
18
|
package-name: gazer
|
19
19
|
bump-minor-pre-major: true
|
20
|
+
bump-patch-for-minor-pre-major: true
|
20
21
|
version-file: "lib/gzr/version.rb"
|
22
|
+
token: ${{ secrets.LOS_AUTO_BOT_RP_TOKEN }}
|
21
23
|
# Checkout code if release was created
|
22
24
|
- uses: actions/checkout@v2
|
23
25
|
if: ${{ steps.release.outputs.release_created }}
|
@@ -9,16 +9,21 @@ on:
|
|
9
9
|
env:
|
10
10
|
LOOKERSDK_BASE_URL: https://localhost:20000
|
11
11
|
LOOKERSDK_VERIFY_SSL: false
|
12
|
-
TS_JUNIT_OUTPUT_DIR: results/sdk-codegen
|
13
12
|
LOOKERSDK_CLIENT_ID: ${{ secrets.LOOKERSDK_CLIENT_ID__21_18 }}
|
14
13
|
LOOKERSDK_CLIENT_SECRET: ${{ secrets.LOOKERSDK_CLIENT_SECRET__21_18 }}
|
15
14
|
|
16
15
|
jobs:
|
17
16
|
test:
|
18
|
-
|
19
|
-
runs-on:
|
17
|
+
name: Test - ${{ matrix.os }} / Looker.${{ matrix.looker }} / Ruby.${{ matrix.ruby-version }}
|
18
|
+
runs-on: ${{ matrix.os }}-latest
|
20
19
|
strategy:
|
21
20
|
matrix:
|
21
|
+
os:
|
22
|
+
- ubuntu
|
23
|
+
looker:
|
24
|
+
- '21_18'
|
25
|
+
- '21_20'
|
26
|
+
- '22_0'
|
22
27
|
ruby-version: [2.5.8]
|
23
28
|
|
24
29
|
steps:
|
@@ -38,11 +43,30 @@ jobs:
|
|
38
43
|
# TODO: can we cache some layers of the image for faster download?
|
39
44
|
# we probably don't want to cache the final image for IP security...
|
40
45
|
run: |
|
41
|
-
docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker
|
46
|
+
docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/${{ matrix.looker }}
|
42
47
|
# set $LOOKER_OPTS to --no-ssl if we want to turn off ssl
|
43
|
-
docker run --name looker-sdk-codegen-ci -d -p 10000:9999 -p 20000:19999 us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker
|
48
|
+
docker run --name looker-sdk-codegen-ci -d -p 10000:9999 -p 20000:19999 us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/${{ matrix.looker }}
|
44
49
|
docker logs -f looker-sdk-codegen-ci --until=30s &
|
45
50
|
|
51
|
+
- name: Determine credentials version
|
52
|
+
# Prior to 21_18, each version had different credentials and a
|
53
|
+
# different secret. 21_20 and later all use the same credentials
|
54
|
+
# as 21_18. The parse_version.sh script parses the version and
|
55
|
+
# yields 21_12, 21_14, 21_16 etc for those versions but 21_18 for
|
56
|
+
# anything 21_18, 21_20, 22_0, etc.
|
57
|
+
#
|
58
|
+
# This can be factored out entirely once 21_18 is the earliest
|
59
|
+
# supported looker version.
|
60
|
+
run: |
|
61
|
+
echo "CREDENTIALS_VERSION=$(${{ github.workspace }}/.github/scripts/parse_version.sh <<< ${{ matrix.looker }})" >> $GITHUB_ENV
|
62
|
+
|
63
|
+
- name: Set up Looker credentials
|
64
|
+
# Load the correct credentials based on the version from
|
65
|
+
# the prior step.
|
66
|
+
run: |
|
67
|
+
echo "LOOKERSDK_CLIENT_ID=${{ secrets[format('LOOKERSDK_CLIENT_ID__{0}', env.CREDENTIALS_VERSION )] }}" >> $GITHUB_ENV
|
68
|
+
echo "LOOKERSDK_CLIENT_SECRET=${{ secrets[format('LOOKERSDK_CLIENT_SECRET__{0}', env.CREDENTIALS_VERSION )] }}" >> $GITHUB_ENV
|
69
|
+
|
46
70
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
47
71
|
uses: ruby/setup-ruby@v1
|
48
72
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### [0.2.54](https://www.github.com/looker-open-source/gzr/compare/v0.2.53...v0.2.54) (2022-03-17)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* Avoid API 4.0 for deprecation of spaces endpoint ([#124](https://www.github.com/looker-open-source/gzr/issues/124)) ([#125](https://www.github.com/looker-open-source/gzr/issues/125)) ([3823399](https://www.github.com/looker-open-source/gzr/commit/38233991bfc5456ac0cf3d485d12520f50a2ea76))
|
9
|
+
|
10
|
+
### [0.2.53](https://www.github.com/looker-open-source/gzr/compare/v0.2.52...v0.2.53) (2021-12-14)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* fix version ([#121](https://www.github.com/looker-open-source/gzr/issues/121)) ([f9b0b22](https://www.github.com/looker-open-source/gzr/commit/f9b0b2237eb3c520aabc2f1ff5a63ddf6c934ce4))
|
16
|
+
|
17
|
+
### [0.2.52](https://www.github.com/looker-open-source/gzr/compare/v0.2.51...v0.2.52) (2021-12-14)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* version number ([#119](https://www.github.com/looker-open-source/gzr/issues/119)) ([b55a892](https://www.github.com/looker-open-source/gzr/commit/b55a892d8d040ce4547924d613a590877e129322))
|
23
|
+
|
24
|
+
### [0.2.51](https://www.github.com/looker-open-source/gzr/compare/v0.2.50...v0.2.51) (2021-12-14)
|
25
|
+
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
* detect if dashboard import gets a look file and vice versa, warn on importing a deleted dashboard or look ([#116](https://www.github.com/looker-open-source/gzr/issues/116)) ([a12dc25](https://www.github.com/looker-open-source/gzr/commit/a12dc2525bed55816b368306f2d05a24dc07aaf4))
|
30
|
+
* Gemfile.lock was out of date ([a4e49c3](https://www.github.com/looker-open-source/gzr/commit/a4e49c3972772e0629a8f1589172ddd136ee7e21))
|
31
|
+
* refactored look and dashboard cat commands and space export to use the same code to generate each look and dashboard file. ([#114](https://www.github.com/looker-open-source/gzr/issues/114)) ([8dadd50](https://www.github.com/looker-open-source/gzr/commit/8dadd500376e2b971c38dbcd69f507268a3e6b9e))
|
32
|
+
* remove Thor deprecation warning ([#115](https://www.github.com/looker-open-source/gzr/issues/115)) ([1100c5a](https://www.github.com/looker-open-source/gzr/commit/1100c5a24b0626c01c6248d87172c7ab624bf42f))
|
33
|
+
|
34
|
+
### [0.2.50](https://www.github.com/looker-open-source/gzr/compare/v0.2.49...v0.2.50) (2021-11-19)
|
35
|
+
|
36
|
+
|
37
|
+
### Bug Fixes
|
38
|
+
|
39
|
+
* resolved warnings in gemspec. Improved handling of live tests ([6291147](https://www.github.com/looker-open-source/gzr/commit/6291147a09f55ed095d718a7a998d5af09b716e3))
|
40
|
+
|
3
41
|
### [0.2.49](https://www.github.com/looker-open-source/gzr/compare/v0.2.48...v0.2.49) (2021-11-18)
|
4
42
|
|
5
43
|
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gazer (0.2.
|
4
|
+
gazer (0.2.54)
|
5
5
|
looker-sdk (~> 0.1.1)
|
6
|
-
net-http-persistent (~> 4.0.1)
|
6
|
+
net-http-persistent (~> 4.0, >= 4.0.1)
|
7
7
|
netrc (~> 0.11.0)
|
8
8
|
pastel (~> 0.8.0)
|
9
|
-
rubyzip (~> 1.3.0)
|
10
|
-
thor (~> 1.1.0)
|
9
|
+
rubyzip (~> 1.3, >= 1.3.0)
|
10
|
+
thor (~> 1.1, >= 1.1.0)
|
11
11
|
tty-reader (~> 0.9.0)
|
12
12
|
tty-table (~> 0.12.0)
|
13
13
|
tty-tree (~> 0.4.0)
|
@@ -19,26 +19,30 @@ GEM
|
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
20
20
|
connection_pool (2.2.5)
|
21
21
|
diff-lcs (1.4.4)
|
22
|
-
faraday (1.
|
22
|
+
faraday (1.10.0)
|
23
23
|
faraday-em_http (~> 1.0)
|
24
24
|
faraday-em_synchrony (~> 1.0)
|
25
25
|
faraday-excon (~> 1.1)
|
26
|
-
faraday-httpclient (~> 1.0
|
26
|
+
faraday-httpclient (~> 1.0)
|
27
|
+
faraday-multipart (~> 1.0)
|
27
28
|
faraday-net_http (~> 1.0)
|
28
|
-
faraday-net_http_persistent (~> 1.
|
29
|
+
faraday-net_http_persistent (~> 1.0)
|
29
30
|
faraday-patron (~> 1.0)
|
30
31
|
faraday-rack (~> 1.0)
|
31
|
-
|
32
|
+
faraday-retry (~> 1.0)
|
32
33
|
ruby2_keywords (>= 0.0.4)
|
33
34
|
faraday-em_http (1.0.0)
|
34
35
|
faraday-em_synchrony (1.0.0)
|
35
36
|
faraday-excon (1.1.0)
|
36
37
|
faraday-httpclient (1.0.1)
|
38
|
+
faraday-multipart (1.0.3)
|
39
|
+
multipart-post (>= 1.2, < 3)
|
37
40
|
faraday-net_http (1.0.1)
|
38
41
|
faraday-net_http_persistent (1.2.0)
|
39
42
|
faraday-patron (1.0.0)
|
40
43
|
faraday-rack (1.0.0)
|
41
|
-
|
44
|
+
faraday-retry (1.0.3)
|
45
|
+
looker-sdk (0.1.2)
|
42
46
|
faraday (>= 1.2, < 2.0)
|
43
47
|
sawyer (~> 0.8)
|
44
48
|
multipart-post (2.1.1)
|
@@ -64,15 +68,15 @@ GEM
|
|
64
68
|
rspec-support (3.10.2)
|
65
69
|
ruby2_keywords (0.0.5)
|
66
70
|
rubyzip (1.3.0)
|
67
|
-
sawyer (0.
|
71
|
+
sawyer (0.9.0)
|
68
72
|
addressable (>= 2.3.5)
|
69
|
-
faraday (
|
73
|
+
faraday (>= 0.9, < 3)
|
70
74
|
strings (0.2.1)
|
71
75
|
strings-ansi (~> 0.2)
|
72
76
|
unicode-display_width (>= 1.5, < 3.0)
|
73
77
|
unicode_utils (~> 1.4)
|
74
78
|
strings-ansi (0.2.0)
|
75
|
-
thor (1.1
|
79
|
+
thor (1.2.1)
|
76
80
|
tty-color (0.6.0)
|
77
81
|
tty-cursor (0.7.1)
|
78
82
|
tty-reader (0.9.0)
|
@@ -93,9 +97,9 @@ PLATFORMS
|
|
93
97
|
x86_64-linux
|
94
98
|
|
95
99
|
DEPENDENCIES
|
96
|
-
bundler (>= 2.2.10)
|
100
|
+
bundler (~> 2.2, >= 2.2.10)
|
97
101
|
gazer!
|
98
|
-
rake (~> 12.3.3)
|
102
|
+
rake (~> 12.3, >= 12.3.3)
|
99
103
|
rspec (~> 3.0)
|
100
104
|
|
101
105
|
RUBY VERSION
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ and Dashboards via a simple command line tool.
|
|
5
5
|
|
6
6
|
## Status and Support
|
7
7
|
|
8
|
-
As of November 2021,
|
8
|
+
As of November 2021, Gazer is supported, but not warrantied by Bytecode IO, Inc. Issues and feature requests can be reported via https://github.com/looker-open-source/gzr/issues, which will be regularly monitored and prioritized by Bytecode IO, Inc., a preferred Looker consulting partner.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
data/gzr.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.email = ["drstrangelove@google.com"]
|
32
32
|
|
33
33
|
spec.summary = %q{Command line tool to manage the content of a Looker instance.}
|
34
|
-
spec.description = %q{
|
34
|
+
spec.description = %q{This tool will help manage the content of a Looker instance.}
|
35
35
|
spec.homepage = "https://github.com/looker-open-source/gzr"
|
36
36
|
|
37
37
|
spec.required_ruby_version = '>= 2.3.0'
|
@@ -56,13 +56,13 @@ Gem::Specification.new do |spec|
|
|
56
56
|
spec.add_dependency "tty-table", "~> 0.12.0"
|
57
57
|
spec.add_dependency "tty-tree", "~> 0.4.0"
|
58
58
|
spec.add_dependency "pastel", "~> 0.8.0"
|
59
|
-
spec.
|
59
|
+
spec.add_runtime_dependency 'thor', '~> 1.1', '>= 1.1.0'
|
60
60
|
spec.add_dependency 'netrc', "~> 0.11.0"
|
61
|
-
spec.
|
61
|
+
spec.add_runtime_dependency 'rubyzip', '~> 1.3', '>= 1.3.0'
|
62
62
|
spec.add_dependency 'looker-sdk', "~> 0.1.1"
|
63
|
-
spec.
|
63
|
+
spec.add_runtime_dependency 'net-http-persistent', '~> 4.0', '>= 4.0.1'
|
64
64
|
|
65
|
-
spec.add_development_dependency
|
66
|
-
spec.add_development_dependency
|
65
|
+
spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.10'
|
66
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
67
67
|
spec.add_development_dependency "rspec", "~> 3.0"
|
68
68
|
end
|
data/lib/gzr/cli.rb
CHANGED
@@ -29,6 +29,10 @@ module Gzr
|
|
29
29
|
#
|
30
30
|
# @api public
|
31
31
|
class CLI < Thor
|
32
|
+
def self.exit_on_failure?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
32
36
|
class_option :debug, type: :boolean, default: false, desc: 'Run in debug mode'
|
33
37
|
class_option :host, type: :string, default: 'localhost', desc: 'Looker Host'
|
34
38
|
class_option :port, type: :string, default: '19999', desc: 'Looker API Port'
|
@@ -43,29 +43,7 @@ module Gzr
|
|
43
43
|
def execute(*args, input: $stdin, output: $stdout)
|
44
44
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
45
45
|
with_session("3.1") do
|
46
|
-
data =
|
47
|
-
data[:dashboard_elements].each_index do |i|
|
48
|
-
element = data[:dashboard_elements][i]
|
49
|
-
find_vis_config_reference(element) do |vis_config|
|
50
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
51
|
-
rewrite_color_palette!(o,default_colors)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
merge_result = merge_query(element[:merge_result_id])&.to_attrs if element[:merge_result_id]
|
55
|
-
if merge_result
|
56
|
-
merge_result[:source_queries].each_index do |j|
|
57
|
-
source_query = merge_result[:source_queries][j]
|
58
|
-
merge_result[:source_queries][j][:query] = query(source_query[:query_id]).to_attrs
|
59
|
-
end
|
60
|
-
find_vis_config_reference(merge_result) do |vis_config|
|
61
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
62
|
-
rewrite_color_palette!(o,default_colors)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
data[:dashboard_elements][i][:merge_result] = merge_result
|
66
|
-
end
|
67
|
-
end
|
68
|
-
data[:scheduled_plans] = query_scheduled_plans_for_dashboard(@dashboard_id,"all").to_attrs if @options[:plans]
|
46
|
+
data = cat_dashboard(@dashboard_id)
|
69
47
|
|
70
48
|
replacements = {}
|
71
49
|
if @options[:transform]
|
@@ -53,8 +53,17 @@ module Gzr
|
|
53
53
|
|
54
54
|
read_file(@file) do |data|
|
55
55
|
|
56
|
-
|
56
|
+
if data[:deleted]
|
57
|
+
say_warning("Attempt to import a deleted dashboard!")
|
58
|
+
say_warning("This may result in errors.")
|
59
|
+
end
|
57
60
|
|
61
|
+
if !data[:dashboard_elements]
|
62
|
+
say_error("File contains no dashboard_elements! Is this a look?")
|
63
|
+
raise Gzr::CLI::Error, "import file is not a valid dashboard"
|
64
|
+
end
|
65
|
+
|
66
|
+
dashboard = sync_dashboard(data,@dest_space_id, output: output)
|
58
67
|
|
59
68
|
dashboard[:dashboard_filters] ||= []
|
60
69
|
source_filters = data[:dashboard_filters].sort { |a,b| a[:row] <=> b[:row] }
|
@@ -42,14 +42,7 @@ module Gzr
|
|
42
42
|
def execute(input: $stdin, output: $stdout)
|
43
43
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
44
44
|
with_session do
|
45
|
-
data =
|
46
|
-
find_vis_config_reference(data) do |vis_config|
|
47
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
48
|
-
rewrite_color_palette!(o,default_colors)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
data[:scheduled_plans] = query_scheduled_plans_for_look(@look_id,"all").to_attrs if @options[:plans]
|
45
|
+
data = cat_look(@look_id)
|
53
46
|
file_name = if @options[:dir]
|
54
47
|
@options[:simple_filename] ? "Look_#{data[:id]}.json" : "Look_#{data[:id]}_#{data[:title]}.json"
|
55
48
|
else
|
@@ -49,6 +49,17 @@ module Gzr
|
|
49
49
|
@me ||= query_me("id")
|
50
50
|
|
51
51
|
read_file(@file) do |data|
|
52
|
+
|
53
|
+
if data[:deleted]
|
54
|
+
say_warning("Attempt to import a deleted look!")
|
55
|
+
say_warning("This may result in errors.")
|
56
|
+
end
|
57
|
+
|
58
|
+
if data[:dashboard_elements]
|
59
|
+
say_error("File contains dashboard_elements! Is this a dashboard?")
|
60
|
+
raise Gzr::CLI::Error, "import file is not a valid look"
|
61
|
+
end
|
62
|
+
|
52
63
|
look = upsert_look(@me.id,create_fetch_query(data[:query]).id,@dest_space_id,data,output: output)
|
53
64
|
upsert_plans_for_look(look.id,@me.id,data[:scheduled_plans]) if data[:scheduled_plans]
|
54
65
|
output.puts "Imported look #{look.id}" unless @options[:plain]
|
@@ -25,6 +25,7 @@ require_relative '../../command'
|
|
25
25
|
require_relative '../../modules/space'
|
26
26
|
require_relative '../../modules/look'
|
27
27
|
require_relative '../../modules/dashboard'
|
28
|
+
require_relative '../../modules/plan'
|
28
29
|
require_relative '../../modules/filehelper'
|
29
30
|
require 'pathname'
|
30
31
|
require 'stringio'
|
@@ -37,6 +38,7 @@ module Gzr
|
|
37
38
|
include Gzr::Space
|
38
39
|
include Gzr::Look
|
39
40
|
include Gzr::Dashboard
|
41
|
+
include Gzr::Plan
|
40
42
|
include Gzr::FileHelper
|
41
43
|
def initialize(space_id, options)
|
42
44
|
super()
|
@@ -96,39 +98,13 @@ module Gzr
|
|
96
98
|
end)
|
97
99
|
end
|
98
100
|
space[:looks].each do |l|
|
99
|
-
look =
|
100
|
-
find_vis_config_reference(look) do |vis_config|
|
101
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
102
|
-
rewrite_color_palette!(o,default_colors)
|
103
|
-
end
|
104
|
-
end
|
101
|
+
look = cat_look(l[:id])
|
105
102
|
write_file("Look_#{look[:id]}_#{look[:title]}.json", base, path) do |f|
|
106
103
|
f.write JSON.pretty_generate(look)
|
107
104
|
end
|
108
105
|
end
|
109
106
|
space[:dashboards].each do |d|
|
110
|
-
data =
|
111
|
-
data[:dashboard_elements].each_index do |i|
|
112
|
-
element = data[:dashboard_elements][i]
|
113
|
-
find_vis_config_reference(element) do |vis_config|
|
114
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
115
|
-
rewrite_color_palette!(o,default_colors)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
merge_result = merge_query(element[:merge_result_id])&.to_attrs() if element[:merge_result_id]
|
119
|
-
if merge_result
|
120
|
-
merge_result[:source_queries].each_index do |j|
|
121
|
-
source_query = merge_result[:source_queries][j]
|
122
|
-
merge_result[:source_queries][j][:query] = query(source_query[:query_id]).to_attrs()
|
123
|
-
end
|
124
|
-
find_vis_config_reference(merge_result) do |vis_config|
|
125
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
126
|
-
rewrite_color_palette!(o,default_colors)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
data[:dashboard_elements][i][:merge_result] = merge_result
|
130
|
-
end
|
131
|
-
end
|
107
|
+
data = cat_dashboard(d[:id])
|
132
108
|
write_file("Dashboard_#{data[:id]}_#{data[:title]}.json", base, path) do |f|
|
133
109
|
f.write JSON.pretty_generate(data)
|
134
110
|
end
|
data/lib/gzr/commands/space.rb
CHANGED
@@ -64,6 +64,8 @@ module Gzr
|
|
64
64
|
desc 'export SPACE_ID', 'Export a space, including all child looks, dashboards, and spaces.'
|
65
65
|
method_option :help, aliases: '-h', type: :boolean,
|
66
66
|
desc: 'Display usage information'
|
67
|
+
method_option :plans, type: :boolean,
|
68
|
+
desc: 'Include scheduled plans'
|
67
69
|
method_option :dir, type: :string, default: '.',
|
68
70
|
desc: 'Directory to store output tree'
|
69
71
|
method_option :tar, type: :string,
|
@@ -226,5 +226,32 @@ module Gzr
|
|
226
226
|
end
|
227
227
|
data
|
228
228
|
end
|
229
|
+
|
230
|
+
def cat_dashboard(dashboard_id)
|
231
|
+
data = query_dashboard(dashboard_id).to_attrs
|
232
|
+
data[:dashboard_elements].each_index do |i|
|
233
|
+
element = data[:dashboard_elements][i]
|
234
|
+
find_vis_config_reference(element) do |vis_config|
|
235
|
+
find_color_palette_reference(vis_config) do |o,default_colors|
|
236
|
+
rewrite_color_palette!(o,default_colors)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
merge_result = merge_query(element[:merge_result_id])&.to_attrs if element[:merge_result_id]
|
240
|
+
if merge_result
|
241
|
+
merge_result[:source_queries].each_index do |j|
|
242
|
+
source_query = merge_result[:source_queries][j]
|
243
|
+
merge_result[:source_queries][j][:query] = query(source_query[:query_id]).to_attrs
|
244
|
+
end
|
245
|
+
find_vis_config_reference(merge_result) do |vis_config|
|
246
|
+
find_color_palette_reference(vis_config) do |o,default_colors|
|
247
|
+
rewrite_color_palette!(o,default_colors)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
data[:dashboard_elements][i][:merge_result] = merge_result
|
251
|
+
end
|
252
|
+
end
|
253
|
+
data[:scheduled_plans] = query_scheduled_plans_for_dashboard(@dashboard_id,"all")&.to_attrs if @options[:plans]
|
254
|
+
data
|
255
|
+
end
|
229
256
|
end
|
230
257
|
end
|
data/lib/gzr/modules/look.rb
CHANGED
@@ -188,5 +188,17 @@ module Gzr
|
|
188
188
|
end
|
189
189
|
return create_merge_query(new_merge_result)
|
190
190
|
end
|
191
|
+
|
192
|
+
def cat_look(look_id)
|
193
|
+
data = query_look(look_id).to_attrs
|
194
|
+
find_vis_config_reference(data) do |vis_config|
|
195
|
+
find_color_palette_reference(vis_config) do |o,default_colors|
|
196
|
+
rewrite_color_palette!(o,default_colors)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
data[:scheduled_plans] = query_scheduled_plans_for_look(@look_id,"all")&.to_attrs if @options[:plans]
|
201
|
+
data
|
202
|
+
end
|
191
203
|
end
|
192
204
|
end
|
data/lib/gzr/modules/plan.rb
CHANGED
@@ -49,6 +49,9 @@ module Gzr
|
|
49
49
|
data = nil
|
50
50
|
begin
|
51
51
|
data = @sdk.scheduled_plans_for_look(look_id,req)
|
52
|
+
return nil if data.respond_to?(:message) && data.message == 'Not found'
|
53
|
+
rescue LookerSDK::NotFound
|
54
|
+
return nil
|
52
55
|
rescue LookerSDK::ClientError => e
|
53
56
|
say_error "Unable to get scheduled_plans_for_look(#{look_id},#{JSON.pretty_generate(req)})"
|
54
57
|
say_error e.message
|
@@ -65,6 +68,9 @@ module Gzr
|
|
65
68
|
data = nil
|
66
69
|
begin
|
67
70
|
data = @sdk.scheduled_plans_for_dashboard(dashboard_id,req)
|
71
|
+
return nil if data.respond_to?(:message) && data.message == 'Not found'
|
72
|
+
rescue LookerSDK::NotFound
|
73
|
+
return nil
|
68
74
|
rescue LookerSDK::ClientError => e
|
69
75
|
say_error "Unable to get scheduled_plans_for_dashboard(#{dashboard_id},#{JSON.pretty_generate(req)})"
|
70
76
|
say_error e.message
|
data/lib/gzr/modules/session.rb
CHANGED
@@ -155,7 +155,7 @@ module Gzr
|
|
155
155
|
begin
|
156
156
|
versions_response = agent.call(:get,"/versions")
|
157
157
|
@versions = versions_response.data.supported_versions
|
158
|
-
@current_version =
|
158
|
+
@current_version = "3.1"
|
159
159
|
rescue Faraday::SSLError => e
|
160
160
|
raise Gzr::CLI::Error, "SSL Certificate could not be verified\nDo you need the --no-verify-ssl option or the --no-ssl option?"
|
161
161
|
rescue Faraday::ConnectionFailed => cf
|
data/lib/gzr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike DeAngelo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|
@@ -71,6 +71,9 @@ dependencies:
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.1'
|
76
|
+
- - ">="
|
74
77
|
- !ruby/object:Gem::Version
|
75
78
|
version: 1.1.0
|
76
79
|
type: :runtime
|
@@ -78,6 +81,9 @@ dependencies:
|
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
80
83
|
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.1'
|
86
|
+
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: 1.1.0
|
83
89
|
- !ruby/object:Gem::Dependency
|
@@ -99,6 +105,9 @@ dependencies:
|
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
107
|
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.3'
|
110
|
+
- - ">="
|
102
111
|
- !ruby/object:Gem::Version
|
103
112
|
version: 1.3.0
|
104
113
|
type: :runtime
|
@@ -106,6 +115,9 @@ dependencies:
|
|
106
115
|
version_requirements: !ruby/object:Gem::Requirement
|
107
116
|
requirements:
|
108
117
|
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '1.3'
|
120
|
+
- - ">="
|
109
121
|
- !ruby/object:Gem::Version
|
110
122
|
version: 1.3.0
|
111
123
|
- !ruby/object:Gem::Dependency
|
@@ -127,6 +139,9 @@ dependencies:
|
|
127
139
|
requirement: !ruby/object:Gem::Requirement
|
128
140
|
requirements:
|
129
141
|
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '4.0'
|
144
|
+
- - ">="
|
130
145
|
- !ruby/object:Gem::Version
|
131
146
|
version: 4.0.1
|
132
147
|
type: :runtime
|
@@ -134,12 +149,18 @@ dependencies:
|
|
134
149
|
version_requirements: !ruby/object:Gem::Requirement
|
135
150
|
requirements:
|
136
151
|
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '4.0'
|
154
|
+
- - ">="
|
137
155
|
- !ruby/object:Gem::Version
|
138
156
|
version: 4.0.1
|
139
157
|
- !ruby/object:Gem::Dependency
|
140
158
|
name: bundler
|
141
159
|
requirement: !ruby/object:Gem::Requirement
|
142
160
|
requirements:
|
161
|
+
- - "~>"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '2.2'
|
143
164
|
- - ">="
|
144
165
|
- !ruby/object:Gem::Version
|
145
166
|
version: 2.2.10
|
@@ -147,6 +168,9 @@ dependencies:
|
|
147
168
|
prerelease: false
|
148
169
|
version_requirements: !ruby/object:Gem::Requirement
|
149
170
|
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '2.2'
|
150
174
|
- - ">="
|
151
175
|
- !ruby/object:Gem::Version
|
152
176
|
version: 2.2.10
|
@@ -155,6 +179,9 @@ dependencies:
|
|
155
179
|
requirement: !ruby/object:Gem::Requirement
|
156
180
|
requirements:
|
157
181
|
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '12.3'
|
184
|
+
- - ">="
|
158
185
|
- !ruby/object:Gem::Version
|
159
186
|
version: 12.3.3
|
160
187
|
type: :development
|
@@ -162,6 +189,9 @@ dependencies:
|
|
162
189
|
version_requirements: !ruby/object:Gem::Requirement
|
163
190
|
requirements:
|
164
191
|
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '12.3'
|
194
|
+
- - ">="
|
165
195
|
- !ruby/object:Gem::Version
|
166
196
|
version: 12.3.3
|
167
197
|
- !ruby/object:Gem::Dependency
|
@@ -178,7 +208,7 @@ dependencies:
|
|
178
208
|
- - "~>"
|
179
209
|
- !ruby/object:Gem::Version
|
180
210
|
version: '3.0'
|
181
|
-
description:
|
211
|
+
description: This tool will help manage the content of a Looker instance.
|
182
212
|
email:
|
183
213
|
- drstrangelove@google.com
|
184
214
|
executables:
|
@@ -186,6 +216,7 @@ executables:
|
|
186
216
|
extensions: []
|
187
217
|
extra_rdoc_files: []
|
188
218
|
files:
|
219
|
+
- ".github/scripts/parse_version.sh"
|
189
220
|
- ".github/scripts/wait_for_looker.sh"
|
190
221
|
- ".github/workflows/release.yml"
|
191
222
|
- ".github/workflows/ruby-ci.yml"
|