Class: Isepick::IseERS
- Inherits:
-
Object
- Object
- Isepick::IseERS
- Defined in:
- lib/isepick.rb
Instance Method Summary collapse
- #aznprofile_get(uuid) ⇒ Object
-
#aznprofile_getAll ⇒ Object
Authorization Profile.
- #dacl_get(uuid) ⇒ Object
-
#dacl_getAll ⇒ Object
Downloadable ACL.
- #eig_get(eig_id) ⇒ Object
-
#eig_getAll ⇒ Object
Endpoint Identity Group.
- #eig_getEndpoints(eig_id) ⇒ Object
- #ep_filterByMAC(mac_addr) ⇒ Object
- #ep_get(ep_id) ⇒ Object
-
#ep_getAll(pageSize = 25, page = 1) ⇒ Object
Endpoints.
-
#initialize(psn_host, psn_user, psn_password) ⇒ IseERS
constructor
A new instance of IseERS.
- #nd_get(nd_id) ⇒ Object
-
#nd_getAll ⇒ Object
Network Device.
- #ndg_get(ndg_id) ⇒ Object
-
#ndg_getAll ⇒ Object
Network Device Group.
Constructor Details
#initialize(psn_host, psn_user, psn_password) ⇒ IseERS
Returns a new instance of IseERS.
36 37 38 39 40 41 42 43 |
# File 'lib/isepick.rb', line 36 def initialize(psn_host, psn_user, psn_password) @client = Faraday.new("https://#{psn_host}:9060/ers/config/") do |conn| conn.basic_auth(psn_user, psn_password) conn.adapter Faraday.default_adapter conn.ssl[:verify] = false conn.headers["Accept"] = "application/json" end end |
Instance Method Details
#aznprofile_get(uuid) ⇒ Object
175 176 177 |
# File 'lib/isepick.rb', line 175 def aznprofile_get(uuid) return JSON.parse(@client.get("authorizationprofile/#{uuid}").body) end |
#aznprofile_getAll ⇒ Object
Authorization Profile
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/isepick.rb', line 159 def aznprofile_getAll() current_page = 1 output = [] loop do cur_output = JSON.parse(@client.get("authorizationprofile?size=25&page=#{current_page}").body) output += cur_output["SearchResult"]["resources"] if cur_output["SearchResult"].key?("nextPage") current_page += 1 else break end end return output end |
#dacl_get(uuid) ⇒ Object
154 155 156 |
# File 'lib/isepick.rb', line 154 def dacl_get(uuid) return JSON.parse(@client.get("downloadableacl/#{uuid}").body) end |
#dacl_getAll ⇒ Object
Downloadable ACL
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/isepick.rb', line 138 def dacl_getAll() current_page = 1 output = [] loop do cur_output = JSON.parse(@client.get("downloadableacl?size=25&page=#{current_page}").body) output += cur_output["SearchResult"]["resources"] if cur_output["SearchResult"].key?("nextPage") current_page += 1 else break end end return output end |
#eig_get(eig_id) ⇒ Object
117 118 119 |
# File 'lib/isepick.rb', line 117 def eig_get(eig_id) return JSON.parse(@client.get("endpointgroup/#{eig_id}").body) end |
#eig_getAll ⇒ Object
Endpoint Identity Group
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/isepick.rb', line 101 def eig_getAll() current_page = 1 output = [] loop do cur_output = JSON.parse(@client.get("endpointgroup?size=25&page=#{current_page}").body) output += cur_output["SearchResult"]["resources"] if cur_output["SearchResult"].key?("nextPage") current_page += 1 else break end end return output end |
#eig_getEndpoints(eig_id) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/isepick.rb', line 121 def eig_getEndpoints(eig_id) current_page = 1 output = [] loop do cur_output = JSON.parse(@client.get("endpoint?size=25&page=#{current_page}&filter=groupId.EQ.#{eig_id}").body) output += cur_output["SearchResult"]["resources"] if cur_output["SearchResult"].key?("nextPage") current_page += 1 else break end end return output end |
#ep_filterByMAC(mac_addr) ⇒ Object
53 54 55 56 |
# File 'lib/isepick.rb', line 53 def ep_filterByMAC(mac_addr) filter_param = mac_addr.gsub(/[^a-fA-F0-9]/, "").upcase.gsub(/(.{2})(?=.)/, '\1:\2') return JSON.parse(@client.get("endpoint?filter=mac.EQ.#{filter_param}").body) end |
#ep_get(ep_id) ⇒ Object
49 50 51 |
# File 'lib/isepick.rb', line 49 def ep_get(ep_id) return JSON.parse(@client.get("endpoint/#{ep_id}").body) end |
#ep_getAll(pageSize = 25, page = 1) ⇒ Object
Endpoints
45 46 47 |
# File 'lib/isepick.rb', line 45 def ep_getAll(pageSize = 25, page = 1) return JSON.parse(@client.get("endpoint").body) end |
#nd_get(nd_id) ⇒ Object
96 97 98 |
# File 'lib/isepick.rb', line 96 def nd_get(nd_id) return JSON.parse(@client.get("networkdevice/#{nd_id}").body) end |
#nd_getAll ⇒ Object
Network Device
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/isepick.rb', line 80 def nd_getAll() current_page = 1 output = [] loop do cur_output = JSON.parse(@client.get("networkdevice?size=25&page=#{current_page}").body) output += cur_output["SearchResult"]["resources"] if cur_output["SearchResult"].key?("nextPage") current_page += 1 else break end end return output end |
#ndg_get(ndg_id) ⇒ Object
75 76 77 |
# File 'lib/isepick.rb', line 75 def ndg_get(ndg_id) return JSON.parse(@client.get("networkdevicegroup/#{ndg_id}").body) end |
#ndg_getAll ⇒ Object
Network Device Group
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/isepick.rb', line 59 def ndg_getAll() current_page = 1 output = [] loop do cur_output = JSON.parse(@client.get("networkdevicegroup?size=25&page=#{current_page}").body) output += cur_output["SearchResult"]["resources"] if cur_output["SearchResult"].key?("nextPage") current_page += 1 else break end end return output end |