class ThreeScaleToolbox::Commands::ProxyConfigCommand::Show::ShowSubcommand
Public Class Methods
command()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 8 def self.command Cri::Command.define do name 'show' usage 'show <remote> <service> <environment>' summary 'Show Proxy Configuration' description 'Show a Proxy Configuration' param :remote param :service_ref param :environment ThreeScaleToolbox::CLI.output_flag(self) option nil, :'config-version', "Specify the Proxy Configuration version. If not specified it gets the latest version", default: 'latest', argument: :required runner ShowSubcommand end end
Public Instance Methods
run()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 26 def run printer.print_record proxy_config.attrs end
Private Instance Methods
find_service()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 68 def find_service Entities::Service.find(remote: remote, ref: service_ref).tap do |svc| raise ThreeScaleToolbox::Error, "Service #{service_ref} does not exist" if svc.nil? end end
printer()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 78 def printer options.fetch(:output, CLI::JsonPrinter.new) end
proxy_config()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 32 def proxy_config if proxy_config_version_option == 'latest' proxy_config_latest else proxy_config_version end end
proxy_config_environment()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 60 def proxy_config_environment arguments[:environment] end
proxy_config_latest()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 46 def proxy_config_latest Entities::ProxyConfig.find_latest(service: service, environment: proxy_config_environment).tap do |pc| raise ThreeScaleToolbox::Error, "ProxyConfig #{proxy_config_environment} in service #{service.id} does not exist" if pc.nil? end end
proxy_config_version()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 40 def proxy_config_version Entities::ProxyConfig.find(service: service, environment: proxy_config_environment, version: proxy_config_version_option).tap do |pc| raise ThreeScaleToolbox::Error, "ProxyConfig #{proxy_config_environment} in service #{service.id} does not exist" if pc.nil? end end
proxy_config_version_option()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 56 def proxy_config_version_option options[:'config-version'] end
remote()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 52 def remote @remote ||= threescale_client(arguments[:remote]) end
service()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 74 def service @service ||= find_service end
service_ref()
click to toggle source
# File lib/3scale_toolbox/commands/proxy_config_command/show_command.rb, line 64 def service_ref arguments[:service_ref] end