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_rdpca_public_key(deadline: nil) ⇒ Object
GetRDPCAPublicKey retrieves the RDP CA public key.
-
#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
2371 2372 2373 2374 2375 2376 2377 2378 |
# File 'lib/svc.rb', line 2371 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_rdpca_public_key(deadline: nil) ⇒ Object
GetRDPCAPublicKey retrieves the RDP CA public key.
2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 |
# File 'lib/svc.rb', line 2414 def get_rdpca_public_key( deadline: nil ) req = V1::ControlPanelGetRDPCAPublicKeyRequest.new() # Execute before interceptor hooks req = @parent.interceptor.execute_before("ControlPanel.GetRDPCAPublicKey", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get_rdpca_public_key(req, metadata: @parent.("ControlPanel.GetRDPCAPublicKey", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("ControlPanel.GetRDPCAPublicKey", self, req, plumbing_response) resp = ControlPanelGetRDPCAPublicKeyResponse.new() resp. = Plumbing::(plumbing_response.) resp.public_key = (plumbing_response.public_key) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get_sshca_public_key(deadline: nil) ⇒ Object
GetSSHCAPublicKey retrieves the SSH CA public key.
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 |
# File 'lib/svc.rb', line 2381 def get_sshca_public_key( deadline: nil ) req = V1::ControlPanelGetSSHCAPublicKeyRequest.new() # Execute before interceptor hooks req = @parent.interceptor.execute_before("ControlPanel.GetSSHCAPublicKey", self, req) 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, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("ControlPanel.GetSSHCAPublicKey", self, req, plumbing_response) 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.
2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 |
# File 'lib/svc.rb', line 2447 def verify_jwt( token, deadline: nil ) req = V1::ControlPanelVerifyJWTRequest.new() req.token = (token) # Execute before interceptor hooks req = @parent.interceptor.execute_before("ControlPanel.VerifyJWT", self, req) 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, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("ControlPanel.VerifyJWT", self, req, plumbing_response) resp = ControlPanelVerifyJWTResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.valid = (plumbing_response.valid) resp end |