skull_island 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a5d7af669323fdbe1216566cf8baeba91724c2292de92a283d39cd3bd1aac4e
4
- data.tar.gz: 55cf31d7419e2cb52f132bf906a02de85d5f79c97bbb2c63f3b8d25889c92af1
3
+ metadata.gz: eff79cef47f9764701711c87bef82cded9cc3b7e58b4a21bc245042dbb77600f
4
+ data.tar.gz: 6f433b14ac328bd48fba2c7eadfdeff256b5f1c97c3f298665c2f25fc1a14327
5
5
  SHA512:
6
- metadata.gz: 335c95cdfbb85ba6979b1d2460ea317fb5aff1207edcd24ebda4fb1974b9e0204bed1e52fd99ad703a809fbaef65517095c1521341e857c5e09be50223393553
7
- data.tar.gz: 002752d03a6dfd2ce7caae75389765608f24dcbfdef00bf7ed85a3fa5c18b82e58de35f9466bce9e7d7f77976af8d17d17d73e6407b41783e6f7d29565c87c27
6
+ metadata.gz: f2422ea1ebd93c4b3f62c8b9229ca8bb8277abef46c036a79ac2a35fa7cd29e4c829a5eaea3df5917c74f1758ed73310f39580c7ce91617574e2127bd118c82e
7
+ data.tar.gz: 9b6026082b5d2811617cda731a4887eb1d54a89935f3c78a06ecce61a399b9b20d432613510428edab0e99372bcc5b4f359842f2ea4ccbc18fee7615bbb825e8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- skull_island (2.0.1)
4
+ skull_island (2.0.3)
5
5
  deepsort (~> 0.4)
6
6
  erubi (~> 1.8)
7
7
  json (~> 2.1)
@@ -62,7 +62,7 @@ GEM
62
62
  net-http-pipeline (1.0.1)
63
63
  netrc (0.11.0)
64
64
  parallel (1.19.1)
65
- parser (2.7.0.2)
65
+ parser (2.7.0.3)
66
66
  ast (~> 2.4.0)
67
67
  pusher-client (0.6.2)
68
68
  json
@@ -88,7 +88,7 @@ GEM
88
88
  diff-lcs (>= 1.2.0, < 2.0)
89
89
  rspec-support (~> 3.9.0)
90
90
  rspec-support (3.9.2)
91
- rubocop (0.80.0)
91
+ rubocop (0.80.1)
92
92
  jaro_winkler (~> 1.5.1)
93
93
  parallel (~> 1.10)
94
94
  parser (>= 2.7.0.1)
@@ -97,7 +97,7 @@ GEM
97
97
  ruby-progressbar (~> 1.7)
98
98
  unicode-display_width (>= 1.4.0, < 1.7)
99
99
  ruby-progressbar (1.10.1)
100
- simplecov (0.18.4)
100
+ simplecov (0.18.5)
101
101
  docile (~> 1.1)
102
102
  simplecov-html (~> 0.11)
103
103
  simplecov-html (0.12.1)
@@ -123,7 +123,7 @@ GEM
123
123
  unf_ext (0.0.7.6)
124
124
  unicode-display_width (1.6.1)
125
125
  websocket (1.2.8)
126
- will_paginate (3.2.1)
126
+ will_paginate (3.3.0)
127
127
  yard (0.9.24)
128
128
 
129
129
  PLATFORMS
data/README.md CHANGED
@@ -270,7 +270,7 @@ plugins:
270
270
  service: "<%= lookup :service, 'search_api' %>"
