upguard 0.0.10 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,4 +1,7 @@
1
1
  ---
2
+ SHA256:
3
+ metadata.gz: 02c8e4f7f0d117e6f9f7e396b7188c7f0a75221dd4ba8bea61633e3405e3e56a
4
+ data.tar.gz: 610294a9da4ecbd52eacba9b92c0b6eed17e38a10d0531955e9dd435fed5b53c
2
5
  SHA512:
3
- metadata.gz: 73a3f8cdabc58e33984017a37b30cf51a019be1fa5c97ce1697a083c464dc5ec990f1daf59d4db8c1930a07153baafbd9ffb3251206fe85b432c1b71b11e7e12
4
- data.tar.gz: f23fe2899775985d9d55041ba81ae53c38fe07df39718a3e56f5a7d2e2bc354585bc0cba59291f4793a815bb1a88f9b378c0a5c26dda51cc971043a484a4dec5
6
+ metadata.gz: 80857243f93931a9d59229f966a3c997a790c03a923112d3b26425106cae64832eb0778cbf3c70ffb24464f74f0f715ae31f22138744acf45add1877435d1aa7
7
+ data.tar.gz: 6cdb09dffdeeb6c662442b676c14fe94b85648d9bf9df928689860a268f08171f94105585434792e62632e06eaf82467a05a373dbfcebddcad7efa5db96d08f9
@@ -1,13 +1,18 @@
1
1
  require_relative 'upguard/BaseObject'
2
2
  require_relative 'upguard/Version'
3
3
  require_relative 'upguard/Account'
4
+ require_relative 'upguard/ChangeRequest'
5
+ require_relative 'upguard/ChangeRequestList'
4
6
  require_relative 'upguard/ConnectionManager'
5
7
  require_relative 'upguard/ConnectionManagerList'
6
8
  require_relative 'upguard/ConnectionManagerGroup'
7
9
  require_relative 'upguard/ConnectionManagerGroupList'
8
10
  require_relative 'upguard/Environment'
9
11
  require_relative 'upguard/EnvironmentList'
12
+ require_relative 'upguard/ExternalEvent'
10
13
  require_relative 'upguard/Event'
14
+ require_relative 'upguard/EventList'
15
+ require_relative 'upguard/EventVariables'
11
16
  require_relative 'upguard/EventAction'
12
17
  require_relative 'upguard/EventActionList'
13
18
  require_relative 'upguard/Incident'
@@ -21,6 +26,7 @@ require_relative 'upguard/NodeGroup'
21
26
  require_relative 'upguard/NodeGroupList'
22
27
  require_relative 'upguard/NodeGroupUser'
23
28
  require_relative 'upguard/NodeGroupUserList'
29
+ require_relative 'upguard/NodeMediumInfo'
24
30
  require_relative 'upguard/NodeType'
25
31
  require_relative 'upguard/OperatingSystem'
26
32
  require_relative 'upguard/OperatingSystemList'
@@ -115,6 +115,10 @@ module UpGuard
115
115
  return the_list
116
116
  end
117
117
 
118
+ def new_external_event
119
+ return ExternalEvent.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
120
+ end
121
+
118
122
  def events_with_view_name(view_name)
119
123
  url = "/api/v2/events.json?view_name=#{view_name}"
120
124
  obj = http_get(url)
@@ -252,18 +256,25 @@ module UpGuard
252
256
  the_list = NodeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
253
257
  obj.each do |x|
254
258
  elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
259
+ elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
255
260
  elem.external_id = x["external_id"] if x.include?("external_id")
256
261
  elem.environment_id = x["environment_id"] if x.include?("environment_id")
257
262
  elem.id = x["id"] if x.include?("id")
263
+ elem.ip_address = x["ip_address"] if x.include?("ip_address")
258
264
  elem.last_scan_status = x["last_scan_status"] if x.include?("last_scan_status")
259
265
  elem.last_scan_status_string = x["last_scan_status_string"] if x.include?("last_scan_status_string")
260
266
  elem.mac_address = x["mac_address"] if x.include?("mac_address")
