upguard 0.0.2 → 0.0.10

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 (39) hide show
  1. checksums.yaml +2 -5
  2. data/lib/upguard.rb +19 -0
  3. data/lib/upguard/Account.rb +333 -129
  4. data/lib/upguard/BaseObject.rb +23 -22
  5. data/lib/upguard/ConnectionManager.rb +18 -3
  6. data/lib/upguard/ConnectionManagerGroup.rb +31 -9
  7. data/lib/upguard/ConnectionManagerGroupList.rb +47 -0
  8. data/lib/upguard/ConnectionManagerList.rb +47 -0
  9. data/lib/upguard/Environment.rb +34 -11
  10. data/lib/upguard/EnvironmentList.rb +47 -0
  11. data/lib/upguard/Event.rb +3 -3
  12. data/lib/upguard/EventAction.rb +8 -2
  13. data/lib/upguard/EventActionList.rb +47 -0
  14. data/lib/upguard/Incident.rb +2 -2
  15. data/lib/upguard/IncidentList.rb +47 -0
  16. data/lib/upguard/Job.rb +60 -0
  17. data/lib/upguard/JobList.rb +47 -0
  18. data/lib/upguard/MediumType.rb +2 -2
  19. data/lib/upguard/Node.rb +54 -18
  20. data/lib/upguard/NodeGroup.rb +80 -8
  21. data/lib/upguard/NodeGroupList.rb +58 -0
  22. data/lib/upguard/NodeGroupUser.rb +21 -0
  23. data/lib/upguard/NodeGroupUserList.rb +58 -0
  24. data/lib/upguard/NodeList.rb +47 -0
  25. data/lib/upguard/NodeType.rb +12 -2
  26. data/lib/upguard/OperatingSystem.rb +3 -3
  27. data/lib/upguard/OperatingSystemFamily.rb +8 -8
  28. data/lib/upguard/OperatingSystemFamilyList.rb +47 -0
  29. data/lib/upguard/OperatingSystemList.rb +47 -0
  30. data/lib/upguard/Policy.rb +79 -0
  31. data/lib/upguard/PolicyList.rb +47 -0
  32. data/lib/upguard/ScheduledJob.rb +6 -3
  33. data/lib/upguard/ScheduledJobList.rb +47 -0
  34. data/lib/upguard/SystemMetric.rb +2 -2
  35. data/lib/upguard/SystemMetricList.rb +47 -0
  36. data/lib/upguard/User.rb +17 -2
  37. data/lib/upguard/UserList.rb +69 -0
  38. data/lib/upguard/Version.rb +21 -0
  39. metadata +24 -5
@@ -1,11 +1,13 @@
1
1
  module UpGuard
2
2
  class ScheduledJob < BaseObject
3
+ attr_accessor :data
3
4
  attr_accessor :id
4
5
  attr_accessor :source_id
5
6
  attr_accessor :source_name
6
7
  attr_accessor :source_type
7
8
  attr_accessor :status
8
9
  def from_hash(h)
10
+ self.data = h['data'] if h.include?('data')
9
11
  self.id = h['id'] if h.include?('id')
10
12
  self.source_id = h['source_id'] if h.include?('source_id')
11
13
  self.source_name = h['source_name'] if h.include?('source_name')
@@ -14,6 +16,7 @@ module UpGuard
14
16
  end
15
17
  def to_hash
16
18
  h = {}
19
+ h['data'] = self.data
17
20
  h['id'] = self.id
18
21
  h['source_id'] = self.source_id
19
22
  h['source_name'] = self.source_name
@@ -21,13 +24,13 @@ module UpGuard
21
24
  h['status'] = self.status
22
25
  return h
23
26
  end
24
- def to_json
27
+ def to_json(options = nil)
25
28
  h = to_hash
26
- return h.to_json
29
+ return h.to_json(options)
27
30
  end
28
31
 
29
32
  def load
30
- obj = http_get("/api/v2/scheduledu_jobs/#{self.id}.json")
33
+ obj = http_get("/api/v2/scheduled_jobs/#{self.id}.json")
31
34
  from_hash(obj)
32
35
  end
33
36
 
@@ -0,0 +1,47 @@
1
+ module UpGuard
2
+ class ScheduledJobList < 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
+ def count
19
+ return @inner_list.count
20
+ end
21
+
22
+ def [](idx)
23
+ return @inner_list[idx]
24
+ end
25
+
26
+
27
+
28
+ def each(&block)
29
+ @inner_list.each(&block)
30
+ end
31
+
32
+
33
+
34
+ def <<(obj)
35
+ @inner_list << obj
36
+ end
37
+
38
+
39
+
40
+ def to_json
41
+ return @inner_list.to_json
42
+ end
43
+
44
+
45
+
46
+ end
47
+ end
@@ -15,9 +15,9 @@ module UpGuard
15
15
  h['timestamp'] = self.timestamp
16
16
  return h
17
17
  end
18
- def to_json
18
+ def to_json(options = nil)
19
19
  h = to_hash
20
- return h.to_json
20
+ return h.to_json(options)
21
21
  end
22
22
 
23
23
  end
@@ -0,0 +1,47 @@
1
+ module UpGuard
2
+ class SystemMetricList < 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
+ def count
19
+ return @inner_list.count
20
+ end
21
+
22
+ def [](idx)
23
+ return @inner_list[idx]
24
+ end
25
+
26
+
27
+
28
+ def each(&block)
29
+ @inner_list.each(&block)
30
+ end
31
+
32
+
33
+
34
+ def <<(obj)
35
+ @inner_list << obj
36
+ end
37
+
38
+
39
+
40
+ def to_json
41
+ return @inner_list.to_json
42
+ end
43
+
44
+
45
+
46
+ end
47
+ end
@@ -8,6 +8,7 @@ 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
11
12
  def from_hash(h)
