2023-09-15 16:31:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
2023-09-22 16:51:15 +00:00
|
|
|
package authv2beta1
|
2023-09-15 16:31:22 +00:00
|
|
|
|
2023-09-22 20:10:10 +00:00
|
|
|
import "github.com/hashicorp/consul/proto-public/pbresource"
|
|
|
|
|
2023-09-15 16:31:22 +00:00
|
|
|
type SourceToSpiffe interface {
|
|
|
|
GetIdentityName() string
|
|
|
|
GetPartition() string
|
|
|
|
GetNamespace() string
|
|
|
|
GetPeer() string
|
2023-09-22 20:10:10 +00:00
|
|
|
GetSamenessGroup() string
|
2023-09-15 16:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var _ SourceToSpiffe = (*Source)(nil)
|
|
|
|
var _ SourceToSpiffe = (*ExcludeSource)(nil)
|
2023-09-22 20:10:10 +00:00
|
|
|
|
|
|
|
func SourceToTenancy(s SourceToSpiffe) *pbresource.Tenancy {
|
|
|
|
return &pbresource.Tenancy{
|
|
|
|
Partition: s.GetPartition(),
|
|
|
|
Namespace: s.GetNamespace(),
|
|
|
|
PeerName: s.GetPeer(),
|
|
|
|
}
|
|
|
|
}
|