Class: Smartdc::Cli::Analytic
Instance Method Summary
collapse
#describe, #horizontal, #output, #use_machine, #vertical
Instance Method Details
#add ⇒ Object
42
43
44
45
|
# File 'lib/smartdc/cli/analytic.rb', line 42
def add
body = {module: options[:module], stat: options[:stat]}
output Smartdc.create_analytic(body), options.merge(table: :vertical, exclude: %i[uris])
end
|
#desc ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/smartdc/cli/analytic.rb', line 9
def desc
if options['raw']
puts Smartdc.describe_analytics.body
else
content = Smartdc.describe_analytics.content
describe('modules', content, options.merge(cols: %w[key label]))
describe('fields', content, options.merge(cols: %w[key label type]))
describe('types', content, options.merge(cols: %w[key name arity unit abbr base power]))
describe('metrics', content, options.merge(cols: :all, exclude: %i[fields]))
describe('transformations', content, options.merge(cols: %w[key label]))
end
end
|
#destroy(id) ⇒ Object
48
49
50
|
# File 'lib/smartdc/cli/analytic.rb', line 48
def destroy(id)
output Smartdc.destroy_analytic(id), options.merge(message: "Analytic #{id} destroy.")
end
|
#list ⇒ Object
23
24
25
26
27
|
# File 'lib/smartdc/cli/analytic.rb', line 23
def list
output Smartdc.analytics, options.merge(table: :horizontal, include: %i[
id module stat decomposition
])
end
|
#show(id) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/smartdc/cli/analytic.rb', line 31
def show(id)
if options[:value]
output Smartdc.value_analytic(id), options.merge({table: :vertical})
else
output Smartdc.analytic(id), options.merge(table: :vertical, exclude: %i[uris])
end
end
|