12
13
  self.id = h['id'] if h.include?('id')
13
14
  self.name = h['name'] if h.include?('name')
@@ -17,6 +18,7 @@ module UpGuard
17
18
  self.invited = h['invited'] if h.include?('invited')
18
19
  self.last_sign_in_at = h['last_sign_in_at'] if h.include?('last_sign_in_at')
19
20
  self.expiry = h['expiry'] if h.include?('expiry')
21
+ self.external_id = h['external_id'] if h.include?('external_id')
20
22
  end
21
23
  def to_hash
22
24
  h = {}
@@ -28,11 +30,12 @@ module UpGuard
28
30
  h['invited'] = self.invited
29
31
  h['last_sign_in_at'] = self.last_sign_in_at
30
32
  h['expiry'] = self.expiry
33
+ h['external_id'] = self.external_id
31
34
  return h
32
35
  end
33
- def to_json
36
+ def to_json(options = nil)
34
37
  h = to_hash
35
- return h.to_json
38
+ return h.to_json(options)
36
39
  end
37
40
  def update_role(role)
38
41
  url = "/api/v2/users/update_role.json?role=#{role}"
@@ -40,6 +43,18 @@ module UpGuard
40
43
  return obj
41
44
  end
42
45
 
46
+
47
+ def update
48
+ h = to_hash
49
+ h.delete("id")
50
+ h.delete("email")
51
+ h.delete("role")
52
+ h.delete("invited")
53
+ h.delete("last_sign_in_at")
54
+ h.delete("expiry")
55
+ http_put("/api/v2/users/#{self.id}.json", h)
56
+ end
57
+
43
58
 
44
59
  end
45
60
  end
@@ -0,0 +1,69 @@
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
+ def count
19
+ return @inner_list.count
20
+ end
21
+
22
+ def [](idx)
23
+ return @inner_list[idx]
24
+ end
25
+
26
+
27
+
28
+ def each(&block)
29
+ @inner_list.each(&block)
30
+ end
31
+
32
+
33
+
34
+ def <<(obj)
35
+ @inner_list << obj
36
+ end
37
+
38
+
39
+
40
+ def to_json
41
+ return @inner_list.to_json
42
+ end
43
+
44
+
45
+
46
+ def find_by_id(id)
47
+ @inner_list.each do |x|
48
+ if x.id.to_s == id.to_s
49
+ return x
50
+ end
51
+ end
52
+ return nil
53
+ end
54
+
55
+
56
+
57
+ def find_by_email(email)
58
+ @inner_list.each do |x|
59
+ if x.email == email
60
+ return x
61
+ end
62
+ end
63
+ return nil
64
+ end
65
+
66
+
67
+
68
+ end
69
+ 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.10"
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.2
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - UpGuard Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -50,20 +50,39 @@ files:
50
50
  - lib/upguard/BaseObject.rb
51
51
  - lib/upguard/ConnectionManager.rb
52
52
  - lib/upguard/ConnectionManagerGroup.rb
53
+ - lib/upguard/ConnectionManagerGroupList.rb
54
+ - lib/upguard/ConnectionManagerList.rb
53
55
  - lib/upguard/Environment.rb
56
+ - lib/upguard/EnvironmentList.rb
54
57
  - lib/upguard/Event.rb
55
58
  - lib/upguard/EventAction.rb
59
+ - lib/upguard/EventActionList.rb
56
60
  - lib/upguard/Incident.rb
61
+ - lib/upguard/IncidentList.rb
62
+ - lib/upguard/Job.rb
63
+ - lib/upguard/JobList.rb
57
64
  - lib/upguard/MediumType.rb
58
65
  - lib/upguard/Node.rb
59
66
  - lib/upguard/NodeGroup.rb
67
+ - lib/upguard/NodeGroupList.rb
68
+ - lib/upguard/NodeGroupUser.rb
69
+ - lib/upguard/NodeGroupUserList.rb
70
+ - lib/upguard/NodeList.rb
60
71
  - lib/upguard/NodeType.rb
61
72
  - lib/upguard/OperatingSystem.rb
62
73
  - lib/upguard/OperatingSystemFamily.rb
74
+ - lib/upguard/OperatingSystemFamilyList.rb
75
+ - lib/upguard/OperatingSystemList.rb
76
+ - lib/upguard/Policy.rb
77
+ - lib/upguard/PolicyList.rb
63
78
  - lib/upguard/ScheduledJob.rb
79
+ - lib/upguard/ScheduledJobList.rb
64
80
  - lib/upguard/SystemMetric.rb
81
+ - lib/upguard/SystemMetricList.rb
65
82
  - lib/upguard/User.rb
66
- homepage:
83
+ - lib/upguard/UserList.rb
84
+ - lib/upguard/Version.rb
85
+ homepage: https://www.upguard.com
67
86
  licenses: []
68
87
  metadata: {}
69
88
  post_install_message:
@@ -82,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
101
  version: '0'
83
102
  requirements: []
84
103
  rubyforge_project:
85
- rubygems_version: 2.6.14
104
+ rubygems_version: 2.5.1
86
105
  signing_key:
87
106
  specification_version: 4
88
- summary: UpGuard SDK for Ruby
107
+ summary: UpGuard Core SDK for Ruby
89
108
  test_files: []