wavefront-cli 5.0.1 → 5.1.0

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: 7b6dd6a0dbe70c8b5b32da314ee85ed859954a1c65b6ab068413d655bb0ef9ed
4
- data.tar.gz: 8b4606d212c1be7e8020946fc3a584774d1e0caa88add714683c896e39822b0c
3
+ metadata.gz: 2500c3c1046355e74eaa41f1e612a2f05054ffc54f752f79cac8f4c8f47dfd07
4
+ data.tar.gz: 9676df59ed6592399703de971ea8b2f691fe09443c74147d60096b3789d83ae5
5
5
  SHA512:
6
- metadata.gz: 906ad829f658c803f7fb9666172ffc78c5b6b5db9918edf5203fe8477ddbc0b1e5e8772cd9ba479160e6e3d4173a2ca363490de7763049174934364989a4a9ad
7
- data.tar.gz: 856022412c9a6ab3aca5ea88870f115bf11373bd1cbac64f6ba52710fda2cdada21c3c385dc416daa3ff94c4a58fca1490b2fdc071b3cc3a8590d4471017e05d
6
+ metadata.gz: 441cf573c9c17603679bd39d3b1f9d0dcf15ca0fc68f8f0b72fa2969fc9384931d9b549e54b0659e5103f0f09f04d50b45987758ddcd54115ceb450bda832366
7
+ data.tar.gz: d4236668320cc4167100784cc7c265c22a5d6bddf5e1a44da54c4b20c8b657e782582046551989800b0c4548f611c06aa900f5eb5ed3daaa46e1472d62f0f35a
data/HISTORY.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.0 (2020-02-20)
4
+ * Add `-U` (`--upsert`) option to `import` sub-commands.
5
+
3
6
  ## 5.0.1 (2020-02-18)
4
7
  * Bugfix: threshold alerts could not be imported.
5
8
 
@@ -476,13 +476,23 @@ module WavefrontCli
476
476
  raw = preprocess_rawfile(raw) if respond_to?(:preprocess_rawfile)
477
477
  prepped = import_to_create(raw)
478
478
 
479
- if options[:update]
479
+ if options[:upsert]
480
+ import_upsert(raw, prepped)
481
+ elsif options[:update]
480
482
  import_update(raw)
481
483
  else
482
484
  wf.create(prepped)
483
485
  end
484
486
  end
485
487
 
488
+ def import_upsert(raw, prepped)
489
+ update_call = import_update(raw)
490
+ return update_call if update_call.ok?
491
+
492
+ puts 'update failed, inserting' if options[:verbose] || options[:debug]
493
+ wf.create(prepped)
494
+ end
495
+
486
496
  def import_update(raw)
487
497
  wf.update(raw[:id], raw, false)
488
498
  end
@@ -16,7 +16,7 @@ class WavefrontCommandAlert < WavefrontCommandBase
16
16
  "history #{CMN} [-o offset] [-L limit] <id>",
17
17
  "latest #{CMN} <id>",
18
18
  "dump #{CMN}",
19
- "import #{CMN} [-u] <file>",
19
+ "import #{CMN} [-uU] <file>",
20
20
  "snooze #{CMN} [-T time] <id>",
21
21
  "set #{CMN} <key=value> <id>",
22
22
  "unsnooze #{CMN} <id>",
@@ -39,6 +39,7 @@ class WavefrontCommandAlert < WavefrontCommandBase
39
39
  "-L, --limit=COUNT number of #{things} to list",
40
40
  '-O, --fields=F1,F2,... only show given fields',
41
41
  "-u, --update update an existing #{thing}",
42
+ "-U, --upsert import new or update existing #{thing}",
42
43
  '-T, --time=SECONDS how long to snooze (default 3600)',
43
44
  "-b, --brief do not show #{thing} names"]
44
45
  end
@@ -25,7 +25,7 @@ class WavefrontCommandCloudintegration < WavefrontCommandBase
25
25
  "enable #{CMN} <id>",
26
26
  "disable #{CMN} <id>",
27
27
  "dump #{CMN}",
28
- "import #{CMN} [-u] <file>",
28
+ "import #{CMN} [-uU] <file>",
29
29
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
30
30
  end
31
31
 
