Class: SDM::ControlPanel
- Inherits:
-
Object
- Object
- SDM::ControlPanel
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
ControlPanel contains all administrative controls.
Instance Method Summary collapse
-
#get_sshca_public_key(deadline: nil) ⇒ Object
GetSSHCAPublicKey retrieves the SSH CA public key.
-
#initialize(channel, parent) ⇒ ControlPanel
constructor
A new instance of ControlPanel.
-
#verify_jwt(token, deadline: nil) ⇒ Object
VerifyJWT reports whether the given JWT token (x-sdm-token) is valid.
Constructor Details
#initialize(channel, parent) ⇒ ControlPanel
Returns a new instance of ControlPanel.
1282 1283 1284 1285 1286 1287 1288 1289 |
# File 'lib/svc.rb', line 1282 def initialize(channel, parent) begin @stub = V1::ControlPanel::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#get_sshca_public_key(deadline: nil) ⇒ Object
GetSSHCAPublicKey retrieves the SSH CA public key.
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 |
# File 'lib/svc.rb', line 1292 def get_sshca_public_key( deadline: nil ) req = V1::ControlPanelGetSSHCAPublicKeyRequest.new() tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get_sshca_public_key(req, metadata: @parent.("ControlPanel.GetSSHCAPublicKey", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = ControlPanelGetSSHCAPublicKeyResponse.new() resp. = Plumbing::(plumbing_response.) resp.public_key = (plumbing_response.public_key) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#verify_jwt(token, deadline: nil) ⇒ Object
VerifyJWT reports whether the given JWT token (x-sdm-token) is valid.
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 |
# File 'lib/svc.rb', line 1320 def verify_jwt( token, deadline: nil ) req = V1::ControlPanelVerifyJWTRequest.new() req.token = (token) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.verify_jwt(req, metadata: @parent.("ControlPanel.VerifyJWT", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = ControlPanelVerifyJWTResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.valid = (plumbing_response.valid) resp end |