3scale_toolbox 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc76523728a2d5fa59805175676eac19b02a689db6c2b6045d821f8b6d5b8fc3
4
- data.tar.gz: 33908dec9c0714102d0899643e40bcc933b90a412b440325ef8476b4427d8596
3
+ metadata.gz: c162adffa46adcb9b43e88642bf1de4daaed45ae9db6abcaa93b388e56f9159a
4
+ data.tar.gz: 481d3485a91d038c6c7af04d7609f9a907d3e8e30e3264c4cb43b2e0f15f2b8c
5
5
  SHA512:
6
- metadata.gz: ff2630a709bb3af2a8e93cc650359f8d3461444a41438aa261415922a02b9ea9f425dbd027f6d8d46652462544d4e388e9b15ef5066f772bd1ae99457794ead5
7
- data.tar.gz: 22c140218478ee375e3762e5cb5ffe674e9d1502e7b702d7303341c98d84ad4680ef3887f6608f9ed42cf7bb584a195a099e33d6dfc4196c11201be21b2ca920
6
+ metadata.gz: 7faf8d5012d24d978a70d357fc1ff5aa9327edb67f4dc307cf8e32bfb3143b3bebe460238b6580a34b82220c8ea590877f3cd5ddc92eaee052a1bf9ec3c0484e
7
+ data.tar.gz: 44b6c5e32f13eb98c1d2494d6b198374567b9cc5d6e0cd1f3461a88270f10a699e9228d4a32cc1d095a1c195cac081e30a0117896c3e7cf0993120130bbf3393
@@ -15,6 +15,7 @@ module ThreeScaleToolbox
15
15
 
16
16
  required :s, :source, '3scale source instance. Format: "http[s]://<provider_key>@3scale_url"'
17
17
  required :d, :destination, '3scale target instance. Format: "http[s]://<provider_key>@3scale_url"'
18
+ option :t, 'target_system_name', 'Target system name', argument: :required
18
19
  flag :f, :force, 'Overwrites the mapping rules by deleting all rules from target service first'
19
20
  flag :r, 'rules-only', 'Updates only the mapping rules'
20
21
 
@@ -34,9 +35,9 @@ module ThreeScaleToolbox
34
35
  end
35
36
 
36
37
  class ServiceUpdater
37
- attr_reader :source_client, :target_client, :source_service_id, :target_service_id
38
+ attr_reader :source_client, :target_client, :source_service_id, :target_service_id, :target_system_name
38
39
 
39
- def initialize (source, source_service_id, destination, target_service_id, insecure)
40
+ def initialize (source, source_service_id, destination, target_service_id, insecure, system_name)
40
41
  @source_client = ThreeScale::API.new(
41
42
  endpoint: endpoint_from_url(source),
42
43
  provider_key: provider_key_from_url(source),
@@ -49,6 +50,7 @@ module ThreeScaleToolbox
49
50
  )
50
51
  @source_service_id = source_service_id
51
52
  @target_service_id = target_service_id
53
+ @target_system_name = system_name
52
54
  end
53
55
 
54
56
  def compare_hashes(first, second, keys)
@@ -66,8 +68,16 @@ module ThreeScaleToolbox
66
68
  uri.to_s
67
69
  end
68
70
 
71
+ # system name only included when specified from options
69
72
  def target_service_params(source)
70
- source.select { |k, v| Commands.service_valid_params.include?(k) && v }
73
+ target_service = source.select do |k, v|
74
+ Commands.service_valid_params.include?(k) \
75
+ && k != 'system_name' \
76
+ && v
77
+ end
78
+ target_service.tap do |hash|
79
+ hash['system_name'] = target_system_name unless target_system_name.nil?
80
+ end
71
81
  end
72
82
 
73
83
  def source_metrics
@@ -233,7 +243,8 @@ module ThreeScaleToolbox
233
243
  target_service_id = args[1]
234
244
  force_update = opts[:force] || false
235
245
  rules_only = opts[:'rules-only'] || false
236
- updater = ServiceUpdater.new(source, source_service_id, destination, target_service_id, insecure)
246
+ system_name = opts[:target_system_name]
247
+ updater = ServiceUpdater.new(source, source_service_id, destination, target_service_id, insecure, system_name)
237
248
 
238
249
  if rules_only
239
250
  updater.copy_mapping_rules force_update
@@ -1,3 +1,3 @@
1
1
  module ThreeScaleToolbox
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
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.5.0
4
+ version: 0.5.1
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: 2018-10-25 00:00:00.000000000 Z
12
+ date: 2018-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler