Class: ThreeScaleToolbox::Commands::PlansCommand::Import::ImportSubcommand

Inherits:
Cri::CommandRunner
  • Object
show all
Includes:
ThreeScaleToolbox::Command, ResourceReader
Defined in:
lib/3scale_toolbox/commands/plans_command/import_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ResourceReader

#load_resource, #read_content, #read_file, #read_stdin, #read_url

Methods included from ThreeScaleToolbox::Command

#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl

Class Method Details

.commandObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/3scale_toolbox/commands/plans_command/import_command.rb', line 16

def self.command
  Cri::Command.define do
    name        'import'
    usage       'import [opts] <remote> <service_system_name>'
    summary     'import application plan'
    description 'Import application plan, limits, pricing rules and features'

    option      :f, :file, 'Read from file or url instead of stdin', argument: :required
    option      :p, :plan, 'Override application plan reference', argument: :required
    param       :remote
    param       :service_system_name

    runner ImportSubcommand
  end
end

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/3scale_toolbox/commands/plans_command/import_command.rb', line 32

def run
  tasks = []
  tasks << CreateOrUpdateAppPlanStep.new(context)
  tasks << ImportMetricsStep.new(context)
  tasks << ImportMetricLimitsStep.new(context)
  tasks << ImportPricingRulesStep.new(context)
  tasks << ImportPlanFeaturesStep.new(context)

  # run tasks
  tasks.each(&:call)
end