* Refactor: inline tablename constants * Refactor: move functionality to new files
39 lines
751 B
Go
39 lines
751 B
Go
package static
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/boundary/internal/db"
|
|
)
|
|
|
|
// PublicId prefixes for the resources in the static package.
|
|
const (
|
|
HostCatalogPrefix = "sthc"
|
|
HostSetPrefix = "sths"
|
|
HostPrefix = "sth"
|
|
)
|
|
|
|
func newHostCatalogId() (string, error) {
|
|
id, err := db.NewPublicId(HostCatalogPrefix)
|
|
if err != nil {
|
|
return "", fmt.Errorf("new host catalog id: %w", err)
|
|
}
|
|
return id, err
|
|
}
|
|
|
|
func newHostId() (string, error) {
|
|
id, err := db.NewPublicId(HostPrefix)
|
|
if err != nil {
|
|
return "", fmt.Errorf("new host id: %w", err)
|
|
}
|
|
return id, err
|
|
}
|
|
|
|
func newHostSetId() (string, error) {
|
|
id, err := db.NewPublicId(HostSetPrefix)
|
|
if err != nil {
|
|
return "", fmt.Errorf("new host set id: %w", err)
|
|
}
|
|
return id, err
|
|
}
|