MCPcopy Index your code
hub / github.com/rilldata/rill / OpenRuntimeClient

Method OpenRuntimeClient

admin/deployments.go:611–630  ·  view source on GitHub ↗
(depl *database.Deployment)

Source from the content-addressed store, hash-verified

609}
610
611func (s *Service) OpenRuntimeClient(depl *database.Deployment) (*client.Client, error) {
612 if depl.RuntimeHost == "" {
613 if depl.Status == database.DeploymentStatusErrored {
614 return nil, fmt.Errorf("%w: deployment %q has no runtime host: %s", ErrDeploymentNotReady, depl.ID, depl.StatusMessage)
615 }
616 return nil, fmt.Errorf("%w: deployment %q has no runtime host", ErrDeploymentNotReady, depl.ID)
617 }
618
619 jwt, err := s.IssueRuntimeManagementToken(depl.RuntimeAudience)
620 if err != nil {
621 return nil, err
622 }
623
624 rt, err := client.New(depl.RuntimeHost, jwt)
625 if err != nil {
626 return nil, err
627 }
628
629 return rt, nil
630}
631
632func (s *Service) IssueRuntimeManagementToken(aud string) (string, error) {
633 jwt, err := s.issuer.NewToken(auth.TokenOptions{

Callers 11

TriggerReportMethod · 0.95
LookupReportMethod · 0.95
TriggerParserMethod · 0.95
LookupAlertMethod · 0.95
StartDeploymentInnerMethod · 0.95
StopDeploymentInnerMethod · 0.95
DeleteDeploymentInnerMethod · 0.95
UpdateDeploymentInnerMethod · 0.95
deploymentHealthCheckFunction · 0.45
TriggerRefreshSourcesMethod · 0.45

Calls 3

NewFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected