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
data/lib/upguard/SystemMetric.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class SystemMetricList < 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 != "SystemMetric"
|
38
|
+
raise "Can only append 'SystemMetric' to 'SystemMetricList'
|
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/User.rb
CHANGED
@@ -8,6 +8,7 @@ module UpGuard
|
|
8
8
|
attr_accessor :invited
|
9
9
|
attr_accessor :last_sign_in_at
|
10
10
|
attr_accessor :expiry
|
11
|
+
attr_accessor :external_id
|
11
12
|
def from_hash(h)
|
12
13
|
self.id = h['id'] if h.include?('id')
|
13
14
|
self.name = h['name'] if h.include?('name')
|
@@ -17,6 +18,7 @@ module UpGuard
|
|
17
18
|
self.invited = h['invited'] if h.include?('invited')
|
18
19
|
self.last_sign_in_at = h['last_sign_in_at'] if h.include?('last_sign_in_at')
|
19
20
|
self.expiry = h['expiry'] if h.include?('expiry')
|
21
|
+
self.external_id = h['external_id'] if h.include?('external_id')
|
20
22
|
end
|
21
23
|
def to_hash
|
22
24
|
h = {}
|
@@ -28,11 +30,12 @@ module UpGuard
|
|
28
30
|
h['invited'] = self.invited
|
29
31
|
h['last_sign_in_at'] = self.last_sign_in_at
|
30
32
|
h['expiry'] = self.expiry
|
33
|
+
h['external_id'] = self.external_id
|
31
34
|
return h
|
32
35
|
end
|
33
|
-
def to_json
|
36
|
+
def to_json(options = nil)
|
34
37
|
h = to_hash
|
35
|
-
return h.to_json
|
38
|
+
return h.to_json(options)
|
36
39
|
end
|
37
40
|
def update_role(role)
|
38
41
|
url = "/api/v2/users/update_role.json?role=#{role}"
|
@@ -40,6 +43,27 @@ module UpGuard
|
|
40
43
|
return obj
|
41
44
|
end
|
42
45
|
|
46
|
+
|
47
|
+
def save
|
48
|
+
if self.id.to_i == 0
|
49
|
+
raise "Cannot create a User"
|
50
|
+
else
|
51
|
+
return update
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def update
|
57
|
+
h = to_hash
|
58
|
+
h.delete("id")
|
59
|
+
h.delete("email")
|
60
|
+
h.delete("role")
|
61
|
+
h.delete("invited")
|
62
|
+
h.delete("last_sign_in_at")
|
63
|
+
h.delete("expiry")
|
64
|
+
http_put("/api/v2/users/#{self.id}.json", h)
|
65
|
+
end
|
66
|
+
|
43
67
|
|
44
68
|
end
|
45
69
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class UserList < 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 != "User"
|
38
|
+
raise "Can only append 'User' to 'UserList'
|
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
|
+
def find_by_id(id)
|
52
|
+
@inner_list.each do |x|
|
53
|
+
if x.id.to_s == id.to_s
|
54
|
+
return x
|
55
|
+
end
|
56
|
+
end
|
57
|
+
return nil
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
def find_by_email(email)
|
63
|
+
@inner_list.each do |x|
|
64
|
+
if x.email == email
|
65
|
+
return x
|
66
|
+
end
|
67
|
+
end
|
68
|
+
return nil
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class Version < 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
|
+
|
14
|
+
def version
|
15
|
+
return "0.0.14"
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upguard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- UpGuard Inc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- support@upguard.com
|
44
44
|
executables: []
|
@@ -48,25 +48,50 @@ files:
|
|
48
48
|
- lib/upguard.rb
|
49
49
|
- lib/upguard/Account.rb
|
50
50
|
- lib/upguard/BaseObject.rb
|
51
|
+
- lib/upguard/ChangeRequest.rb
|
52
|
+
- lib/upguard/ChangeRequestList.rb
|
51
53
|
- lib/upguard/ConnectionManager.rb
|
52
54
|
- lib/upguard/ConnectionManagerGroup.rb
|
55
|
+
- lib/upguard/ConnectionManagerGroupList.rb
|
56
|
+
- lib/upguard/ConnectionManagerList.rb
|
53
57
|
- lib/upguard/Environment.rb
|
58
|
+
- lib/upguard/EnvironmentList.rb
|
54
59
|
- lib/upguard/Event.rb
|
55
60
|
- lib/upguard/EventAction.rb
|
61
|
+
- lib/upguard/EventActionList.rb
|
62
|
+
- lib/upguard/EventList.rb
|
63
|
+
- lib/upguard/EventVariables.rb
|
64
|
+
- lib/upguard/ExternalEvent.rb
|
56
65
|
- lib/upguard/Incident.rb
|
66
|
+
- lib/upguard/IncidentList.rb
|
67
|
+
- lib/upguard/Job.rb
|
68
|
+
- lib/upguard/JobList.rb
|
57
69
|
- lib/upguard/MediumType.rb
|
58
70
|
- lib/upguard/Node.rb
|
59
71
|
- lib/upguard/NodeGroup.rb
|
72
|
+
- lib/upguard/NodeGroupList.rb
|
73
|
+
- lib/upguard/NodeGroupUser.rb
|
74
|
+
- lib/upguard/NodeGroupUserList.rb
|
75
|
+
- lib/upguard/NodeList.rb
|
76
|
+
- lib/upguard/NodeMediumInfo.rb
|
60
77
|
- lib/upguard/NodeType.rb
|
61
78
|
- lib/upguard/OperatingSystem.rb
|
62
79
|
- lib/upguard/OperatingSystemFamily.rb
|
80
|
+
- lib/upguard/OperatingSystemFamilyList.rb
|
81
|
+
- lib/upguard/OperatingSystemList.rb
|
82
|
+
- lib/upguard/Policy.rb
|
83
|
+
- lib/upguard/PolicyList.rb
|
63
84
|
- lib/upguard/ScheduledJob.rb
|
85
|
+
- lib/upguard/ScheduledJobList.rb
|
64
86
|
- lib/upguard/SystemMetric.rb
|
87
|
+
- lib/upguard/SystemMetricList.rb
|
65
88
|
- lib/upguard/User.rb
|
66
|
-
|
89
|
+
- lib/upguard/UserList.rb
|
90
|
+
- lib/upguard/Version.rb
|
91
|
+
homepage: https://www.upguard.com
|
67
92
|
licenses: []
|
68
93
|
metadata: {}
|
69
|
-
post_install_message:
|
94
|
+
post_install_message:
|
70
95
|
rdoc_options: []
|
71
96
|
require_paths:
|
72
97
|
- lib
|
@@ -81,9 +106,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
106
|
- !ruby/object:Gem::Version
|
82
107
|
version: '0'
|
83
108
|
requirements: []
|
84
|
-
rubyforge_project:
|
85
|
-
rubygems_version: 2.6.
|
86
|
-
signing_key:
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.7.6.2
|
111
|
+
signing_key:
|
87
112
|
specification_version: 4
|
88
|
-
summary: UpGuard SDK for Ruby
|
113
|
+
summary: UpGuard Core SDK for Ruby
|
89
114
|
test_files: []
|