open-consul/agent/consul/state/config_entry_exported_services_oss.go
hashicorp-copywrite[bot] 87aee8308b
[COMPLIANCE] Add Copyright and License Headers (#16854)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Ronald <roncodingenthusiast@users.noreply.github.com>
2023-04-20 12:40:22 +00:00

35 lines
959 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build !consulent
// +build !consulent
package state
import (
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/agent/configentry"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/go-memdb"
)
func getSimplifiedExportedServices(
tx ReadTxn,
ws memdb.WatchSet,
overrides map[configentry.KindName]structs.ConfigEntry,
entMeta acl.EnterpriseMeta,
) (uint64, *SimplifiedExportedServices, error) {
idx, exports, err := getExportedServicesConfigEntryTxn(tx, ws, overrides, &entMeta)
if exports == nil {
return idx, nil, err
}
simple := SimplifiedExportedServices(*exports)
return idx, &simple, err
}
func (s *Store) GetSimplifiedExportedServices(ws memdb.WatchSet, entMeta acl.EnterpriseMeta) (uint64, *SimplifiedExportedServices, error) {
tx := s.db.Txn(false)
defer tx.Abort()
return getSimplifiedExportedServices(tx, ws, nil, entMeta)
}