upguard 0.0.9 → 0.0.18

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 (48) hide show
  1. checksums.yaml +5 -2
  2. data/lib/upguard.rb +11 -0
  3. data/lib/upguard/Account.rb +87 -5
  4. data/lib/upguard/ChangeRequest.rb +55 -0
  5. data/lib/upguard/ChangeRequestList.rb +53 -0
  6. data/lib/upguard/ConnectionManager.rb +24 -0
  7. data/lib/upguard/ConnectionManagerGroup.rb +10 -0
  8. data/lib/upguard/ConnectionManagerGroupList.rb +11 -5
  9. data/lib/upguard/ConnectionManagerList.rb +11 -5
  10. data/lib/upguard/Environment.rb +14 -0
  11. data/lib/upguard/EnvironmentList.rb +11 -5
  12. data/lib/upguard/Event.rb +12 -0
  13. data/lib/upguard/EventAction.rb +10 -0
  14. data/lib/upguard/EventActionList.rb +11 -5
  15. data/lib/upguard/EventList.rb +53 -0
  16. data/lib/upguard/EventVariables.rb +43 -0
  17. data/lib/upguard/ExternalEvent.rb +36 -0
  18. data/lib/upguard/Incident.rb +10 -0
  19. data/lib/upguard/IncidentList.rb +11 -5
  20. data/lib/upguard/Job.rb +10 -0
  21. data/lib/upguard/JobList.rb +11 -5
  22. data/lib/upguard/MediumType.rb +3 -0
  23. data/lib/upguard/Node.rb +59 -1
  24. data/lib/upguard/NodeGroup.rb +17 -0
  25. data/lib/upguard/NodeGroupList.rb +22 -5
  26. data/lib/upguard/NodeGroupUser.rb +6 -0
  27. data/lib/upguard/NodeGroupUserList.rb +11 -5
  28. data/lib/upguard/NodeList.rb +11 -5
  29. data/lib/upguard/NodeMediumInfo.rb +49 -0
  30. data/lib/upguard/NodeScan.rb +78 -0
  31. data/lib/upguard/NodeScanList.rb +53 -0
  32. data/lib/upguard/NodeType.rb +10 -0
  33. data/lib/upguard/OperatingSystem.rb +8 -0
  34. data/lib/upguard/OperatingSystemFamily.rb +6 -0
  35. data/lib/upguard/OperatingSystemFamilyList.rb +11 -5
  36. data/lib/upguard/OperatingSystemList.rb +11 -5
  37. data/lib/upguard/Pluggable.rb +81 -0
  38. data/lib/upguard/PluggableList.rb +53 -0
  39. data/lib/upguard/Policy.rb +8 -0
  40. data/lib/upguard/PolicyList.rb +11 -5
  41. data/lib/upguard/ScheduledJob.rb +11 -1
  42. data/lib/upguard/ScheduledJobList.rb +11 -5
  43. data/lib/upguard/SystemMetric.rb +7 -0
  44. data/lib/upguard/SystemMetricList.rb +11 -5
  45. data/lib/upguard/User.rb +37 -0
  46. data/lib/upguard/UserList.rb +22 -5
  47. data/lib/upguard/Version.rb +21 -0
  48. metadata +19 -8
