Class: SDM::ControlPanel

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/svc.rb

Overview

ControlPanel contains all administrative controls.

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ ControlPanel

Returns a new instance of ControlPanel.

[View source]

2014
2015
2016
2017
2018
2019
2020
2021
# File 'lib/svc.rb', line 2014

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.

[View source]

2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
# File 'lib/svc.rb', line 2052

def get_rdpca_public_key(
  deadline: nil
)
  req = V1::ControlPanelGetRDPCAPublicKeyRequest.new()

  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))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = ControlPanelGetRDPCAPublicKeyResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  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.

[View source]

2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
# File 'lib/svc.rb', line 2024

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.meta = Plumbing::(plumbing_response.meta)
  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.

[View source]

2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
# File 'lib/svc.rb', line 2080

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.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.valid = (plumbing_response.valid)
  resp
end