271
271
  ```
272
272
 
273
- All top-level keys (other than `version` and `project`) require an Array as a parameter, either by providing a list of entries or an empty Array (`[]`), or they can be omitted entirely which is the same as providing an empty Array. The above shows how to use the `lookup()` function to refer to another resource. This "looks up" the resource type (`service` in this case) by `name` (`search_api` in this case) and resolves its `id`. This function can also be used to lookup a `route` or `upstream` by its `name`, or a `consumer` by its `username`. Note that Kong itself doesn't _require_ `route` resources to have unique names, so you'll need to enforce that practice yourself for `lookup` to be useful for Routes.
273
+ All top-level keys (other than `version` and `project`) require an Array as a parameter, either by providing a list of entries or an empty Array (`[]`), or they can be omitted entirely which is the same as providing an empty Array. The above shows how to use the `lookup()` function to refer to another resource. This "looks up" the resource type (`service` in this case) by `name` (`search_api` in this case) and resolves its `id`. This function can also be used to lookup a `route` or `upstream` by its `name`, or a `consumer` by its `username`. Note that Kong itself doesn't _require_ `route` resources to have unique names, so you'll need to enforce that practice yourself for `lookup` to be useful for Routes. The `lookup` function also supports a third parameter to provide just the `id` value, rather than wrapping it in a key/value pair of `id: 9992...`. Simple call `lookup` like `lookup :service, 'search_api', true` to turn on this "raw id mode".
274
274
 
275
275
  Note that while this configuration looks a lot like the [DB-less](https://docs.konghq.com/1.4.x/db-less-and-declarative-config/) configuration (and even may, at times, be interchangeable), this is merely a coincidence. **Skull Island doesn't support the DB-less mode for Kong.** This may potentially change in the future, but for now it is not a goal of this project.
276
276
 
@@ -12,8 +12,8 @@ module SkullIsland
12
12
  end
13
13
 
14
14
  # At this phase, we want to leave this alone...
15
- def lookup(type, value)
16
- "<%= lookup :#{type}, '#{value}' %>"
15
+ def lookup(type, value, raw = false)
16
+ "<%= lookup :#{type}, '#{value}', #{raw} %>"
17
17
  end
18
18
  end
19
19
  end
@@ -105,19 +105,22 @@ module SkullIsland
105
105
  # rubocop:enable Metrics/CyclomaticComplexity
106
106
  # rubocop:enable Metrics/PerceivedComplexity
107
107
 
108
- def lookup(type, value)
109
- case type
110
- when :consumer
111
- { 'id' => Resources::Consumer.find(:username, value).id }
112
- when :route
113
- { 'id' => Resources::Route.find(:name, value).id }
114
- when :service
115
- { 'id' => Resources::Service.find(:name, value).id }
116
- when :upstream
117
- { 'id' => Resources::Upstream.find(:name, value).id }
118
- else
119
- raise Exceptions::InvalidArguments, "#{type} is not a valid lookup type"
120
- end
108
+ # Looks up IDs (and usually wraps them in a Hash)
109
+ def lookup(type, value, raw = false)
110
+ id_value = case type
111
+ when :consumer
112
+ Resources::Consumer.find(:username, value).id
113
+ when :route
114
+ Resources::Route.find(:name, value).id
115
+ when :service
116
+ Resources::Service.find(:name, value).id
117
+ when :upstream
118
+ Resources::Upstream.find(:name, value).id
119
+ else
120
+ raise Exceptions::InvalidArguments, "#{type} is not a valid lookup type"
121
+ end
122
+
123
+ raw ? id_value : { 'id' => id_value }
121
124
  end
122
125
 
123
126
  # ActiveRecord ActiveModel::Name compatibility method
@@ -20,6 +20,7 @@ module SkullIsland
20
20
  property :strip_path, type: :boolean
21
21
  property :preserve_host, type: :boolean
22
22
  property :snis, validate: true
23
+ property :path_handling, validate: true
23
24
  property :sources
24
25
  property :destinations
25
26
  property :service, validate: true, preprocess: true, postprocess: true
@@ -135,6 +136,12 @@ module SkullIsland
135
136
  end
136
137
  end
137
138
 
139
+ # Used to validate {#path_handling} on set
140
+ def validate_path_handling(value)
141
+ valid_values = %w[v0 v1]
142
+ valid_values.include?(value)
143
+ end
144
+
138
145
  # Used to validate {#protocols} on set
139
146
  def validate_protocols(value)
140
147
  valid_protos = %w[http https tls tcp grpc grpcs]
@@ -4,6 +4,6 @@ module SkullIsland
4
4
  VERSION = [
5
5
  2, # Major
6
6
  0, # Minor
7
- 1 # Patch
7
+ 3 # Patch
8
8
  ].join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skull_island
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-25 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deepsort