gapi

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: AGPL-3.0 Imports: 26 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotEnabled = errors.New("grpc api client is not enabled")

ErrNotEnabled is returned by NewClient when the client is explicitly disabled.

Functions

func BlueprintSummaryToProto

func BlueprintSummaryToProto(m *models.BlueprintSummary) *commonv1.BlueprintSummary

BlueprintSummaryToProto converts a Go BlueprintSummary model to its protobuf message.

func CompleteUserWebFlowToProto

func CompleteUserWebFlowToProto(m *models.CompleteUserWebFlow) *commonv1.CompleteUserWebFlow

CompleteUserWebFlowToProto converts a Go model to a protobuf message.

func OnboardUserDeviceFlowToProto

func OnboardUserDeviceFlowToProto(m *models.OnboardUserDeviceFlow) *commonv1.OnboardUserDeviceFlow

OnboardUserDeviceFlowToProto converts a Go model to a protobuf message.

func OnboardUserWebFlowToProto

func OnboardUserWebFlowToProto(m *models.OnboardUserWebFlow) *commonv1.OnboardUserWebFlow

OnboardUserWebFlowToProto converts a Go model to a protobuf message.

func ProtoToBlueprintSummary

func ProtoToBlueprintSummary(pb *commonv1.BlueprintSummary) *models.BlueprintSummary

ProtoToBlueprintSummary converts a protobuf BlueprintSummary message to its Go model.

func ProtoToCompleteUserWebFlow

func ProtoToCompleteUserWebFlow(pb *commonv1.CompleteUserWebFlow) *models.CompleteUserWebFlow

ProtoToCompleteUserWebFlow converts a protobuf message to a Go model.

func ProtoToOnboardUserDeviceFlow

func ProtoToOnboardUserDeviceFlow(pb *commonv1.OnboardUserDeviceFlow) *models.OnboardUserDeviceFlow

ProtoToOnboardUserDeviceFlow converts a protobuf message to a Go model.

func ProtoToOnboardUserWebFlow

func ProtoToOnboardUserWebFlow(pb *commonv1.OnboardUserWebFlow) *models.OnboardUserWebFlow

ProtoToOnboardUserWebFlow converts a protobuf message to a Go model.

func ProtoToUser

func ProtoToUser(pb *commonv1.User) *models.User

func ProtoToUserCredential

func ProtoToUserCredential(pb *commonv1.UserCredential) *models.UserCredential

ProtoToUserCredential converts a protobuf message to a Go model.

func ProtoToUserOnboardCapability

func ProtoToUserOnboardCapability(pb *commonv1.UserOnboardCapability) *models.OnboardCapability

ProtoToUserOnboardCapability converts a protobuf message to a Go model.

func ProtoToWorkspaceDetails

func ProtoToWorkspaceDetails(pb *commonv1.WorkspaceDetails) *models.WorkspaceDetails

ProtoToWorkspaceDetails converts a protobuf WorkspaceDetails message to its Go model.

func ProtoToWorkspaceStatus

func ProtoToWorkspaceStatus(pb *commonv1.WorkspaceStatus) *models.WorkspaceStatus

ProtoToWorkspaceStatus converts a protobuf WorkspaceStatus message to its Go model.

func UserCredentialToProto

func UserCredentialToProto(c *models.UserCredential) *commonv1.UserCredential

UserCredentialToProto converts a Go model to a protobuf message.

func UserOnboardCapabilityToProto

func UserOnboardCapabilityToProto(m *models.OnboardCapability) *commonv1.UserOnboardCapability

UserOnboardCapabilityToProto converts a Go model to a protobuf message.

func UserToProto

func UserToProto(u *models.User) *commonv1.User

func WithMD

func WithMD(ctx context.Context, kv ...string) context.Context

WithMD returns a new context with the provided key-value pairs added to outgoing gRPC metadata.

func WorkspaceDetailsToProto

func WorkspaceDetailsToProto(m *models.WorkspaceDetails) *commonv1.WorkspaceDetails

WorkspaceDetailsToProto converts a Go WorkspaceDetails model to its protobuf message.

func WorkspaceStatusToProto

func WorkspaceStatusToProto(m *models.WorkspaceStatus) *commonv1.WorkspaceStatus

WorkspaceStatusToProto converts a Go WorkspaceStatus model to its protobuf message.

Types

type AllowedCaller

type AllowedCaller struct {
	Namespace      string `yaml:"namespace"`
	ServiceAccount string `yaml:"serviceAccount"`
}

type Caller

type Caller struct{ Namespace, ServiceAccount string }

type Client

type Client struct {
	Conn *grpc.ClientConn
	// contains filtered or unexported fields
}

Client gRPC client

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

NewClient creates and returns a new gRPC client connection.

func (*Client) Close

func (c *Client) Close() error

Close the gRPC client connection.

type ClientConfig

type ClientConfig struct {
	// Address of the gRPC server, e.g. "localhost:50051".
	// Use the dns:/// scheme to enable client-side round-robin load balancing
	// across multiple endpoints (e.g. a headless Service in Kubernetes):
	// "dns:///grpc-server-headless.default.svc.cluster.local:50051"
	Address string `yaml:"address"`

	// ServerName is optional TLS ServerName for hostname verification.
	// Required if CACertPath is set and cert SAN doesn't match address host.
	ServerName string `yaml:"serverName"`

	// TokenFilePath is path to file containing token for authentication.
	// The file is read on each request to support token rotation.
	TokenFilePath string `yaml:"tokenFilePath"`

	// CACertPath is optional path to CA cert for TLS.
	//  If empty, TLS is disabled and credentials are insecure.
	CACertPath string `yaml:"caCertPath"`
}

ClientConfig holds configuration for gRPC client

func (*ClientConfig) IsEnabled

func (c *ClientConfig) IsEnabled() bool

type Server

type Server struct {
	GrpcServer *grpc.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *ServerConfig, stopGracefully bool) (*Server, error)

func (*Server) AddInterceptor

func (s *Server) AddInterceptor(interceptor grpc.UnaryServerInterceptor)

func (*Server) RegisterService

func (s *Server) RegisterService(regFunc ServiceRegistrationFunc) error

RegisterService adds a service registration callback

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop()

type ServerConfig

type ServerConfig struct {
	Port            int             `yaml:"port"`
	EnableTLS       bool            `yaml:"enableTLS"`
	CertFile        string          `yaml:"certFile"`
	KeyFile         string          `yaml:"keyFile"`
	CertReloadDelay time.Duration   `yaml:"certReloadDelay"`
	AuthEnabled     bool            `yaml:"authEnabled"`
	IssuerURL       string          `yaml:"issuerURL"`
	Audience        string          `yaml:"audience"`
	Allowed         []AllowedCaller `yaml:"allowed"`
}

type ServiceRegistrationFunc

type ServiceRegistrationFunc func(*grpc.Server) error

ServiceRegistrationFunc is a callback function to register services on the gRPC server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL