Files
threshold/internal/session/session_connect_with.go
T
s-christoffandJim 6b78108ecf Update primary error functions to take a context, deprecate old functions (#1358)
* add new error funcs which take a ctx and deprecate existing funcs

* use context where available when writing error events

* remove circular internal/errors pkg dep

* suppress some chatty errors using errors.WithoutEvent()

* convert auth oidc funcs to take context where needed to write events

Co-authored-by: Jim <jlambert@hashicorp.com>
2021-07-29 20:52:56 -04:00

36 lines
1.1 KiB
Go

package session
import (
"github.com/hashicorp/boundary/internal/errors"
)
// ConnectWith defines the boundary data that is saved in the repo when the
// worker has established a connection between the client and the endpoint.
type ConnectWith struct {
ConnectionId string
ClientTcpAddress string
ClientTcpPort uint32
EndpointTcpAddress string
EndpointTcpPort uint32
}
func (c ConnectWith) validate() error {
const op = "session.(ConnectWith).validate"
if c.ConnectionId == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing session id")
}
if c.ClientTcpAddress == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing client tcp address")
}
if c.ClientTcpPort == 0 {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing client ctp port")
}
if c.EndpointTcpAddress == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing endpoint tcp address")
}
if c.EndpointTcpPort == 0 {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing endpoint ctp port")
}
return nil
}