Sha256: 7092b6fad795f220c52d949aee520393139c1f7ac04cc44cc2fe185ad679a84f
Contents?: true
Size: 1.95 KB
Versions: 3
Compression:
Stored size: 1.95 KB
Contents
module ThreeScaleToolbox module Commands module PlansCommand module Show class ShowSubcommand < Cri::CommandRunner include ThreeScaleToolbox::Command FIELDS_TO_SHOW = %w[id name system_name approval_required end_user_required cost_per_month setup_fee trial_period_days].freeze def self.command Cri::Command.define do name 'show' usage 'show [opts] <remote> <service> <plan>' summary 'show application plan' description 'show application plan' ThreeScaleToolbox::CLI.output_flag(self) param :remote param :service_ref param :plan_ref runner ShowSubcommand end end def run printer.print_record plan.attrs end private def service @service ||= find_service end def plan @plan ||= find_plan end 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 def find_plan Entities::ApplicationPlan.find(service: service, ref: plan_ref).tap do |p| raise ThreeScaleToolbox::Error, "Application plan #{plan_ref} does not exist" if p.nil? end end def remote @remote ||= threescale_client(arguments[:remote]) end def service_ref arguments[:service_ref] end def plan_ref arguments[:plan_ref] end def printer options.fetch(:output, CLI::CustomTablePrinter.new(FIELDS_TO_SHOW)) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems