Module: Aptible::CLI::Subcommands::Environment

Included in:
Agent
Defined in:
lib/aptible/cli/subcommands/environment.rb

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/aptible/cli/subcommands/environment.rb', line 5

def self.included(thor)
  thor.class_eval do
    include Helpers::Environment
    include Helpers::Token

    desc 'environment:list', 'List all environments'
    option :environment
    define_method 'environment:list' do
      Formatter.render(Renderer.current) do |root|
        root.keyed_list(
          'handle'
        ) do |node|
          scoped_environments(options).each do ||
            node.object do |n|
              ResourceFormatter.(n, )
            end
          end
        end
      end
    end

    desc 'environment:ca_cert',
         'Retrieve the CA certificate associated with the environment'
    option :environment
    define_method 'environment:ca_cert' do
      Formatter.render(Renderer.current) do |root|
        root.grouped_keyed_list(
          'handle',
          'ca_body'
        ) do |node|
          scoped_environments(options).each do ||
            node.object do |n|
              n.value('ca_body', .ca_body)
              ResourceFormatter.(n, )
            end
          end
        end
      end
    end
  end
end