2023-03-28 19:12:30 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2023-02-08 20:07:21 +00:00
|
|
|
//go:build !consulent
|
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package instances
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/consul/acl"
|
|
|
|
"github.com/hashicorp/consul/api"
|
|
|
|
)
|
|
|
|
|
|
|
|
const showPartitionNamespace = false
|
|
|
|
|
|
|
|
func getBillableInstanceCounts(usage api.ServiceUsage, datacenter string) []serviceCount {
|
|
|
|
return []serviceCount{
|
|
|
|
{
|
|
|
|
datacenter: datacenter,
|
|
|
|
partition: acl.DefaultPartitionName,
|
|
|
|
namespace: acl.DefaultNamespaceName,
|
|
|
|
instanceCount: usage.BillableServiceInstances,
|
|
|
|
services: usage.Services,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getConnectInstanceCounts(usage api.ServiceUsage, datacenter string) []serviceCount {
|
|
|
|
var counts []serviceCount
|
|
|
|
|
|
|
|
for serviceType, instanceCount := range usage.ConnectServiceInstances {
|
|
|
|
counts = append(counts, serviceCount{
|
|
|
|
datacenter: datacenter,
|
|
|
|
partition: acl.DefaultPartitionName,
|
|
|
|
namespace: acl.DefaultNamespaceName,
|
|
|
|
serviceType: serviceType,
|
|
|
|
instanceCount: instanceCount,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return counts
|
|
|
|
}
|