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
@@ -0,0 +1,53 @@
|
|
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 ["Incident", "UpGuard::Incident"].include?(obj.class.name)
|
38
|
+
@inner_list << obj
|
39
|
+
else
|
40
|
+
raise "Can only append 'Incident' to 'IncidentList'"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
def to_json
|
47
|
+
return @inner_list.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
data/lib/upguard/Job.rb
ADDED
@@ -0,0 +1,70 @@
|
|
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 initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
10
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
11
|
+
self.id = nil
|
12
|
+
self.organisation_id = nil
|
13
|
+
self.source_id = nil
|
14
|
+
self.source_name = nil
|
15
|
+
self.source_type = nil
|
16
|
+
self.status = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def from_hash(h)
|
20
|
+
self.id = h['id'] if h.include?('id')
|
21
|
+
self.organisation_id = h['organisation_id'] if h.include?('organisation_id')
|
22
|
+
self.source_id = h['source_id'] if h.include?('source_id')
|
23
|
+
self.source_name = h['source_name'] if h.include?('source_name')
|
24
|
+
self.source_type = h['source_type'] if h.include?('source_type')
|
25
|
+
self.status = h['status'] if h.include?('status')
|
26
|
+
end
|
27
|
+
def to_hash
|
28
|
+
h = {}
|
29
|
+
h['id'] = self.id
|
30
|
+
h['organisation_id'] = self.organisation_id
|
31
|
+
h['source_id'] = self.source_id
|
32
|
+
h['source_name'] = self.source_name
|
33
|
+
h['source_type'] = self.source_type
|
34
|
+
h['status'] = self.status
|
35
|
+
return h
|
36
|
+
end
|
37
|
+
def to_json(options = nil)
|
38
|
+
h = to_hash
|
39
|
+
return h.to_json(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def tasks
|
43
|
+
obj = http_get("/api/v2/jobs/{job_id}/tasks.json")
|
44
|
+
the_list = TaskList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
45
|
+
obj.each do |x|
|
46
|
+
elem = Task.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
47
|
+
elem.agent_name = x["agent_name"] if x.include?("agent_name")
|
48
|
+
elem.connection_manager_id = x["connection_manager_id"] if x.include?("connection_manager_id")
|
49
|
+
elem.created_at = x["created_at"] if x.include?("created_at")
|
50
|
+
elem.id = x["id"] if x.include?("id")
|
51
|
+
elem.job_id = x["job_id"] if x.include?("job_id")
|
52
|
+
elem.label = x["label"] if x.include?("label")
|
53
|
+
elem.log = x["log"] if x.include?("log")
|
54
|
+
elem.node_id = x["node_id"] if x.include?("node_id")
|
55
|
+
elem.node_session_id = x["node_session_id"] if x.include?("node_session_id")
|
56
|
+
elem.payload = x["payload"] if x.include?("payload")
|
57
|
+
elem.report = x["report"] if x.include?("report")
|
58
|
+
elem.sequence = x["sequence"] if x.include?("sequence")
|
59
|
+
elem.status = x["status"] if x.include?("status")
|
60
|
+
elem.step_description = x["step_description"] if x.include?("step_description")
|
61
|
+
elem.updated_at = x["updated_at"] if x.include?("updated_at")
|
62
|
+
elem.uuid = x["uuid"] if x.include?("uuid")
|
63
|
+
the_list << elem
|
64
|
+
end
|
65
|
+
return the_list
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,53 @@
|
|
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 ["Job", "UpGuard::Job"].include?(obj.class.name)
|
38
|
+
@inner_list << obj
|
39
|
+
else
|
40
|
+
raise "Can only append 'Job' to 'JobList'"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
def to_json
|
47
|
+
return @inner_list.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
data/lib/upguard/MediumType.rb
CHANGED
data/lib/upguard/Node.rb
CHANGED
@@ -3,45 +3,92 @@ module UpGuard
|
|
3
3
|
attr_accessor :connection_manager_group_id
|
4
4
|
attr_accessor :environment_id
|
5
5
|
attr_accessor :external_id
|
6
|
-
attr_accessor :hostname
|
7
6
|
attr_accessor :id
|
7
|
+
attr_accessor :ip_address
|
8
|
+
attr_accessor :last_scan_status
|
9
|
+
attr_accessor :last_scan_status_string
|
10
|
+
attr_accessor :mac_address
|
8
11
|
attr_accessor :medium_hostname
|
12
|
+
attr_accessor :medium_info
|
13
|
+
attr_accessor :medium_port
|
9
14
|
attr_accessor :medium_type
|
15
|
+
attr_accessor :medium_username
|
10
16
|
attr_accessor :name
|
11
17
|
attr_accessor :node_type
|
18
|
+
attr_accessor :online
|
12
19
|
attr_accessor :operating_system_family_id
|
13
20
|
attr_accessor :operating_system_id
|
21
|
+
attr_accessor :short_description
|
22
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
23
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
24
|
+
self.connection_manager_group_id = nil
|
25
|
+
self.environment_id = nil
|
26
|
+
self.external_id = nil
|
27
|
+
self.id = nil
|
28
|
+
self.ip_address = nil
|
29
|
+
self.last_scan_status = nil
|
30
|
+
self.last_scan_status_string = nil
|
31
|
+
self.mac_address = nil
|
32
|
+
self.medium_hostname = nil
|
33
|
+
self.medium_info = NodeMediumInfo.new(appliance_url, appliance_api_key, sec_key, insecure)
|
34
|
+
self.medium_port = nil
|
35
|
+
self.medium_type = nil
|
36
|
+
self.medium_username = nil
|
37
|
+
self.name = nil
|
38
|
+
self.node_type = nil
|
39
|
+
self.online = nil
|
40
|
+
self.operating_system_family_id = nil
|
41
|
+
self.operating_system_id = nil
|
42
|
+
self.short_description = nil
|
43
|
+
end
|
44
|
+
|
14
45
|
def from_hash(h)
|
15
46
|
self.connection_manager_group_id = h['connection_manager_group_id'] if h.include?('connection_manager_group_id')
|
16
47
|
self.environment_id = h['environment_id'] if h.include?('environment_id')
|
17
48
|
self.external_id = h['external_id'] if h.include?('external_id')
|
18
|
-
self.hostname = h['hostname'] if h.include?('hostname')
|
19
49
|
self.id = h['id'] if h.include?('id')
|
50
|
+
self.ip_address = h['ip_address'] if h.include?('ip_address')
|
51
|
+
self.last_scan_status = h['last_scan_status'] if h.include?('last_scan_status')
|
52
|
+
self.last_scan_status_string = h['last_scan_status_string'] if h.include?('last_scan_status_string')
|
53
|
+
self.mac_address = h['mac_address'] if h.include?('mac_address')
|
20
54
|
self.medium_hostname = h['medium_hostname'] if h.include?('medium_hostname')
|
55
|
+
self.medium_info = h['medium_info'] if h.include?('medium_info')
|
56
|
+
self.medium_port = h['medium_port'] if h.include?('medium_port')
|
21
57
|
self.medium_type = h['medium_type'] if h.include?('medium_type')
|
58
|
+
self.medium_username = h['medium_username'] if h.include?('medium_username')
|
22
59
|
self.name = h['name'] if h.include?('name')
|
23
60
|
self.node_type = h['node_type'] if h.include?('node_type')
|
61
|
+
self.online = h['online'] if h.include?('online')
|
24
62
|
self.operating_system_family_id = h['operating_system_family_id'] if h.include?('operating_system_family_id')
|
25
63
|
self.operating_system_id = h['operating_system_id'] if h.include?('operating_system_id')
|
64
|
+
self.short_description = h['short_description'] if h.include?('short_description')
|
26
65
|
end
|
27
66
|
def to_hash
|
28
67
|
h = {}
|
29
68
|
h['connection_manager_group_id'] = self.connection_manager_group_id
|
30
69
|
h['environment_id'] = self.environment_id
|
31
70
|
h['external_id'] = self.external_id
|
32
|
-
h['hostname'] = self.hostname
|
33
71
|
h['id'] = self.id
|
72
|
+
h['ip_address'] = self.ip_address
|
73
|
+
h['last_scan_status'] = self.last_scan_status
|
74
|
+
h['last_scan_status_string'] = self.last_scan_status_string
|
75
|
+
h['mac_address'] = self.mac_address
|
34
76
|
h['medium_hostname'] = self.medium_hostname
|
77
|
+
h['medium_info'] = self.medium_info
|
78
|
+
h['medium_port'] = self.medium_port
|
35
79
|
h['medium_type'] = self.medium_type
|
80
|
+
h['medium_username'] = self.medium_username
|
36
81
|
h['name'] = self.name
|
37
82
|
h['node_type'] = self.node_type
|
83
|
+
h['online'] = self.online
|
38
84
|
h['operating_system_family_id'] = self.operating_system_family_id
|
39
85
|
h['operating_system_id'] = self.operating_system_id
|
86
|
+
h['short_description'] = self.short_description
|
40
87
|
return h
|
41
88
|
end
|
42
|
-
def to_json
|
89
|
+
def to_json(options = nil)
|
43
90
|
h = to_hash
|
44
|
-
return h.to_json
|
91
|
+
return h.to_json(options)
|
45
92
|
end
|
46
93
|
|
47
94
|
def load
|
@@ -79,7 +126,7 @@ module UpGuard
|
|
79
126
|
|
80
127
|
def connection_manager_group
|
81
128
|
obj = http_get("/api/v2/connection_manager_groups/{connection_manager_group_id}.json")
|
82
|
-
elem = ConnectionManagerGroup.new(self.
|
129
|
+
elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
83
130
|
elem.id = obj["id"]
|
84
131
|
elem.name = obj["name"]
|
85
132
|
return elem
|
@@ -88,7 +135,7 @@ module UpGuard
|
|
88
135
|
|
89
136
|
def environment
|
90
137
|
obj = http_get("/api/v2/environments/#{self.environment_id}.json")
|
91
|
-
elem = Environment.new(self.
|
138
|
+
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
92
139
|
elem.id = obj["id"]
|
93
140
|
elem.name = obj["name"]
|
94
141
|
return elem
|
@@ -97,7 +144,7 @@ module UpGuard
|
|
97
144
|
|
98
145
|
def operating_system
|
99
146
|
obj = http_get("/api/v2/operating_systems/#{self.operating_system_id}.json")
|
100
|
-
elem = OperatingSystem.new(self.
|
147
|
+
elem = OperatingSystem.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
101
148
|
elem.id = obj["id"]
|
102
149
|
elem.name = obj["name"]
|
103
150
|
return elem
|
@@ -106,7 +153,7 @@ module UpGuard
|
|
106
153
|
|
107
154
|
def operating_system_family
|
108
155
|
obj = http_get("/api/v2/operating_system_families/#{self.operating_system_family_id}.json")
|
109
|
-
elem = OperatingSystemFamily.new(self.
|
156
|
+
elem = OperatingSystemFamily.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
110
157
|
elem.id = obj["id"]
|
111
158
|
elem.name = obj["name"]
|
112
159
|
return elem
|
@@ -118,6 +165,36 @@ module UpGuard
|
|
118
165
|
return obj
|
119
166
|
end
|
120
167
|
|
168
|
+
|
169
|
+
def node_groups
|
170
|
+
obj = http_get("/api/v2/nodes/#{self.id}/node_groups.json")
|
171
|
+
the_list = NodeGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
172
|
+
obj.each do |x|
|
173
|
+
elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
174
|
+
elem.id = x["id"] if x.include?("id")
|
175
|
+
elem.name = x["name"] if x.include?("name")
|
176
|
+
elem.description = x["description"] if x.include?("description")
|
177
|
+
elem.node_rules = x["node_rules"] if x.include?("node_rules")
|
178
|
+
the_list << elem
|
179
|
+
end
|
180
|
+
return the_list
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
def raw_files
|
185
|
+
obj = http_get("/api/v2/nodes/#{self.id}/raw_files.json")
|
186
|
+
the_list = RawFileList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
187
|
+
obj.each do |x|
|
188
|
+
elem = RawFile.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
189
|
+
elem.id = x["id"] if x.include?("id")
|
190
|
+
elem.node_scan_id = x["node_scan_id"] if x.include?("node_scan_id")
|
191
|
+
elem.created_at = x["created_at"] if x.include?("created_at")
|
192
|
+
elem.updated_at = x["updated_at"] if x.include?("updated_at")
|
193
|
+
the_list << elem
|
194
|
+
end
|
195
|
+
return the_list
|
196
|
+
end
|
197
|
+
|
121
198
|
|
122
199
|
end
|
123
200
|
end
|
data/lib/upguard/NodeGroup.rb
CHANGED
@@ -1,20 +1,70 @@
|
|
1
1
|
module UpGuard
|
2
2
|
class NodeGroup < BaseObject
|
3
|
+
attr_accessor :created_at
|
4
|
+
attr_accessor :created_by
|
5
|
+
attr_accessor :description
|
6
|
+
attr_accessor :diff_notify
|
7
|
+
attr_accessor :external_id
|
3
8
|
attr_accessor :id
|
4
9
|
attr_accessor :name
|
10
|
+
attr_accessor :node_rules
|
11
|
+
attr_accessor :scan_options
|
12
|
+
attr_accessor :search_query
|
13
|
+
attr_accessor :status
|
14
|
+
attr_accessor :updated_at
|
15
|
+
attr_accessor :updated_by
|
16
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
17
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
18
|
+
self.created_at = nil
|
19
|
+
self.created_by = nil
|
20
|
+
self.description = nil
|
21
|
+
self.diff_notify = nil
|
22
|
+
self.external_id = nil
|
23
|
+
self.id = nil
|
24
|
+
self.name = nil
|
25
|
+
self.node_rules = nil
|
26
|
+
self.scan_options = nil
|
27
|
+
self.search_query = nil
|
28
|
+
self.status = nil
|
29
|
+
self.updated_at = nil
|
30
|
+
self.updated_by = nil
|
31
|
+
end
|
32
|
+
|
5
33
|
def from_hash(h)
|
34
|
+
self.created_at = h['created_at'] if h.include?('created_at')
|
35
|
+
self.created_by = h['created_by'] if h.include?('created_by')
|
36
|
+
self.description = h['description'] if h.include?('description')
|
37
|
+
self.diff_notify = h['diff_notify'] if h.include?('diff_notify')
|
38
|
+
self.external_id = h['external_id'] if h.include?('external_id')
|
6
39
|
self.id = h['id'] if h.include?('id')
|
7
40
|
self.name = h['name'] if h.include?('name')
|
41
|
+
self.node_rules = h['node_rules'] if h.include?('node_rules')
|
42
|
+
self.scan_options = h['scan_options'] if h.include?('scan_options')
|
43
|
+
self.search_query = h['search_query'] if h.include?('search_query')
|
44
|
+
self.status = h['status'] if h.include?('status')
|
45
|
+
self.updated_at = h['updated_at'] if h.include?('updated_at')
|
46
|
+
self.updated_by = h['updated_by'] if h.include?('updated_by')
|
8
47
|
end
|
9
48
|
def to_hash
|
10
49
|
h = {}
|
50
|
+
h['created_at'] = self.created_at
|
51
|
+
h['created_by'] = self.created_by
|
52
|
+
h['description'] = self.description
|
53
|
+
h['diff_notify'] = self.diff_notify
|
54
|
+
h['external_id'] = self.external_id
|
11
55
|
h['id'] = self.id
|
12
56
|
h['name'] = self.name
|
57
|
+
h['node_rules'] = self.node_rules
|
58
|
+
h['scan_options'] = self.scan_options
|
59
|
+
h['search_query'] = self.search_query
|
60
|
+
h['status'] = self.status
|
61
|
+
h['updated_at'] = self.updated_at
|
62
|
+
h['updated_by'] = self.updated_by
|
13
63
|
return h
|
14
64
|
end
|
15
|
-
def to_json
|
65
|
+
def to_json(options = nil)
|
16
66
|
h = to_hash
|
17
|
-
return h.to_json
|
67
|
+
return h.to_json(options)
|
18
68
|
end
|
19
69
|
|
20
70
|
def load
|
@@ -51,14 +101,53 @@ module UpGuard
|
|
51
101
|
|
52
102
|
def nodes
|
53
103
|
obj = http_get("/api/v2/node_groups/#{self.id}/nodes.json")
|
54
|
-
|
104
|
+
the_list = NodeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
105
|
+
obj.each do |x|
|
106
|
+
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
107
|
+
elem.id = x["id"] if x.include?("id")
|
108
|
+
elem.name = x["name"] if x.include?("name")
|
109
|
+
the_list << elem
|
110
|
+
end
|
111
|
+
return the_list
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
def policy_versions
|
116
|
+
obj = http_get("/api/v2/node_groups/#{self.id}/policy_versions.json")
|
117
|
+
the_list = PolicyVersionList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
118
|
+
obj.each do |x|
|
119
|
+
elem = PolicyVersion.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
120
|
+
elem.id = x["id"] if x.include?("id")
|
121
|
+
elem.name = x["name"] if x.include?("name")
|
122
|
+
elem.version = x["version"] if x.include?("version")
|
123
|
+
the_list << elem
|
124
|
+
end
|
125
|
+
return the_list
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def users
|
130
|
+
obj = http_get("/api/v2/node_groups/#{self.id}/users.json")
|
131
|
+
the_list = NodeGroupUserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
55
132
|
obj.each do |x|
|
56
|
-
elem =
|
57
|
-
elem.
|
58
|
-
elem.
|
59
|
-
|
133
|
+
elem = NodeGroupUser.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
134
|
+
elem.email = x["email"] if x.include?("email")
|
135
|
+
elem.user_id = x["user_id"] if x.include?("user_id")
|
136
|
+
the_list << elem
|
60
137
|
end
|
61
|
-
return
|
138
|
+
return the_list
|
139
|
+
end
|
140
|
+
|
141
|
+
def add_user(user_id)
|
142
|
+
url = "/api/v2/node_groups/#{self.id}/add_users.json?user_id=#{user_id}"
|
143
|
+
obj = http_post(url, nil)
|
144
|
+
return obj
|
145
|
+
end
|
146
|
+
|
147
|
+
def remove_user(user_id)
|
148
|
+
url = "/api/v2/node_groups/#{self.id}/remove_user.json?user_id=#{user_id}"
|
149
|
+
obj = http_put(url, nil)
|
150
|
+
return obj
|
62
151
|
end
|
63
152
|
|
64
153
|
|