2023-04-24 19:27:41 -04:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
|
|
|
|
|
package plugin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/boundary/globals"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/db"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/errors"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/types/subtypes"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const StorageDomain = "storage"
|
|
|
|
|
|
|
|
|
|
func init() {
|
2023-11-02 16:03:47 -04:00
|
|
|
if err := subtypes.Register(StorageDomain, Subtype, globals.PluginStorageBucketPrefix); err != nil {
|
2023-04-24 19:27:41 -04:00
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-02 16:03:47 -04:00
|
|
|
const (
|
|
|
|
|
Subtype = subtypes.Subtype("plugin")
|
|
|
|
|
)
|
|
|
|
|
|
2023-04-24 19:27:41 -04:00
|
|
|
func newStorageBucketId(ctx context.Context) (string, error) {
|
|
|
|
|
const op = "plugin.newStorageBucketId"
|
2023-06-06 17:09:08 -04:00
|
|
|
id, err := db.NewPublicId(ctx, globals.PluginStorageBucketPrefix)
|
2023-04-24 19:27:41 -04:00
|
|
|
if err != nil {
|
|
|
|
|
return "", errors.Wrap(ctx, err, op)
|
|
|
|
|
}
|
|
|
|
|
return id, nil
|
|
|
|
|
}
|