267
+ elem.medium_hostname = x["medium_hostname"] if x.include?("medium_hostname")
268
+ elem.medium_port = x["medium_port"] if x.include?("medium_port")
269
+ elem.medium_type = x["medium_type"] if x.include?("medium_type")
270
+ elem.medium_username = x["medium_username"] if x.include?("medium_username")
261
271
  elem.name = x["name"] if x.include?("name")
262
272
  elem.node_type = x["node_type"] if x.include?("node_type")
263
273
  elem.online = x["online"] if x.include?("online")
264
274
  elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
265
275
  elem.operating_system_id = x["operating_system_id"] if x.include?("operating_system_id")
266
276
  elem.short_description = x["short_description"] if x.include?("short_description")
277
+ elem.medium_info.from_dict(x["medium_info"]) if x.include?("medium_info")
267
278
  the_list << elem
268
279
  end
269
280
  return the_list
@@ -327,6 +338,16 @@ module UpGuard
327
338
  return elem
328
339
  end
329
340
 
341
+ def node_group_by_name(name)
342
+ url = "/api/v2/node_groups/lookup.json?name=#{name}"
343
+ obj = http_get(url)
344
+ id = obj["node_group_id"]
345
+ elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
346
+ elem.id = id
347
+ elem.load
348
+ return elem
349
+ end
350
+
330
351
 
331
352
  def node_scan_by_id(id)
332
353
  obj = http_get("/api/v2/node_scans/#{id}.json")
@@ -455,6 +476,26 @@ module UpGuard
455
476
  return the_list
456
477
  end
457
478
 
479
+
480
+ def users_and_invitees
481
+ obj = http_get("/api/v2/users.json?invited=true")
482
+ the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
483
+ obj.each do |x|
484
+ elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
485
+ elem.email = x["email"] if x.include?("email")
486
+ elem.expiry = x["expiry"] if x.include?("expiry")
487
+ elem.id = x["id"] if x.include?("id")
488
+ elem.invited = x["invited"] if x.include?("invited")
489
+ elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
490
+ elem.name = x["name"] if x.include?("name")
491
+ elem.role = x["role"] if x.include?("role")
492
+ elem.surname = x["surname"] if x.include?("surname")
493
+ elem.external_id = x["external_id"] if x.include?("external_id")
494
+ the_list << elem
495
+ end
496
+ return the_list
497
+ end
498
+
458
499
  def invite_user(email, role)
459
500
  url = "/api/v2/users/invite.json?email=#{email}&role=#{role}"
460
501
  obj = http_post(url, nil)
@@ -0,0 +1,42 @@
1
+ module UpGuard
2
+ class ChangeRequest < BaseObject
3
+ attr_accessor :data
4
+ attr_accessor :ended_at
5
+ attr_accessor :external_id
6
+ attr_accessor :id
7
+ attr_accessor :planned_end_at
8
+ attr_accessor :planned_start_at
9
+ attr_accessor :short_description
10
+ attr_accessor :started_at
11
+ attr_accessor :url
12
+ def from_hash(h)
13
+ self.data = h['data'] if h.include?('data')
14
+ self.ended_at = h['ended_at'] if h.include?('ended_at')
15
+ self.external_id = h['external_id'] if h.include?('external_id')
16
+ self.id = h['id'] if h.include?('id')
17
+ self.planned_end_at = h['planned_end_at'] if h.include?('planned_end_at')
18
+ self.planned_start_at = h['planned_start_at'] if h.include?('planned_start_at')
19
+ self.short_description = h['short_description'] if h.include?('short_description')
20
+ self.started_at = h['started_at'] if h.include?('started_at')
21
+ self.url = h['url'] if h.include?('url')
22
+ end
23
+ def to_hash
24
+ h = {}
25
+ h['data'] = self.data
26
+ h['ended_at'] = self.ended_at
27
+ h['external_id'] = self.external_id
28
+ h['id'] = self.id
29
+ h['planned_end_at'] = self.planned_end_at
30
+ h['planned_start_at'] = self.planned_start_at
31
+ h['short_description'] = self.short_description
32
+ h['started_at'] = self.started_at
33
+ h['url'] = self.url
34
+ return h
35
+ end
36
+ def to_json(options = nil)
37
+ h = to_hash
38
+ return h.to_json(options)
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,52 @@
1
+ module UpGuard
2
+ class ChangeRequestList < 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 != "ChangeRequest"
38
+ raise "Can only append 'ChangeRequest' to 'ChangeRequestList'
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
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "ConnectionManagerGroup"
38
+ raise "Can only append 'ConnectionManagerGroup' to 'ConnectionManagerGroupList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "ConnectionManager"
38
+ raise "Can only append 'ConnectionManager' to 'ConnectionManagerList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "Environment"
38
+ raise "Can only append 'Environment' to 'EnvironmentList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -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,6 +18,7 @@ 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
24
  def to_json(options = nil)
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "EventAction"
38
+ raise "Can only append 'EventAction' to 'EventActionList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -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
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "Incident"
38
+ raise "Can only append 'Incident' to 'IncidentList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "Job"
38
+ raise "Can only append 'Job' to 'JobList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -10,7 +10,10 @@ module UpGuard
10
10
  h = to_hash
