gazer 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +3 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +5 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +35 -0
  8. data/Gemfile.lock +150 -0
  9. data/LICENSE.txt +20 -0
  10. data/README.md +527 -0
  11. data/Rakefile +27 -0
  12. data/bin/console +35 -0
  13. data/bin/setup +30 -0
  14. data/exe/gzr +40 -0
  15. data/gzr.gemspec +67 -0
  16. data/lib/gzr.rb +25 -0
  17. data/lib/gzr/cli.rb +86 -0
  18. data/lib/gzr/command.rb +251 -0
  19. data/lib/gzr/commands/.gitkeep +1 -0
  20. data/lib/gzr/commands/connection.rb +69 -0
  21. data/lib/gzr/commands/connection/dialects.rb +72 -0
  22. data/lib/gzr/commands/connection/ls.rb +72 -0
  23. data/lib/gzr/commands/dashboard.rb +75 -0
  24. data/lib/gzr/commands/dashboard/cat.rb +67 -0
  25. data/lib/gzr/commands/dashboard/import.rb +256 -0
  26. data/lib/gzr/commands/dashboard/rm.rb +47 -0
  27. data/lib/gzr/commands/group.rb +87 -0
  28. data/lib/gzr/commands/group/ls.rb +73 -0
  29. data/lib/gzr/commands/group/member_groups.rb +74 -0
  30. data/lib/gzr/commands/group/member_users.rb +74 -0
  31. data/lib/gzr/commands/look.rb +75 -0
  32. data/lib/gzr/commands/look/cat.rb +55 -0
  33. data/lib/gzr/commands/look/import.rb +62 -0
  34. data/lib/gzr/commands/look/rm.rb +47 -0
  35. data/lib/gzr/commands/model.rb +51 -0
  36. data/lib/gzr/commands/model/ls.rb +72 -0
  37. data/lib/gzr/commands/plan.rb +149 -0
  38. data/lib/gzr/commands/plan/cat.rb +52 -0
  39. data/lib/gzr/commands/plan/disable.rb +49 -0
  40. data/lib/gzr/commands/plan/enable.rb +49 -0
  41. data/lib/gzr/commands/plan/failures.rb +98 -0
  42. data/lib/gzr/commands/plan/import.rb +69 -0
  43. data/lib/gzr/commands/plan/ls.rb +102 -0
  44. data/lib/gzr/commands/plan/rm.rb +47 -0
  45. data/lib/gzr/commands/plan/run.rb +58 -0
  46. data/lib/gzr/commands/query.rb +49 -0
  47. data/lib/gzr/commands/query/runquery.rb +102 -0
  48. data/lib/gzr/commands/role.rb +163 -0
  49. data/lib/gzr/commands/role/cat.rb +52 -0
  50. data/lib/gzr/commands/role/group_add.rb +51 -0
  51. data/lib/gzr/commands/role/group_ls.rb +76 -0
  52. data/lib/gzr/commands/role/group_rm.rb +51 -0
  53. data/lib/gzr/commands/role/ls.rb +75 -0
  54. data/lib/gzr/commands/role/rm.rb +47 -0
  55. data/lib/gzr/commands/role/user_add.rb +51 -0
  56. data/lib/gzr/commands/role/user_ls.rb +76 -0
  57. data/lib/gzr/commands/role/user_rm.rb +51 -0
  58. data/lib/gzr/commands/space.rb +137 -0
  59. data/lib/gzr/commands/space/cat.rb +53 -0
  60. data/lib/gzr/commands/space/create.rb +50 -0
  61. data/lib/gzr/commands/space/export.rb +117 -0
  62. data/lib/gzr/commands/space/ls.rb +97 -0
  63. data/lib/gzr/commands/space/rm.rb +56 -0
  64. data/lib/gzr/commands/space/top.rb +62 -0
  65. data/lib/gzr/commands/space/tree.rb +79 -0
  66. data/lib/gzr/commands/subcommandbase.rb +41 -0
  67. data/lib/gzr/commands/user.rb +111 -0
  68. data/lib/gzr/commands/user/cat.rb +52 -0
  69. data/lib/gzr/commands/user/disable.rb +47 -0
  70. data/lib/gzr/commands/user/enable.rb +47 -0
  71. data/lib/gzr/commands/user/ls.rb +82 -0
  72. data/lib/gzr/commands/user/me.rb +66 -0
  73. data/lib/gzr/modules/connection.rb +52 -0
  74. data/lib/gzr/modules/dashboard.rb +215 -0
  75. data/lib/gzr/modules/filehelper.rb +81 -0
  76. data/lib/gzr/modules/group.rb +93 -0
  77. data/lib/gzr/modules/look.rb +162 -0
  78. data/lib/gzr/modules/model.rb +40 -0
  79. data/lib/gzr/modules/plan.rb +216 -0
  80. data/lib/gzr/modules/role.rb +128 -0
  81. data/lib/gzr/modules/session.rb +203 -0
  82. data/lib/gzr/modules/space.rb +160 -0
  83. data/lib/gzr/modules/user.rb +114 -0
  84. data/lib/gzr/templates/.gitkeep +1 -0
  85. data/lib/gzr/templates/connection/dialects/.gitkeep +1 -0
  86. data/lib/gzr/templates/connection/ls/.gitkeep +1 -0
  87. data/lib/gzr/templates/dashboard/cat/.gitkeep +1 -0
  88. data/lib/gzr/templates/dashboard/import/.gitkeep +1 -0
  89. data/lib/gzr/templates/dashboard/rm/.gitkeep +1 -0
  90. data/lib/gzr/templates/group/ls/.gitkeep +1 -0
  91. data/lib/gzr/templates/group/member_groups/.gitkeep +1 -0
  92. data/lib/gzr/templates/group/member_users/.gitkeep +1 -0
  93. data/lib/gzr/templates/look/cat/.gitkeep +1 -0
  94. data/lib/gzr/templates/look/import/.gitkeep +1 -0
  95. data/lib/gzr/templates/look/rm/.gitkeep +1 -0
  96. data/lib/gzr/templates/model/ls/.gitkeep +1 -0
  97. data/lib/gzr/templates/plan/cat/.gitkeep +1 -0
  98. data/lib/gzr/templates/plan/disable/.gitkeep +1 -0
  99. data/lib/gzr/templates/plan/enable/.gitkeep +1 -0
  100. data/lib/gzr/templates/plan/failures/.gitkeep +1 -0
  101. data/lib/gzr/templates/plan/import/.gitkeep +1 -0
  102. data/lib/gzr/templates/plan/ls/.gitkeep +1 -0
  103. data/lib/gzr/templates/plan/rm/.gitkeep +1 -0
  104. data/lib/gzr/templates/plan/run/.gitkeep +1 -0
  105. data/lib/gzr/templates/query/run/.gitkeep +1 -0
  106. data/lib/gzr/templates/role/cat/.gitkeep +1 -0
  107. data/lib/gzr/templates/role/group_add/.gitkeep +1 -0
  108. data/lib/gzr/templates/role/group_ls/.gitkeep +1 -0
  109. data/lib/gzr/templates/role/group_rm/.gitkeep +1 -0
  110. data/lib/gzr/templates/role/ls/.gitkeep +1 -0
  111. data/lib/gzr/templates/role/rm/.gitkeep +1 -0
  112. data/lib/gzr/templates/role/user_add/.gitkeep +1 -0
  113. data/lib/gzr/templates/role/user_ls/.gitkeep +1 -0
  114. data/lib/gzr/templates/role/user_rm/.gitkeep +1 -0
  115. data/lib/gzr/templates/space/cat/.gitkeep +1 -0
  116. data/lib/gzr/templates/space/create/.gitkeep +1 -0
  117. data/lib/gzr/templates/space/export/.gitkeep +1 -0
  118. data/lib/gzr/templates/space/ls/.gitkeep +1 -0
  119. data/lib/gzr/templates/space/rm/.gitkeep +1 -0
  120. data/lib/gzr/templates/space/top/.gitkeep +1 -0
  121. data/lib/gzr/templates/space/tree/.gitkeep +1 -0
  122. data/lib/gzr/templates/user/cat/.gitkeep +1 -0
  123. data/lib/gzr/templates/user/disable/.gitkeep +1 -0
  124. data/lib/gzr/templates/user/enable/.gitkeep +1 -0
  125. data/lib/gzr/templates/user/ls/.gitkeep +1 -0
  126. data/lib/gzr/templates/user/me/.gitkeep +1 -0
  127. data/lib/gzr/version.rb +24 -0
  128. metadata +325 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9be1f366962bba0ba3b9ff09f8da55be6918e03f
