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.
1035 1036 1037 1038 1039 1040 1041 1042 |
# File 'lib/svc.rb', line 1035 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.
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 |
# File 'lib/svc.rb', line 1045 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.
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 |
# File 'lib/svc.rb', line 1073 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 |