@@ -36,6 +36,7 @@ class WavefrontCommandCloudintegration < WavefrontCommandBase
36
36
  "-o, --offset=n start from nth #{thing}",
37
37
  '-O, --fields=F1,F2,... only show given fields',
38
38
  "-L, --limit=COUNT number of #{things} to list",
39
- "-u, --update update an existing #{thing}"]
39
+ "-u, --update update an existing #{thing}",
40
+ "-U, --upsert import new or update existing #{thing}"]
40
41
  end
41
42
  end
@@ -23,7 +23,7 @@ class WavefrontCommandCluster < WavefrontCommandBase
23
23
  "delete #{CMN} <id>",
24
24
  "create #{CMN} [-v version] <platform> <name> <id>",
25
25
  "dump #{CMN}",
26
- "import #{CMN} [-u] <file>",
26
+ "import #{CMN} [-uU] <file>",
27
27
  "set #{CMN} <key=value> <id>",
28
28
  tag_commands,
29
29
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>...",
@@ -38,6 +38,7 @@ class WavefrontCommandCluster < WavefrontCommandBase
38
38
  '-O, --fields=F1,F2,... only show given fields',
39
39
  "-L, --limit=COUNT number of #{things} to list",
40
40
  "-u, --update update an existing #{thing}",
41
+ "-U, --upsert import new or update existing #{thing}",
41
42
  "-v, --version=VERSION version of #{thing}"]
42
43
  end
43
44
  end
@@ -9,7 +9,7 @@ class WavefrontCommandDashboard < WavefrontCommandBase
9
9
  ["list #{CMN} [-alN] [-O fields] [-o offset] [-L limit]",
10
10
  "describe #{CMN} [-v version] <id>",
11
11
  "dump #{CMN}",
12
- "import #{CMN} [-u] <file>",
12
+ "import #{CMN} [-uU] <file>",
13
13
  "set #{CMN} <key=value> <id>",
14
14
  "delete #{CMN} <id>",
15
15
  "undelete #{CMN} <id>",
@@ -31,6 +31,7 @@ class WavefrontCommandDashboard < WavefrontCommandBase
31
31
  "-L, --limit=COUNT number of #{things} or revisions to list",
32
32
  '-O, --fields=F1,F2,... only show given fields',
33
33
  "-u, --update update an existing #{thing}",
34
+ "-U, --upsert import new or update existing #{thing}",
34
35
  '-T, --time=SECONDS how long to snooze (default 3600)',
35
36
  "-v, --version=INTEGER version of #{thing}",
36
37
  "-b, --brief do not show #{thing} names",
@@ -23,7 +23,7 @@ class WavefrontCommandDerivedmetric < WavefrontCommandBase
23
23
  "create #{CMN} [-d description] [-T tag...] [-b] [-i interval] " \
24
24
  '[-r range] <name> <query>',
25
25
  "dump #{CMN}",
26
- "import #{CMN} [-u] <file>",
26
+ "import #{CMN} [-uU] <file>",
27
27
  "set #{CMN} <key=value> <id>",
28
28
  "delete #{CMN} <id>",
29
29
  "undelete #{CMN} <id>",
@@ -46,6 +46,7 @@ class WavefrontCommandDerivedmetric < WavefrontCommandBase
46
46
  '-i, --interval=INTEGER execute query every n minutes [default: 1]',
47
47
  '-r, --range=INTEGER include results in the last n minutes ' \
48
48
  '[default: 5]',
49
- "-u, --update update an existing #{thing}"]
49
+ "-u, --update update an existing #{thing}",
50
+ "-U, --upsert import new or update existing #{thing}"]
50
51
  end
51
52
  end
@@ -23,7 +23,7 @@ class WavefrontCommandIngestionpolicy < WavefrontCommandBase
23
23
  "describe #{CMN} <id>",
24
24
  "delete #{CMN} <id>",
25
25
  "dump #{CMN}",
26
- "import #{CMN} [-u] <file>",
26
+ "import #{CMN} [-uU] <file>",
27
27
  "set #{CMN} <key=value> <id>",
28
28
  "add user #{CMN} <id> <user>...",
29
29
  "remove user #{CMN} <id> <user>...",
@@ -40,6 +40,7 @@ class WavefrontCommandIngestionpolicy < WavefrontCommandBase
40
40
  '-O, --fields=F1,F2,... only show given fields',
