jx/internal/resource/containerlogstreamtype.go
Matthew Rich 07808c62fd
Some checks failed
Declarative Tests / test (push) Waiting to run
Lint / golangci-lint (push) Has been cancelled
add support for remote command execution
2024-11-10 10:24:06 -08:00

30 lines
690 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
// Container resource
package resource
import (
"fmt"
"errors"
)
type ContainerLogStreamType byte
const (
ContainerLogStreamStdin ContainerLogStreamType = 0x0
ContainerLogStreamStdout ContainerLogStreamType = 0x1
ContainerLogStreamStderr ContainerLogStreamType = 0x2
)
var (
ErrContainerLogInvalidStreamType error = errors.New("Invalid container log stream type")
)
func (s ContainerLogStreamType) Validate() error {
switch s {
case ContainerLogStreamStdin, ContainerLogStreamStdout, ContainerLogStreamStderr:
return nil
}
return fmt.Errorf("%w: %d", ErrContainerLogInvalidStreamType, s)
}