kennel 1.81.1 → 1.81.2

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: 4ecb9c89748e6eeee268d0d744622b536242af1c1d7f615bf77fc5963e1630d8
4
- data.tar.gz: e6cae4da66e0947163d1f441bce2afb19f1818dac0ed9418143b3f2a2480b220
3
+ metadata.gz: 5f9d3050dbb7a4e94cd22e64618142bedffd6fdfc5b5ee8e20b621b90f1d8f27
4
+ data.tar.gz: 640a86b74e46e27ec7f1b09dd555f0ba8f99e4fc1f687e5230bb00d12636ae1d
5
5
  SHA512:
6
- metadata.gz: 7a3342551a926a55c580571524cadbb32bf7b02b77a914f32e1edf2a07b6772091373286c36871d9651a57899134364d8c9c5894a8ef1e46f72ad091ca241990
7
- data.tar.gz: 6eb25f647a3a7d47c0858ca03f0649e151f6437d711701ea24f1dd3b742b5adbfbd3f0318a531076b2236063dda194bbdec72237eaf3f1159f447ac86a95ee68
6
+ metadata.gz: 80dbfff63550b6f5c3127cb8ecc97db6b3db38876469bcb9d50fce00a7e1b78e2f473dd3c3abaec081cb21037f53be72021d907c4285352b30dd3b6991f6c622
7
+ data.tar.gz: 02a3122ec70a951dc01f919c4d13877de88c6266048d006770a62adadd19587d74a603e8281699f878be0a20227a7086e37727c751cf5833e815fc795e3f9ee3
data/Readme.md CHANGED
@@ -216,7 +216,7 @@ to unblock use the `validate: -> { false }` option.
216
216
 
217
217
  Link resources with their kennel_id in the format `project kennel_id` + `:` + `resource kennel_id`,
218
218
  this should be used to create dependent resources like monitor + slos,
219
- so they can be created in a single update and can be re-created if any of them is deleted.
219
+ so they can be created in a single update and can be re-created if any of them is deleted.
220
220
 
221
221
  |Resource|Type|Syntax|
222
222
  |---|---|---|
@@ -186,22 +186,26 @@ module Kennel
186
186
  end
187
187
 
188
188
  def render_definitions(definitions)
189
- definitions.map do |title, type, display_type, queries, options = {}, ignored = nil|
190
- # validate inputs
191
- if ignored || (!title || !type || !queries || !options.is_a?(Hash))
192
- raise ArgumentError, "Expected exactly 5 arguments for each definition (title, type, display_type, queries, options)"
193
- end
194
- if (SUPPORTED_DEFINITION_OPTIONS | options.keys) != SUPPORTED_DEFINITION_OPTIONS
195
- raise ArgumentError, "Supported options are: #{SUPPORTED_DEFINITION_OPTIONS.map(&:inspect).join(", ")}"
196
- end
189
+ definitions.map do |title, type, display_type, queries, options = {}, too_many_args = nil|
190
+ if title.is_a?(Hash) && !type
191
+ title # user gave a full widget, just use it
192
+ else
193
+ # validate inputs
194
+ if too_many_args || (!title || !type || !queries || !options.is_a?(Hash))
195
+ raise ArgumentError, "Expected exactly 5 arguments for each definition (title, type, display_type, queries, options)"
196
+ end
197
+ if (SUPPORTED_DEFINITION_OPTIONS | options.keys) != SUPPORTED_DEFINITION_OPTIONS
198
+ raise ArgumentError, "Supported options are: #{SUPPORTED_DEFINITION_OPTIONS.map(&:inspect).join(", ")}"
199
+ end
197
200
 
198
- # build definition
199
- requests = Array(queries).map do |q|
200
- request = { q: q }
201
- request[:display_type] = display_type if display_type
202
- request
201
+ # build definition
202
+ requests = Array(queries).map do |q|
203
+ request = { q: q }
204
+ request[:display_type] = display_type if display_type
205
+ request
206
+ end
207
+ { definition: { title: title, type: type, requests: requests, **options } }
203
208
  end
204
- { definition: { title: title, type: type, requests: requests, **options } }
205
209
  end
206
210
  end
207
211
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.81.1"
3
+ VERSION = "1.81.2"
4
4
  end
data/template/Readme.md CHANGED
@@ -194,10 +194,11 @@ removing the `id` will cause kennel to create a new resource in datadog.
194
194
  Some validations might be too strict for your usecase or just wrong, please [open an issue](https://github.com/grosser/kennel/issues) and
195
195
  to unblock use the `validate: -> { false }` option.
196
196
 
197
- ### Linking with kennel_ids
197
+ ### Linking resources with kennel_id
198
198
 
199
- Link resources via their kennel_id `projects kennel_id` + `:` + `monitors kennel id`,
200
- this should be used to create dependent resources like monitor + slos.
199
+ Link resources with their kennel_id in the format `project kennel_id` + `:` + `resource kennel_id`,
200
+ this should be used to create dependent resources like monitor + slos,
201
+ so they can be created in a single update and can be re-created if any of them is deleted.
201
202
 
202
203
  |Resource|Type|Syntax|
203
204
  |---|---|---|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.81.1
4
+ version: 1.81.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-21 00:00:00.000000000 Z
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday