You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/command/operator/usage/instances/usage_instances_ce.go

42 lines
1004 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
//go: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
}