@@ -0,0 +1,81 @@
1
+ module UpGuard
2
+ class Pluggable < BaseObject
3
+ attr_accessor :description
4
+ attr_accessor :id
5
+ attr_accessor :name
6
+ attr_accessor :operating_system_family
7
+ attr_accessor :operating_system_family_id
8
+ attr_accessor :operating_system_id
9
+ attr_accessor :script
10
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
11
+ super(appliance_url, appliance_api_key, sec_key, insecure)
12
+ self.description = nil
13
+ self.id = nil
14
+ self.name = nil
15
+ self.operating_system_family = nil
16
+ self.operating_system_family_id = nil
17
+ self.operating_system_id = nil
18
+ self.script = nil
19
+ end
20
+
21
+ def from_hash(h)
22
+ self.description = h['description'] if h.include?('description')
23
+ self.id = h['id'] if h.include?('id')
24
+ self.name = h['name'] if h.include?('name')
25
+ self.operating_system_family = h['operating_system_family'] if h.include?('operating_system_family')
26
+ self.operating_system_family_id = h['operating_system_family_id'] if h.include?('operating_system_family_id')
27
+ self.operating_system_id = h['operating_system_id'] if h.include?('operating_system_id')
28
+ self.script = h['script'] if h.include?('script')
29
+ end
30
+ def to_hash
31
+ h = {}
32
+ h['description'] = self.description
33
+ h['id'] = self.id
34
+ h['name'] = self.name
35
+ h['operating_system_family'] = self.operating_system_family
36
+ h['operating_system_family_id'] = self.operating_system_family_id
37
+ h['operating_system_id'] = self.operating_system_id
38
+ h['script'] = self.script
39
+ return h
40
+ end
41
+ def to_json(options = nil)
42
+ h = to_hash
43
+ return h.to_json(options)
44
+ end
45
+
46
+ def load
47
+ obj = http_get("/api/v2/pluggables/#{self.operating_system_id}.json")
48
+ from_hash(obj)
49
+ end
50
+
51
+
52
+ def save
53
+ if self.id.to_i == 0
54
+ return create
55
+ else
56
+ return update
57
+ end
58
+ end
59
+
60
+
61
+ def create
62
+ h = to_hash
63
+ out = http_post("/api/v2/pluggables.json", h)
64
+ from_hash(out)
65
+ end
66
+
67
+
68
+ def update
69
+ h = to_hash
70
+ h.delete("operating_system_family_id")
71
+ h.delete("operating_system_id")
72
+ http_put("/api/v2/pluggables/#{self.operating_system_id}.json", h)
73
+ end
74
+
75
+ def delete
76
+ http_delete("/api/v2/pluggables/#{self.operating_system_id}.json")
77
+ end
78
+
79
+
80
+ end
81
+ end
@@ -0,0 +1,53 @@
1
+ module UpGuard
2
+ class PluggableList < 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 ["Pluggable", "UpGuard::Pluggable"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Pluggable' to 'PluggableList'"
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
@@ -4,6 +4,14 @@ module UpGuard
4
4
  attr_accessor :name
5
5
  attr_accessor :short_description
6
6
  attr_accessor :description
7
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
8
+ super(appliance_url, appliance_api_key, sec_key, insecure)
9
+ self.id = nil
10
+ self.name = nil
11
+ self.short_description = nil
12
+ self.description = nil
13
+ end
14
+
7
15
  def from_hash(h)
8
16
  self.id = h['id'] if h.include?('id')
9
17
  self.name = h['name'] if h.include?('name')
@@ -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,7 +34,11 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
35
- @inner_list << obj
37
+ if ["Policy", "UpGuard::Policy"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Policy' to 'PolicyList'"
41
+ end
36
42
  end
37
43
 
38
44
 
@@ -6,6 +6,16 @@ module UpGuard
6
6
  attr_accessor :source_name
7
7
  attr_accessor :source_type
8
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.data = nil
12
+ self.id = nil
13
+ self.source_id = nil
14
+ self.source_name = nil
15
+ self.source_type = nil
16
+ self.status = nil
17
+ end
18
+
9
19
  def from_hash(h)
10
20
  self.data = h['data'] if h.include?('data')
11
21
  self.id = h['id'] if h.include?('id')
@@ -60,7 +70,7 @@ module UpGuard
60
70
  http_delete("/api/v2/scheduled_jobs/#{self.id}.json")
61
71
  end
62
72
 
63
- def cancel_jobs()
73
+ def cancel_jobs
64
74
  url = "/api/v2/scheduled_jobs/#{self.id}/cancel_jobs.json"
65
75
  obj = http_post(url, nil)
66
76
  return obj
@@ -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,7 +34,11 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
35
- @inner_list << obj
37
+ if ["ScheduledJob", "UpGuard::ScheduledJob"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'ScheduledJob' to 'ScheduledJobList'"
41
+ end
36
42
  end
37
43
 
38
44
 
@@ -3,6 +3,13 @@ module UpGuard
3
3
  attr_accessor :metric
4
4
  attr_accessor :value
5
5
  attr_accessor :timestamp
6
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
7
+ super(appliance_url, appliance_api_key, sec_key, insecure)
8
+ self.metric = nil
9
+ self.value = nil
10
+ self.timestamp = nil
11
+ end
12
+
6
13
  def from_hash(h)
7
14
  self.metric = h['metric'] if h.include?('metric')
8
15
  self.value = h['value'] if h.include?('value')
@@ -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,7 +34,11 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
35
- @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
36
42
  end
37
43
 
38
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
@@ -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,7 +34,11 @@ module UpGuard
32
34
 
33
35
 
34
36
  def <<(obj)
35
- @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
36
42
  end
37
43
 
38
44
 
@@ -43,6 +49,17 @@ module UpGuard
43
49
 
44
50
 
45
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
+
46
63
  def find_by_email(email)
47
64
  @inner_list.each do |x|
48
65
  if x.email == email
@@ -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.18"
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.9
4
+ version: 0.0.18
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-02 00:00:00.000000000 Z
11
+ date: 2020-09-03 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,11 +73,16 @@ files:
68
73
  - lib/upguard/NodeGroupUser.rb
69
74
  - lib/upguard/NodeGroupUserList.rb
70
75
  - lib/upguard/NodeList.rb
76
+ - lib/upguard/NodeMediumInfo.rb
77
+ - lib/upguard/NodeScan.rb
78
+ - lib/upguard/NodeScanList.rb
71
79
  - lib/upguard/NodeType.rb
72
80
  - lib/upguard/OperatingSystem.rb
73
81
  - lib/upguard/OperatingSystemFamily.rb
74
82
  - lib/upguard/OperatingSystemFamilyList.rb
75
83
  - lib/upguard/OperatingSystemList.rb
84
+ - lib/upguard/Pluggable.rb
85
+ - lib/upguard/PluggableList.rb
76
86
  - lib/upguard/Policy.rb
77
87
  - lib/upguard/PolicyList.rb
78
88
  - lib/upguard/ScheduledJob.rb
@@ -81,10 +91,11 @@ files:
81
91
  - lib/upguard/SystemMetricList.rb
82
92
  - lib/upguard/User.rb
83
93
  - lib/upguard/UserList.rb
94
+ - lib/upguard/Version.rb
84
95
  homepage: https://www.upguard.com
85
96
  licenses: []
86
97
  metadata: {}
87
- post_install_message:
98
+ post_install_message:
88
99
  rdoc_options: []
89
100
  require_paths:
90
101
  - lib
@@ -99,9 +110,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
110
  - !ruby/object:Gem::Version
100
111
  version: '0'
101
112
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.5.1
104
- signing_key:
113
+ rubyforge_project:
114
+ rubygems_version: 2.7.6.2
115
+ signing_key:
105
116
  specification_version: 4
106
117
  summary: UpGuard Core SDK for Ruby
107
118
  test_files: []