41
41
  "-L, --limit=COUNT number of #{things} to list",
42
42
  "-d, --desc=STRING reason for #{thing}",
43
- "-u, --update update an existing #{thing}"]
43
+ "-u, --update update an existing #{thing}",
44
+ "-U, --upsert import new or update existing #{thing}"]
44
45
  end
45
46
  end
@@ -24,7 +24,7 @@ class WavefrontCommandLink < WavefrontCommandBase
24
24
  '<description> <template>',
25
25
  "delete #{CMN} <id>",
26
26
  "dump #{CMN}",
27
- "import #{CMN} [-u] <file>",
27
+ "import #{CMN} [-uU] <file>",
28
28
  "set #{CMN} <key=value> <id>",
29
29
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
30
30
  end
@@ -39,6 +39,7 @@ class WavefrontCommandLink < WavefrontCommandBase
39
39
  '-m, --metric-regex=REGEX metric filter regular expression',
40
40
  '-s, --source-regex=REGEX source filter regular expression',
41
41
  '-p, --point-regex=REGEX point filter regular expression',
42
- "-u, --update update an existing #{thing}"]
42
+ "-u, --update update an existing #{thing}",
43
+ "-U, --upsert import new or update existing #{thing}"]
43
44
  end
44
45
  end
@@ -17,7 +17,7 @@ class WavefrontCommandNotificant < WavefrontCommandBase
17
17
  ["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
18
18
  "describe #{CMN} <id>",
19
19
  "dump #{CMN}",
20
- "import #{CMN} [-u] <file>",
20
+ "import #{CMN} [-uU] <file>",
21
21
  "delete #{CMN} <id>",
22
22
  "test #{CMN} <id>",
23
23
  "set #{CMN} <key=value> <id>",
@@ -31,6 +31,7 @@ class WavefrontCommandNotificant < WavefrontCommandBase
31
31
  "-o, --offset=n start from nth #{thing}",
32
32
  '-O, --fields=F1,F2,... only show given fields',
33
33
  "-L, --limit=COUNT number of #{things} to list",
34
- "-u, --update update an existing #{thing}"]
34
+ "-u, --update update an existing #{thing}",
35
+ "-U, --upsert import new or update existing #{thing}"]
35
36
  end
36
37
  end
@@ -26,7 +26,7 @@ class WavefrontCommandSavedsearch < WavefrontCommandBase
26
26
  "describe #{CMN} <id>",
27
27
  "delete #{CMN} <id>",
28
28
  "dump #{CMN}",
29
- "import #{CMN} [-u] <file>",
29
+ "import #{CMN} [-uU] <file>",
30
30
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
31
31
  end
32
32
 
@@ -37,6 +37,7 @@ class WavefrontCommandSavedsearch < WavefrontCommandBase
37
37
  "-o, --offset=n start from nth #{thing}",
38
38
  '-O, --fields=F1,F2,... only show given fields',
39
39
  "-L, --limit=COUNT number of #{things} to list",
40
- "-u, --update update an existing #{thing}"]
40
+ "-u, --update update an existing #{thing}",
41
+ "-U, --upsert import new or update existing #{thing}"]
41
42
  end
42
43
  end
@@ -33,7 +33,7 @@ class WavefrontCommandServiceaccount < WavefrontCommandBase
33
33
  "grant #{CMN} <permission> to <id>",
34
34
  "revoke #{CMN} <permission> from <id>",
35
35
  "set #{CMN} <key=value> <id>",
36
- "import #{CMN} [-u] <file>",
36
+ "import #{CMN} [-uU] <file>",
37
37
  "apitoken list #{CMN} [-O fields] <id>",
38
38
  "apitoken create #{CMN} [-N name] <id>",
39
39
  "apitoken delete #{CMN} <id> <token_id>",
@@ -49,6 +49,7 @@ class WavefrontCommandServiceaccount < WavefrontCommandBase
49
49
  "-L, --limit=COUNT number of #{things} to list",
50
50
  '-O, --fields=F1,F2,... only show given fields',
51
51
  "-u, --update update an existing #{thing}",
52
+ "-U, --upsert import new or update existing #{thing}",
52
53
  "-I, --inactive create an inactive #{thing}",
53
54
  "-d, --desc=STRING description of #{thing}",