4
+ data.tar.gz: 031e2bbd695dc6f180f9de2287892f399da35023
5
+ SHA512:
6
+ metadata.gz: 51c76b2379314a222103a59e2f0797c0aa0fc4dbd9ad9f11b844fa46bdbbb40063329d241ba3dec982740928021c297d046ffb3948d9119a4e0a3dbab03a1c48
7
+ data.tar.gz: 6fc85c7094d58a4bc3e54f1ac6d610a930d451689ff03f4cdc5e9cdb9eaa628e5cfc95668ef2ff4d8c80c3641dea92b0dfe1eeedffab9ddc3071c94eea44f57a
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ *~
14
+ *.swp
15
+ *.json
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1 @@
1
+ ruby-2.3.3
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at deangelo@looker.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,35 @@
1
+ # The MIT License (MIT)
2
+
3
+ # Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc.
4
+
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ # this software and associated documentation files (the "Software"), to deal in
7
+ # the Software without restriction, including without limitation the rights to
8
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ # the Software, and to permit persons to whom the Software is furnished to do so,
10
+ # subject to the following conditions:
11
+
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ RUBY_VERSION = File.read(File.join(File.dirname(__FILE__), '.ruby-version')).split('-').last.chomp
23
+
24
+ ruby '2.3.3', engine: 'ruby', engine_version: RUBY_VERSION
25
+
26
+ source "https://rubygems.org"
27
+
28
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
29
+
30
+ # Specify your gem's dependencies in gzr.gemspec
31
+ gemspec
32
+ #gem 'looker-sdk', :git => 'git@github.com:looker/looker-sdk-ruby.git'
33
+ #gem 'tty', :git => 'git@github.com:piotrmurach/tty.git'
34
+ #gem 'tty-file', :git => 'git@github.com:piotrmurach/tty-file.git'
35
+
@@ -0,0 +1,150 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gazer (0.2.9)
5
+ looker-sdk (~> 0.0.6)
6
+ netrc (~> 0.11.0)
7
+ pastel (~> 0.7.2)
8
+ thor (~> 0.20.0)
9
+ tty-reader (~> 0.3.0)
10
+ tty-table (~> 0.10.0)
11
+ tty-tree (~> 0.1.0)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ addressable (2.5.2)
17
+ public_suffix (>= 2.0.2, < 4.0)
18
+ diff-lcs (1.3)
19
+ equatable (0.5.0)
20
+ faraday (0.15.4)
21
+ multipart-post (>= 1.2, < 3)
22
+ hitimes (1.3.0)
23
+ kramdown (1.16.2)
24
+ looker-sdk (0.0.6)
25
+ faraday (>= 0.9.0, < 1.0)
26
+ sawyer (~> 0.8)
27
+ multipart-post (2.0.0)
28
+ necromancer (0.4.0)
29
+ netrc (0.11.0)
30
+ pastel (0.7.2)
31
+ equatable (~> 0.5.0)
32
+ tty-color (~> 0.4.0)
33
+ public_suffix (3.0.3)
34
+ rake (10.5.0)
35
+ rouge (3.1.1)
36
+ rspec (3.8.0)
37
+ rspec-core (~> 3.8.0)
38
+ rspec-expectations (~> 3.8.0)
39
+ rspec-mocks (~> 3.8.0)
40
+ rspec-core (3.8.0)
41
+ rspec-support (~> 3.8.0)
42
+ rspec-expectations (3.8.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.8.0)
45
+ rspec-mocks (3.8.0)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.8.0)
48
+ rspec-support (3.8.0)
49
+ sawyer (0.8.1)
50
+ addressable (>= 2.3.5, < 2.6)
51
+ faraday (~> 0.8, < 1.0)
52
+ strings (0.1.3)
53
+ strings-ansi (~> 0.1.0)
54
+ unicode-display_width (~> 1.4.0)
55
+ unicode_utils (~> 1.4.0)
56
+ strings-ansi (0.1.0)
57
+ thor (0.20.0)
58
+ timers (4.1.2)
59
+ hitimes
60
+ tty (0.8.1)
61
+ bundler (~> 1.16, < 2.0)
62
+ equatable (~> 0.5.0)
63
+ pastel (~> 0.7.2)
64
+ thor (~> 0.20.0)
65
+ tty-color (~> 0.4.2)
66
+ tty-command (~> 0.8.0)
67
+ tty-config (~> 0.2.0)
68
+ tty-cursor (~> 0.5.0)
69
+ tty-editor (~> 0.4.0)
70
+ tty-file (~> 0.6.0)
71
+ tty-font (~> 0.2.0)
72
+ tty-markdown (~> 0.4.0)
73
+ tty-pager (~> 0.11.0)
74
+ tty-platform (~> 0.1.0)
75
+ tty-progressbar (~> 0.15.0)
76
+ tty-prompt (~> 0.16.1)
77
+ tty-screen (~> 0.6.4)
78
+ tty-spinner (~> 0.8.0)
79
+ tty-table (~> 0.10.0)
80
+ tty-tree (~> 0.1.0)
81
+ tty-which (~> 0.3.0)
82
+ tty-color (0.4.3)
83
+ tty-command (0.8.2)
84
+ pastel (~> 0.7.0)
85
+ tty-config (0.2.0)
86
+ tty-cursor (0.5.0)
87
+ tty-editor (0.4.0)
88
+ tty-prompt (~> 0.16.0)
89
+ tty-which (~> 0.3.0)
90
+ tty-file (0.6.0)
91
+ diff-lcs (~> 1.3.0)
92
+ pastel (~> 0.7.2)
93
+ tty-prompt (~> 0.16.1)
94
+ tty-font (0.2.0)
95
+ tty-markdown (0.4.0)
96
+ kramdown (~> 1.16.2)
97
+ pastel (~> 0.7.2)
98
+ rouge (~> 3.1.0)
99
+ strings (~> 0.1.0)
100
+ tty-color (~> 0.4.2)
101
+ tty-screen (~> 0.6.4)
102
+ tty-pager (0.11.0)
103
+ strings (~> 0.1.0)
104
+ tty-screen (~> 0.6.4)
105
+ tty-which (~> 0.3.0)
106
+ tty-platform (0.1.0)
107
+ tty-progressbar (0.15.1)
108
+ tty-cursor (~> 0.5.0)
109
+ tty-screen (~> 0.6.4)
110
+ unicode-display_width (~> 1.3)
111
+ tty-prompt (0.16.1)
112
+ necromancer (~> 0.4.0)
113
+ pastel (~> 0.7.0)
114
+ timers (~> 4.0)
115
+ tty-cursor (~> 0.5.0)
116
+ tty-reader (~> 0.3.0)
117
+ tty-reader (0.3.0)
118
+ tty-cursor (~> 0.5.0)
119
+ tty-screen (~> 0.6.4)
120
+ wisper (~> 2.0.0)
121
+ tty-screen (0.6.5)
122
+ tty-spinner (0.8.0)
123
+ tty-cursor (>= 0.5.0)
124
+ tty-table (0.10.0)
125
+ equatable (~> 0.5.0)
126
+ necromancer (~> 0.4.0)
127
+ pastel (~> 0.7.2)
128
+ strings (~> 0.1.0)
129
+ tty-screen (~> 0.6.4)
130
+ tty-tree (0.1.0)
131
+ tty-which (0.3.0)
132
+ unicode-display_width (1.4.0)
133
+ unicode_utils (1.4.0)
134
+ wisper (2.0.0)
135
+
136
+ PLATFORMS
137
+ ruby
138
+
139
+ DEPENDENCIES
140
+ bundler (~> 1.16)
141
+ gazer!
142
+ rake (~> 10.0)
143
+ rspec (~> 3.0)
144
+ tty (~> 0.8)
145
+
146
+ RUBY VERSION
147
+ ruby 2.3.3p222
148
+
149
+ BUNDLED WITH
150
+ 1.16.1
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,527 @@
1
+ # Gazer - A Looker Content Utility
2
+
3
+ Gazer can be used to navigate and manges Spaces, Looks,
4
+ and Dashboards via a simple command line tool.
5
+
6
+ ## Status and Support
7
+
8
+ Gazer is **NOT** supported or warranteed by Looker in any way. Please do not contact Looker support
9
+ for issues with Gazer. Issues can be logged via https://github.com/deangelo-llooker/gzr/issues
10
+
11
+ ## Installation
12
+
13
+ You can install this gem by simply typing:
14
+
15
+ $ gem install gazer
16
+
17
+ Alternately you can follow the Development setup below, typing `bundle exec rake install` to install it
18
+ locally
19
+
20
+ ## Usage
21
+
22
+ Display help information...
23
+
24
+ $ gzr help
25
+
26
+ ### Storing Credentials
27
+ Store login information by creating the file `~/.netrc` in your home directory with the api3 credentials
28
+
29
+ ```
30
+ machine foo.bar.mycompany.com
31
+ login AbCdEfGhIjKlMnOp
32
+ password QrStUvWxYz1234567890
33
+ ```
34
+
35
+ Make sure that the `~/.netrc` file has restricted permissions by running `chmod 600 ~/.netrc`.
36
+
37
+ ### Options that apply to many commands
38
+
39
+ #### --su option
40
+
41
+ The `--su` option can be used with a user id to run the command as another user. This options works
42
+ with all commands. In order to use the `--su` option the user must provide admin credentials.
43
+
44
+ For example...
45
+
46
+ ```
47
+ $ gzr user me --su 1237 --host foo.bar.mycompany.com
48
+ +----+----------+---------+---------------------+
49
+ | id|first_name|last_name|email |
50
+ +----+----------+---------+---------------------+
51
+ |1237|Susan    |Gibson |sgibson@mycompany.com|
52
+ +----+----------+---------+---------------------+
53
+ ````
54
+ #### Suppressing Formatted Output
55
+
56
+ Many commands provide tabular output. For tables the
57
+ option `--plain` will suppress the table headers and format lines, making it easier to use tools
58
+ like grep, awk, etc. to retrieve values from the output of these commands.
59
+
60
+ #### CSV Output
61
+
62
+ Many commands provide tabular output. For tables thehe option `--csv` will output tabular data in
63
+ csv format. When combined with `--plain` the header will also be suppressed.
64
+
65
+ ### User Information
66
+
67
+ The command `gzr user help` will show details about subcommands of the user command.
68
+
69
+ #### user me
70
+
71
+ Display information about the current user with the command `gzr user me`.
72
+
73
+ ```
74
+ $ gzr user me --host foo.bar.mycompany.com
75
+ +----+----------+---------+--------------------+
76
+ | id|first_name|last_name|email |
77
+ +----+----------+---------+--------------------+
78
+ |1234|John     |Smith |jsmith@mycompany.com|
79
+ +----+----------+---------+--------------------+
80
+ ```
81
+
82
+ #### user ls
83
+
84
+ Display information about all users with the command `gzr user ls`.
85
+
86
+ ```
87
+ $ gzr user ls --host foo.bar.mycompany.com
88
+ +----+----------+---------+---------------------+
89
+ | id|first_name|last_name|email |
90
+ +----+----------+---------+---------------------+
91
+ |1234|John     |Smith |jsmith@mycompany.com |
92
+ |1235|Frank    |Jones |fjones@mycompany.com |
93
+ |1236|Bill     |Weld |wweld@mycompany.com |
94
+ |1237|Susan    |Gibson |sgibson@mycompany.com|
95
+ |1238|Anna     |Grace |agrace@mycompany.com |
96
+ |1239|Mike     |Arthur |marthur@mycompany.com|
97
+ +----+----------+---------+---------------------+
98
+ ```
99
+
100
+ Different fields can be returned using the `--fields` option. For example the option
101
+ `--fields id,first_name,last_name,email,personal_space_id,home_space_id`.
102
+
103
+ ### Group Information
104
+
105
+ The command `gzr group help` will show details about subcommands of the group command.
106
+
107
+ #### group ls
108
+
109
+ The command `gzr group ls` will list the groups defined on a particular Looker instance.
110
+
111
+ ```
112
+ gzr group ls --host foo.bar.mycompany.com
113
+ +--+------------------------------------+----------+---------------------+------------------+-----------------+
114
+ |id|name |user_count|contains_current_user|externally_managed|external_group_id|
115
+ +--+------------------------------------+----------+---------------------+------------------+-----------------+
116
+ | 4|Ecommerce Dashboard-only User | 2|false | | |
117
+ | 5|Marketing | 3|false | | |
118
+ | 6|Developer (no deploy) | 6|false | | |
119
+ | 9|dashboard_only | 7|false | | |
120
+ |24|Finance Team | 2|false | | |
121
+ |25|Marketing Team | 1|false | | |
122
+ |36|Embed Shared Group Engineering | 0|false | |Engineering |
123
+ |37|Embed Shared Group ecomm_only_users | 1|false | |ecomm_only_users |
124
+ |38|Embed Shared Group awesome_engineers| 1|false | |awesome_engineers|
125
+ |39|sub finance | 1|false | | |
126
+ |49|All Users | 570|true |true | |
127
+ +--+------------------------------------+----------+---------------------+------------------+-----------------+
128
+ ```
129
+
130
+ #### group member_groups
131
+
132
+ The command `gzr group member_group GROUP_ID` will list the group that have been added as
133
+ as members of the given group id.
134
+
135
+ ```
136
+ $ gzr group member_group 24 --host foo.bar.mycompany.com
137
+ +--+-----------+----------+---------------------+------------------+-----------------+
138
+ |id|name |user_count|contains_current_user|externally_managed|external_group_id|
139
+ +--+-----------+----------+---------------------+------------------+-----------------+
140
+ |39|sub finance| 1| | | |
141
+ +--+-----------+----------+---------------------+------------------+-----------------+
142
+ ```
143
+
144
+ #### group member_users
145
+
146
+ The command `gzr group member_users GROUP_ID` will list the users that have been added as
147
+ as members of the given group id.
148
+
149
+ ```
150
+ $ gzr group member_users 39 --host foo.bar.mycompany.com
151
+ +----+---------------------+---------+----------+-----------------+-------------+
152
+ | id|email |last_name|first_name|personal_space_id|home_space_id|
153
+ +----+---------------------+---------+----------+-----------------+-------------+
154
+ |1237|sgibson@mycompany.com|Gibson |Susan | 758| 758|
155
+ +----+---------------------+---------+----------+-----------------+-------------+
156
+ ```
157
+
158
+ ### Space Information
159
+
160
+ The command `gzr space help` will show details about subcommands of the space command.
161
+
162
+ #### space ls
163
+
164
+ The command `gzr space ls` will list the contents of a space, including subspaces, looks, and dashboards.
165
+
166
+ Without any arguments, the command will list the contents of the user's "home" space.
167
+
168
+ ```
169
+ $ gzr space ls --host foo.bar.mycompany.com
170
+ +---------+---+------+---------+----------------------------+--------------+--------------------------------+
171
+ |parent_id|id | name|looks(id)|looks(title) |dashboards(id)|dashboards(title) |
172
+ +---------+---+------+---------+----------------------------+--------------+--------------------------------+
173
+ | |801|Shared| | | | |
174
+ | |801|Shared|857 |Daily Profit | | |
175
+ | |801|Shared|1479 |totals | | |
176
+ | |801|Shared|1486 |Test look2 | | |
177
+ | |801|Shared|1509 |Aircraft Production by Year | | |
178
+ | |801|Shared| | |192 |Daily Profit Dashboard |
179
+ | |801|Shared| | |261 |New Test Dashboard |
180
+ | |801|Shared| | |383 |Sales Dashboard |
181
+ | |801|Shared| | |463 |Customer Dashboard |
182
+ +---------+---+------+---------+----------------------------+--------------+--------------------------------+
183
+ ```
184
+
185
+ With the argument "~" the command will list the content of the calling user's "personal" space.
186
+
187
+ ```
188
+ $ gzr space ls "~" --host foo.bar.mycompany.com
189
+ +---------+----+----------+---------+-----------------+--------------+-------------------------------------+
190
+ |parent_id|id | name|looks(id)|looks(title) |dashboards(id)|dashboards(title) |
191
+ +---------+----+----------+---------+-----------------+--------------+-------------------------------------+
192
+ | 709|1132|John Smith| | | | |
193
+ | 709|1132|John Smith|1570 |test | | |
194
+ | 709|1132|John Smith|1726 |you can delete me| | |
195
+ | 709|1132|John Smith|1737 |My First Look | | |
196
+ | 709|1132|John Smith| | |410 |Indicator Dashboard |
197
+ | 709|1132|John Smith| | |413 |Accidents Dashboard 2011 |
198
+ +---------+----+----------+---------+-----------------+--------------+-------------------------------------+
199
+ ```
200
+
201
+ With a simple numeric argument the command will list the content of the space with the given space id.
202
+
203
+ ```
204
+ $ gzr space ls 103 --host foo.bar.mycompany.com
205
+ ```
206
+
207
+ With a tilde plus a simple numeric argument the command will list the content of the personal space
208
+ of the given user id.
209
+
210
+ ```
211
+ $ gzr space ls "~1237" --host foo.bar.mycompany.com
212
+ ```
213
+
214
+ The user can be identified by name as well.
215
+
216
+ ```
217
+ $ gzr space ls "~Susan Gibson" --host foo.bar.mycompany.com
218
+ ```
219
+ Finally, the space can be searched by name.
220
+
221
+ ```
222
+ $ gzr space ls "Marketing" --host foo.bar.mycompany.com
223
+ ```
224
+
225
+ #### space tree
226
+
227
+ The command `gzr space tree` will display the child spaces, dashboards, and looks in a tree format.
228
+
229
+ ```
230
+ $ gzr space tree "~" --host foo.bar.mycompany.com
231
+ John Smith
232
+ ├── Trace Data
233
+ │ ├── (l) All-Time Visits
234
+ │ └── (l) Sessions by Week
235
+ ├── (l) test
236
+ ├── (l) you can delete me
237
+ ├── (l) My First Look
238
+ ├── (d) Indicator Dashboard
239
+ └── (d) Indicator Dashboard 2011
240
+ ```
241
+
242
+ The same arguments are accepted as by `space ls`.
243
+
244
+ #### space cat
245
+
246
+ The `space cat` command is used to output the json that describes the space.
247
+
248
+ ```
249
+ $ gzr space cat 758 --host foo.bar.mycompany.com
250
+ {
251
+ "id": 758,
252
+ "creator_id": 1237,
253
+ "name": "Susan Gibson",
254
+ "content_metadata_id": 734,
255
+ "is_personal": true,
256
+ "is_shared_root": false,
257
+ "is_users_root": false,
258
+ "is_personal_descendant": false,
259
+ "is_embed": false,
260
+ "is_embed_shared_root": false,
261
+ "is_embed_users_root": false,
262
+ "external_id": null,
263
+ "parent_id": 709,
264
+ "is_user_root": false,
265
+ "is_root": false,
266
+ "looks": [
267
+ ],
268
+ "dashboards": [
269
+ ],
270
+ "can": {
271
+ "index": true,
272
+ "show": true,
273
+ "create": true,
274
+ "see_admin_spaces": true,
275
+ "update": false,
276
+ "destroy": false,
277
+ "move_content": true,
278
+ "edit_content": true
279
+ }
280
+ }
281
+ ```
282
+
283
+ The output document can be very long. Usually one will use the switch `--dir DIRECTORY` to
284
+ save to a file. The file will be named `Space_{SPACE_ID}_{SPACE_NAME}.json`.
285
+
286
+ #### space export
287
+
288
+ The `space export SPACE_ID` command is used to export a space and its subspaces, looks, and dashboards.
289
+ The structure of spaces and subspaces will be mirrored in directories and subdirectories in the file system
290
+ under the directory given by the `--dir DIRECTORY` switch. The directories will be named like
291
+ `Space_{SPACE_ID}_{SPACE_NAME}` and the metadata for each space will be stored in a
292
+ file with the name `Space_{SPACE_ID}_{SPACE_NAME}.json` within its corresponding directory.
293
+
294
+ The JSON information for the Looks and Dashboards in a space are usually part of the space
295
+ json data. When using the export command, this information would be redundant and so it is not
296
+ included in the `Space_{SPACE_ID}_{SPACE_NAME}.json` file.
297
+
298
+ Looks and Dashboards will be located in the space directories in files named like
299
+ `Look_{LOOK_ID}_{LOOK_TITLE}.json` and `Dashboard_{DASHBOARD_ID}_{DASHBOARD_TITLE}.json`.
300
+
301
+ ```
302
+ $ gzr space export 758 --host foo.bar.mycompany.com --dir .
303
+ ```
304
+
305
+ One interesting use of exporting a space into a directory tree is that it can be placed under version control
306
+ using a tool like git. In that way user defined content changes can be tracked over time, and older versions
307
+ of content can be restored if desired.
308
+
309
+ Alternately, the space can be exported into a `tar` style archive file with the switch `--tar FILENAME`.
310
+
311
+ ```
312
+ $ gzr space export 758 --host foo.bar.mycompany.com --tar export.tar
313
+ ```
314
+
315
+ That tar file can also be automatically compressed with `gzip` compression by using the switch
316
+ `--tgz FILENAME`.
317
+
318
+ ```
319
+ $ gzr space export 758 --host foo.bar.mycompany.com --tgz export.tar.gz
320
+ ```
321
+
322
+ #### space rm
323
+
324
+ The `space rm SPACE_ID` command is used to delete a space. If the space is not empty
325
+ this command will refuse to perform the delete. By adding the `--force` switch the command
326
+ will also delete the subspaces, looks, and dashboards contained in the space.
327
+
328
+ ```
329
+ $ gzr space rm 758 --host foo.bar.mycompany.com --force
330
+ ```
331
+
332
+ #### space create
333
+
334
+ The `space create NAME PARENT_SPACE_ID` command is used to create a new subspace.
335
+
336
+ ```
337
+ $ gzr space create "My New Space" 758 --host foo.bar.mycompany.com
338
+ ```
339
+
340
+ ### Look Information
341
+
342
+ The command `gzr look help` will show details about subcommands of the look command.
343
+
344
+ #### look cat
345
+
346
+ The `look cat` command is used to output the json that describes the look.
347
+
348
+ ```
349
+ $ gzr look cat 758 --host foo.bar.mycompany.com
350
+ JSON data for look
351
+ ```
352
+
353
+ The output document can be very long. Usually one will use the switch `--dir DIRECTORY` to
354
+ save to a file. The file will be named `Look_{LOOK_ID}_{LOOK_TITLE}.json`.
355
+
356
+ #### look rm
357
+
358
+ The `look rm LOOK_ID` command is used to delete a look.
359
+
360
+ ```
361
+ $ gzr look rm 758 --host foo.bar.mycompany.com
362
+ ```
363
+
364
+ #### look import
365
+
366
+ The `look import LOOK_FILE SPACE_ID` command is used to import a look from a file. If a look by the same
367
+ name exists in that space then the `--force` switch must be used.
368
+
369
+ Gazer will attempt to update the existing look of the same name, rather than create a new look. In
370
+ that way the look id, schedules, permissions, etc. will be preserved.
371
+
372
+ ```
373
+ $ gzr look import Path/To/Look_123_My\ Look.json 123 --host foo.bar.mycompany.com --force
374
+ ```
375
+
376
+ ### Dashboard Information
377
+
378
+ The command `gzr dashboard help` will show details about subcommands of the dashboard command.
379
+
380
+ #### dashboard cat
381
+
382
+ The `dashboard cat` command is used to output the json that describes the dashboard.
383
+
384
+ ```
385
+ $ gzr dashboard cat 192 --host foo.bar.mycompany.com
386
+ JSON data for dashboard
387
+ ```
388
+
389
+ The output document can be very long. Usually one will use the switch `--dir DIRECTORY` to
390
+ save to a file. The file will be named `Dashboard_{DASHBOARD_ID}_{DASHBOARD_TITLE}.json`.
391
+
392
+ #### dashboard rm
393
+
394
+ The `dashboard rm DASHBOARD_ID` command is used to delete a dashboard.
395
+
396
+ ```
397
+ $ gzr dashboard rm 192 --host foo.bar.mycompany.com
398
+ ```
399
+
400
+ #### dashboard import
401
+
402
+ The `dashboard import DASHBAORD_FILE SPACE_ID` command is used to import a dashboard and
403
+ its associated looks from a file. If a dashbaord or look by the same
404
+ name exists in that space then the `--force` switch must be used.
405
+
406
+ Gazer will attempt to update the existing dashboard or look of the same name, rather than
407
+ create a new dashboard or look. In
408
+ that way the id, schedules, permissions, etc. will be preserved.
409
+
410
+ ```
411
+ $ gzr dashboard import Path/To/Dashboard_123_My\ Dash.json 123 --host foo.bar.mycompany.com --force
412
+ ```
413
+
414
+ ### Connection Information
415
+
416
+ The command `gzr connection help` will show details about subcommands of the connection command.
417
+
418
+ #### connection ls
419
+
420
+ The command `gzr connection ls` will list the connections that have been defined in the Looker instance.
421
+
422
+ ```
423
+ $ gzr connection ls --host foo.bar.mycompany.com
424
+ +-------------------------+---------------------+-----------------+----+--------------------------+-----------+
425
+ |name |dialect.name |host |port|database |schema |
426
+ +-------------------------+---------------------+-----------------+----+--------------------------+-----------+
427
+ |thelook |mysql |db1.mycompany.com|3306|demo_db | |
428
+ |faa |mysql |db1.mycompany.com|3306|flightstats | |
429
+ |video_store |mysql |db1.mycompany.com|3306|sakila | |
430
+ |looker |mysql | | | | |
431
+ +-------------------------+---------------------+-----------------+----+--------------------------+-----------+
432
+ ```
433
+
434
+ #### connection dialect
435
+
436
+ The command `gzr connection dialect` will list the dialects that have been defined in the Looker instance.
437
+
438
+ ```
439
+ $ gzr connection dialect --host foo.bar.mycompany.com
440
+ +---------------------+----------------------------------+
441
+ |name |label |
442
+ +---------------------+----------------------------------+
443
+ |mysql |MySQL |
444
+ |amazonaurora |Amazon Aurora |
445
+ |googlecloudsql |Google Cloud SQL |
446
+ |memsql |MemSQL |
447
+ |mariadb |MariaDB |
448
+ |clustrix |Clustrix |
449
+ |postgres |PostgreSQL |
450
+ |google_cloud_postgres|Google Cloud PostgreSQL |
451
+ |azure_postgres |Azure PostgreSQL |
452
+ |presto |PrestoDB |
453
+ |athena |Amazon Athena |
454
+ |qubole_presto |Qubole Presto v0.157+ |
455
+ |qubole_presto_v142 |Qubole Presto v0.142 |
456
+ |xtremedata |XtremeData |
457
+ |redshift |Amazon Redshift |
458
+ |snowflake |Snowflake |
459
+ |greenplum |Greenplum |
460
+ |mssql_2008 |Microsoft SQL Server 2008+ |
461
+ |msazuresql |Microsoft Azure SQL Database |
462
+ |mssql |Microsoft SQL Server 2005 |
463
+ |mssqldw |Microsoft Azure SQL Data Warehouse|
464
+ |aster |Aster Data |
465
+ |vertica |Vertica 7.1+ |
466
+ |vertica_v5 |Vertica 6 |
467
+ |bigquery |Google BigQuery Legacy SQL |
468
+ |bigquery_standard_sql|Google BigQuery Standard SQL |
469
+ |spanner |Google Cloud Spanner |
470
+ |db2 |IBM DB2 |
471
+ |datavirtuality |DataVirtuality |
472
+ |dashdb |IBM DashDB |
473
+ |hana |SAP HANA |
474
+ |oracle |Oracle |
475
+ |oracle_dwcs |Oracle ADWC |
476
+ |hive2 |Apache Hive2 |
477
+ |impala |Cloudera Impala |
478
+ |spark1_5 |Apache Spark 1.5+ |
479
+ |spark2_0 |Apache Spark 2.0 |
480
+ |teradata |Teradata |
481
+ |exasol |Exasol |
482
+ |denodo |Denodo |
483
+ |druid |Druid |
484
+ |netezza |IBM Netezza |
485
+ |dremio |Dremio |
486
+ +---------------------+----------------------------------+
487
+ ```
488
+
489
+ ### Model Information
490
+
491
+ The command `gzr model help` will show details about subcommands of the model command.
492
+
493
+ #### model ls
494
+
495
+ The command `gzr model ls` will list the models that have been defined in the Looker instance.
496
+
497
+ ```
498
+ $ gzr model ls --host foo.bar.mycompany.com
499
+ +---------------------------------------------+---------------------------------------------+-------------------------+
500
+ |name |label |project_name |
501
+ +---------------------------------------------+---------------------------------------------+-------------------------+
502
+ |faa |Faa |faa |
503
+ |300_daily_active_users |300 Daily Active Users |lookml_design_patterns |
504
+ |001_hello_world |001 Hello World |lookml_design_patterns |
505
+ |video_store |Video Store |video_store |
506
+ |looker |Looker |i__looker_dev |
507
+ |faa_redshift |Faa Redshift |faa_redshift |
508
+ +---------------------------------------------+---------------------------------------------+-------------------------+
509
+ ```
510
+
511
+ ## Development
512
+
513
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
514
+
515
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
516
+
517
+ ## Contributing
518
+
519
+ Bug reports and pull requests are welcome on GitHub at https://github.com/deangelo-llooker/gzr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
520
+
521
+ ## Code of Conduct
522
+
523
+ Everyone interacting in the Gazer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/deangelo-llooker/gzr/blob/master/CODE_OF_CONDUCT.md).
524
+
525
+ ## Copyright
526
+
527
+ Copyright (c) 2018 Mike DeAngelo for Looker Data Sciences. See [MIT License](LICENSE.txt) for further details.