Documentation ¶
Index ¶
- Constants
- Variables
- func ConnectionIsClosed(stream grpc.ServerStream) bool
- func GetUser(ctx context.Context) (*model.User, *model.UserSession, error)
- func GetUserExternalToken(ctx context.Context) (string, error)
- func NewGRPCServer(db *db.PgDB, srv proto.DeterminedServer, enablePrometheus bool, ...) *grpc.Server
- func RegisterHTTPProxy(ctx context.Context, e *echo.Echo, port int, cert *tls.Certificate) error
- func ValidateRequest(checks ...Check) error
- type Check
Constants ¶
const ( // GrpcMetadataPrefix is the prefix used for gRPC metadata headers. GrpcMetadataPrefix = "Grpc-Metadata-" // AllocationTokenHeader is the header used to pass the allocation token. AllocationTokenHeader = "x-allocation-token" )
Variables ¶
var ( // ErrInvalidCredentials notifies that the provided credentials are invalid or missing. ErrInvalidCredentials = status.Error(codes.Unauthenticated, "invalid credentials") // ErrTokenMissing notifies that the bearer token could not be found. ErrTokenMissing = status.Error(codes.Unauthenticated, "token missing") // ErrNotActive notifies that the user is not active. ErrNotActive = status.Error(codes.PermissionDenied, "user is not active") // ErrPermissionDenied notifies that the user does not have permission to access the method. ErrPermissionDenied = status.Error(codes.PermissionDenied, "user does not have permission") )
var OrderBySQL = map[apiv1.OrderBy]string{ apiv1.OrderBy_ORDER_BY_UNSPECIFIED: "ASC", apiv1.OrderBy_ORDER_BY_ASC: "ASC", apiv1.OrderBy_ORDER_BY_DESC: "DESC", }
OrderBySQL maps our protobuf OrderBy enum to SQL. Unspecified maps to ASC.
var UnimplementedError = status.Error(codes.Unimplemented, "method not yet available")
UnimplementedError is the error return by API endpoints that are not yet implemented.
Functions ¶
func ConnectionIsClosed ¶
func ConnectionIsClosed(stream grpc.ServerStream) bool
ConnectionIsClosed returns whether the connection has been closed from the client's side.
func GetUserExternalToken ¶
GetUserExternalToken returns the external token for the currently logged in user.
func NewGRPCServer ¶
func NewGRPCServer(db *db.PgDB, srv proto.DeterminedServer, enablePrometheus bool, extConfig *model.ExternalSessions, logStore *logger.LogBuffer, ) *grpc.Server
NewGRPCServer creates a Determined gRPC service.
func RegisterHTTPProxy ¶
RegisterHTTPProxy registers grpc-gateway with the master echo server.
func ValidateRequest ¶
ValidateRequest validates that all the checks pass. If a check does not pass, an InvalidArgument error is returned.
Types ¶
type Check ¶
Check returns a bool value denoting whether the check passed or failed. If the check fails, the string denotes the error reason.
func ValidateFollow ¶
ValidateFollow validates Follow message fields.
func ValidateLimit ¶
ValidateLimit validates Limit message fields.