Class: ThreeScaleToolbox::Commands::PlansCommand::Import::ImportMetricLimitsStep
- Inherits:
-
Object
- Object
- ThreeScaleToolbox::Commands::PlansCommand::Import::ImportMetricLimitsStep
- Includes:
- Step
- Defined in:
- lib/3scale_toolbox/commands/plans_command/import/import_plan_limits_step.rb
Instance Attribute Summary
Attributes included from Step
Instance Method Summary collapse
-
#call ⇒ Object
Writes Plan limits.
Methods included from Step
#artifacts_resource, #file, #find_feature_by_system_name, #find_metric_by_system_name, #initialize, #plan, #plan_system_name, #resource_features, #resource_limits, #resource_methods, #resource_metrics, #resource_plan, #resource_pricing_rules, #result, #service, #service_features, #service_metrics_and_methods, #service_system_name, #threescale_client
Instance Method Details
#call ⇒ Object
Writes Plan limits
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/3scale_toolbox/commands/plans_command/import/import_plan_limits_step.rb', line 9 def call # SET semantics # First, delete existing limits # Second, add new limits plan.limits.each do |limit| limit.delete() puts "Deleted existing plan limit: [metric: #{limit.metric_id}, #{limit.attrs}]" end resource_limits_processed.each do |limit_attrs| metric_id = limit_attrs.delete('metric_id') plan.create_limit(metric_id, limit_attrs) puts "Created plan limit: [metric: #{metric_id}, #{limit_attrs}]" end end |