gazer 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/gzr/command.rb +9 -5
- data/lib/gzr/commands/alert/cat.rb +2 -2
- data/lib/gzr/commands/alert/ls.rb +2 -2
- data/lib/gzr/commands/alert/notifications.rb +2 -2
- data/lib/gzr/commands/attribute/cat.rb +3 -3
- data/lib/gzr/commands/attribute/create.rb +2 -2
- data/lib/gzr/commands/attribute/get_group_value.rb +4 -4
- data/lib/gzr/commands/attribute/import.rb +3 -3
- data/lib/gzr/commands/attribute/ls.rb +3 -3
- data/lib/gzr/commands/attribute/rm.rb +4 -4
- data/lib/gzr/commands/attribute/set_group_value.rb +4 -4
- data/lib/gzr/commands/connection/dialects.rb +4 -4
- data/lib/gzr/commands/connection/ls.rb +2 -2
- data/lib/gzr/commands/connection/test.rb +2 -2
- data/lib/gzr/commands/dashboard/import.rb +30 -30
- data/lib/gzr/commands/dashboard/mv.rb +1 -1
- data/lib/gzr/commands/folder/cat.rb +3 -3
- data/lib/gzr/commands/folder/create.rb +3 -3
- data/lib/gzr/commands/folder/export.rb +2 -2
- data/lib/gzr/commands/folder/ls.rb +3 -4
- data/lib/gzr/commands/folder/rm.rb +3 -3
- data/lib/gzr/commands/folder/top.rb +4 -4
- data/lib/gzr/commands/folder/tree.rb +11 -11
- data/lib/gzr/commands/group/ls.rb +3 -3
- data/lib/gzr/commands/group/member_groups.rb +3 -3
- data/lib/gzr/commands/group/member_users.rb +3 -3
- data/lib/gzr/commands/look/cat.rb +1 -1
- data/lib/gzr/commands/look/import.rb +5 -5
- data/lib/gzr/commands/look/mv.rb +1 -1
- data/lib/gzr/commands/look/rm.rb +1 -1
- data/lib/gzr/commands/model/ls.rb +4 -4
- data/lib/gzr/commands/model/set/ls.rb +2 -2
- data/lib/gzr/commands/permission/ls.rb +2 -2
- data/lib/gzr/commands/permission/set/ls.rb +2 -2
- data/lib/gzr/commands/plan/cat.rb +3 -3
- data/lib/gzr/commands/plan/disable.rb +3 -3
- data/lib/gzr/commands/plan/enable.rb +3 -3
- data/lib/gzr/commands/plan/failures.rb +12 -7
- data/lib/gzr/commands/plan/import.rb +5 -5
- data/lib/gzr/commands/plan/ls.rb +5 -5
- data/lib/gzr/commands/plan/run.rb +2 -2
- data/lib/gzr/commands/project/branch.rb +4 -4
- data/lib/gzr/commands/project/ls.rb +3 -3
- data/lib/gzr/commands/role/cat.rb +2 -2
- data/lib/gzr/commands/role/group_add.rb +2 -2
- data/lib/gzr/commands/role/group_ls.rb +3 -3
- data/lib/gzr/commands/role/group_rm.rb +2 -2
- data/lib/gzr/commands/role/ls.rb +3 -3
- data/lib/gzr/commands/role/user_add.rb +2 -2
- data/lib/gzr/commands/role/user_ls.rb +3 -3
- data/lib/gzr/commands/role/user_rm.rb +2 -2
- data/lib/gzr/commands/user/cat.rb +5 -3
- data/lib/gzr/commands/user/delete.rb +2 -1
- data/lib/gzr/commands/user/disable.rb +2 -1
- data/lib/gzr/commands/user/enable.rb +2 -1
- data/lib/gzr/commands/user/ls.rb +22 -11
- data/lib/gzr/commands/user/me.rb +6 -2
- data/lib/gzr/commands/user.rb +2 -0
- data/lib/gzr/modules/alert.rb +30 -17
- data/lib/gzr/modules/attribute.rb +24 -22
- data/lib/gzr/modules/connection.rb +10 -25
- data/lib/gzr/modules/dashboard.rb +86 -44
- data/lib/gzr/modules/folder.rb +20 -28
- data/lib/gzr/modules/group.rb +8 -10
- data/lib/gzr/modules/look.rb +23 -21
- data/lib/gzr/modules/model/set.rb +6 -6
- data/lib/gzr/modules/model.rb +14 -7
- data/lib/gzr/modules/permission/set.rb +2 -2
- data/lib/gzr/modules/permission.rb +2 -4
- data/lib/gzr/modules/plan.rb +36 -36
- data/lib/gzr/modules/project.rb +26 -21
- data/lib/gzr/modules/role.rb +48 -36
- data/lib/gzr/modules/session.rb +2 -2
- data/lib/gzr/modules/user.rb +52 -43
- data/lib/gzr/version.rb +1 -1
- metadata +2 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -69,14 +69,14 @@ module Gzr
|
|
69
69
|
|
70
70
|
folder_ids.each do |folder_id|
|
71
71
|
s = query_folder(folder_id, "id,name,parent_id,looks(id,title),dashboards(id,title)")
|
72
|
-
folder_name = s
|
73
|
-
folder_name = "nil (#{s
|
72
|
+
folder_name = s[:name]
|
73
|
+
folder_name = "nil (#{s[:id]})" unless folder_name
|
74
74
|
folder_name = "\"#{folder_name}\"" if ((folder_name != folder_name.strip) || (folder_name.length == 0))
|
75
75
|
folder_name += " (#{folder_id})" unless folder_ids.length == 1
|
76
76
|
tree_data[folder_name] =
|
77
|
-
[ recurse_folders(s
|
78
|
-
s
|
79
|
-
s
|
77
|
+
[ recurse_folders(s[:id]) ] +
|
78
|
+
s[:looks].map { |l| "(l) #{l[:title]}" } +
|
79
|
+
s[:dashboards].map { |d| "(d) #{d[:title]}" }
|
80
80
|
end
|
81
81
|
tree = TTY::Tree.new(tree_data)
|
82
82
|
output.puts tree.render
|
@@ -87,13 +87,13 @@ module Gzr
|
|
87
87
|
data = query_folder_children(folder_id, "id,name,parent_id,looks(id,title),dashboards(id,title)")
|
88
88
|
tree_branch = Hash.new
|
89
89
|
data.each do |s|
|
90
|
-
folder_name = s
|
91
|
-
folder_name = "nil (#{s
|
90
|
+
folder_name = s[:name]
|
91
|
+
folder_name = "nil (#{s[:id]})" unless folder_name
|
92
92
|
folder_name = "\"#{folder_name}\"" if ((folder_name != folder_name.strip) || (folder_name.length == 0))
|
93
93
|
tree_branch[folder_name] =
|
94
|
-
[ recurse_folders(s
|
95
|
-
s
|
96
|
-
s
|
94
|
+
[ recurse_folders(s[:id]) ] +
|
95
|
+
s[:looks].map { |l| "(l) #{l[:title]}" } +
|
96
|
+
s[:dashboards].map { |d| "(d) #{d[:title]}" }
|
97
97
|
end
|
98
98
|
tree_branch
|
99
99
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -47,10 +47,10 @@ module Gzr
|
|
47
47
|
table_hash = Hash.new
|
48
48
|
fields = field_names(@options[:fields])
|
49
49
|
table_hash[:header] = fields unless @options[:plain]
|
50
|
-
expressions = fields.collect { |fn|
|
50
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
51
51
|
table_hash[:rows] = data.map do |row|
|
52
52
|
expressions.collect do |e|
|
53
|
-
eval "row
|
53
|
+
eval "row#{e}"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
eval "row
|
54
|
+
eval "row#{e}"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
eval "row
|
54
|
+
eval "row#{e}"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -60,10 +60,10 @@ module Gzr
|
|
60
60
|
raise Gzr::CLI::Error, "import file is not a valid look"
|
61
61
|
end
|
62
62
|
|
63
|
-
look = upsert_look(@me
|
64
|
-
upsert_plans_for_look(look.id,@me
|
65
|
-
output.puts "Imported look #{look
|
66
|
-
output.puts look
|
63
|
+
look = upsert_look(@me[:id],create_fetch_query(data[:query]).id,@dest_folder_id,data,output: output)
|
64
|
+
upsert_plans_for_look(look.id,@me[:id],data[:scheduled_plans]) if data[:scheduled_plans]
|
65
|
+
output.puts "Imported look #{look[:id]}" unless @options[:plain]
|
66
|
+
output.puts look[:id] if @options[:plain]
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
data/lib/gzr/commands/look/mv.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
data/lib/gzr/commands/look/rm.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -38,7 +38,7 @@ module Gzr
|
|
38
38
|
def execute(input: $stdin, output: $stdout)
|
39
39
|
say_warning(@options) if @options[:debug]
|
40
40
|
with_session do
|
41
|
-
data = query_all_lookml_models(@options[:fields])
|
41
|
+
data = query_all_lookml_models(@options[:fields], @options[:debug])
|
42
42
|
begin
|
43
43
|
say_ok "No users found"
|
44
44
|
return nil
|
@@ -47,10 +47,10 @@ module Gzr
|
|
47
47
|
table_hash = Hash.new
|
48
48
|
fields = field_names(@options[:fields])
|
49
49
|
table_hash[:header] = fields unless @options[:plain]
|
50
|
-
expressions = fields.collect { |fn|
|
50
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
51
51
|
table_hash[:rows] = data.map do |row|
|
52
52
|
expressions.collect do |e|
|
53
|
-
eval "row
|
53
|
+
eval "row#{e}"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
table = TTY::Table.new(table_hash)
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
eval "row
|
54
|
+
eval "row#{e}"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
table = TTY::Table.new(table_hash)
|
@@ -49,10 +49,10 @@ module Gzr
|
|
49
49
|
table_hash = Hash.new
|
50
50
|
fields = field_names('permission,parent,description')
|
51
51
|
table_hash[:header] = fields unless @options[:plain]
|
52
|
-
expressions = fields.collect { |fn|
|
52
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
53
53
|
table_hash[:rows] = data.map do |row|
|
54
54
|
expressions.collect do |e|
|
55
|
-
eval "row
|
55
|
+
eval "row#{e}"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
table = TTY::Table.new(table_hash)
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
exp = eval "row
|
54
|
+
exp = eval "row#{e}"
|
55
55
|
if exp.kind_of? Array
|
56
56
|
exp = exp.join "\n"
|
57
57
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -41,8 +41,8 @@ module Gzr
|
|
41
41
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
42
42
|
with_session do
|
43
43
|
data = query_scheduled_plan(@plan_id)
|
44
|
-
write_file(@options[:dir] ? "Plan_#{data
|
45
|
-
f.puts JSON.pretty_generate(data
|
44
|
+
write_file(@options[:dir] ? "Plan_#{data[:id]}_#{data[:name]}.json" : nil, @options[:dir], nil, output) do |f|
|
45
|
+
f.puts JSON.pretty_generate(data)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -39,8 +39,8 @@ module Gzr
|
|
39
39
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
40
40
|
with_session do
|
41
41
|
plan = update_scheduled_plan(@plan_id, { :enabled=>false })
|
42
|
-
output.puts "Disabled plan #{plan
|
43
|
-
output.puts plan
|
42
|
+
output.puts "Disabled plan #{plan[:id]}" unless @options[:plain]
|
43
|
+
output.puts plan[:id] if @options[:plain]
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -39,8 +39,8 @@ module Gzr
|
|
39
39
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
40
40
|
with_session do
|
41
41
|
plan = update_scheduled_plan(@plan_id, { :enabled=>true })
|
42
|
-
output.puts "Enabled plan #{plan
|
43
|
-
output.puts plan
|
42
|
+
output.puts "Enabled plan #{plan[:id]}" unless @options[:plain]
|
43
|
+
output.puts plan[:id] if @options[:plain]
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -43,11 +43,16 @@ module Gzr
|
|
43
43
|
:view=>"scheduled_plan",
|
44
44
|
:fields=>[
|
45
45
|
"scheduled_plan.id",
|
46
|
+
"scheduled_plan.name",
|
47
|
+
"user.id",
|
46
48
|
"user.name",
|
47
49
|
"scheduled_job.status",
|
48
50
|
"scheduled_job.id",
|
49
51
|
"scheduled_job.created_time",
|
50
|
-
"scheduled_plan.next_run_time"
|
52
|
+
"scheduled_plan.next_run_time",
|
53
|
+
"scheduled_plan.look_id",
|
54
|
+
"scheduled_plan.dashboard_id",
|
55
|
+
"scheduled_plan.lookml_dashboard_id"
|
51
56
|
],
|
52
57
|
:filters=>{
|
53
58
|
"scheduled_job_stage.stage": "execute",
|
@@ -62,7 +67,7 @@ module Gzr
|
|
62
67
|
}
|
63
68
|
data = run_inline_query(query)
|
64
69
|
fields = query[:fields]
|
65
|
-
expressions = fields.collect { |f| "
|
70
|
+
expressions = fields.collect { |f| "[:'#{f}']" }
|
66
71
|
begin
|
67
72
|
say_ok "No plans found in history"
|
68
73
|
return nil
|
@@ -72,11 +77,11 @@ module Gzr
|
|
72
77
|
table_hash[:header] = fields unless @options[:plain]
|
73
78
|
prior_plan_id = nil
|
74
79
|
table_hash[:rows] = data.collect do |row|
|
75
|
-
next if row
|
76
|
-
prior_plan_id = row
|
77
|
-
next if row
|
80
|
+
next if row[:'scheduled_plan.id'] == prior_plan_id
|
81
|
+
prior_plan_id = row[:'scheduled_plan.id']
|
82
|
+
next if row[:'scheduled_job.status'] == 'success'
|
78
83
|
expressions.collect do |e|
|
79
|
-
eval "row
|
84
|
+
eval "row#{e}"
|
80
85
|
end
|
81
86
|
end.compact
|
82
87
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -52,14 +52,14 @@ module Gzr
|
|
52
52
|
plan = nil
|
53
53
|
case @obj_type
|
54
54
|
when /dashboard/i
|
55
|
-
plan = upsert_plan_for_dashboard(@obj_id,@me
|
55
|
+
plan = upsert_plan_for_dashboard(@obj_id,@me[:id],data)
|
56
56
|
when /look/i
|
57
|
-
plan = upsert_plan_for_look(@obj_id,@me
|
57
|
+
plan = upsert_plan_for_look(@obj_id,@me[:id],data)
|
58
58
|
else
|
59
59
|
raise Gzr::CLI::Error, "Invalid type '#{obj_type}', valid types are look and dashboard"
|
60
60
|
end
|
61
|
-
output.puts "Imported plan #{plan
|
62
|
-
output.puts plan
|
61
|
+
output.puts "Imported plan #{plan[:id]}" unless @options[:plain]
|
62
|
+
output.puts plan[:id] if @options[:plain]
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
data/lib/gzr/commands/plan/ls.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -55,7 +55,7 @@ module Gzr
|
|
55
55
|
"scheduled_plan.lookml_dashboard_id"
|
56
56
|
],
|
57
57
|
:filters=>{
|
58
|
-
"scheduled_plan.enabled"=>false
|
58
|
+
"scheduled_plan.enabled"=>"false"
|
59
59
|
},
|
60
60
|
:sorts=>[
|
61
61
|
"scheduled_plan.id asc 0"
|
@@ -64,11 +64,11 @@ module Gzr
|
|
64
64
|
}
|
65
65
|
data = run_inline_query(query)
|
66
66
|
fields = query[:fields]
|
67
|
-
expressions = fields.collect { |f| "
|
67
|
+
expressions = fields.collect { |f| "[:'#{f}']" }
|
68
68
|
else
|
69
69
|
data = query_all_scheduled_plans("all",@options[:fields])
|
70
70
|
fields = field_names(@options[:fields])
|
71
|
-
expressions = fields.collect { |fn|
|
71
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
72
72
|
end
|
73
73
|
begin
|
74
74
|
say_ok "No plans found"
|
@@ -79,7 +79,7 @@ module Gzr
|
|
79
79
|
table_hash[:header] = fields unless @options[:plain]
|
80
80
|
table_hash[:rows] = data.map do |row|
|
81
81
|
expressions.collect do |e|
|
82
|
-
eval "row
|
82
|
+
eval "row#{e}"
|
83
83
|
end
|
84
84
|
end
|
85
85
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -38,7 +38,7 @@ module Gzr
|
|
38
38
|
def execute(input: $stdin, output: $stdout)
|
39
39
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
40
40
|
with_session do
|
41
|
-
plan = query_scheduled_plan(@plan_id)
|
41
|
+
plan = query_scheduled_plan(@plan_id)
|
42
42
|
# The api call scheduled_plan_run_once is an odd duck. It accepts
|
43
43
|
# the output of any of the calls to retrieve a scheduled plan
|
44
44
|
# even though many of the attributes passed are marked read-only.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -61,7 +61,7 @@ $ gzr session logout --token_file --host looker.example.com
|
|
61
61
|
|
62
62
|
if @options[:all]
|
63
63
|
say_warning "querying all_git_branches(#{@project_id})" if @options[:debug]
|
64
|
-
data += all_git_branches(@project_id).select{ |e| e
|
64
|
+
data += all_git_branches(@project_id).select{ |e| e[:name] != data[0][:name] }
|
65
65
|
end
|
66
66
|
begin
|
67
67
|
say_ok "No branches found"
|
@@ -71,10 +71,10 @@ $ gzr session logout --token_file --host looker.example.com
|
|
71
71
|
table_hash = Hash.new
|
72
72
|
fields = field_names(@options[:fields])
|
73
73
|
table_hash[:header] = fields unless @options[:plain]
|
74
|
-
expressions = fields.collect { |fn|
|
74
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
75
75
|
table_hash[:rows] = data.map do |row|
|
76
76
|
expressions.collect do |e|
|
77
|
-
eval "row
|
77
|
+
eval "row#{e}"
|
78
78
|
end
|
79
79
|
end
|
80
80
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
eval "row
|
54
|
+
eval "row#{e}"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
table = TTY::Table.new(table_hash)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -40,7 +40,7 @@ module Gzr
|
|
40
40
|
def execute(input: $stdin, output: $stdout)
|
41
41
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
42
42
|
with_session do
|
43
|
-
data = query_role(@role_id)
|
43
|
+
data = query_role(@role_id)
|
44
44
|
data = trim_role(data) if @options[:trim]
|
45
45
|
write_file(@options[:dir] ? "Role_#{data[:id]}_#{data[:name]}.json" : nil, @options[:dir], nil, output) do |f|
|
46
46
|
f.puts JSON.pretty_generate(data)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -40,7 +40,7 @@ module Gzr
|
|
40
40
|
say_warning(@options) if @options[:debug]
|
41
41
|
|
42
42
|
with_session do
|
43
|
-
groups = query_role_groups(@role_id, 'id').collect { |g| g
|
43
|
+
groups = query_role_groups(@role_id, 'id').collect { |g| g[:id] }
|
44
44
|
groups += @groups
|
45
45
|
set_role_groups(@role_id,groups.uniq)
|
46
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
v = eval "row
|
54
|
+
v = eval "row#{e}"
|
55
55
|
next (v.join "\n") if v.kind_of? Array
|
56
56
|
v
|
57
57
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -40,7 +40,7 @@ module Gzr
|
|
40
40
|
say_warning(@options) if @options[:debug]
|
41
41
|
|
42
42
|
with_session do
|
43
|
-
groups = query_role_groups(@role_id, 'id').collect { |g| g
|
43
|
+
groups = query_role_groups(@role_id, 'id').collect { |g| g[:id] }
|
44
44
|
groups -= @groups
|
45
45
|
set_role_groups(@role_id,groups.uniq)
|
46
46
|
end
|
data/lib/gzr/commands/role/ls.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -47,10 +47,10 @@ module Gzr
|
|
47
47
|
table_hash = Hash.new
|
48
48
|
fields = field_names(@options[:fields])
|
49
49
|
table_hash[:header] = fields unless @options[:plain]
|
50
|
-
expressions = fields.collect { |fn|
|
50
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
51
51
|
table_hash[:rows] = data.map do |row|
|
52
52
|
expressions.collect do |e|
|
53
|
-
v = eval "row
|
53
|
+
v = eval "row#{e}"
|
54
54
|
next (v.join "\n") if v.kind_of? Array
|
55
55
|
v
|
56
56
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -40,7 +40,7 @@ module Gzr
|
|
40
40
|
say_warning(@options) if @options[:debug]
|
41
41
|
|
42
42
|
with_session do
|
43
|
-
users = query_role_users(@role_id, 'id').collect { |u| u
|
43
|
+
users = query_role_users(@role_id, 'id').collect { |u| u[:id] }
|
44
44
|
users += @users
|
45
45
|
set_role_users(@role_id,users.uniq)
|
46
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -48,10 +48,10 @@ module Gzr
|
|
48
48
|
table_hash = Hash.new
|
49
49
|
fields = field_names(@options[:fields])
|
50
50
|
table_hash[:header] = fields unless @options[:plain]
|
51
|
-
expressions = fields.collect { |fn|
|
51
|
+
expressions = fields.collect { |fn| field_expression_hash(fn) }
|
52
52
|
table_hash[:rows] = data.map do |row|
|
53
53
|
expressions.collect do |e|
|
54
|
-
v = eval "row
|
54
|
+
v = eval "row#{e}"
|
55
55
|
next (v.join "\n") if v.kind_of? Array
|
56
56
|
v
|
57
57
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
4
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -40,7 +40,7 @@ module Gzr
|
|
40
40
|
say_warning(@options) if @options[:debug]
|
41
41
|
|
42
42
|
with_session do
|
43
|
-
users = query_role_users(@role_id, 'id').collect { |u| u
|
43
|
+
users = query_role_users(@role_id, 'id').collect { |u| u[:id] }
|
44
44
|
users -= @users
|
45
45
|
set_role_users(@role_id,users.uniq)
|
46
46
|
end
|