Files
threshold/internal/host/static/public_ids.go
T

47 lines
1.1 KiB
Go
Raw Normal View History

2020-08-13 14:00:15 -04:00
package static
import (
"github.com/hashicorp/boundary/internal/db"
2020-12-09 10:11:38 -08:00
"github.com/hashicorp/boundary/internal/errors"
"github.com/hashicorp/boundary/internal/host"
"github.com/hashicorp/boundary/internal/types/subtypes"
2020-08-13 14:00:15 -04:00
)
func init() {
if err := host.Register(Subtype, HostCatalogPrefix, HostSetPrefix, HostPrefix); err != nil {
panic(err)
}
}
2020-08-13 14:00:15 -04:00
// PublicId prefixes for the resources in the static package.
const (
2020-08-25 00:21:08 -04:00
HostCatalogPrefix = "hcst"
HostSetPrefix = "hsst"
HostPrefix = "hst"
Subtype = subtypes.Subtype("static")
2020-08-13 14:00:15 -04:00
)
func newHostCatalogId() (string, error) {
id, err := db.NewPublicId(HostCatalogPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, "static.newHostCatalogId")
2020-08-13 14:00:15 -04:00
}
2020-12-23 11:00:00 -08:00
return id, nil
2020-08-13 14:00:15 -04:00
}
func newHostId() (string, error) {
id, err := db.NewPublicId(HostPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, "static.newHostId")
2020-08-13 14:00:15 -04:00
}
2020-12-23 11:00:00 -08:00
return id, nil
2020-08-13 14:00:15 -04:00
}
func newHostSetId() (string, error) {
id, err := db.NewPublicId(HostSetPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, "static.newHostSetId")
2020-08-13 14:00:15 -04:00
}
2020-12-23 11:00:00 -08:00
return id, nil
2020-08-13 14:00:15 -04:00
}