3scale_toolbox 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -23
- data/lib/3scale_toolbox/base_command.rb +0 -1
- data/lib/3scale_toolbox/commands.rb +4 -0
- data/lib/3scale_toolbox/commands/copy_command/copy_service.rb +1 -1
- data/lib/3scale_toolbox/commands/import_command/openapi/create_activedocs_step.rb +2 -2
- data/lib/3scale_toolbox/commands/import_command/openapi/create_method_step.rb +21 -15
- data/lib/3scale_toolbox/commands/import_command/openapi/create_service_step.rb +10 -13
- data/lib/3scale_toolbox/commands/methods_command.rb +28 -0
- data/lib/3scale_toolbox/commands/methods_command/apply_command.rb +101 -0
- data/lib/3scale_toolbox/commands/methods_command/create_command.rb +73 -0
- data/lib/3scale_toolbox/commands/methods_command/delete_command.rb +67 -0
- data/lib/3scale_toolbox/commands/methods_command/list_command.rb +64 -0
- data/lib/3scale_toolbox/commands/metrics_command.rb +28 -0
- data/lib/3scale_toolbox/commands/metrics_command/apply_command.rb +102 -0
- data/lib/3scale_toolbox/commands/metrics_command/create_command.rb +77 -0
- data/lib/3scale_toolbox/commands/metrics_command/delete_command.rb +66 -0
- data/lib/3scale_toolbox/commands/metrics_command/list_command.rb +70 -0
- data/lib/3scale_toolbox/commands/plans_command/create_command.rb +1 -1
- data/lib/3scale_toolbox/commands/plans_command/export/read_app_plan_step.rb +1 -1
- data/lib/3scale_toolbox/commands/plans_command/export/step.rb +5 -1
- data/lib/3scale_toolbox/commands/plans_command/import/import_plan_metrics_step.rb +7 -13
- data/lib/3scale_toolbox/commands/plans_command/import/step.rb +2 -8
- data/lib/3scale_toolbox/commands/plans_command/show_command.rb +1 -1
- data/lib/3scale_toolbox/commands/remote_command/remote_add.rb +1 -1
- data/lib/3scale_toolbox/entities.rb +2 -0
- data/lib/3scale_toolbox/entities/application_plan.rb +47 -14
- data/lib/3scale_toolbox/entities/method.rb +80 -0
- data/lib/3scale_toolbox/entities/metric.rb +113 -0
- data/lib/3scale_toolbox/entities/service.rb +112 -38
- data/lib/3scale_toolbox/error.rb +13 -0
- data/lib/3scale_toolbox/tasks/copy_activedocs_task.rb +1 -1
- data/lib/3scale_toolbox/tasks/copy_methods_task.rb +11 -8
- data/lib/3scale_toolbox/tasks/copy_metrics_task.rb +1 -1
- data/lib/3scale_toolbox/tasks/copy_service_proxy_task.rb +1 -1
- data/lib/3scale_toolbox/tasks/delete_activedocs_task.rb +1 -1
- data/lib/3scale_toolbox/tasks/update_service_settings_task.rb +3 -3
- data/lib/3scale_toolbox/version.rb +1 -1
- metadata +16 -4
data/lib/3scale_toolbox/error.rb
CHANGED
@@ -5,4 +5,17 @@ module ThreeScaleToolbox
|
|
5
5
|
|
6
6
|
class InvalidUrlError < Error
|
7
7
|
end
|
8
|
+
|
9
|
+
class ThreeScaleApiError < Error
|
10
|
+
attr_reader :apierrors
|
11
|
+
|
12
|
+
def initialize(msg = '', apierrors = {})
|
13
|
+
@apierrors = apierrors
|
14
|
+
super(msg)
|
15
|
+
end
|
16
|
+
|
17
|
+
def message
|
18
|
+
"#{super}. Errors: #{apierrors}"
|
19
|
+
end
|
20
|
+
end
|
8
21
|
end
|
@@ -6,7 +6,7 @@ module ThreeScaleToolbox
|
|
6
6
|
def call
|
7
7
|
puts 'copying all service ActiveDocs'
|
8
8
|
|
9
|
-
target_activedocs = source.
|
9
|
+
target_activedocs = source.activedocs.map do |source_activedoc|
|
10
10
|
source_activedoc.clone.tap do |target_activedoc|
|
11
11
|
target_activedoc.delete('id')
|
12
12
|
target_activedoc['service_id'] = target.id
|
@@ -4,15 +4,18 @@ module ThreeScaleToolbox
|
|
4
4
|
include CopyTask
|
5
5
|
|
6
6
|
def call
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
puts "
|
7
|
+
source_hits_id = source.hits['id']
|
8
|
+
target_hits_id = target.hits['id']
|
9
|
+
source_methods = source.methods source_hits_id
|
10
|
+
target_methods = target.methods target_hits_id
|
11
|
+
puts "original service hits metric #{source_hits_id} has #{source_methods.size} methods"
|
12
|
+
puts "target service hits metric #{target_hits_id} has #{target_methods.size} methods"
|
12
13
|
missing = missing_methods(source_methods, target_methods).each do |method|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
Entities::Method.create(
|
15
|
+
service: target,
|
16
|
+
parent_id: target_hits_id,
|
17
|
+
attrs: ThreeScaleToolbox::Helper.filter_params(%w[friendly_name system_name], method)
|
18
|
+
)
|
16
19
|
end
|
17
20
|
puts "created #{missing.size} missing methods on target service"
|
18
21
|
end
|
@@ -10,7 +10,7 @@ module ThreeScaleToolbox
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call
|
13
|
-
source_obj = source.
|
13
|
+
source_obj = source.attrs
|
14
14
|
svc_obj = update_service target_service_params(source_obj)
|
15
15
|
if (errors = svc_obj['errors'])
|
16
16
|
raise ThreeScaleToolbox::Error, "Service has not been saved. Errors: #{errors}" \
|
@@ -22,7 +22,7 @@ module ThreeScaleToolbox
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def update_service(service)
|
25
|
-
svc_obj = target.
|
25
|
+
svc_obj = target.update service
|
26
26
|
|
27
27
|
# Source and target remotes might not allow same set of deployment options
|
28
28
|
# Invalid deployment option check
|
@@ -30,7 +30,7 @@ module ThreeScaleToolbox
|
|
30
30
|
if (errors = svc_obj['errors']) &&
|
31
31
|
ThreeScaleToolbox::Helper.service_invalid_deployment_option?(errors)
|
32
32
|
service.delete('deployment_option')
|
33
|
-
svc_obj = target.
|
33
|
+
svc_obj = target.update service
|
34
34
|
end
|
35
35
|
|
36
36
|
svc_obj
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 3scale_toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Cichra
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-05-
|
12
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
90
|
+
version: 0.4.0
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.
|
97
|
+
version: 0.4.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: cri
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +159,16 @@ files:
|
|
159
159
|
- lib/3scale_toolbox/commands/import_command/openapi/update_policies_step.rb
|
160
160
|
- lib/3scale_toolbox/commands/import_command/openapi/update_service_oidc_conf_step.rb
|
161
161
|
- lib/3scale_toolbox/commands/import_command/openapi/update_service_proxy_step.rb
|
162
|
+
- lib/3scale_toolbox/commands/methods_command.rb
|
163
|
+
- lib/3scale_toolbox/commands/methods_command/apply_command.rb
|
164
|
+
- lib/3scale_toolbox/commands/methods_command/create_command.rb
|
165
|
+
- lib/3scale_toolbox/commands/methods_command/delete_command.rb
|
166
|
+
- lib/3scale_toolbox/commands/methods_command/list_command.rb
|
167
|
+
- lib/3scale_toolbox/commands/metrics_command.rb
|
168
|
+
- lib/3scale_toolbox/commands/metrics_command/apply_command.rb
|
169
|
+
- lib/3scale_toolbox/commands/metrics_command/create_command.rb
|
170
|
+
- lib/3scale_toolbox/commands/metrics_command/delete_command.rb
|
171
|
+
- lib/3scale_toolbox/commands/metrics_command/list_command.rb
|
162
172
|
- lib/3scale_toolbox/commands/plans_command.rb
|
163
173
|
- lib/3scale_toolbox/commands/plans_command/apply_command.rb
|
164
174
|
- lib/3scale_toolbox/commands/plans_command/create_command.rb
|
@@ -191,6 +201,8 @@ files:
|
|
191
201
|
- lib/3scale_toolbox/configuration.rb
|
192
202
|
- lib/3scale_toolbox/entities.rb
|
193
203
|
- lib/3scale_toolbox/entities/application_plan.rb
|
204
|
+
- lib/3scale_toolbox/entities/method.rb
|
205
|
+
- lib/3scale_toolbox/entities/metric.rb
|
194
206
|
- lib/3scale_toolbox/entities/service.rb
|
195
207
|
- lib/3scale_toolbox/error.rb
|
196
208
|
- lib/3scale_toolbox/helper.rb
|