upguard 0.0.1 → 0.0.9
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 +2 -5
- data/lib/upguard.rb +19 -0
- data/lib/upguard/Account.rb +346 -102
- data/lib/upguard/BaseObject.rb +23 -22
- data/lib/upguard/ConnectionManager.rb +18 -3
- data/lib/upguard/ConnectionManagerGroup.rb +31 -9
- data/lib/upguard/ConnectionManagerGroupList.rb +47 -0
- data/lib/upguard/ConnectionManagerList.rb +47 -0
- data/lib/upguard/Environment.rb +34 -11
- data/lib/upguard/EnvironmentList.rb +47 -0
- data/lib/upguard/Event.rb +3 -3
- data/lib/upguard/EventAction.rb +8 -2
- data/lib/upguard/EventActionList.rb +47 -0
- data/lib/upguard/Incident.rb +33 -0
- data/lib/upguard/IncidentList.rb +47 -0
- data/lib/upguard/Job.rb +60 -0
- data/lib/upguard/JobList.rb +47 -0
- data/lib/upguard/MediumType.rb +2 -2
- data/lib/upguard/Node.rb +54 -18
- data/lib/upguard/NodeGroup.rb +80 -8
- data/lib/upguard/NodeGroupList.rb +47 -0
- data/lib/upguard/NodeGroupUser.rb +21 -0
- data/lib/upguard/NodeGroupUserList.rb +58 -0
- data/lib/upguard/NodeList.rb +47 -0
- data/lib/upguard/NodeType.rb +2 -2
- data/lib/upguard/OperatingSystem.rb +3 -3
- data/lib/upguard/OperatingSystemFamily.rb +8 -8
- data/lib/upguard/OperatingSystemFamilyList.rb +47 -0
- data/lib/upguard/OperatingSystemList.rb +47 -0
- data/lib/upguard/Policy.rb +79 -0
- data/lib/upguard/PolicyList.rb +47 -0
- data/lib/upguard/ScheduledJob.rb +6 -3
- data/lib/upguard/ScheduledJobList.rb +47 -0
- data/lib/upguard/SystemMetric.rb +2 -2
- data/lib/upguard/SystemMetricList.rb +47 -0
- data/lib/upguard/User.rb +2 -2
- data/lib/upguard/UserList.rb +58 -0
- metadata +23 -4
@@ -0,0 +1,47 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class NodeGroupList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
return @inner_list.count
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](idx)
|
23
|
+
return @inner_list[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@inner_list.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def <<(obj)
|
35
|
+
@inner_list << obj
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
return @inner_list.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class NodeGroupUser < BaseObject
|
3
|
+
attr_accessor :email
|
4
|
+
attr_accessor :user_id
|
5
|
+
def from_hash(h)
|
6
|
+
self.email = h['email'] if h.include?('email')
|
7
|
+
self.user_id = h['user_id'] if h.include?('user_id')
|
8
|
+
end
|
9
|
+
def to_hash
|
10
|
+
h = {}
|
11
|
+
h['email'] = self.email
|
12
|
+
h['user_id'] = self.user_id
|
13
|
+
return h
|
14
|
+
end
|
15
|
+
def to_json(options = nil)
|
16
|
+
h = to_hash
|
17
|
+
return h.to_json(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class NodeGroupUserList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
return @inner_list.count
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](idx)
|
23
|
+
return @inner_list[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@inner_list.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def <<(obj)
|
35
|
+
@inner_list << obj
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
return @inner_list.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
def find_by_email(email)
|
47
|
+
@inner_list.each do |x|
|
48
|
+
if x.email == email
|
49
|
+
return x
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return nil
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class NodeList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
return @inner_list.count
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](idx)
|
23
|
+
return @inner_list[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@inner_list.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def <<(obj)
|
35
|
+
@inner_list << obj
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
return @inner_list.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
data/lib/upguard/NodeType.rb
CHANGED
@@ -18,14 +18,14 @@ module UpGuard
|
|
18
18
|
h['operating_system_family_id'] = self.operating_system_family_id
|
19
19
|
return h
|
20
20
|
end
|
21
|
-
def to_json
|
21
|
+
def to_json(options = nil)
|
22
22
|
h = to_hash
|
23
|
-
return h.to_json
|
23
|
+
return h.to_json(options)
|
24
24
|
end
|
25
25
|
|
26
26
|
def operating_system_family
|
27
27
|
obj = http_get("/api/v2/operating_system_families/#{self.operating_system_family_id}.json")
|
28
|
-
elem = OperatingSystemFamily.new(self.
|
28
|
+
elem = OperatingSystemFamily.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
29
29
|
elem.id = obj["id"]
|
30
30
|
elem.name = obj["name"]
|
31
31
|
return elem
|
@@ -12,21 +12,21 @@ module UpGuard
|
|
12
12
|
h['name'] = self.name
|
13
13
|
return h
|
14
14
|
end
|
15
|
-
def to_json
|
15
|
+
def to_json(options = nil)
|
16
16
|
h = to_hash
|
17
|
-
return h.to_json
|
17
|
+
return h.to_json(options)
|
18
18
|
end
|
19
19
|
|
20
20
|
def operating_systems
|
21
21
|
obj = http_get("/api/v2/operating_system_families/#{self.id}/operating_systems.json")
|
22
|
-
|
22
|
+
the_list = OperatingSystemList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
23
23
|
obj.each do |x|
|
24
|
-
elem = OperatingSystem.new(self.
|
25
|
-
elem.id = x["id"]
|
26
|
-
elem.name = x["name"]
|
27
|
-
|
24
|
+
elem = OperatingSystem.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
25
|
+
elem.id = x["id"] if x.include?("id")
|
26
|
+
elem.name = x["name"] if x.include?("name")
|
27
|
+
the_list << elem
|
28
28
|
end
|
29
|
-
return
|
29
|
+
return the_list
|
30
30
|
end
|
31
31
|
|
32
32
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class OperatingSystemFamilyList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
return @inner_list.count
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](idx)
|
23
|
+
return @inner_list[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@inner_list.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def <<(obj)
|
35
|
+
@inner_list << obj
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
return @inner_list.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class OperatingSystemList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
return @inner_list.count
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](idx)
|
23
|
+
return @inner_list[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@inner_list.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def <<(obj)
|
35
|
+
@inner_list << obj
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
return @inner_list.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class Policy < BaseObject
|
3
|
+
attr_accessor :id
|
4
|
+
attr_accessor :name
|
5
|
+
attr_accessor :short_description
|
6
|
+
attr_accessor :description
|
7
|
+
def from_hash(h)
|
8
|
+
self.id = h['id'] if h.include?('id')
|
9
|
+
self.name = h['name'] if h.include?('name')
|
10
|
+
self.short_description = h['short_description'] if h.include?('short_description')
|
11
|
+
self.description = h['description'] if h.include?('description')
|
12
|
+
end
|
13
|
+
def to_hash
|
14
|
+
h = {}
|
15
|
+
h['id'] = self.id
|
16
|
+
h['name'] = self.name
|
17
|
+
h['short_description'] = self.short_description
|
18
|
+
h['description'] = self.description
|
19
|
+
return h
|
20
|
+
end
|
21
|
+
def to_json(options = nil)
|
22
|
+
h = to_hash
|
23
|
+
return h.to_json(options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def load
|
27
|
+
obj = http_get("/api/v2/policies/#{self.id}.json")
|
28
|
+
from_hash(obj)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def save
|
33
|
+
if self.id.to_i == 0
|
34
|
+
return create
|
35
|
+
else
|
36
|
+
return update
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def create
|
42
|
+
h = to_hash
|
43
|
+
out = http_post("/api/v2/policies.json", h)
|
44
|
+
from_hash(out)
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def update
|
49
|
+
h = to_hash
|
50
|
+
http_put("/api/v2/policies/#{self.id}.json", h)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete
|
54
|
+
http_delete("/api/v2/policies/#{self.id}.json")
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def policy_versions
|
59
|
+
obj = http_get("/api/v2/policies/#{self.id}/versions.json")
|
60
|
+
the_list = PolicyVersionList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
61
|
+
obj.each do |x|
|
62
|
+
elem = PolicyVersion.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
63
|
+
elem.id = x["id"] if x.include?("id")
|
64
|
+
elem.version = x["version"] if x.include?("version")
|
65
|
+
elem.tag = x["tag"] if x.include?("tag")
|
66
|
+
the_list << elem
|
67
|
+
end
|
68
|
+
return the_list
|
69
|
+
end
|
70
|
+
|
71
|
+
def add_file_check(section, file_path, attr, check, expected, absent_pass=false)
|
72
|
+
url = "/api/v2/policies/#{self.id}/add_file_check.json?section=#{section}&file_path=#{file_path}&attr=#{attr}&check=#{check}&expected=#{expected}&absent_pass=#{absent_pass}"
|
73
|
+
obj = http_post(url, nil)
|
74
|
+
return obj
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class PolicyList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
return @inner_list.count
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](idx)
|
23
|
+
return @inner_list[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@inner_list.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def <<(obj)
|
35
|
+
@inner_list << obj
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def to_json
|
41
|
+
return @inner_list.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|