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