Sha256: 2db1f369fb17c28f6ba46899d727a6a795b15059cc157a1bd656e98494ab8443

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require "json"

module Neetob
  class CLI
    module NeetoDeploy
      class Certificates < CLI::Base
        attr_accessor :app

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

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

          parsed_certificates_result = JSON.parse(parseable_result)
          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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neetob-0.5.16 lib/neetob/cli/neeto_deploy/certificates.rb
neetob-0.5.15 lib/neetob/cli/neeto_deploy/certificates.rb
neetob-0.5.14 lib/neetob/cli/neeto_deploy/certificates.rb
neetob-0.5.13 lib/neetob/cli/neeto_deploy/certificates.rb