Class: Neetob::CLI::NeetoDeploy::Certificates

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/neeto_deploy/certificates.rb

Constant Summary

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary collapse

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initialize(app) ⇒ Certificates



11
12
13
14
# File 'lib/neetob/cli/neeto_deploy/certificates.rb', line 11

def initialize(app)
  super()
  @app = app
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



9
10
11
# File 'lib/neetob/cli/neeto_deploy/certificates.rb', line 9

def app
  @app
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/neetob/cli/neeto_deploy/certificates.rb', line 16

def run
  certificates_command_result = `neetodeploy certificates list -a #{app}`
  parseable_result = certificates_command_result.strip.gsub("=>", ":")

  parsed_certificates_result = JSON.parse(parseable_result)

  return parsed_certificates_result if Thread.current[:audit_mode]

  if parsed_certificates_result.empty?
    ui.error("No certificates found for the app with name \"#{app}\".")
  else
    parsed_certificates_result.each do |certificate|
      if certificate["expires_before_30_days"]
        ui.error("Certificate #{certificate["name"]} is expiring in less than 30 days.")
      else
        ui.success("Certificate #{certificate["name"]} is valid for over 30 days in the future.")
      end
    end
  end
end