knife-analytics 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -2
- data/lib/chef/knife/notification_create.rb +47 -0
- data/lib/chef/knife/rule_create.rb +47 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43ac6211eb9315955037ec7b07b6dfb4662658bd
|
4
|
+
data.tar.gz: 25b5e5b44466b16eb64e81635c5e5b4ab8e0487d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4d07ef3ac9a168fdcaa9dbc4aac6a09d80936f30239774193693fd14005383381260fc67b941d6a8f9cb6b078f8c2099fea76155a16f4dd9b10331cf0b8f10a
|
7
|
+
data.tar.gz: 800abaed51fc4c8e150bbb492ba3d1460f071b52a0fb2297de48ff0b10c707dd69d8bbb6c85a6573db7035049948db50bbda5f13119bd729fbd7091d287c2943
|
data/README.md
CHANGED
@@ -16,13 +16,48 @@ knife audit list
|
|
16
16
|
knife audit show <id>
|
17
17
|
knife notification list
|
18
18
|
knife notification show <id>
|
19
|
+
knife notification create <notification.json>
|
19
20
|
knife rule list
|
20
21
|
knife rule show <id>
|
22
|
+
knife rule create <rule.json>
|
23
|
+
```
|
24
|
+
|
25
|
+
## Example data for creating rules and notifications:
|
26
|
+
|
27
|
+
### Rules
|
28
|
+
```
|
29
|
+
{
|
30
|
+
"name": "New Rule Group 1",
|
31
|
+
"modified_by": "admin",
|
32
|
+
"with": {
|
33
|
+
"priority": 0
|
34
|
+
},
|
35
|
+
"active":true,
|
36
|
+
"rule":"rules 'New Rule Group 1'\n rule on action\n when\n true\n then\n noop()\n end\nend"
|
37
|
+
}
|
38
|
+
```
|
39
|
+
|
40
|
+
### Notification
|
41
|
+
```
|
42
|
+
{
|
43
|
+
"name": "chef-splunk-example",
|
44
|
+
"notification_type": "Splunk",
|
45
|
+
"modified_by": "admin",
|
46
|
+
"delivery_options": {
|
47
|
+
"hostname": "splunk.chef.inc.com",
|
48
|
+
"port": 8089,
|
49
|
+
"username": "serdar",
|
50
|
+
"password": "SweetPassword",
|
51
|
+
"index": "chef-analytics",
|
52
|
+
"sourcetype": "chef-analytics-data"
|
53
|
+
}
|
54
|
+
}
|
21
55
|
```
|
22
56
|
|
23
57
|
License & Authors
|
24
58
|
-----------------
|
25
|
-
- Author: James Casey
|
59
|
+
- Author: James Casey <james@chef.io>
|
60
|
+
- Author: Serdar Sutay <serdar@chef.io>
|
26
61
|
|
27
62
|
```text
|
28
63
|
Copyright 2014, Chef Software
|
@@ -39,4 +74,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
39
74
|
See the License for the specific language governing permissions and
|
40
75
|
limitations under the License.
|
41
76
|
```
|
42
|
-
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef-analytics'
|
19
|
+
require 'json'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class NotificationCreate < ChefAnalytics::Knife
|
24
|
+
category "CHEF ANALYTICS"
|
25
|
+
|
26
|
+
banner "knife notification create <notification.json>"
|
27
|
+
|
28
|
+
option :identity_server_url,
|
29
|
+
:long => "--identity-server-url HOST",
|
30
|
+
:description => "URL of Chef identity server to use"
|
31
|
+
|
32
|
+
option :analytics_server_url,
|
33
|
+
:long => "--analytics-server-url HOST",
|
34
|
+
:description => "URL of Chef analytics server to use"
|
35
|
+
|
36
|
+
def run
|
37
|
+
validate_and_set_params
|
38
|
+
|
39
|
+
@rest = ChefAnalytics::ServerAPI.new(analytics_server_url, fetch_token)
|
40
|
+
|
41
|
+
headers = {"Content-Type" => "application/json"}
|
42
|
+
response = @rest.post("/aliases", File.read(name_args[0]), headers)
|
43
|
+
output(response)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef-analytics'
|
19
|
+
require 'json'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class RuleCreate < ChefAnalytics::Knife
|
24
|
+
category "CHEF ANALYTICS"
|
25
|
+
|
26
|
+
banner "knife rule create <rule.json>"
|
27
|
+
|
28
|
+
option :identity_server_url,
|
29
|
+
:long => "--identity-server-url HOST",
|
30
|
+
:description => "URL of Chef identity server to use"
|
31
|
+
|
32
|
+
option :analytics_server_url,
|
33
|
+
:long => "--analytics-server-url HOST",
|
34
|
+
:description => "URL of Chef analytics server to use"
|
35
|
+
|
36
|
+
def run
|
37
|
+
validate_and_set_params
|
38
|
+
|
39
|
+
@rest = ChefAnalytics::ServerAPI.new(analytics_server_url, fetch_token)
|
40
|
+
|
41
|
+
headers = {"Content-Type" => "application/json"}
|
42
|
+
response = @rest.post("/rules", File.read(name_args[0]), headers)
|
43
|
+
output(response)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-analytics
|
@@ -39,8 +39,10 @@ files:
|
|
39
39
|
- lib/chef/knife/action_show.rb
|
40
40
|
- lib/chef/knife/alert_list.rb
|
41
41
|
- lib/chef/knife/alert_show.rb
|
42
|
+
- lib/chef/knife/notification_create.rb
|
42
43
|
- lib/chef/knife/notification_list.rb
|
43
44
|
- lib/chef/knife/notification_show.rb
|
45
|
+
- lib/chef/knife/rule_create.rb
|
44
46
|
- lib/chef/knife/rule_list.rb
|
45
47
|
- lib/chef/knife/rule_show.rb
|
46
48
|
homepage: http://www.getchef.com/
|
@@ -63,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
65
|
version: '0'
|
64
66
|
requirements: []
|
65
67
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.
|
68
|
+
rubygems_version: 2.4.4
|
67
69
|
signing_key:
|
68
70
|
specification_version: 4
|
69
71
|
summary: Knife plugin for the Chef analytics platform
|