2023-03-28 19:39:22 +01:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 09:12:13 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 19:39:22 +01:00
|
|
|
|
2022-01-20 10:12:04 -06:00
|
|
|
//go:build !consulent
|
|
|
|
|
|
|
|
package proxycfg
|
|
|
|
|
|
|
|
import (
|
2022-04-05 14:10:06 -07:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2022-01-20 10:12:04 -06:00
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
|
|
)
|
|
|
|
|
2022-04-29 18:12:51 -04:00
|
|
|
func UpstreamIDString(typ, dc, name string, _ *acl.EnterpriseMeta, peerName string) string {
|
2022-01-20 10:12:04 -06:00
|
|
|
ret := name
|
|
|
|
|
2022-04-29 18:12:51 -04:00
|
|
|
if peerName != "" {
|
|
|
|
ret += "?peer=" + peerName
|
|
|
|
} else if dc != "" {
|
2022-01-20 10:12:04 -06:00
|
|
|
ret += "?dc=" + dc
|
|
|
|
}
|
|
|
|
|
|
|
|
if typ == "" || typ == structs.UpstreamDestTypeService {
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
|
|
|
return typ + ":" + ret
|
|
|
|
}
|
|
|
|
|
2022-04-05 14:10:06 -07:00
|
|
|
func parseInnerUpstreamIDString(input string) (string, *acl.EnterpriseMeta) {
|
2022-01-20 10:12:04 -06:00
|
|
|
return input, structs.DefaultEnterpriseMetaInDefaultPartition()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u UpstreamID) enterpriseIdentifierPrefix() string {
|
|
|
|
return ""
|
|
|
|
}
|