11
11
  return h.to_json(options)
12
12
  end
13
+ AGENT = 1
13
14
  SSH = 3
15
+ WINRM = 7
16
+ DATABASE = 11
14
17
 
15
18
  end
16
19
  end
@@ -1,5 +1,6 @@
1
1
  module UpGuard
2
2
  class Node < BaseObject
3
+ attr_accessor :connection_manager_group_id
3
4
  attr_accessor :environment_id
4
5
  attr_accessor :external_id
5
6
  attr_accessor :id
@@ -7,6 +8,11 @@ module UpGuard
7
8
  attr_accessor :last_scan_status
8
9
  attr_accessor :last_scan_status_string
9
10
  attr_accessor :mac_address
11
+ attr_accessor :medium_hostname
12
+ attr_accessor :medium_info
13
+ attr_accessor :medium_port
14
+ attr_accessor :medium_type
15
+ attr_accessor :medium_username
10
16
  attr_accessor :name
11
17
  attr_accessor :node_type
12
18
  attr_accessor :online
@@ -14,6 +20,7 @@ module UpGuard
14
20
  attr_accessor :operating_system_id
15
21
  attr_accessor :short_description
16
22
  def from_hash(h)
23
+ self.connection_manager_group_id = h['connection_manager_group_id'] if h.include?('connection_manager_group_id')
17
24
  self.environment_id = h['environment_id'] if h.include?('environment_id')
18
25
  self.external_id = h['external_id'] if h.include?('external_id')
19
26
  self.id = h['id'] if h.include?('id')
@@ -21,6 +28,11 @@ module UpGuard
21
28
  self.last_scan_status = h['last_scan_status'] if h.include?('last_scan_status')
22
29
  self.last_scan_status_string = h['last_scan_status_string'] if h.include?('last_scan_status_string')
23
30
  self.mac_address = h['mac_address'] if h.include?('mac_address')
31
+ self.medium_hostname = h['medium_hostname'] if h.include?('medium_hostname')
32
+ self.medium_info = h['medium_info'] if h.include?('medium_info')
33
+ self.medium_port = h['medium_port'] if h.include?('medium_port')
34
+ self.medium_type = h['medium_type'] if h.include?('medium_type')
35
+ self.medium_username = h['medium_username'] if h.include?('medium_username')
24
36
  self.name = h['name'] if h.include?('name')
25
37
  self.node_type = h['node_type'] if h.include?('node_type')
26
38
  self.online = h['online'] if h.include?('online')
@@ -30,6 +42,7 @@ module UpGuard
30
42
  end
31
43
  def to_hash
32
44
  h = {}
45
+ h['connection_manager_group_id'] = self.connection_manager_group_id
33
46
  h['environment_id'] = self.environment_id
34
47
  h['external_id'] = self.external_id
35
48
  h['id'] = self.id
@@ -37,6 +50,11 @@ module UpGuard
37
50
  h['last_scan_status'] = self.last_scan_status
38
51
  h['last_scan_status_string'] = self.last_scan_status_string
39
52
  h['mac_address'] = self.mac_address
53
+ h['medium_hostname'] = self.medium_hostname
54
+ h['medium_info'] = self.medium_info
55
+ h['medium_port'] = self.medium_port
56
+ h['medium_type'] = self.medium_type
57
+ h['medium_username'] = self.medium_username
40
58
  h['name'] = self.name
