2022-05-18 20:20:45 -07:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-02-02 17:15:17 -08:00
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
package static
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
2023-03-10 15:06:39 -05:00
|
|
|
"github.com/hashicorp/boundary/globals"
|
2022-05-18 20:20:45 -07:00
|
|
|
"github.com/hashicorp/boundary/internal/credential"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/db"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/errors"
|
2023-11-15 19:55:46 -05:00
|
|
|
"github.com/hashicorp/boundary/internal/types/resource"
|
2022-05-18 20:20:45 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
2023-11-15 19:55:46 -05:00
|
|
|
globals.RegisterPrefixToResourceInfo(globals.StaticCredentialStorePrefix, resource.CredentialStore, credential.Domain, Subtype)
|
|
|
|
|
globals.RegisterPrefixToResourceInfo(globals.StaticCredentialStorePreviousPrefix, resource.CredentialStore, credential.Domain, Subtype)
|
2022-05-18 20:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
2023-11-02 16:03:47 -04:00
|
|
|
// PublicId prefixes for the resources in the static package.
|
|
|
|
|
const (
|
2023-11-15 19:55:46 -05:00
|
|
|
Subtype = globals.Subtype("static")
|
2023-11-02 16:03:47 -04:00
|
|
|
)
|
|
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
func newCredentialStoreId(ctx context.Context) (string, error) {
|
2023-06-06 17:09:08 -04:00
|
|
|
id, err := db.NewPublicId(ctx, globals.StaticCredentialStorePrefix)
|
2022-05-18 20:20:45 -07:00
|
|
|
if err != nil {
|
|
|
|
|
return "", errors.Wrap(ctx, err, "static.newCredentialStoreId")
|
|
|
|
|
}
|
|
|
|
|
return id, nil
|
|
|
|
|
}
|