3scale_toolbox 0.15.0 → 0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/3scale_toolbox.gemspec +2 -2
- data/README.md +15 -9
- data/lib/3scale_toolbox.rb +3 -1
- data/lib/3scale_toolbox/3scale_client_factory.rb +3 -4
- data/lib/3scale_toolbox/cli.rb +4 -0
- data/lib/3scale_toolbox/cli/custom_table_printer.rb +32 -0
- data/lib/3scale_toolbox/cli/error_handler.rb +17 -14
- data/lib/3scale_toolbox/cli/json_printer.rb +13 -0
- data/lib/3scale_toolbox/cli/output_flag.rb +20 -0
- data/lib/3scale_toolbox/cli/yaml_printer.rb +13 -0
- data/lib/3scale_toolbox/commands.rb +7 -1
- data/lib/3scale_toolbox/commands/activedocs_command/apply_command.rb +33 -10
- data/lib/3scale_toolbox/commands/activedocs_command/create_command.rb +22 -7
- data/lib/3scale_toolbox/commands/activedocs_command/list_command.rb +10 -17
- data/lib/3scale_toolbox/commands/application_command/apply_command.rb +27 -4
- data/lib/3scale_toolbox/commands/application_command/create_command.rb +16 -1
- data/lib/3scale_toolbox/commands/application_command/list_command.rb +10 -13
- data/lib/3scale_toolbox/commands/application_command/show_command.rb +8 -14
- data/lib/3scale_toolbox/commands/backend_command.rb +22 -0
- data/lib/3scale_toolbox/commands/backend_command/copy_command.rb +65 -0
- data/lib/3scale_toolbox/commands/backend_command/copy_command/copy_mapping_rules_task.rb +36 -0
- data/lib/3scale_toolbox/commands/backend_command/copy_command/copy_methods_task.rb +35 -0
- data/lib/3scale_toolbox/commands/backend_command/copy_command/copy_metrics_task.rb +30 -0
- data/lib/3scale_toolbox/commands/backend_command/copy_command/create_or_update_target_backend_task.rb +46 -0
- data/lib/3scale_toolbox/commands/backend_command/copy_command/task.rb +67 -0
- data/lib/3scale_toolbox/commands/copy_command.rb +2 -2
- data/lib/3scale_toolbox/commands/copy_command/service_command.rb +40 -0
- data/lib/3scale_toolbox/commands/import_command/issuer_type_transformer.rb +16 -0
- data/lib/3scale_toolbox/commands/import_command/openapi.rb +6 -2
- data/lib/3scale_toolbox/commands/import_command/openapi/create_mapping_rule_step.rb +2 -1
- data/lib/3scale_toolbox/commands/import_command/openapi/create_method_step.rb +5 -14
- data/lib/3scale_toolbox/commands/import_command/openapi/step.rb +4 -0
- data/lib/3scale_toolbox/commands/import_command/openapi/update_service_proxy_step.rb +1 -0
- data/lib/3scale_toolbox/commands/methods_command/apply_command.rb +28 -8
- data/lib/3scale_toolbox/commands/methods_command/create_command.rb +23 -3
- data/lib/3scale_toolbox/commands/methods_command/delete_command.rb +1 -1
- data/lib/3scale_toolbox/commands/methods_command/list_command.rb +7 -13
- data/lib/3scale_toolbox/commands/metrics_command/apply_command.rb +26 -4
- data/lib/3scale_toolbox/commands/metrics_command/create_command.rb +23 -1
- data/lib/3scale_toolbox/commands/metrics_command/list_command.rb +7 -12
- data/lib/3scale_toolbox/commands/plans_command/apply_command.rb +36 -7
- data/lib/3scale_toolbox/commands/plans_command/create_command.rb +23 -1
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_limits_step.rb +1 -1
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_methods_step.rb +2 -2
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_metrics_step.rb +2 -2
- data/lib/3scale_toolbox/commands/plans_command/export/read_plan_pricing_rules_step.rb +1 -2
- data/lib/3scale_toolbox/commands/plans_command/export/step.rb +8 -20
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_limits_step.rb +12 -14
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb +6 -13
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_pricing_rules_step.rb +12 -20
- data/lib/3scale_toolbox/commands/plans_command/import/step.rb +2 -22
- data/lib/3scale_toolbox/commands/plans_command/list_command.rb +8 -13
- data/lib/3scale_toolbox/commands/plans_command/show_command.rb +7 -15
- data/lib/3scale_toolbox/commands/policies_command.rb +24 -0
- data/lib/3scale_toolbox/commands/policies_command/export_command.rb +98 -0
- data/lib/3scale_toolbox/commands/policies_command/import_command.rb +61 -0
- data/lib/3scale_toolbox/commands/product_command.rb +26 -0
- data/lib/3scale_toolbox/commands/product_command/copy_command.rb +82 -0
- data/lib/3scale_toolbox/commands/product_command/copy_command/copy_backends_task.rb +88 -0
- data/lib/3scale_toolbox/commands/product_command/copy_command/delete_target_backend_usages_task.rb +48 -0
- data/lib/3scale_toolbox/commands/product_command/export_command.rb +81 -0
- data/lib/3scale_toolbox/commands/product_command/import_command.rb +125 -0
- data/lib/3scale_toolbox/commands/proxy_config_command.rb +5 -0
- data/lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb +54 -0
- data/lib/3scale_toolbox/commands/proxy_config_command/export_command.rb +74 -0
- data/lib/3scale_toolbox/commands/proxy_config_command/helper.rb +15 -0
- data/lib/3scale_toolbox/commands/proxy_config_command/list_command.rb +13 -29
- data/lib/3scale_toolbox/commands/proxy_config_command/show_command.rb +20 -23
- data/lib/3scale_toolbox/commands/service_command.rb +7 -5
- data/lib/3scale_toolbox/commands/service_command/apply_command.rb +69 -58
- data/lib/3scale_toolbox/commands/service_command/copy_command.rb +95 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/bump_proxy_version_task.rb +36 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_activedocs_task.rb +49 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_app_plans_task.rb +35 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_limits_task.rb +38 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_mapping_rules_task.rb +35 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_methods_task.rb +37 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_metrics_task.rb +37 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_policies_task.rb +17 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_pricingrules_task.rb +41 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb +32 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/create_or_update_service_task.rb +49 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/destroy_mapping_rules_task.rb +38 -0
- data/lib/3scale_toolbox/commands/service_command/copy_command/task.rb +85 -0
- data/lib/3scale_toolbox/commands/service_command/create_command.rb +58 -44
- data/lib/3scale_toolbox/commands/service_command/delete_command.rb +31 -33
- data/lib/3scale_toolbox/commands/service_command/list_command.rb +24 -34
- data/lib/3scale_toolbox/commands/service_command/show_command.rb +39 -44
- data/lib/3scale_toolbox/commands/update_command.rb +3 -3
- data/lib/3scale_toolbox/commands/update_command/{update_service.rb → service_command.rb} +22 -18
- data/lib/3scale_toolbox/commands/update_command/service_command/copy_service_settings_task.rb +35 -0
- data/lib/3scale_toolbox/commands/update_command/service_command/delete_activedocs_task.rb +24 -0
- data/lib/3scale_toolbox/crds.rb +16 -0
- data/lib/3scale_toolbox/crds/application_plan_dump.rb +19 -0
- data/lib/3scale_toolbox/crds/backend_dump.rb +39 -0
- data/lib/3scale_toolbox/crds/backend_mapping_rule_dump.rb +26 -0
- data/lib/3scale_toolbox/crds/backend_method_dump.rb +12 -0
- data/lib/3scale_toolbox/crds/backend_metric_dump.rb +13 -0
- data/lib/3scale_toolbox/crds/backend_parser.rb +55 -0
- data/lib/3scale_toolbox/crds/backend_usage_dump.rb +11 -0
- data/lib/3scale_toolbox/crds/limit_dump.rb +37 -0
- data/lib/3scale_toolbox/crds/mapping_rule_dump.rb +26 -0
- data/lib/3scale_toolbox/crds/method_dump.rb +12 -0
- data/lib/3scale_toolbox/crds/metric_dump.rb +13 -0
- data/lib/3scale_toolbox/crds/pricing_rule_dump.rb +38 -0
- data/lib/3scale_toolbox/crds/product_deployment_parser.rb +329 -0
- data/lib/3scale_toolbox/crds/product_dump.rb +157 -0
- data/lib/3scale_toolbox/crds/product_parser.rb +114 -0
- data/lib/3scale_toolbox/crds/remote.rb +682 -0
- data/lib/3scale_toolbox/entities.rb +8 -0
- data/lib/3scale_toolbox/entities/activedocs.rb +12 -0
- data/lib/3scale_toolbox/entities/application_plan.rb +74 -39
- data/lib/3scale_toolbox/entities/backend.rb +187 -0
- data/lib/3scale_toolbox/entities/backend_mapping_rule.rb +102 -0
- data/lib/3scale_toolbox/entities/backend_method.rb +99 -0
- data/lib/3scale_toolbox/entities/backend_metric.rb +98 -0
- data/lib/3scale_toolbox/entities/backend_usage.rb +105 -0
- data/lib/3scale_toolbox/entities/limit.rb +71 -0
- data/lib/3scale_toolbox/entities/mapping_rule.rb +90 -0
- data/lib/3scale_toolbox/entities/method.rb +33 -19
- data/lib/3scale_toolbox/entities/metric.rb +29 -18
- data/lib/3scale_toolbox/entities/pricing_rule.rb +63 -0
- data/lib/3scale_toolbox/entities/proxy_config.rb +0 -1
- data/lib/3scale_toolbox/entities/service.rb +166 -48
- data/lib/3scale_toolbox/error.rb +53 -0
- data/lib/3scale_toolbox/helper.rb +17 -0
- data/lib/3scale_toolbox/openapi/oas3.rb +1 -1
- data/lib/3scale_toolbox/proxy_logger.rb +5 -1
- data/lib/3scale_toolbox/remote_cache.rb +157 -0
- data/lib/3scale_toolbox/remotes.rb +2 -2
- data/lib/3scale_toolbox/version.rb +1 -1
- data/licenses.xml +113 -45
- metadata +75 -26
- data/lib/3scale_toolbox/commands/copy_command/copy_service.rb +0 -144
- data/lib/3scale_toolbox/tasks.rb +0 -15
- data/lib/3scale_toolbox/tasks/bump_proxy_version_task.rb +0 -32
- data/lib/3scale_toolbox/tasks/copy_activedocs_task.rb +0 -42
- data/lib/3scale_toolbox/tasks/copy_app_plans_task.rb +0 -31
- data/lib/3scale_toolbox/tasks/copy_limits_task.rb +0 -36
- data/lib/3scale_toolbox/tasks/copy_mapping_rules_task.rb +0 -32
- data/lib/3scale_toolbox/tasks/copy_methods_task.rb +0 -36
- data/lib/3scale_toolbox/tasks/copy_metrics_task.rb +0 -33
- data/lib/3scale_toolbox/tasks/copy_policies_task.rb +0 -13
- data/lib/3scale_toolbox/tasks/copy_pricingrules_task.rb +0 -41
- data/lib/3scale_toolbox/tasks/copy_service_proxy_task.rb +0 -13
- data/lib/3scale_toolbox/tasks/copy_service_settings_task.rb +0 -38
- data/lib/3scale_toolbox/tasks/copy_task.rb +0 -66
- data/lib/3scale_toolbox/tasks/delete_activedocs_task.rb +0 -22
- data/lib/3scale_toolbox/tasks/destroy_mapping_rules_task.rb +0 -22
- data/lib/3scale_toolbox/tasks/helper_task.rb +0 -25
data/lib/3scale_toolbox/error.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
module ThreeScaleToolbox
|
2
2
|
# Generic error. Superclass for all specific errors.
|
3
3
|
class Error < ::StandardError
|
4
|
+
def code
|
5
|
+
'E_3SCALE'
|
6
|
+
end
|
7
|
+
|
8
|
+
def kind
|
9
|
+
self.class
|
10
|
+
end
|
11
|
+
|
12
|
+
def stacktrace
|
13
|
+
# For managed errors, stacktrace should not be necessary
|
14
|
+
nil
|
15
|
+
end
|
4
16
|
end
|
5
17
|
|
6
18
|
class InvalidUrlError < Error
|
19
|
+
def code
|
20
|
+
'E_INVALID_URL'
|
21
|
+
end
|
7
22
|
end
|
8
23
|
|
9
24
|
class ActiveDocsNotFoundError < Error
|
@@ -12,6 +27,10 @@ module ThreeScaleToolbox
|
|
12
27
|
def initialize(id)
|
13
28
|
super("ActiveDocs with ID #{id} not found")
|
14
29
|
end
|
30
|
+
|
31
|
+
def code
|
32
|
+
'E_ACTIVEDOCS_NOT_FOUND'
|
33
|
+
end
|
15
34
|
end
|
16
35
|
|
17
36
|
class ThreeScaleApiError < Error
|
@@ -25,5 +44,39 @@ module ThreeScaleToolbox
|
|
25
44
|
def message
|
26
45
|
"#{super}. Errors: #{apierrors}"
|
27
46
|
end
|
47
|
+
|
48
|
+
def code
|
49
|
+
'E_3SCALE_API'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class InvalidIdError < Error
|
54
|
+
def code
|
55
|
+
'E_INVALID_ID'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class UnexpectedError < ::StandardError
|
60
|
+
attr_reader :unexpectederror
|
61
|
+
|
62
|
+
def initialize(err)
|
63
|
+
@unexpectederror = err
|
64
|
+
end
|
65
|
+
|
66
|
+
def message
|
67
|
+
unexpectederror.message
|
68
|
+
end
|
69
|
+
|
70
|
+
def kind
|
71
|
+
unexpectederror.class
|
72
|
+
end
|
73
|
+
|
74
|
+
def code
|
75
|
+
'E_UNKNOWN'
|
76
|
+
end
|
77
|
+
|
78
|
+
def stacktrace
|
79
|
+
unexpectederror.backtrace
|
80
|
+
end
|
28
81
|
end
|
29
82
|
end
|
@@ -50,6 +50,23 @@ module ThreeScaleToolbox
|
|
50
50
|
def period_already_taken_error?(error)
|
51
51
|
Array(Hash(error)['period']).any? { |msg| msg.match(/has already been taken/) }
|
52
52
|
end
|
53
|
+
|
54
|
+
def application_plan_mapping(source_app_plans, target_app_plans)
|
55
|
+
target_app_plans.map do |target|
|
56
|
+
source = source_app_plans.find { |app_plan| app_plan.system_name == target.system_name }
|
57
|
+
[source, target]
|
58
|
+
end.reject { |key, _| key.nil? }
|
59
|
+
end
|
60
|
+
|
61
|
+
def random_lowercase_name(length=8)
|
62
|
+
[*('a'..'z')].sample(length).join
|
63
|
+
end
|
64
|
+
|
65
|
+
def backend_metric_link_parser(link)
|
66
|
+
return if link.nil?
|
67
|
+
|
68
|
+
link.match(/admin\/api\/backend_apis\/(\d+)\/metrics/) { |m| m.captures[0] }
|
69
|
+
end
|
53
70
|
end
|
54
71
|
|
55
72
|
class BooleanTransformer
|
@@ -9,10 +9,14 @@ module ThreeScaleToolbox
|
|
9
9
|
result = @subject.public_send(name, *args)
|
10
10
|
ensure
|
11
11
|
end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start_time
|
12
|
-
::Kernel.warn "-- call #{name} args |#{args.inspect[0..
|
12
|
+
::Kernel.warn "-- call #{name} args |#{args.inspect[0..2000]}| response |#{result.inspect[0..2000]}| - (#{end_time}s)"
|
13
13
|
result
|
14
14
|
end
|
15
15
|
|
16
|
+
def public_send(name, *args)
|
17
|
+
method_missing(name, *args)
|
18
|
+
end
|
19
|
+
|
16
20
|
def respond_to_missing?(method_name, include_private = false)
|
17
21
|
super
|
18
22
|
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
module ThreeScaleToolbox
|
2
|
+
class RemoteCache < BasicObject
|
3
|
+
|
4
|
+
attr_reader :metrics_cache, :methods_cache, :backend_metrics_cache, :backend_methods_cache, :subject
|
5
|
+
|
6
|
+
def initialize(subject)
|
7
|
+
@subject = subject
|
8
|
+
# Metrics and methods cache data
|
9
|
+
@metrics_cache = {}
|
10
|
+
# methods cache data
|
11
|
+
@methods_cache = {}
|
12
|
+
# Backend Metrics and methods cache data
|
13
|
+
@backend_metrics_cache = {}
|
14
|
+
# Backend methods cache data
|
15
|
+
@backend_methods_cache = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def list_metrics(service_id)
|
19
|
+
return metrics_cache[service_id] if metrics_cache.has_key? service_id
|
20
|
+
|
21
|
+
subject.list_metrics(service_id).tap do |metrics|
|
22
|
+
metrics_cache[service_id] = metrics unless metrics.respond_to?(:has_key?) && !metrics['errors'].nil?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def list_methods(service_id, metric_id)
|
27
|
+
key = method_cache_key(service_id, metric_id)
|
28
|
+
return methods_cache[key] if methods_cache.has_key? key
|
29
|
+
|
30
|
+
subject.list_methods(service_id, metric_id).tap do |methods|
|
31
|
+
methods_cache[key] = methods unless methods.respond_to?(:has_key?) && !methods['errors'].nil?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_metric(service_id, attributes)
|
36
|
+
subject.create_metric(service_id, attributes).tap do |metric_attrs|
|
37
|
+
metrics_cache.delete(service_id) unless metric_attrs.respond_to?(:has_key?) && !metric_attrs['errors'].nil?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def update_metric(service_id, metric_id, attributes)
|
42
|
+
subject.update_metric(service_id, metric_id, attributes).tap do |metric_attrs|
|
43
|
+
metrics_cache.delete(service_id) unless metric_attrs.respond_to?(:has_key?) && !metric_attrs['errors'].nil?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete_metric(service_id, metric_id)
|
48
|
+
subject.delete_metric(service_id, metric_id).tap do |_|
|
49
|
+
metrics_cache.delete(service_id)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def update_method(service_id, parent_id, id, attributes)
|
54
|
+
subject.update_method(service_id, parent_id, id, attributes).tap do |method_attrs|
|
55
|
+
metrics_cache.delete(service_id) unless method_attrs.respond_to?(:has_key?) && !method_attrs['errors'].nil?
|
56
|
+
methods_cache.delete(method_cache_key(service_id, parent_id)) unless method_attrs.respond_to?(:has_key?) && !method_attrs['errors'].nil?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
def create_method(service_id, metric_id, attributes)
|
62
|
+
subject.create_method(service_id, metric_id, attributes).tap do |method_attrs|
|
63
|
+
metrics_cache.delete(service_id) unless method_attrs.respond_to?(:has_key?) && !method_attrs['errors'].nil?
|
64
|
+
methods_cache.delete(method_cache_key(service_id, metric_id)) unless method_attrs.respond_to?(:has_key?) && !method_attrs['errors'].nil?
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def delete_method(service_id, parent_id, id)
|
69
|
+
subject.delete_method(service_id, parent_id, id).tap do |_|
|
70
|
+
metrics_cache.delete(service_id)
|
71
|
+
methods_cache.delete(method_cache_key(service_id, parent_id))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
###
|
76
|
+
# Backends
|
77
|
+
###
|
78
|
+
|
79
|
+
def list_backend_metrics(backend_id)
|
80
|
+
return backend_metrics_cache[backend_id] if backend_metrics_cache.has_key? backend_id
|
81
|
+
|
82
|
+
subject.list_backend_metrics(backend_id).tap do |metrics|
|
83
|
+
backend_metrics_cache[backend_id] = metrics unless metrics.respond_to?(:has_key?) && !metrics['errors'].nil?
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def list_backend_methods(backend_id, metric_id)
|
88
|
+
key = method_cache_key(backend_id, metric_id)
|
89
|
+
return backend_methods_cache[key] if backend_methods_cache.has_key? key
|
90
|
+
|
91
|
+
subject.list_backend_methods(backend_id, metric_id).tap do |methods|
|
92
|
+
backend_methods_cache[key] = methods unless methods.respond_to?(:has_key?) && !methods['errors'].nil?
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_backend_metric(backend_id, attributes)
|
97
|
+
subject.create_backend_metric(backend_id, attributes).tap do |metric_attrs|
|
98
|
+
backend_metrics_cache.delete(backend_id) unless metric_attrs.respond_to?(:has_key?) && !metric_attrs['errors'].nil?
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def update_backend_metric(backend_id, metric_id, attributes)
|
103
|
+
subject.update_backend_metric(backend_id, metric_id, attributes).tap do |metric_attrs|
|
104
|
+
backend_metrics_cache.delete(backend_id) unless metric_attrs.respond_to?(:has_key?) && !metric_attrs['errors'].nil?
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def delete_backend_metric(backend_id, metric_id)
|
109
|
+
subject.delete_backend_metric(backend_id, metric_id).tap do |_|
|
110
|
+
backend_metrics_cache.delete(backend_id)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def create_backend_method(backend_id, metric_id, attributes)
|
115
|
+
subject.create_backend_method(backend_id, metric_id, attributes).tap do |method_attrs|
|
116
|
+
unless method_attrs.respond_to?(:has_key?) && !method_attrs['errors'].nil?
|
117
|
+
backend_metrics_cache.delete(backend_id)
|
118
|
+
backend_methods_cache.delete(method_cache_key(backend_id, metric_id))
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def delete_backend_method(backend_id, metric_id, method_id)
|
124
|
+
subject.delete_backend_method(backend_id, metric_id, method_id).tap do |_|
|
125
|
+
backend_metrics_cache.delete(backend_id)
|
126
|
+
backend_methods_cache.delete(method_cache_key(backend_id, metric_id))
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def update_backend_method(backend_id, metric_id, method_id, attributes)
|
131
|
+
subject.update_backend_method(backend_id, metric_id, method_id, attributes).tap do |method_attrs|
|
132
|
+
unless method_attrs.respond_to?(:has_key?) && !method_attrs['errors'].nil?
|
133
|
+
backend_metrics_cache.delete(backend_id)
|
134
|
+
backend_methods_cache.delete(method_cache_key(backend_id, metric_id))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
###
|
140
|
+
# Generic methods
|
141
|
+
###
|
142
|
+
|
143
|
+
def method_missing(name, *args)
|
144
|
+
subject.public_send(name, *args)
|
145
|
+
end
|
146
|
+
|
147
|
+
def respond_to_missing?(method_name, include_private = false)
|
148
|
+
super
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
def method_cache_key(id, metric_id)
|
154
|
+
"#{id}#{metric_id}"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
@@ -35,14 +35,14 @@ module ThreeScaleToolbox
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def delete(key)
|
38
|
+
def delete(key, &block)
|
39
39
|
value = nil
|
40
40
|
update do |rmts|
|
41
41
|
# block should return rmts
|
42
42
|
# but main method should return deleted value
|
43
43
|
rmts.tap do |r|
|
44
44
|
value = if block_given?
|
45
|
-
r.delete(key, &
|
45
|
+
r.delete(key, &block)
|
46
46
|
else
|
47
47
|
r.delete(key)
|
48
48
|
end
|
data/licenses.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<dependencies>
|
4
4
|
<dependency>
|
5
5
|
<packageName>3scale-api</packageName>
|
6
|
-
<version>
|
6
|
+
<version>1.4.0</version>
|
7
7
|
<licenses>
|
8
8
|
<license>
|
9
9
|
<name>MIT</name>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
</dependency>
|
14
14
|
<dependency>
|
15
15
|
<packageName>3scale_toolbox</packageName>
|
16
|
-
<version>0.
|
16
|
+
<version>0.18.2</version>
|
17
17
|
<licenses>
|
18
18
|
<license>
|
19
19
|
<name>MIT</name>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
</dependency>
|
24
24
|
<dependency>
|
25
25
|
<packageName>activesupport</packageName>
|
26
|
-
<version>6.
|
26
|
+
<version>6.1.3.1</version>
|
27
27
|
<licenses>
|
28
28
|
<license>
|
29
29
|
<name>MIT</name>
|
@@ -53,17 +53,27 @@
|
|
53
53
|
</dependency>
|
54
54
|
<dependency>
|
55
55
|
<packageName>bundler</packageName>
|
56
|
-
<version>1.
|
56
|
+
<version>2.1.4</version>
|
57
57
|
<licenses>
|
58
58
|
<license>
|
59
|
-
<name>
|
60
|
-
<url
|
59
|
+
<name>MIT</name>
|
60
|
+
<url>http://opensource.org/licenses/mit-license</url>
|
61
|
+
</license>
|
62
|
+
</licenses>
|
63
|
+
</dependency>
|
64
|
+
<dependency>
|
65
|
+
<packageName>codecov</packageName>
|
66
|
+
<version>0.5.1</version>
|
67
|
+
<licenses>
|
68
|
+
<license>
|
69
|
+
<name>MIT</name>
|
70
|
+
<url>http://opensource.org/licenses/mit-license</url>
|
61
71
|
</license>
|
62
72
|
</licenses>
|
63
73
|
</dependency>
|
64
74
|
<dependency>
|
65
75
|
<packageName>coderay</packageName>
|
66
|
-
<version>1.1.
|
76
|
+
<version>1.1.3</version>
|
67
77
|
<licenses>
|
68
78
|
<license>
|
69
79
|
<name>MIT</name>
|
@@ -73,7 +83,7 @@
|
|
73
83
|
</dependency>
|
74
84
|
<dependency>
|
75
85
|
<packageName>concurrent-ruby</packageName>
|
76
|
-
<version>1.1.
|
86
|
+
<version>1.1.8</version>
|
77
87
|
<licenses>
|
78
88
|
<license>
|
79
89
|
<name>MIT</name>
|
@@ -83,7 +93,7 @@
|
|
83
93
|
</dependency>
|
84
94
|
<dependency>
|
85
95
|
<packageName>crack</packageName>
|
86
|
-
<version>0.4.
|
96
|
+
<version>0.4.5</version>
|
87
97
|
<licenses>
|
88
98
|
<license>
|
89
99
|
<name>MIT</name>
|
@@ -93,7 +103,7 @@
|
|
93
103
|
</dependency>
|
94
104
|
<dependency>
|
95
105
|
<packageName>cri</packageName>
|
96
|
-
<version>2.15.
|
106
|
+
<version>2.15.11</version>
|
97
107
|
<licenses>
|
98
108
|
<license>
|
99
109
|
<name>MIT</name>
|
@@ -113,7 +123,7 @@
|
|
113
123
|
</dependency>
|
114
124
|
<dependency>
|
115
125
|
<packageName>diff-lcs</packageName>
|
116
|
-
<version>1.
|
126
|
+
<version>1.4.4</version>
|
117
127
|
<licenses>
|
118
128
|
<license>
|
119
129
|
<name>MIT</name>
|
@@ -128,10 +138,20 @@
|
|
128
138
|
<url></url>
|
129
139
|
</license>
|
130
140
|
</licenses>
|
141
|
+
</dependency>
|
142
|
+
<dependency>
|
143
|
+
<packageName>docile</packageName>
|
144
|
+
<version>1.3.5</version>
|
145
|
+
<licenses>
|
146
|
+
<license>
|
147
|
+
<name>MIT</name>
|
148
|
+
<url>http://opensource.org/licenses/mit-license</url>
|
149
|
+
</license>
|
150
|
+
</licenses>
|
131
151
|
</dependency>
|
132
152
|
<dependency>
|
133
153
|
<packageName>dotenv</packageName>
|
134
|
-
<version>2.7.
|
154
|
+
<version>2.7.6</version>
|
135
155
|
<licenses>
|
136
156
|
<license>
|
137
157
|
<name>MIT</name>
|
@@ -161,7 +181,7 @@
|
|
161
181
|
</dependency>
|
162
182
|
<dependency>
|
163
183
|
<packageName>hashdiff</packageName>
|
164
|
-
<version>1.0.
|
184
|
+
<version>1.0.1</version>
|
165
185
|
<licenses>
|
166
186
|
<license>
|
167
187
|
<name>MIT</name>
|
@@ -171,7 +191,7 @@
|
|
171
191
|
</dependency>
|
172
192
|
<dependency>
|
173
193
|
<packageName>i18n</packageName>
|
174
|
-
<version>1.8.
|
194
|
+
<version>1.8.10</version>
|
175
195
|
<licenses>
|
176
196
|
<license>
|
177
197
|
<name>MIT</name>
|
@@ -191,7 +211,7 @@
|
|
191
211
|
</dependency>
|
192
212
|
<dependency>
|
193
213
|
<packageName>license_finder</packageName>
|
194
|
-
<version>5.
|
214
|
+
<version>5.11.1</version>
|
195
215
|
<licenses>
|
196
216
|
<license>
|
197
217
|
<name>MIT</name>
|
@@ -201,7 +221,7 @@
|
|
201
221
|
</dependency>
|
202
222
|
<dependency>
|
203
223
|
<packageName>method_source</packageName>
|
204
|
-
<version>0.
|
224
|
+
<version>1.0.0</version>
|
205
225
|
<licenses>
|
206
226
|
<license>
|
207
227
|
<name>MIT</name>
|
@@ -211,7 +231,7 @@
|
|
211
231
|
</dependency>
|
212
232
|
<dependency>
|
213
233
|
<packageName>mini_portile2</packageName>
|
214
|
-
<version>2.
|
234
|
+
<version>2.5.1</version>
|
215
235
|
<licenses>
|
216
236
|
<license>
|
217
237
|
<name>MIT</name>
|
@@ -221,7 +241,7 @@
|
|
221
241
|
</dependency>
|
222
242
|
<dependency>
|
223
243
|
<packageName>minitest</packageName>
|
224
|
-
<version>5.14.
|
244
|
+
<version>5.14.4</version>
|
225
245
|
<licenses>
|
226
246
|
<license>
|
227
247
|
<name>MIT</name>
|
@@ -231,7 +251,7 @@
|
|
231
251
|
</dependency>
|
232
252
|
<dependency>
|
233
253
|
<packageName>mustermann</packageName>
|
234
|
-
<version>1.
|
254
|
+
<version>1.1.1</version>
|
235
255
|
<licenses>
|
236
256
|
<license>
|
237
257
|
<name>MIT</name>
|
@@ -241,7 +261,7 @@
|
|
241
261
|
</dependency>
|
242
262
|
<dependency>
|
243
263
|
<packageName>mustermann-contrib</packageName>
|
244
|
-
<version>1.
|
264
|
+
<version>1.1.1</version>
|
245
265
|
<licenses>
|
246
266
|
<license>
|
247
267
|
<name>MIT</name>
|
@@ -251,7 +271,7 @@
|
|
251
271
|
</dependency>
|
252
272
|
<dependency>
|
253
273
|
<packageName>nokogiri</packageName>
|
254
|
-
<version>1.
|
274
|
+
<version>1.11.3</version>
|
255
275
|
<licenses>
|
256
276
|
<license>
|
257
277
|
<name>MIT</name>
|
@@ -261,7 +281,7 @@
|
|
261
281
|
</dependency>
|
262
282
|
<dependency>
|
263
283
|
<packageName>oas_parser</packageName>
|
264
|
-
<version>0.
|
284
|
+
<version>0.25.4</version>
|
265
285
|
<licenses>
|
266
286
|
<license>
|
267
287
|
<name>MIT</name>
|
@@ -281,7 +301,7 @@
|
|
281
301
|
</dependency>
|
282
302
|
<dependency>
|
283
303
|
<packageName>pry</packageName>
|
284
|
-
<version>0.
|
304
|
+
<version>0.13.1</version>
|
285
305
|
<licenses>
|
286
306
|
<license>
|
287
307
|
<name>MIT</name>
|
@@ -291,27 +311,51 @@
|
|
291
311
|
</dependency>
|
292
312
|
<dependency>
|
293
313
|
<packageName>public_suffix</packageName>
|
294
|
-
<version>4.0.
|
314
|
+
<version>4.0.6</version>
|
295
315
|
<licenses>
|
296
316
|
<license>
|
297
317
|
<name>MIT</name>
|
298
318
|
<url>http://opensource.org/licenses/mit-license</url>
|
299
319
|
</license>
|
300
320
|
</licenses>
|
321
|
+
</dependency>
|
322
|
+
<dependency>
|
323
|
+
<packageName>racc</packageName>
|
324
|
+
<version>1.5.2</version>
|
325
|
+
<licenses>
|
326
|
+
<license>
|
327
|
+
<name>ruby</name>
|
328
|
+
<url>http://www.ruby-lang.org/en/LICENSE.txt</url>
|
329
|
+
</license>
|
330
|
+
<license>
|
331
|
+
<name>Simplified BSD</name>
|
332
|
+
<url>http://opensource.org/licenses/bsd-license</url>
|
333
|
+
</license>
|
334
|
+
</licenses>
|
301
335
|
</dependency>
|
302
336
|
<dependency>
|
303
337
|
<packageName>rake</packageName>
|
304
|
-
<version>
|
338
|
+
<version>13.0.3</version>
|
305
339
|
<licenses>
|
306
340
|
<license>
|
307
341
|
<name>MIT</name>
|
308
342
|
<url>http://opensource.org/licenses/mit-license</url>
|
309
343
|
</license>
|
310
344
|
</licenses>
|
345
|
+
</dependency>
|
346
|
+
<dependency>
|
347
|
+
<packageName>rexml</packageName>
|
348
|
+
<version>3.2.5</version>
|
349
|
+
<licenses>
|
350
|
+
<license>
|
351
|
+
<name>Simplified BSD</name>
|
352
|
+
<url>http://opensource.org/licenses/bsd-license</url>
|
353
|
+
</license>
|
354
|
+
</licenses>
|
311
355
|
</dependency>
|
312
356
|
<dependency>
|
313
357
|
<packageName>rspec</packageName>
|
314
|
-
<version>3.
|
358
|
+
<version>3.10.0</version>
|
315
359
|
<licenses>
|
316
360
|
<license>
|
317
361
|
<name>MIT</name>
|
@@ -321,7 +365,7 @@
|
|
321
365
|
</dependency>
|
322
366
|
<dependency>
|
323
367
|
<packageName>rspec-core</packageName>
|
324
|
-
<version>3.
|
368
|
+
<version>3.10.1</version>
|
325
369
|
<licenses>
|
326
370
|
<license>
|
327
371
|
<name>MIT</name>
|
@@ -331,7 +375,7 @@
|
|
331
375
|
</dependency>
|
332
376
|
<dependency>
|
333
377
|
<packageName>rspec-expectations</packageName>
|
334
|
-
<version>3.
|
378
|
+
<version>3.10.1</version>
|
335
379
|
<licenses>
|
336
380
|
<license>
|
337
381
|
<name>MIT</name>
|
@@ -341,7 +385,7 @@
|
|
341
385
|
</dependency>
|
342
386
|
<dependency>
|
343
387
|
<packageName>rspec-mocks</packageName>
|
344
|
-
<version>3.
|
388
|
+
<version>3.10.1</version>
|
345
389
|
<licenses>
|
346
390
|
<license>
|
347
391
|
<name>MIT</name>
|
@@ -351,17 +395,31 @@
|
|
351
395
|
</dependency>
|
352
396
|
<dependency>
|
353
397
|
<packageName>rspec-support</packageName>
|
354
|
-
<version>3.
|
398
|
+
<version>3.10.1</version>
|
355
399
|
<licenses>
|
356
400
|
<license>
|
357
401
|
<name>MIT</name>
|
358
402
|
<url>http://opensource.org/licenses/mit-license</url>
|
359
403
|
</license>
|
360
404
|
</licenses>
|
405
|
+
</dependency>
|
406
|
+
<dependency>
|
407
|
+
<packageName>ruby2_keywords</packageName>
|
408
|
+
<version>0.0.4</version>
|
409
|
+
<licenses>
|
410
|
+
<license>
|
411
|
+
<name>ruby</name>
|
412
|
+
<url>http://www.ruby-lang.org/en/LICENSE.txt</url>
|
413
|
+
</license>
|
414
|
+
<license>
|
415
|
+
<name>Simplified BSD</name>
|
416
|
+
<url>http://opensource.org/licenses/bsd-license</url>
|
417
|
+
</license>
|
418
|
+
</licenses>
|
361
419
|
</dependency>
|
362
420
|
<dependency>
|
363
421
|
<packageName>rubyzip</packageName>
|
364
|
-
<version>2.
|
422
|
+
<version>2.3.0</version>
|
365
423
|
<licenses>
|
366
424
|
<license>
|
367
425
|
<name>Simplified BSD</name>
|
@@ -370,8 +428,8 @@
|
|
370
428
|
</licenses>
|
371
429
|
</dependency>
|
372
430
|
<dependency>
|
373
|
-
<packageName>
|
374
|
-
<version>
|
431
|
+
<packageName>simplecov</packageName>
|
432
|
+
<version>0.21.2</version>
|
375
433
|
<licenses>
|
376
434
|
<license>
|
377
435
|
<name>MIT</name>
|
@@ -380,8 +438,8 @@
|
|
380
438
|
</licenses>
|
381
439
|
</dependency>
|
382
440
|
<dependency>
|
383
|
-
<packageName>
|
384
|
-
<version>0.
|
441
|
+
<packageName>simplecov-html</packageName>
|
442
|
+
<version>0.12.3</version>
|
385
443
|
<licenses>
|
386
444
|
<license>
|
387
445
|
<name>MIT</name>
|
@@ -390,12 +448,22 @@
|
|
390
448
|
</licenses>
|
391
449
|
</dependency>
|
392
450
|
<dependency>
|
393
|
-
<packageName>
|
394
|
-
<version>0.
|
451
|
+
<packageName>simplecov_json_formatter</packageName>
|
452
|
+
<version>0.1.2</version>
|
395
453
|
<licenses>
|
396
454
|
<license>
|
397
|
-
<name>
|
398
|
-
<url>http://
|
455
|
+
<name>MIT</name>
|
456
|
+
<url>http://opensource.org/licenses/mit-license</url>
|
457
|
+
</license>
|
458
|
+
</licenses>
|
459
|
+
</dependency>
|
460
|
+
<dependency>
|
461
|
+
<packageName>thor</packageName>
|
462
|
+
<version>1.0.1</version>
|
463
|
+
<licenses>
|
464
|
+
<license>
|
465
|
+
<name>MIT</name>
|
466
|
+
<url>http://opensource.org/licenses/mit-license</url>
|
399
467
|
</license>
|
400
468
|
</licenses>
|
401
469
|
</dependency>
|
@@ -411,7 +479,7 @@
|
|
411
479
|
</dependency>
|
412
480
|
<dependency>
|
413
481
|
<packageName>tzinfo</packageName>
|
414
|
-
<version>
|
482
|
+
<version>2.0.4</version>
|
415
483
|
<licenses>
|
416
484
|
<license>
|
417
485
|
<name>MIT</name>
|
@@ -421,7 +489,7 @@
|
|
421
489
|
</dependency>
|
422
490
|
<dependency>
|
423
491
|
<packageName>webmock</packageName>
|
424
|
-
<version>3.
|
492
|
+
<version>3.11.1</version>
|
425
493
|
<licenses>
|
426
494
|
<license>
|
427
495
|
<name>MIT</name>
|
@@ -441,17 +509,17 @@
|
|
441
509
|
</dependency>
|
442
510
|
<dependency>
|
443
511
|
<packageName>xml-simple</packageName>
|
444
|
-
<version>1.1.
|
512
|
+
<version>1.1.8</version>
|
445
513
|
<licenses>
|
446
514
|
<license>
|
447
|
-
<name>
|
448
|
-
<url>http://
|
515
|
+
<name>MIT</name>
|
516
|
+
<url>http://opensource.org/licenses/mit-license</url>
|
449
517
|
</license>
|
450
518
|
</licenses>
|
451
519
|
</dependency>
|
452
520
|
<dependency>
|
453
521
|
<packageName>zeitwerk</packageName>
|
454
|
-
<version>2.
|
522
|
+
<version>2.4.2</version>
|
455
523
|
<licenses>
|
456
524
|
<license>
|
457
525
|
<name>MIT</name>
|