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"
|
2023-11-15 19:55:46 -05:00
|
|
|
"github.com/hashicorp/boundary/internal/types/resource"
|
2023-04-24 19:27:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const StorageDomain = "storage"
|
|
|
|
|
|
|
|
|
|
func init() {
|
2023-11-15 19:55:46 -05:00
|
|
|
globals.RegisterPrefixToResourceInfo(globals.PluginStorageBucketPrefix, resource.StorageBucket, StorageDomain, Subtype)
|
2023-04-24 19:27:41 -04:00
|
|
|
}
|
|
|
|
|
|
2023-11-02 16:03:47 -04:00
|
|
|
const (
|
2023-11-15 19:55:46 -05:00
|
|
|
Subtype = globals.Subtype("plugin")
|
2023-11-02 16:03:47 -04:00
|
|
|
)
|
|
|
|
|
|
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
|
|
|
|
|
}
|