3scale_toolbox 0.19.2 → 0.19.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/3scale_toolbox/commands/import_command/openapi/update_policies_step.rb +23 -10
- data/lib/3scale_toolbox/commands/plans_command/export_command.rb +52 -29
- data/lib/3scale_toolbox/commands/plans_command/import/import_backend_metrics_step.rb +37 -0
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_limits_step.rb +11 -2
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb +2 -2
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_pricing_rules_step.rb +12 -1
- data/lib/3scale_toolbox/commands/plans_command/import/step.rb +23 -8
- data/lib/3scale_toolbox/commands/plans_command/import/validate_plan_step.rb +126 -0
- data/lib/3scale_toolbox/commands/plans_command/import_command.rb +5 -1
- data/lib/3scale_toolbox/crds/limit_dump.rb +1 -1
- data/lib/3scale_toolbox/crds/pricing_rule_dump.rb +1 -1
- data/lib/3scale_toolbox/entities/application_plan.rb +64 -0
- data/lib/3scale_toolbox/entities/backend.rb +4 -0
- data/lib/3scale_toolbox/entities/backend_method.rb +16 -0
- data/lib/3scale_toolbox/entities/backend_metric.rb +16 -0
- data/lib/3scale_toolbox/entities/limit.rb +52 -7
- data/lib/3scale_toolbox/entities/method.rb +11 -0
- data/lib/3scale_toolbox/entities/metric.rb +12 -0
- data/lib/3scale_toolbox/entities/pricing_rule.rb +52 -7
- data/lib/3scale_toolbox/entities/service.rb +4 -0
- data/lib/3scale_toolbox/remote_cache.rb +42 -1
- data/lib/3scale_toolbox/version.rb +1 -1
- data/licenses.xml +4 -4
- metadata +4 -10
- data/lib/3scale_toolbox/commands/plans_command/export/read_app_plan_step.rb +0 -16
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_features_step.rb +0 -16
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_limits_step.rb +0 -19
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb +0 -47
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_metrics_step.rb +0 -47
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_pricing_rules_step.rb +0 -19
- data/lib/3scale_toolbox/commands/plans_command/export/step.rb +0 -85
- data/lib/3scale_toolbox/commands/plans_command/export/write_artifacts_file_step.rb +0 -84
@@ -1,84 +0,0 @@
|
|
1
|
-
module ThreeScaleToolbox
|
2
|
-
module Commands
|
3
|
-
module PlansCommand
|
4
|
-
module Export
|
5
|
-
class WriteArtifactsStep
|
6
|
-
include Step
|
7
|
-
##
|
8
|
-
# Serialization of Application Plan objects
|
9
|
-
def call
|
10
|
-
select_output do |output|
|
11
|
-
output.write(serialized_object.to_yaml)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def select_output
|
18
|
-
ios = if file
|
19
|
-
File.open(file, 'w')
|
20
|
-
else
|
21
|
-
$stdout
|
22
|
-
end
|
23
|
-
begin
|
24
|
-
yield(ios)
|
25
|
-
ensure
|
26
|
-
ios.close
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def serialized_object
|
31
|
-
{
|
32
|
-
'plan' => serialized_plan,
|
33
|
-
'limits' => serialized_limits,
|
34
|
-
'pricingrules' => serialized_pricing_rules,
|
35
|
-
'plan_features' => serialized_plan_features,
|
36
|
-
'metrics' => serialized_metrics,
|
37
|
-
'methods' => serialized_methods,
|
38
|
-
'created_at' => Time.now.utc.iso8601,
|
39
|
-
'toolbox_version' => ThreeScaleToolbox::VERSION
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
def serialized_plan
|
44
|
-
result[:plan].reject { |key, _| APP_PLANS_BLACKLIST.include? key }
|
45
|
-
end
|
46
|
-
|
47
|
-
def serialized_limits
|
48
|
-
result[:limits].map do |limit|
|
49
|
-
metric = limit.delete('metric')
|
50
|
-
limit['metric_system_name'] = metric['system_name']
|
51
|
-
limit.reject { |key, _| LIMITS_BLACKLIST.include? key }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def serialized_pricing_rules
|
56
|
-
result[:pricingrules].map do |pr|
|
57
|
-
metric = pr.delete('metric')
|
58
|
-
pr['metric_system_name'] = metric['system_name']
|
59
|
-
pr.reject { |key, _| PRICINGRULES_BLACKLIST.include? key }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def serialized_plan_features
|
64
|
-
result[:plan_features].map do |pr|
|
65
|
-
pr.reject { |key, _| PLAN_FEATURE_BLACKLIST.include? key }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def serialized_metrics
|
70
|
-
result[:plan_metrics].values.map do |metric|
|
71
|
-
metric.reject { |key, _| METRIC_BLACKLIST.include? key }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def serialized_methods
|
76
|
-
result[:plan_methods].values.map do |method|
|
77
|
-
method.reject { |key, _| METRIC_BLACKLIST.include? key }
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|