Files
threshold/internal/daemon/worker/worker_proxy_service.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.5 KiB
Go
Raw Normal View History

2022-05-09 13:23:38 -04:00
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
2023-02-02 17:15:17 -08:00
2022-05-24 14:10:13 -04:00
package worker
2022-05-09 13:23:38 -04:00
import (
"context"
pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
"google.golang.org/grpc"
2022-05-09 13:23:38 -04:00
)
type workerProxyServiceServer struct {
pbs.UnsafeServerCoordinationServiceServer
pbs.UnsafeSessionServiceServer
2022-05-09 13:23:38 -04:00
2023-04-28 12:24:42 -07:00
cc *grpc.ClientConn
2022-05-09 13:23:38 -04:00
}
var (
_ pbs.ServerCoordinationServiceServer = (*workerProxyServiceServer)(nil)
_ pbs.SessionServiceServer = (*workerProxyServiceServer)(nil)
)
2022-05-09 13:23:38 -04:00
func NewWorkerProxyServiceServer(
cc *grpc.ClientConn,
2022-05-09 13:23:38 -04:00
) *workerProxyServiceServer {
return &workerProxyServiceServer{
2023-04-28 12:24:42 -07:00
cc: cc,
2022-05-09 13:23:38 -04:00
}
}
func (ws *workerProxyServiceServer) Status(ctx context.Context, req *pbs.StatusRequest) (*pbs.StatusResponse, error) {
2023-04-28 12:24:42 -07:00
resp, err := pbs.NewServerCoordinationServiceClient(ws.cc).Status(ctx, req)
2022-06-01 01:09:56 -04:00
if resp != nil {
// We don't currently support distributing new addreses to workers
// multiple hops away so ensure they're stripped out
resp.CalculatedUpstreams = nil
2022-06-01 01:09:56 -04:00
}
return resp, err
2022-05-09 13:23:38 -04:00
}
func (ws *workerProxyServiceServer) ListHcpbWorkers(ctx context.Context, req *pbs.ListHcpbWorkersRequest) (*pbs.ListHcpbWorkersResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewServerCoordinationServiceClient(ws.cc).ListHcpbWorkers(ctx, req)
}
2022-05-09 13:23:38 -04:00
func (ws *workerProxyServiceServer) LookupSession(ctx context.Context, req *pbs.LookupSessionRequest) (*pbs.LookupSessionResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewSessionServiceClient(ws.cc).LookupSession(ctx, req)
2022-05-09 13:23:38 -04:00
}
func (ws *workerProxyServiceServer) CancelSession(ctx context.Context, req *pbs.CancelSessionRequest) (*pbs.CancelSessionResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewSessionServiceClient(ws.cc).CancelSession(ctx, req)
2022-05-09 13:23:38 -04:00
}
func (ws *workerProxyServiceServer) ActivateSession(ctx context.Context, req *pbs.ActivateSessionRequest) (*pbs.ActivateSessionResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewSessionServiceClient(ws.cc).ActivateSession(ctx, req)
2022-05-09 13:23:38 -04:00
}
func (ws *workerProxyServiceServer) AuthorizeConnection(ctx context.Context, req *pbs.AuthorizeConnectionRequest) (*pbs.AuthorizeConnectionResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewSessionServiceClient(ws.cc).AuthorizeConnection(ctx, req)
2022-05-09 13:23:38 -04:00
}
func (ws *workerProxyServiceServer) ConnectConnection(ctx context.Context, req *pbs.ConnectConnectionRequest) (*pbs.ConnectConnectionResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewSessionServiceClient(ws.cc).ConnectConnection(ctx, req)
2022-05-09 13:23:38 -04:00
}
func (ws *workerProxyServiceServer) CloseConnection(ctx context.Context, req *pbs.CloseConnectionRequest) (*pbs.CloseConnectionResponse, error) {
2023-04-28 12:24:42 -07:00
return pbs.NewSessionServiceClient(ws.cc).CloseConnection(ctx, req)
2022-05-09 13:23:38 -04:00
}