41
59
  h['node_type'] = self.node_type
42
60
  h['online'] = self.online
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "NodeGroup"
38
+ raise "Can only append 'NodeGroup' to 'NodeGroupList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "NodeGroupUser"
38
+ raise "Can only append 'NodeGroupUser' to 'NodeGroupUserList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "Node"
38
+ raise "Can only append 'Node' to 'NodeList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -0,0 +1,49 @@
1
+ module UpGuard
2
+ class NodeMediumInfo < 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
+ def from_hash(h)
43
+ self.inner_map = h
44
+ end
45
+
46
+
47
+
48
+ end
49
+ end
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "OperatingSystemFamily"
38
+ raise "Can only append 'OperatingSystemFamily' to 'OperatingSystemFamilyList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "OperatingSystem"
38
+ raise "Can only append 'OperatingSystem' to 'OperatingSystemList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "Policy"
38
+ raise "Can only append 'Policy' to 'PolicyList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "ScheduledJob"
38
+ raise "Can only append 'ScheduledJob' to 'ScheduledJobList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "SystemMetric"
38
+ raise "Can only append 'SystemMetric' to 'SystemMetricList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -44,6 +44,15 @@ module UpGuard
44
44
  end
45
45
 
46
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
+
47
56
  def update
48
57
  h = to_hash
49
58
  h.delete("id")
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
19
- return @inner_list.count
20
- end
21
-
18
+
22
19
  def [](idx)
23
20
  return @inner_list[idx]
24
21
  end
25
22
 
26
23
 
24
+ def count
25
+ return @inner_list.count
26
+ end
27
+
28
+
27
29
 
28
30
  def each(&block)
29
31
  @inner_list.each(&block)
@@ -32,6 +34,9 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
37
+ if obj.class.name != "User"
38
+ raise "Can only append 'User' to 'UserList'
39
+ end
35
40
  @inner_list << obj
36
41
  end
37
42
 
@@ -12,7 +12,7 @@ module UpGuard
12
12
  end
13
13
 
14
14
  def version
15
- return "0.0.10"
15
+ return "0.0.14"
16
16
  end
17
17
 
18
18
 
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.10
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: 2020-06-22 00:00:00.000000000 Z
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,6 +48,8 @@ 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
53
55
  - lib/upguard/ConnectionManagerGroupList.rb
@@ -57,6 +59,9 @@ files:
57
59
  - lib/upguard/Event.rb
58
60
  - lib/upguard/EventAction.rb
59
61
  - lib/upguard/EventActionList.rb
62
+ - lib/upguard/EventList.rb
63
+ - lib/upguard/EventVariables.rb
64
+ - lib/upguard/ExternalEvent.rb
60
65
  - lib/upguard/Incident.rb
61
66
  - lib/upguard/IncidentList.rb
62
67
  - lib/upguard/Job.rb
@@ -68,6 +73,7 @@ files:
68
73
  - lib/upguard/NodeGroupUser.rb
69
74
  - lib/upguard/NodeGroupUserList.rb
70
75
  - lib/upguard/NodeList.rb
76
+ - lib/upguard/NodeMediumInfo.rb
71
77
  - lib/upguard/NodeType.rb
72
78
  - lib/upguard/OperatingSystem.rb
73
79
  - lib/upguard/OperatingSystemFamily.rb
@@ -85,7 +91,7 @@ files:
85
91
  homepage: https://www.upguard.com
86
92
  licenses: []
87
93
  metadata: {}
88
- post_install_message:
94
+ post_install_message:
89
95
  rdoc_options: []
90
96
  require_paths:
91
97
  - lib
@@ -100,9 +106,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
106
  - !ruby/object:Gem::Version
101
107
  version: '0'
102
108
  requirements: []
103
- rubyforge_project:
104
- rubygems_version: 2.5.1
105
- signing_key:
109
+ rubyforge_project:
110
+ rubygems_version: 2.7.6.2
111
+ signing_key:
106
112
  specification_version: 4
107
113
  summary: UpGuard Core SDK for Ruby
108
114
  test_files: []