54
55
  "-p, --permission=STRING give #{thing} this permission",
@@ -20,7 +20,7 @@ class WavefrontCommandUser < WavefrontCommandBase
20
20
  "invite #{CMN} [-m permission...] [-g group...] <id>",
21
21
  "delete #{CMN} <user>...",
22
22
  "dump #{CMN}",
23
- "import #{CMN} [-u] <file>",
23
+ "import #{CMN} [-uU] <file>",
24
24
  "groups #{CMN} <id>",
25
25
  "privileges #{CMN} <id>",
26
26
  "join #{CMN} <id> <group>...",
@@ -40,6 +40,7 @@ class WavefrontCommandUser < WavefrontCommandBase
40
40
  "-L, --limit=COUNT number of #{things} to list",
41
41
  '-O, --fields=F1,F2,... only show given fields',
42
42
  "-u, --update update an existing #{thing}",
43
+ "-U, --upsert import new or update existing #{thing}",
43
44
  "-e, --email send e-mail to #{thing} on account creation",
44
45
  "-m, --permission=STRING give #{thing} this permission",
45
46
  "-g, --group=STRING add #{thing} to this user group"]
@@ -27,7 +27,7 @@ class WavefrontCommandUsergroup < WavefrontCommandBase
27
27
  "create #{CMN} [-p permission...] <name>",
28
28
  "delete #{CMN} <id>",
29
29
  "dump #{CMN}",
30
- "import #{CMN} [-u] <file>",
30
+ "import #{CMN} [-uU] <file>",
31
31
  "set #{CMN} <key=value> <id>",
32
32
  "users #{CMN} <id>",
33
33
  "permissions #{CMN} <id>",
@@ -46,6 +46,7 @@ class WavefrontCommandUsergroup < WavefrontCommandBase
46
46
  "-L, --limit=COUNT number of #{things} to list",
47
47
  '-O, --fields=F1,F2,... only show given fields',
48
48
  "-u, --update update an existing #{thing}",
49
+ "-U, --upsert import new or update existing #{thing}",
49
50
  '-p, --permission=STRING Wavefront permission']
50
51
  end
51
52
 
@@ -10,7 +10,7 @@ class WavefrontCommandWebhook < WavefrontCommandBase
10
10
  "describe #{CMN} <id>",
11
11
  "delete #{CMN} <id>",
12
12
  "dump #{CMN}",
13
- "import #{CMN} [-u] <file>",
13
+ "import #{CMN} [-uU] <file>",
14
14
  "set #{CMN} <key=value> <id>",
15
15
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
16
16
  end
@@ -22,6 +22,7 @@ class WavefrontCommandWebhook < WavefrontCommandBase
22
22
  "-o, --offset=n start list from nth #{thing}",
23
23
  '-O, --fields=F1,F2,... only show given fields',
24
24
  "-L, --limit=COUNT number of #{things} to list",
25
- "-u, --update update an existing #{thing}"]
25
+ "-u, --update update an existing #{thing}",
26
+ "-U, --upsert import new or update existing #{thing}"]
26
27
  end
27
28
  end
@@ -26,7 +26,7 @@ class WavefrontCommandWindow < WavefrontCommandBase
26
26
  "extend #{CMN} (by|to) <time> <id>",
27
27
  "delete #{CMN} <id>",
28
28
  "dump #{CMN}",
29
- "import #{CMN} [-u] <file>",
29
+ "import #{CMN} [-uU] <file>",
30
30
  "set #{CMN} <key=value> <id>",
31
31
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>...",
32
32
  "ongoing #{CMN}",
@@ -41,6 +41,7 @@ class WavefrontCommandWindow < WavefrontCommandBase
41
41
  '-O, --fields=F1,F2,... only show given fields',
42
42
  "-L, --limit=COUNT number of #{things} to list",
43
43
  "-u, --update update an existing #{thing}",
44
+ "-U, --upsert import new or update existing #{thing}",
44
45
  "-d, --desc=STRING reason for #{thing}",
45
46
  "-s, --start=TIME time at which #{thing} begins",
46
47
  "-e, --end=TIME time at which #{thing} ends",
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- WF_CLI_VERSION = '5.0.1'
3
+ WF_CLI_VERSION = '5.1.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt