Documentation ¶
Index ¶
Constants ¶
const ( ECONFLICT = "conflict" EINTERNAL = "internal" EINVALID = "invalid" ENOTFOUND = "not_found" ENOTIMPLEMENTED = "not_implemented" EUNAUTHORIZED = "unauthorized" EFORBIDDEN = "forbidden" EBADGATEWAY = "bad_gateway" )
Application error codes.
NOTE: These are meant to be generic, and they map well to HTTP error codes. Different applications can have very different error code requirements so these should be expanded as needed (or introduce subcodes).
Variables ¶
var Version = "v0.0.1"
Functions ¶
func ErrorCode ¶
ErrorCode unwraps an application error and returns its code. Non-application errors always return EINTERNAL.
func ErrorMessage ¶
ErrorMessage unwraps an application error and returns its message. Non-application errors always return "Internal error".
Types ¶
type CreateProxyOptions ¶
type CreateProxyOptions struct { // Suffix will append after uuid // Format: <uuid><.suffix> // Optional. Suffix string `schema:"suffix,omitempty"` }
type Error ¶
type Error struct { // Machine-readable error code. Code string // Human-readable error message. Message string }
Error represents an application-specific error. Application errors can be unwrapped by the caller to extract out the code & message.
Any non-application error (such as a disk error) should be reported as an EINTERNAL error and the human user should only see "Internal error" as the message. These low-level internal error details should only be logged and reported to the operator of the application (not the end user).
type ListProxiesOptions ¶
type ListProxiesOptions struct { // ProxyID unique proxy rule id. ProxyID string `schema:"proxy_id,omitempty"` // PageSize sets the maximum number of users to be returned. // 0 means no maximum; driver implementations should choose a reasonable // max. It is guaranteed to be >= 0. PageSize int `schema:"page_size,omitempty"` // PageToken may be filled in with the NextPageToken from a previous // ListUsers call. PageToken string `schema:"page_token,omitempty"` }
type ListProxiesPage ¶
type Proxy ¶
type Proxy struct { // ID Unique proxy id. // Format: <uuid><.suffix> // Output only. ID string `json:"proxy_id"` // User Over SSH login name. // Required. User string `json:"user"` // Host Over SSH login host. // Required. Host string `json:"host"` // PrivateKey Over SSH login private key. // Optional. PrivateKey string `json:"private_key,omitempty"` // Passphrase Over SSH login private key passphrase. // Optional. Passphrase string `json:"passphrase,omitempty"` // Password Over SSH login password. // Optional. Password string `json:"password,omitempty"` // Node Proxy to destination. // Required. Node string `json:"node"` // Port Proxy to destination. // Required. Port uint16 `json:"port"` // CreateTime Create time of this address. // Output only. CreateTime time.Time `json:"create_time"` // UpdateTime Update time of this address. // Output only. UpdateTime time.Time `json:"update_time"` }
type ProxyService ¶
type ProxyService interface { CreateProxy(ctx context.Context, proxy *Proxy, opts CreateProxyOptions) error ListProxies(ctx context.Context, opts ListProxiesOptions) (*ListProxiesPage, error) DeleteProxy(ctx context.Context, proxyID string) error }