Rename root, api and sdk module paths (imports, go.mod, go_package, ldflags, build scripts, buf configs) and regenerate protobuf/gateway code with the project's pinned toolchain. Wire identifiers unchanged. api gets a local replace for sdk; root/api/sdk require v0.1.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package host
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/globals"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/db/timestamp"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/errors"
|
|
)
|
|
|
|
// CatalogListQueryResult describes the result from the
|
|
// host catalog list query used to list all host
|
|
// catalog subtypes.
|
|
type CatalogListQueryResult struct {
|
|
// PublicId is a surrogate key suitable for use in a public API.
|
|
PublicId string `gorm:"primary_key"`
|
|
// The Project Id of the owning project and must be set.
|
|
ProjectId string
|
|
// Optional name of the host catalog.
|
|
Name string
|
|
// Optional description of the host catalog.
|
|
Description string
|
|
// Create time of the host catalog.
|
|
CreateTime *timestamp.Timestamp
|
|
// Update time of the host catalog.
|
|
UpdateTime *timestamp.Timestamp
|
|
// Version of the host catalog.
|
|
Version uint32
|
|
// Optional plugin ID of the host catalog.
|
|
PluginId string
|
|
// Optional secrets HMAC of the host catalog.
|
|
SecretsHmac []byte
|
|
// Optional attributes of the host catalog.
|
|
Attributes []byte
|
|
// The subtype of the host catalog.
|
|
Subtype string
|
|
// Optional worker filter of a plugin-subtype host catalog.
|
|
WorkerFilter string
|
|
}
|
|
|
|
func (s *CatalogListQueryResult) toCatalog(ctx context.Context) (Catalog, error) {
|
|
const op = "host.(*CatalogListQueryResult).toCatalog"
|
|
|
|
newFn, ok := subtypeRegistry.newFunc(globals.Subtype(s.Subtype))
|
|
if !ok {
|
|
return nil, errors.New(ctx,
|
|
errors.InvalidParameter,
|
|
op,
|
|
fmt.Sprintf("%s is an unknown host catalog subtype of %s", s.PublicId, s.Subtype),
|
|
)
|
|
}
|
|
|
|
return newFn(ctx, s)
|
|
}
|