Class: ThreeScaleToolbox::Commands::ServiceCommand::CopySubcommand
- Inherits:
-
Cri::CommandRunner
- Object
- Cri::CommandRunner
- ThreeScaleToolbox::Commands::ServiceCommand::CopySubcommand
- Includes:
- ThreeScaleToolbox::Command
- Defined in:
- lib/3scale_toolbox/commands/service_command/copy_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ThreeScaleToolbox::Command
#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl
Class Method Details
.command ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/3scale_toolbox/commands/service_command/copy_command.rb', line 21 def self.command Cri::Command.define do name 'copy' usage 'copy [opts] -s <src> -d <dst> <source-service>' summary 'Copy service' description <<-HEREDOC This command makes a copy of the referenced service. Target service will be searched by source service system name. System name can be overriden with `--target_system_name` option. If a service with the selected `system_name` is not found, it will be created. \n Components of the service being copied: \nservice settings \nproxy settings \npricing rules \nactivedocs \nmetrics \nmethods \napplication plans \nmapping rules HEREDOC option :s, :source, '3scale source instance. Url or remote name', argument: :required option :d, :destination, '3scale target instance. Url or remote name', argument: :required option :t, 'target_system_name', 'Target system name. Default to source system name', argument: :required flag :f, :force, 'Overwrites the mapping rules by deleting all rules from target service first' flag :r, 'rules-only', 'Only mapping rules are copied' param :source_service runner CopySubcommand end end |
Instance Method Details
#run ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/3scale_toolbox/commands/service_command/copy_command.rb', line 52 def run tasks = [] unless option_rules_only tasks << CopyCommand::CreateOrUpdateTargetServiceTask.new(context) tasks << CopyCommand::CopyServiceProxyTask.new(context) tasks << CopyCommand::CopyMethodsTask.new(context) tasks << CopyCommand::CopyMetricsTask.new(context) tasks << CopyCommand::CopyApplicationPlansTask.new(context) tasks << CopyCommand::CopyLimitsTask.new(context) tasks << CopyCommand::CopyPoliciesTask.new(context) tasks << CopyCommand::CopyPricingRulesTask.new(context) tasks << CopyCommand::CopyActiveDocsTask.new(context) end tasks << CopyCommand::DestroyMappingRulesTask.new(context) tasks << CopyCommand::CopyMappingRulesTask.new(context) tasks.each(&:call) # This should be the last step CopyCommand::BumpProxyVersionTask.new(service: context[:target]).call end |