upguard 0.0.3 → 0.0.14
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 +5 -5
- data/lib/upguard.rb +25 -0
- data/lib/upguard/Account.rb +374 -129
- data/lib/upguard/BaseObject.rb +23 -22
- data/lib/upguard/ChangeRequest.rb +42 -0
- data/lib/upguard/ChangeRequestList.rb +52 -0
- data/lib/upguard/ConnectionManager.rb +18 -3
- data/lib/upguard/ConnectionManagerGroup.rb +31 -9
- data/lib/upguard/ConnectionManagerGroupList.rb +52 -0
- data/lib/upguard/ConnectionManagerList.rb +52 -0
- data/lib/upguard/Environment.rb +34 -11
- data/lib/upguard/EnvironmentList.rb +52 -0
- data/lib/upguard/Event.rb +6 -3
- data/lib/upguard/EventAction.rb +8 -2
- data/lib/upguard/EventActionList.rb +52 -0
- data/lib/upguard/EventList.rb +52 -0
- data/lib/upguard/EventVariables.rb +43 -0
- data/lib/upguard/ExternalEvent.rb +30 -0
- data/lib/upguard/Incident.rb +2 -2
- data/lib/upguard/IncidentList.rb +52 -0
- data/lib/upguard/Job.rb +60 -0
- data/lib/upguard/JobList.rb +52 -0
- data/lib/upguard/MediumType.rb +5 -2
- data/lib/upguard/Node.rb +63 -9
- data/lib/upguard/NodeGroup.rb +80 -8
- data/lib/upguard/NodeGroupList.rb +63 -0
- data/lib/upguard/NodeGroupUser.rb +21 -0
- data/lib/upguard/NodeGroupUserList.rb +63 -0
- data/lib/upguard/NodeList.rb +52 -0
- data/lib/upguard/NodeMediumInfo.rb +49 -0
- data/lib/upguard/NodeType.rb +12 -2
- data/lib/upguard/OperatingSystem.rb +3 -3
- data/lib/upguard/OperatingSystemFamily.rb +8 -8
- data/lib/upguard/OperatingSystemFamilyList.rb +52 -0
- data/lib/upguard/OperatingSystemList.rb +52 -0
- data/lib/upguard/Policy.rb +79 -0
- data/lib/upguard/PolicyList.rb +52 -0
- data/lib/upguard/ScheduledJob.rb +6 -3
- data/lib/upguard/ScheduledJobList.rb +52 -0
- data/lib/upguard/SystemMetric.rb +2 -2
- data/lib/upguard/SystemMetricList.rb +52 -0
- data/lib/upguard/User.rb +26 -2
- data/lib/upguard/UserList.rb +74 -0
- data/lib/upguard/Version.rb +21 -0
- metadata +35 -10
@@ -0,0 +1,52 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class EnvironmentList < 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
|
+
|
19
|
+
def [](idx)
|
20
|
+
return @inner_list[idx]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def each(&block)
|
31
|
+
@inner_list.each(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def <<(obj)
|
37
|
+
if obj.class.name != "Environment"
|
38
|
+
raise "Can only append 'Environment' to 'EnvironmentList'
|
39
|
+
end
|
40
|
+
@inner_list << obj
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def to_json
|
46
|
+
return @inner_list.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
data/lib/upguard/Event.rb
CHANGED
@@ -4,11 +4,13 @@ module UpGuard
|
|
4
4
|
attr_accessor :type_id
|
5
5
|
attr_accessor :environment_id
|
6
6
|
attr_accessor :created_at
|
7
|
+
attr_accessor :variables
|
7
8
|
def from_hash(h)
|
8
9
|
self.id = h['id'] if h.include?('id')
|
9
10
|
self.type_id = h['type_id'] if h.include?('type_id')
|
10
11
|
self.environment_id = h['environment_id'] if h.include?('environment_id')
|
11
12
|
self.created_at = h['created_at'] if h.include?('created_at')
|
13
|
+
self.variables = h['variables'] if h.include?('variables')
|
12
14
|
end
|
13
15
|
def to_hash
|
14
16
|
h = {}
|
@@ -16,16 +18,17 @@ module UpGuard
|
|
16
18
|
h['type_id'] = self.type_id
|
17
19
|
h['environment_id'] = self.environment_id
|
18
20
|
h['created_at'] = self.created_at
|
21
|
+
h['variables'] = self.variables
|
19
22
|
return h
|
20
23
|
end
|
21
|
-
def to_json
|
24
|
+
def to_json(options = nil)
|
22
25
|
h = to_hash
|
23
|
-
return h.to_json
|
26
|
+
return h.to_json(options)
|
24
27
|
end
|
25
28
|
|
26
29
|
def environment
|
27
30
|
obj = http_get("/api/v2/environments/#{self.environment_id}.json")
|
28
|
-
elem = Environment.new(self.
|
31
|
+
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
29
32
|
elem.id = obj["id"]
|
30
33
|
elem.name = obj["name"]
|
31
34
|
elem.organisation_id = obj["organisation_id"]
|
data/lib/upguard/EventAction.rb
CHANGED
@@ -4,11 +4,15 @@ module UpGuard
|
|
4
4
|
attr_accessor :name
|
5
5
|
attr_accessor :status
|
6
6
|
attr_accessor :type
|
7
|
+
attr_accessor :variables
|
8
|
+
attr_accessor :view
|
7
9
|
def from_hash(h)
|
8
10
|
self.id = h['id'] if h.include?('id')
|
9
11
|
self.name = h['name'] if h.include?('name')
|
10
12
|
self.status = h['status'] if h.include?('status')
|
11
13
|
self.type = h['type'] if h.include?('type')
|
14
|
+
self.variables = h['variables'] if h.include?('variables')
|
15
|
+
self.view = h['view'] if h.include?('view')
|
12
16
|
end
|
13
17
|
def to_hash
|
14
18
|
h = {}
|
@@ -16,11 +20,13 @@ module UpGuard
|
|
16
20
|
h['name'] = self.name
|
17
21
|
h['status'] = self.status
|
18
22
|
h['type'] = self.type
|
23
|
+
h['variables'] = self.variables
|
24
|
+
h['view'] = self.view
|
19
25
|
return h
|
20
26
|
end
|
21
|
-
def to_json
|
27
|
+
def to_json(options = nil)
|
22
28
|
h = to_hash
|
23
|
-
return h.to_json
|
29
|
+
return h.to_json(options)
|
24
30
|
end
|
25
31
|
|
26
32
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class EventActionList < 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
|
+
|
19
|
+
def [](idx)
|
20
|
+
return @inner_list[idx]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def each(&block)
|
31
|
+
@inner_list.each(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def <<(obj)
|
37
|
+
if obj.class.name != "EventAction"
|
38
|
+
raise "Can only append 'EventAction' to 'EventActionList'
|
39
|
+
end
|
40
|
+
@inner_list << obj
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def to_json
|
46
|
+
return @inner_list.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class EventList < 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
|
+
|
19
|
+
def [](idx)
|
20
|
+
return @inner_list[idx]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def each(&block)
|
31
|
+
@inner_list.each(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def <<(obj)
|
37
|
+
if obj.class.name != "Event"
|
38
|
+
raise "Can only append 'Event' to 'EventList'
|
39
|
+
end
|
40
|
+
@inner_list << obj
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def to_json
|
46
|
+
return @inner_list.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class EventVariables < 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_map = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def [](key)
|
20
|
+
return @inner_map[key]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def []=(key, value)
|
25
|
+
@inner_map[key] = value
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def to_json
|
31
|
+
return @inner_map.to_json
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def to_hash
|
37
|
+
return self.inner_map
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class ExternalEvent < BaseObject
|
3
|
+
attr_accessor :type
|
4
|
+
attr_accessor :variables
|
5
|
+
def from_hash(h)
|
6
|
+
self.type = h['type'] if h.include?('type')
|
7
|
+
self.variables = h['variables'] if h.include?('variables')
|
8
|
+
end
|
9
|
+
def to_hash
|
10
|
+
h = {}
|
11
|
+
h['type'] = self.type
|
12
|
+
h['variables'] = self.variables
|
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
|
+
def create
|
21
|
+
h = {}
|
22
|
+
h["variables"] = self.variables.to_hash
|
23
|
+
h["variables"]["type"] = self.type
|
24
|
+
http_post("/api/v2/events.json", h)
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/lib/upguard/Incident.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class IncidentList < 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
|
+
|
19
|
+
def [](idx)
|
20
|
+
return @inner_list[idx]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def each(&block)
|
31
|
+
@inner_list.each(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def <<(obj)
|
37
|
+
if obj.class.name != "Incident"
|
38
|
+
raise "Can only append 'Incident' to 'IncidentList'
|
39
|
+
end
|
40
|
+
@inner_list << obj
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def to_json
|
46
|
+
return @inner_list.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
data/lib/upguard/Job.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class Job < BaseObject
|
3
|
+
attr_accessor :id
|
4
|
+
attr_accessor :organisation_id
|
5
|
+
attr_accessor :source_id
|
6
|
+
attr_accessor :source_name
|
7
|
+
attr_accessor :source_type
|
8
|
+
attr_accessor :status
|
9
|
+
def from_hash(h)
|
10
|
+
self.id = h['id'] if h.include?('id')
|
11
|
+
self.organisation_id = h['organisation_id'] if h.include?('organisation_id')
|
12
|
+
self.source_id = h['source_id'] if h.include?('source_id')
|
13
|
+
self.source_name = h['source_name'] if h.include?('source_name')
|
14
|
+
self.source_type = h['source_type'] if h.include?('source_type')
|
15
|
+
self.status = h['status'] if h.include?('status')
|
16
|
+
end
|
17
|
+
def to_hash
|
18
|
+
h = {}
|
19
|
+
h['id'] = self.id
|
20
|
+
h['organisation_id'] = self.organisation_id
|
21
|
+
h['source_id'] = self.source_id
|
22
|
+
h['source_name'] = self.source_name
|
23
|
+
h['source_type'] = self.source_type
|
24
|
+
h['status'] = self.status
|
25
|
+
return h
|
26
|
+
end
|
27
|
+
def to_json(options = nil)
|
28
|
+
h = to_hash
|
29
|
+
return h.to_json(options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def tasks
|
33
|
+
obj = http_get("/api/v2/jobs/{job_id}/tasks.json")
|
34
|
+
the_list = TaskList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
35
|
+
obj.each do |x|
|
36
|
+
elem = Task.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
37
|
+
elem.agent_name = x["agent_name"] if x.include?("agent_name")
|
38
|
+
elem.connection_manager_id = x["connection_manager_id"] if x.include?("connection_manager_id")
|
39
|
+
elem.created_at = x["created_at"] if x.include?("created_at")
|
40
|
+
elem.id = x["id"] if x.include?("id")
|
41
|
+
elem.job_id = x["job_id"] if x.include?("job_id")
|
42
|
+
elem.label = x["label"] if x.include?("label")
|
43
|
+
elem.log = x["log"] if x.include?("log")
|
44
|
+
elem.node_id = x["node_id"] if x.include?("node_id")
|
45
|
+
elem.node_session_id = x["node_session_id"] if x.include?("node_session_id")
|
46
|
+
elem.payload = x["payload"] if x.include?("payload")
|
47
|
+
elem.report = x["report"] if x.include?("report")
|
48
|
+
elem.sequence = x["sequence"] if x.include?("sequence")
|
49
|
+
elem.status = x["status"] if x.include?("status")
|
50
|
+
elem.step_description = x["step_description"] if x.include?("step_description")
|
51
|
+
elem.updated_at = x["updated_at"] if x.include?("updated_at")
|
52
|
+
elem.uuid = x["uuid"] if x.include?("uuid")
|
53
|
+
the_list << elem
|
54
|
+
end
|
55
|
+
return the_list
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class JobList < 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
|
+
|
19
|
+
def [](idx)
|
20
|
+
return @inner_list[idx]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def each(&block)
|
31
|
+
@inner_list.each(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def <<(obj)
|
37
|
+
if obj.class.name != "Job"
|
38
|
+
raise "Can only append 'Job' to 'JobList'
|
39
|
+
end
|
40
|
+
@inner_list << obj
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def to_json
|
46
|
+
return @inner_list.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|