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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c162adffa46adcb9b43e88642bf1de4daaed45ae9db6abcaa93b388e56f9159a
|
4
|
+
data.tar.gz: 481d3485a91d038c6c7af04d7609f9a907d3e8e30e3264c4cb43b2e0f15f2b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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
|
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.
|
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-
|
12
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|