Class: UpGuard::ConnectionManager

Inherits:
BaseObject show all
Defined in:
lib/upguard/ConnectionManager.rb

Instance Attribute Summary collapse

Attributes inherited from BaseObject

#appliance_api_key, #appliance_url, #insecure, #sec_key

Instance Method Summary collapse

Methods inherited from BaseObject

#http_delete, #http_get, #http_post, #http_put, #make_headers

Constructor Details

#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ ConnectionManager

Returns a new instance of ConnectionManager.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/upguard/ConnectionManager.rb', line 14

def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
  super(appliance_url, appliance_api_key, sec_key, insecure)
  self.agent_version = nil
  self.agent_type = nil
  self.channels = nil
  self.connection_manager_group_id = nil
  self.created_at = nil
  self.id = nil
  self.ip_address = nil
  self.hostname = nil
  self.last_contact = nil
  self.stats = nil
  self.updated_at = nil
end

Instance Attribute Details

#agent_typeObject

Returns the value of attribute agent_type.



4
5
6
# File 'lib/upguard/ConnectionManager.rb', line 4

def agent_type
  @agent_type
end

#agent_versionObject

Returns the value of attribute agent_version.



3
4
5
# File 'lib/upguard/ConnectionManager.rb', line 3

def agent_version
  @agent_version
end

#channelsObject

Returns the value of attribute channels.



5
6
7
# File 'lib/upguard/ConnectionManager.rb', line 5

def channels
  @channels
end

#connection_manager_group_idObject

Returns the value of attribute connection_manager_group_id.



6
7
8
# File 'lib/upguard/ConnectionManager.rb', line 6

def connection_manager_group_id
  @connection_manager_group_id
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/upguard/ConnectionManager.rb', line 7

def created_at
  @created_at
end

#hostnameObject

Returns the value of attribute hostname.



10
11
12
# File 'lib/upguard/ConnectionManager.rb', line 10

def hostname
  @hostname
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/upguard/ConnectionManager.rb', line 8

def id
  @id
end

#ip_addressObject

Returns the value of attribute ip_address.



9
10
11
# File 'lib/upguard/ConnectionManager.rb', line 9

def ip_address
  @ip_address
end

#last_contactObject

Returns the value of attribute last_contact.



11
12
13
# File 'lib/upguard/ConnectionManager.rb', line 11

def last_contact
  @last_contact
end

#statsObject

Returns the value of attribute stats.



12
13
14
# File 'lib/upguard/ConnectionManager.rb', line 12

def stats
  @stats
end

#updated_atObject

Returns the value of attribute updated_at.



13
14
15
# File 'lib/upguard/ConnectionManager.rb', line 13

def updated_at
  @updated_at
end

Instance Method Details

#connection_manager_groupObject



62
63
64
65
66
67
68
# File 'lib/upguard/ConnectionManager.rb', line 62

def connection_manager_group
  obj = http_get("/api/v2/connection_manager_groups/{connection_manager_group_id}.json")
  elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
    elem.id = obj["id"]
    elem.name = obj["name"]
  return elem
end

#from_hash(h) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/upguard/ConnectionManager.rb', line 29

def from_hash(h)
  self.agent_version = h['agent_version'] if h.include?('agent_version')
  self.agent_type = h['agent_type'] if h.include?('agent_type')
  self.channels = h['channels'] if h.include?('channels')
  self.connection_manager_group_id = h['connection_manager_group_id'] if h.include?('connection_manager_group_id')
  self.created_at = h['created_at'] if h.include?('created_at')
  self.id = h['id'] if h.include?('id')
  self.ip_address = h['ip_address'] if h.include?('ip_address')
  self.hostname = h['hostname'] if h.include?('hostname')
  self.last_contact = h['last_contact'] if h.include?('last_contact')
  self.stats = h['stats'] if h.include?('stats')
  self.updated_at = h['updated_at'] if h.include?('updated_at')
end

#to_hashObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/upguard/ConnectionManager.rb', line 42

def to_hash
  h = {}
  h['agent_version'] = self.agent_version
  h['agent_type'] = self.agent_type
  h['channels'] = self.channels
  h['connection_manager_group_id'] = self.connection_manager_group_id
  h['created_at'] = self.created_at
  h['id'] = self.id
  h['ip_address'] = self.ip_address
  h['hostname'] = self.hostname
  h['last_contact'] = self.last_contact
  h['stats'] = self.stats
  h['updated_at'] = self.updated_at
  return h
end

#to_json(options = nil) ⇒ Object



57
58
59
60
# File 'lib/upguard/ConnectionManager.rb', line 57

def to_json(options = nil)
  h = to_hash
  return h.to_json(options)
end