upguard 0.0.6 → 0.0.17

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.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/lib/upguard.rb +13 -0
  3. data/lib/upguard/Account.rb +192 -49
  4. data/lib/upguard/BaseObject.rb +8 -7
  5. data/lib/upguard/ChangeRequest.rb +55 -0
  6. data/lib/upguard/ChangeRequestList.rb +53 -0
  7. data/lib/upguard/ConnectionManager.rb +25 -1
  8. data/lib/upguard/ConnectionManagerGroup.rb +16 -6
  9. data/lib/upguard/ConnectionManagerGroupList.rb +17 -3
  10. data/lib/upguard/ConnectionManagerList.rb +17 -3
  11. data/lib/upguard/Environment.rb +16 -2
  12. data/lib/upguard/EnvironmentList.rb +17 -3
  13. data/lib/upguard/Event.rb +13 -1
  14. data/lib/upguard/EventAction.rb +10 -0
  15. data/lib/upguard/EventActionList.rb +17 -3
  16. data/lib/upguard/EventList.rb +53 -0
  17. data/lib/upguard/EventVariables.rb +43 -0
  18. data/lib/upguard/ExternalEvent.rb +36 -0
  19. data/lib/upguard/Incident.rb +10 -0
  20. data/lib/upguard/IncidentList.rb +17 -3
  21. data/lib/upguard/Job.rb +37 -0
  22. data/lib/upguard/JobList.rb +17 -3
  23. data/lib/upguard/MediumType.rb +3 -0
  24. data/lib/upguard/Node.rb +93 -5
  25. data/lib/upguard/NodeGroup.rb +82 -2
  26. data/lib/upguard/NodeGroupList.rb +28 -3
  27. data/lib/upguard/NodeGroupUser.rb +27 -0
  28. data/lib/upguard/NodeGroupUserList.rb +64 -0
  29. data/lib/upguard/NodeList.rb +17 -3
  30. data/lib/upguard/NodeMediumInfo.rb +49 -0
  31. data/lib/upguard/NodeScan.rb +78 -0
  32. data/lib/upguard/NodeScanList.rb +53 -0
  33. data/lib/upguard/NodeType.rb +10 -0
  34. data/lib/upguard/OperatingSystem.rb +9 -1
  35. data/lib/upguard/OperatingSystemFamily.rb +8 -2
  36. data/lib/upguard/OperatingSystemFamilyList.rb +17 -3
  37. data/lib/upguard/OperatingSystemList.rb +17 -3
  38. data/lib/upguard/Pluggable.rb +81 -0
  39. data/lib/upguard/PluggableList.rb +53 -0
  40. data/lib/upguard/Policy.rb +34 -0
  41. data/lib/upguard/PolicyList.rb +17 -3
  42. data/lib/upguard/ScheduledJob.rb +11 -1
  43. data/lib/upguard/ScheduledJobList.rb +17 -3
  44. data/lib/upguard/SystemMetric.rb +7 -0
  45. data/lib/upguard/SystemMetricList.rb +17 -3
  46. data/lib/upguard/User.rb +37 -0
  47. data/lib/upguard/UserList.rb +39 -3
  48. data/lib/upguard/Version.rb +21 -0
  49. metadata +21 -8
@@ -10,12 +10,22 @@ module UpGuard
10
10
  h = to_hash
11
11
  return h.to_json(options)
12
12
  end
13
- def initialize(appliance_url, api_key, sec_key, insecure)
14
- super(appliance_url, api_key, sec_key, insecure)
13
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure)
14
+ super(appliance_url, appliance_api_key, sec_key, insecure)
15
15
  @inner_list = []
16
16
  end
17
17
 
18
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
+
19
29
 
20
30
  def each(&block)
21
31
  @inner_list.each(&block)
@@ -24,7 +34,11 @@ module UpGuard
24
34
 
25
35
 
26
36
  def <<(obj)
27
- @inner_list << obj
37
+ if ["SystemMetric", "UpGuard::SystemMetric"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'SystemMetric' to 'SystemMetricList'"
41
+ end
28
42
  end
29
43
 
30
44
 
@@ -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,6 +43,7 @@ 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
49
  def to_json(options = nil)
@@ -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
@@ -10,12 +10,22 @@ module UpGuard
10
10
  h = to_hash
11
11
  return h.to_json(options)
12
12
  end
13
- def initialize(appliance_url, api_key, sec_key, insecure)
14
- super(appliance_url, api_key, sec_key, insecure)
13
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure)
14
+ super(appliance_url, appliance_api_key, sec_key, insecure)
15
15
  @inner_list = []
16
16
  end
17
17
 
18
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
+
19
29
 
20
30
  def each(&block)
21
31
  @inner_list.each(&block)
@@ -24,7 +34,11 @@ module UpGuard
24
34
 
25
35
 
26
36
  def <<(obj)
27
- @inner_list << 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
28
42
  end
29
43
 
30
44
 
@@ -34,6 +48,28 @@ module UpGuard
34
48
  end
35
49
 
36
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
+
37
73
 
38
74
  end
39
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.17"
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.6
4
+ version: 0.0.17
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: 2019-10-04 00:00:00.000000000 Z
11
+ date: 2020-08-28 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
@@ -65,12 +70,19 @@ files:
65
70
  - lib/upguard/Node.rb
66
71
  - lib/upguard/NodeGroup.rb
67
72
  - lib/upguard/NodeGroupList.rb
73
+ - lib/upguard/NodeGroupUser.rb
74
+ - lib/upguard/NodeGroupUserList.rb
68
75
  - lib/upguard/NodeList.rb
76
+ - lib/upguard/NodeMediumInfo.rb
77
+ - lib/upguard/NodeScan.rb
78
+ - lib/upguard/NodeScanList.rb
69
79
  - lib/upguard/NodeType.rb
70
80
  - lib/upguard/OperatingSystem.rb
71
81
  - lib/upguard/OperatingSystemFamily.rb
72
82
  - lib/upguard/OperatingSystemFamilyList.rb
73
83
  - lib/upguard/OperatingSystemList.rb
84
+ - lib/upguard/Pluggable.rb
85
+ - lib/upguard/PluggableList.rb
74
86
  - lib/upguard/Policy.rb
75
87
  - lib/upguard/PolicyList.rb
76
88
  - lib/upguard/ScheduledJob.rb
@@ -79,10 +91,11 @@ files:
79
91
  - lib/upguard/SystemMetricList.rb
80
92
  - lib/upguard/User.rb
81
93
  - lib/upguard/UserList.rb
94
+ - lib/upguard/Version.rb
82
95
  homepage: https://www.upguard.com
83
96
  licenses: []
84
97
  metadata: {}
85
- post_install_message:
98
+ post_install_message:
86
99
  rdoc_options: []
87
100
  require_paths:
88
101
  - lib
@@ -97,9 +110,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
110
  - !ruby/object:Gem::Version
98
111
  version: '0'
99
112
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.6.14
102
- signing_key:
113
+ rubyforge_project:
114
+ rubygems_version: 2.7.6.2
115
+ signing_key:
103
116
  specification_version: 4
104
117
  summary: UpGuard Core SDK for Ruby
105
118
  test_files: []