Files
threshold/internal/session/ids.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

57 lines
1.2 KiB
Go

package session
import (
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/errors"
)
const (
// SessionPrefix for session PK ids
SessionPrefix = "s"
// StatePrefix for state PK ids
StatePrefix = "ss"
// ConnectionPrefix for connection PK ids
ConnectionPrefix = "sc"
// ConnectionStatePrefix for connection state PK ids
ConnectionStatePrefix = "scs"
)
func newId() (string, error) {
const op = "session.newId"
id, err := db.NewPublicId(SessionPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, op)
}
return id, nil
}
func newStateId() (string, error) {
const op = "session.newStateId"
id, err := db.NewPublicId(StatePrefix)
if err != nil {
return "", errors.WrapDeprecated(err, op)
}
return id, nil
}
func newConnectionId() (string, error) {
const op = "session.newConnectionId"
id, err := db.NewPublicId(ConnectionPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, op)
}
return id, nil
}
func newConnectionStateId() (string, error) {
const op = "session.newConnectionStateId"
id, err := db.NewPublicId(ConnectionStatePrefix)
if err != nil {
return "", errors.WrapDeprecated(err, op)
}
return id, nil
}