Class: ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::CopyLimitsTask
- Inherits:
-
Object
- Object
- ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::CopyLimitsTask
- Includes:
- Task
- Defined in:
- lib/3scale_toolbox/commands/service_command/copy_command/copy_limits_task.rb
Instance Attribute Summary
Attributes included from Task
Instance Method Summary collapse
Methods included from Task
#activedocs_report, #delete_mapping_rules, #find_source_service, #force_delete_mapping_rules, #initialize, #logger, #option_target_system_name, #plans_report, #report, #source, #source_metrics_and_methods, #source_remote, #source_service_ref, #target, #target=, #target_metrics_and_methods, #target_remote
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/3scale_toolbox/commands/service_command/copy_command/copy_limits_task.rb', line 8 def call plan_mapping = Helper.application_plan_mapping(source.plans, target.plans) plan_mapping.each do |source_plan, target_plan| missing_limits = compute_missing_limits(source_plan.limits, target_plan.limits) missing_limits.each do |limit| target_plan.create_limit(metrics_map.fetch(limit.metric_id), limit.attrs) end logger.info "Missing #{missing_limits.size} plan limits from target application plan " \ "#{target_plan.id}. Source plan #{source_plan.id}" plans_report[target_plan.system_name] = {'application_plan_id' => target_plan.id} unless plans_report.has_key? target_plan.system_name plans_report[target_plan.system_name].merge!({'missing_limits_created' => missing_limits.size}) end end |