3scale_toolbox 0.19.3 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/3scale_toolbox.gemspec +2 -1
  3. data/README.md +6 -4
  4. data/lib/3scale_toolbox/3scale_client_factory.rb +9 -7
  5. data/lib/3scale_toolbox/base_command.rb +5 -1
  6. data/lib/3scale_toolbox/cli/null_printer.rb +11 -0
  7. data/lib/3scale_toolbox/cli.rb +1 -0
  8. data/lib/3scale_toolbox/commands/3scale_command.rb +1 -0
  9. data/lib/3scale_toolbox/commands/activedocs_command/apply_command.rb +1 -1
  10. data/lib/3scale_toolbox/commands/activedocs_command/create_command.rb +8 -9
  11. data/lib/3scale_toolbox/commands/import_command/openapi/create_activedocs_step.rb +1 -1
  12. data/lib/3scale_toolbox/commands/import_command/openapi/create_backend_mapping_rule_step.rb +21 -0
  13. data/lib/3scale_toolbox/commands/import_command/openapi/create_backend_method_step.rb +41 -0
  14. data/lib/3scale_toolbox/commands/import_command/openapi/create_backend_step.rb +62 -0
  15. data/lib/3scale_toolbox/commands/import_command/openapi/create_mapping_rule_step.rb +3 -1
  16. data/lib/3scale_toolbox/commands/import_command/openapi/create_service_step.rb +7 -2
  17. data/lib/3scale_toolbox/commands/import_command/openapi/import_backend_step.rb +31 -0
  18. data/lib/3scale_toolbox/commands/import_command/openapi/import_product_step.rb +30 -0
  19. data/lib/3scale_toolbox/commands/import_command/openapi/method.rb +1 -1
  20. data/lib/3scale_toolbox/commands/import_command/openapi/step.rb +27 -1
  21. data/lib/3scale_toolbox/commands/import_command/openapi/update_policies_step.rb +1 -1
  22. data/lib/3scale_toolbox/commands/import_command/openapi/update_service_oidc_conf_step.rb +1 -1
  23. data/lib/3scale_toolbox/commands/import_command/openapi/update_service_proxy_step.rb +4 -8
  24. data/lib/3scale_toolbox/commands/import_command/openapi.rb +44 -18
  25. data/lib/3scale_toolbox/commands/plans_command/import_command.rb +1 -1
  26. data/lib/3scale_toolbox/commands/policies_command/import_command.rb +1 -1
  27. data/lib/3scale_toolbox/commands/product_command/import_command.rb +1 -1
  28. data/lib/3scale_toolbox/commands/proxy_command/deploy_command.rb +54 -0
  29. data/lib/3scale_toolbox/commands/proxy_command/show_command.rb +54 -0
  30. data/lib/3scale_toolbox/commands/proxy_command/update_command.rb +75 -0
  31. data/lib/3scale_toolbox/commands/proxy_command.rb +28 -0
  32. data/lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb +3 -2
  33. data/lib/3scale_toolbox/commands/service_command/show_command.rb +1 -2
  34. data/lib/3scale_toolbox/commands.rb +2 -2
  35. data/lib/3scale_toolbox/entities/backend.rb +13 -1
  36. data/lib/3scale_toolbox/entities/service.rb +1 -2
  37. data/lib/3scale_toolbox/resource_reader.rb +24 -9
  38. data/lib/3scale_toolbox/version.rb +1 -1
  39. data/licenses.xml +18 -18
  40. metadata +28 -8
  41. data/lib/3scale_toolbox/commands/update_command/service_command/copy_service_settings_task.rb +0 -35
  42. data/lib/3scale_toolbox/commands/update_command/service_command/delete_activedocs_task.rb +0 -24
  43. data/lib/3scale_toolbox/commands/update_command/service_command.rb +0 -80
  44. data/lib/3scale_toolbox/commands/update_command.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2a44bdf128bf6f8d4d0a592a4eee49c82c34415017e03366ff2bcc241fe18c0
4
- data.tar.gz: 0e94df4747331e9092ae0c961709cfcc334a553eb54209378941b8239307eceb
3
+ metadata.gz: f688ec02bf32ca42f99e737b789e9826111d09417987fc0ef8bb32ee1719956b
4
+ data.tar.gz: '068391c70eeb07ddd450af05abe77c80e4b623c53383f5da6b75375d45cade58'
5
5
  SHA512:
