Class: ThreeScaleToolbox::Commands::BackendCommand::CopyCommand::CopyMappingRulesTask
- Inherits:
-
Object
- Object
- ThreeScaleToolbox::Commands::BackendCommand::CopyCommand::CopyMappingRulesTask
- Includes:
- Task
- Defined in:
- lib/3scale_toolbox/commands/backend_command/copy_command/copy_mapping_rules_task.rb
Instance Attribute Summary
Attributes included from Task
Instance Method Summary collapse
-
#run ⇒ Object
entrypoint.
Methods included from Task
#call, #initialize, #invalidate_target_methods, #invalidate_target_metrics, #option_target_system_name, #source_backend, #source_backend_ref, #source_hits, #source_methods, #source_metrics, #source_remote, #target_backend, #target_backend=, #target_hits, #target_methods, #target_metrics, #target_remote
Instance Method Details
#run ⇒ Object
entrypoint
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/copy_mapping_rules_task.rb', line 9 def run missing_rules = missing_mapping_rules(source_backend.mapping_rules, target_backend.mapping_rules, metrics_map) missing_rules.each do |mapping_rule| mapping_rule.metric_id = metrics_map.fetch(mapping_rule.metric_id) Entities::BackendMappingRule.create(backend: target_backend, attrs: mapping_rule.attrs) end puts "created #{missing_rules.size} mapping rules" end |