6
- metadata.gz: 8dd7a6efc6567598d87e4ebbc18c486eba1ea9e6766ca6c0241f78e73a4287408d9e18ac838788e81a073c8f3a8fd93d299fac4ea9f21a42571e3cff68f2b0bb
7
- data.tar.gz: c4ed75a0b46414606208a5fb6e1374e72d5fe06fbb5a237b3793bc2471d20667c489acace51cdf93d4971bfe59b42dc2919631b90074a8af72bac1668c663d01
6
+ metadata.gz: 82fe4022c976594d2d8b52db9d84f0b1d8886738c3f076614864ddc34b48e24c62445c6fab34d25c9ce164176f19490c290bc3d97b5f8b913f1a57f20ee9a2d6
7
+ data.tar.gz: 9b24f6ee07f2209d1180ce57cf21096b6b9a2970c07539a4619c21dbcbc5700359a1b132539ece15668d9c6753a8858a89cb635ab491385f0f8e15d6388c389a
@@ -36,8 +36,9 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'webmock', '~> 3.4'
37
37
  spec.required_ruby_version = '>= 2.6'
38
38
 
39
- spec.add_dependency '3scale-api', '~> 1.4'
39
+ spec.add_dependency '3scale-api', '~> 1.6'
40
40
  spec.add_dependency 'cri', '~> 2.15'
41
41
  spec.add_dependency 'json-schema', '~> 2.8'
42
42
  spec.add_dependency 'oas_parser', '~> 0.20'
43
+ spec.add_dependency 'activesupport', '~> 6.0'
43
44
  end
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![CircleCI](https://circleci.com/gh/3scale/3scale_toolbox.svg?style=svg)](https://circleci.com/gh/3scale/3scale_toolbox)
3
3
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
4
4
  [![GitHub release](https://img.shields.io/github/v/release/3scale/3scale_toolbox.svg)](https://github.com/3scale/3scale_toolbox/releases/latest)
5
+ [![codecov](https://codecov.io/gh/3scale/3scale_toolbox/branch/main/graph/badge.svg?token=ojinl2NVv5)](https://codecov.io/gh/3scale/3scale_toolbox)
5
6
 
6
7
  ## Description
7
8
  3scale toolbox is a set of tools to help you manage your 3scale product. Using the [3scale API Ruby Client](https://github.com/3scale/3scale-api-ruby).
@@ -22,7 +23,8 @@
22
23
  * Create, Apply, List, Delete [Method](docs/method.md)
23
24
  * Create, Apply, List, Show, Delete [Service](docs/service.md)
24
25
  * Create, Apply, List, Delete [ActiveDocs](docs/activedocs.md)
25
- * List, Show, Promote, Export, Deploy [Proxy Configuration](docs/proxy-config.md)
26
+ * Show, Update, Deploy [APIcast proxy settings](docs/proxy.md)
27
+ * List, Show, Promote, Export [Staging/Production Proxy Configuration](docs/proxy-config.md)
26
28
  * [Copy Policy Registry](docs/copy-policy-registry.md)
27
29
  * Create, Apply, List, Show, Delete, Suspend, Resume [Applications](docs/applications.md)
28
30
  * [Export/Import Product Policy Chain](docs/export-import-policy-chain.md)
@@ -82,16 +84,18 @@ COMMANDS
82
84
  import import super command
83
85
  method method super command
84
86
  metric metric super command
87
+ policies policies super command
85
88
  policy-registry policy-registry super command
86
89
  product product super command
90
+ proxy proxy super command
87
91
  proxy-config proxy-config super command
88
92
  remote remotes super command
89
93
  service services super command
90
- update [DEPRECATED] update super command
91
94
 
92
95
  OPTIONS
93
96
  -c --config-file=<value> 3scale toolbox configuration file (default:
94
97
  $HOME/.3scalerc.yaml)
98
+ --disable-keep-alive Disable keep alive HTTP connection mode
95
99
  -h --help show help for this command
96
100
  -k --insecure Proceed and operate even for server
97
101
  connections otherwise considered insecure
@@ -173,7 +177,6 @@ Then register the core command in `lib/3scale_toolbox/commands.rb`
173
177
  +++ b/lib/3scale_toolbox/commands.rb
174
178
  @@ -4,6 +4,7 @@ require '3scale_toolbox/commands/copy_command'
175
179
  require '3scale_toolbox/commands/import_command'
176
- require '3scale_toolbox/commands/update_command'
177
180
  require '3scale_toolbox/commands/remote_command'
178
181
  +require '3scale_toolbox/commands/service_list_command'
179
182
 
@@ -182,7 +185,6 @@ Then register the core command in `lib/3scale_toolbox/commands.rb`
182
185
  @@ -12,7 +13,8 @@ module ThreeScaleToolbox
183
186
  ThreeScaleToolbox::Commands::CopyCommand,
184
187
  ThreeScaleToolbox::Commands::ImportCommand,
185
- ThreeScaleToolbox::Commands::UpdateCommand,
186
188
  - ThreeScaleToolbox::Commands::RemoteCommand::RemoteCommand
187
189
  + ThreeScaleToolbox::Commands::RemoteCommand::RemoteCommand,
188
190
  + ThreeScaleToolbox::Commands::ServiceListCommand
@@ -1,18 +1,19 @@
1
1
  module ThreeScaleToolbox
2
2
  class ThreeScaleClientFactory
3
3
  class << self
4
- def get(remotes, remote_str, verify_ssl, verbose = false)
5
- new(remotes, remote_str, verify_ssl, verbose).call
4
+ def get(remotes, remote_str, verify_ssl, verbose = false, keep_alive = true)
5
+ new(remotes, remote_str, verify_ssl, verbose, keep_alive).call
6
6
  end
7
7
  end
8
8
 
9
- attr_reader :remotes, :remote_str, :verify_ssl, :verbose
9
+ attr_reader :remotes, :remote_str, :verify_ssl, :verbose, :keep_alive
10
10
 
11
- def initialize(remotes, remote_str, verify_ssl, verbose)
11
+ def initialize(remotes, remote_str, verify_ssl, verbose, keep_alive)
12
12
  @remotes = remotes
13
13
  @remote_str = remote_str
14
14
  @verify_ssl = verify_ssl
15
15
  @verbose = verbose
16
+ @keep_alive = keep_alive
16
17
  end
17
18
 
18
19
  def call
@@ -22,15 +23,16 @@ module ThreeScaleToolbox
22
23
  remote = remotes.fetch(remote_str)
23
24
  end
24
25
 
25
- client = remote_client(**remote.merge(verify_ssl: verify_ssl))
26
+ client = remote_client(**remote.merge(verify_ssl: verify_ssl, keep_alive: keep_alive))
26
27
  client = ProxyLogger.new(client) if verbose
27
28
  RemoteCache.new(client)
28
29
  end
29
30
 
30
31
  private
31
32
 
32
- def remote_client(endpoint:, authentication:, verify_ssl:)
33
- ThreeScale::API.new(endpoint: endpoint, provider_key: authentication, verify_ssl: verify_ssl)
33
+ def remote_client(endpoint:, authentication:, verify_ssl:, keep_alive:)
34
+ ThreeScale::API.new(endpoint: endpoint, provider_key: authentication,
35
+ verify_ssl: verify_ssl, keep_alive: keep_alive)
34
36
  end
35
37
  end
36
38
  end
@@ -46,7 +46,7 @@ module ThreeScaleToolbox
46
46
  # Input param can be endpoint url or remote name
47
47
  #
48
48
  def threescale_client(str)
49
- ThreeScaleClientFactory.get(remotes, str, verify_ssl, verbose)
49
+ ThreeScaleClientFactory.get(remotes, str, verify_ssl, verbose, keep_alive)
50
50
  end
51
51
 
52
52
  def verify_ssl
@@ -58,6 +58,10 @@ module ThreeScaleToolbox
58
58
  options[:verbose]
59
59
  end
60
60
 
61
+ def keep_alive
62
+ !options[:'disable-keep-alive']
63
+ end
64
+
61
65
  def exit_with_message(message)
62
66
  raise ThreeScaleToolbox::Error, message
63
67
  end
@@ -0,0 +1,11 @@
1
+ module ThreeScaleToolbox
2
+ module CLI
3
+ class NullPrinter
4
+ def print_record(record)
5
+ end
6
+
7
+ def print_collection(collection)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,4 +1,5 @@
1
1
  require '3scale_toolbox/cli/error_handler'
2
+ require '3scale_toolbox/cli/null_printer'
2
3
  require '3scale_toolbox/cli/json_printer'
3
4
  require '3scale_toolbox/cli/yaml_printer'
4
5
  require '3scale_toolbox/cli/custom_table_printer'
@@ -17,6 +17,7 @@ module ThreeScaleToolbox
17
17
  end
18
18
  flag :k, :insecure, 'Proceed and operate even for server connections otherwise considered insecure'
19
19
  flag nil, :verbose, 'Verbose mode'
20
+ flag nil, :'disable-keep-alive', 'Disable keep alive HTTP connection mode'
20
21
  flag :h, :help, 'show help for this command' do |_, cmd|
21
22
  puts cmd.help
22
23
  exit 0
@@ -108,7 +108,7 @@ module ThreeScaleToolbox
108
108
 
109
109
  def read_activedocs_json_spec
110
110
  activedoc_spec = option_openapi_spec
111
- activedoc_spec_content = load_resource(activedoc_spec)
111
+ activedoc_spec_content = load_resource(activedoc_spec, verify_ssl)
112
112
  JSON.pretty_generate(activedoc_spec_content)
113
113
  end
114
114
 
@@ -52,20 +52,19 @@ module ThreeScaleToolbox
52
52
  end
53
53
 
54
54
  def activedocs_json_spec
55
- activedoc_spec = arguments[:activedocs_spec]
56
- activedoc_spec_content = load_resource(arguments[:activedocs_spec])
55
+ activedoc_spec_content = load_resource(arguments[:activedocs_spec], verify_ssl)
57
56
  JSON.pretty_generate(activedoc_spec_content)
58
57
  end
59
58
 
60
59
  def activedocs_attrs
61
60
  {
62
- "service_id" => options[:'service-id'],
63
- "published" => options[:'published'],
64
- "skip_swagger_validations" => options[:'skip-swagger-validations'],
65
- "description" => options[:'description'],
66
- "system_name" => options[:'system-name'],
67
- "name" => activedocs_name,
68
- "body" => activedocs_json_spec,
61
+ 'service_id' => options[:'service-id'],
62
+ 'published' => options[:'published'],
63
+ 'skip_swagger_validations' => options[:'skip-swagger-validations'],
64
+ 'description' => options[:'description'],
65
+ 'system_name' => options[:'system-name'],
66
+ 'name' => activedocs_name,
67
+ 'body' => activedocs_json_spec,
69
68
  }.compact
70
69
  end
71
70
 
@@ -23,7 +23,7 @@ module ThreeScaleToolbox
23
23
  unless ThreeScaleToolbox::Helper.system_name_already_taken_error? errors
24
24
 
25
25
  # if activedocs system_name exists, ignore error, update activedocs
26
- puts 'Activedocs exists, update!'
26
+ logger.info 'Activedocs exists, update!'
27
27
  update_res = threescale_client.update_activedocs(find_activedocs_id, active_doc)
28
28
  raise ThreeScaleToolbox::Error, "ActiveDocs has not been updated. #{update_res['errors']}" unless update_res['errors'].nil?
29
29
  end
@@ -0,0 +1,21 @@
1
+ module ThreeScaleToolbox
2
+ module Commands
3
+ module ImportCommand
4
+ module OpenAPI
5
+ class CreateBackendMappingRulesStep
6
+ include Step
7
+
8
+ def call
9
+ backend.mapping_rules.each(&:delete)
10
+
11
+ report['mapping_rules'] = {}
12
+ operations.each do |op|
13
+ b_m_r = Entities::BackendMappingRule.create(backend: backend, attrs: op.mapping_rule)
14
+ report['mapping_rules'][op.friendly_name] = op.mapping_rule
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,41 @@
1
+ module ThreeScaleToolbox
2
+ module Commands
3
+ module ImportCommand
4
+ module OpenAPI
5
+ class CreateBackendMethodsStep
6
+ include Step
7
+
8
+ def call
9
+ missing_operations.each do |op|
10
+ method = Entities::BackendMethod.create(backend: backend, attrs: op.method)
11
+ op.set(:metric_id, method.id)
12
+ end
13
+
14
+ existing_operations.each do |op|
15
+ method_attrs = methods_index.fetch(op.method['system_name']).attrs
16
+ method = Entities::BackendMethod.new(id: method_attrs.fetch('id'), backend: backend)
17
+ method.update(op.method)
18
+ op.set(:metric_id, method.id)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def methods_index
25
+ @methods_index ||= backend.methods.each_with_object({}) do |method, acc|
26
+ acc[method.system_name] = method
27
+ end
28
+ end
29
+
30
+ def missing_operations
31
+ operations.reject { |op| methods_index.key? op.method['system_name'] }
32
+ end
33
+
34
+ def existing_operations
35
+ operations.select { |op| methods_index.key? op.method['system_name'] }
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,62 @@
1
+ module ThreeScaleToolbox
2
+ module Commands
3
+ module ImportCommand
4
+ module OpenAPI
5
+ class CreateBackendStep
6
+ include Step
7
+
8
+ ##
9
+ # Creates backend with a given system_name
10
+ # If the backend already exists, update basic settings like name and description
11
+ def call
12
+ # Update backend and update context
13
+ self.backend = Entities::Backend.find_by_system_name(remote: threescale_client,
14
+ system_name: system_name)
15
+ if backend.nil?
16
+ # Create service and update context
17
+ self.backend = Entities::Backend.create(remote: threescale_client,
18
+ attrs: create_attrs)
19
+ else
20
+ backend.update(update_attrs)
21
+ end
22
+
23
+ report['id'] = backend.id
24
+ report['system_name'] = backend.system_name
25
+ report['private_endpoint'] = backend.private_endpoint
26
+ end
27
+
28
+ private
29
+
30
+ def create_attrs
31
+ {
32
+ 'name' => title,
33
+ 'system_name' => system_name,
34
+ 'description' => description,
35
+ 'private_endpoint' => private_endpoint
36
+ }
37
+ end
38
+
39
+ def update_attrs
40
+ {
41
+ 'name' => title,
42
+ 'description' => description,
43
+ 'private_endpoint' => private_endpoint
44
+ }
45
+ end
46
+
47
+ def system_name
48
+ target_system_name || title.downcase.gsub(/[^\w]/, '_')
49
+ end
50
+
51
+ def title
52
+ api_spec.title
53
+ end
54
+
55
+ def description
56
+ api_spec.description
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -6,10 +6,12 @@ module ThreeScaleToolbox
6
6
  include Step
7
7
 
8
8
  def call
9
+ report['mapping_rules'] = {}
9
10
  operations.each do |op|
10
11
  Entities::MappingRule.create(service: service,
11
12
  attrs: op.mapping_rule)
12
- puts "Created #{op.http_method} #{op.pattern} endpoint"
13
+ logger.info "Created #{op.http_method} #{op.pattern} endpoint"
14
+ report['mapping_rules'][op.friendly_name] = op.mapping_rule
13
15
  end
14
16
  end
15
17
  end
@@ -16,11 +16,16 @@ module ThreeScaleToolbox
16
16
  # Create service and update context
17
17
  self.service = Entities::Service.create(remote: threescale_client,
18
18
  service_params: service_settings)
19
- puts "Created service id: #{service.id}, name: #{service_name}"
19
+ logger.info "Created service id: #{service.id}, name: #{service_name}"
20
20
  else
21
21
  service.update(service_settings)
22
- puts "Updated service id: #{service.id}, name: #{service_name}"
22
+ logger.info "Updated service id: #{service.id}, name: #{service_name}"
23
23
  end
24
+
25
+ report['id'] = service.id
26
+ report['system_name'] = service.system_name
27
+ report['name'] = service.name
28
+ report['backend_version'] = api_spec.service_backend_version
24
29
  end
25
30
 
26
31
  private
@@ -0,0 +1,31 @@
1
+ module ThreeScaleToolbox
2
+ module Commands
3
+ module ImportCommand
4
+ module OpenAPI
5
+ class ImportBackendStep
6
+ include Step
7
+
8
+ def call
9
+ verify_params
10
+
11
+ tasks = []
12
+ tasks << CreateBackendStep.new(context)
13
+ tasks << CreateBackendMethodsStep.new(context)
14
+ tasks << CreateBackendMappingRulesStep.new(context)
15
+
16
+ # run tasks
17
+ tasks.each(&:call)
18
+ end
19
+
20
+ private
21
+
22
+ def verify_params
23
+ if private_endpoint.nil?
24
+ raise ThreeScaleToolbox::Error, 'private endpoint not specified'
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ module ThreeScaleToolbox
2
+ module Commands
3
+ module ImportCommand
4
+ module OpenAPI
5
+ class ImportProductStep
6
+ include Step
7
+
8
+ def call
9
+ tasks = []
10
+ tasks << CreateServiceStep.new(context)
11
+ # other tasks might read proxy settings (CreateActiveDocsStep does)
12
+ tasks << UpdateServiceProxyStep.new(context)
13
+ tasks << CreateMethodsStep.new(context)
14
+ tasks << ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::DestroyMappingRulesTask.new(context)
15
+ tasks << CreateMappingRulesStep.new(context)
16
+ tasks << CreateActiveDocsStep.new(context)
17
+ tasks << UpdateServiceOidcConfStep.new(context)
18
+ tasks << UpdatePoliciesStep.new(context)
19
+
20
+ # run tasks
21
+ tasks.each(&:call)
22
+
23
+ # This should be the last step
24
+ ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::BumpProxyVersionTask.new(service: context[:target]).call
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -12,7 +12,7 @@ module ThreeScaleToolbox
12
12
  end
13
13
 
14
14
  def friendly_name
15
- operation[:operationId] || operation_id
15
+ operation[:operation_id] || operation_id
16
16
  end
17
17
 
18
18
  def system_name
@@ -9,6 +9,18 @@ module ThreeScaleToolbox
9
9
  @context = context
10
10
  end
11
11
 
12
+ def report
13
+ context[:report] ||= {}
14
+ end
15
+
16
+ def backend
17
+ context[:backend_target]
18
+ end
19
+
20
+ def backend=(backend_obj)
21
+ context[:backend_target] = backend_obj
22
+ end
23
+
12
24
  # Can be nil on initialization time and not nil afterwards
13
25
  # method to fetch from context required
14
26
  def service
@@ -41,7 +53,7 @@ module ThreeScaleToolbox
41
53
  public_base_path: public_base_path,
42
54
  path: op[:path],
43
55
  verb: op[:verb],
44
- operationId: op[:operation_id],
56
+ operation_id: op[:operation_id],
45
57
  description: op[:description],
46
58
  prefix_matching: prefix_matching,
47
59
  )
@@ -101,6 +113,16 @@ module ThreeScaleToolbox
101
113
  context[:prefix_matching]
102
114
  end
103
115
 
116
+ def private_endpoint
117
+ override_private_base_url || host
118
+ end
119
+
120
+ def host
121
+ return if api_spec.host.nil?
122
+
123
+ "#{api_spec.scheme || 'https'}://#{api_spec.host}"
124
+ end
125
+
104
126
  def base_path
105
127
  api_spec.base_path || '/'
106
128
  end
@@ -112,6 +134,10 @@ module ThreeScaleToolbox
112
134
  def private_base_path
113
135
  override_private_basepath || base_path
114
136
  end
137
+
138
+ def logger
139
+ context[:logger]
140
+ end
115
141
  end
116
142
  end
117
143
  end
@@ -26,7 +26,7 @@ module ThreeScaleToolbox
26
26
  raise ThreeScaleToolbox::Error, "Service policies have not been updated. #{errors}"
27
27
  end
28
28
 
29
- puts 'Service policies updated'
29
+ logger.info 'Service policies updated'
30
30
  end
31
31
 
32
32
  private
@@ -20,7 +20,7 @@ module ThreeScaleToolbox
20
20
  raise ThreeScaleToolbox::Error, "Service oidc has not been updated. #{errors}"
21
21
  end
22
22
 
23
- puts 'Service oidc updated'
23
+ logger.info 'Service oidc updated'
24
24
  end
25
25
 
26
26
  private
@@ -22,7 +22,7 @@ module ThreeScaleToolbox
22
22
  raise ThreeScaleToolbox::Error, "Service proxy has not been updated. #{errors}"
23
23
  end
24
24
 
25
- puts 'Service proxy updated'
25
+ logger.info 'Service proxy updated'
26
26
  end
27
27
 
28
28
  private
@@ -31,12 +31,14 @@ module ThreeScaleToolbox
31
31
  return if production_public_base_url.nil?
32
32
 
33
33
  settings[:endpoint] = production_public_base_url
34
+ report['endpoint'] = production_public_base_url
34
35
  end
35
36
 
36
37
  def add_sandbox_endpoint_settings(settings)
37
38
  return if staging_public_base_url.nil?
38
39
 
39
40
  settings[:sandbox_endpoint] = staging_public_base_url
41
+ report['sandbox_endpoint'] = staging_public_base_url
40
42
  end
41
43
 
42
44
  def add_api_backend_settings(settings)
@@ -74,13 +76,7 @@ module ThreeScaleToolbox
74
76
  end
75
77
 
76
78
  def private_base_url
77
- override_private_base_url || private_base_url_from_openapi
78
- end
79
-
80
- def private_base_url_from_openapi
81
- return if api_spec.host.nil?
82
-
83
- "#{api_spec.scheme || 'https'}://#{api_spec.host}"
79
+ override_private_base_url || host
84
80
  end
85
81
  end
86
82
  end