2022-03-16 16:12:29 +00:00
|
|
|
package pbconnect
|
|
|
|
|
|
|
|
import (
|
2022-04-05 21:10:06 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2022-03-16 16:12:29 +00:00
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
2022-03-23 13:25:56 +00:00
|
|
|
"github.com/hashicorp/consul/proto/pbcommon"
|
2022-03-16 16:12:29 +00:00
|
|
|
)
|
|
|
|
|
2022-03-23 13:25:56 +00:00
|
|
|
func QueryMetaFrom(f structs.QueryMeta) *pbcommon.QueryMeta {
|
|
|
|
t := new(pbcommon.QueryMeta)
|
|
|
|
pbcommon.QueryMetaFromStructs(&f, t)
|
2022-03-22 20:30:00 +00:00
|
|
|
return t
|
2022-03-16 16:12:29 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:25:56 +00:00
|
|
|
func QueryMetaTo(f *pbcommon.QueryMeta) structs.QueryMeta {
|
2022-03-22 20:30:00 +00:00
|
|
|
t := new(structs.QueryMeta)
|
2022-03-23 13:25:56 +00:00
|
|
|
pbcommon.QueryMetaToStructs(f, t)
|
2022-03-22 20:30:00 +00:00
|
|
|
return *t
|
2022-03-16 16:12:29 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:25:56 +00:00
|
|
|
func RaftIndexFrom(f structs.RaftIndex) *pbcommon.RaftIndex {
|
|
|
|
t := new(pbcommon.RaftIndex)
|
|
|
|
pbcommon.RaftIndexFromStructs(&f, t)
|
2022-03-22 20:30:00 +00:00
|
|
|
return t
|
2022-03-16 16:12:29 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:25:56 +00:00
|
|
|
func RaftIndexTo(f *pbcommon.RaftIndex) structs.RaftIndex {
|
2022-03-22 20:30:00 +00:00
|
|
|
t := new(structs.RaftIndex)
|
2022-03-23 13:25:56 +00:00
|
|
|
pbcommon.RaftIndexToStructs(f, t)
|
2022-03-22 20:30:00 +00:00
|
|
|
return *t
|
2022-03-16 16:12:29 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
func EnterpriseMetaFrom(f acl.EnterpriseMeta) *pbcommon.EnterpriseMeta {
|
2022-03-23 13:25:56 +00:00
|
|
|
t := new(pbcommon.EnterpriseMeta)
|
|
|
|
pbcommon.EnterpriseMetaFromStructs(&f, t)
|
2022-03-22 20:30:00 +00:00
|
|
|
return t
|
2022-03-16 16:12:29 +00:00
|
|
|
}
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
func EnterpriseMetaTo(f *pbcommon.EnterpriseMeta) acl.EnterpriseMeta {
|
|
|
|
t := new(acl.EnterpriseMeta)
|
2022-03-23 13:25:56 +00:00
|
|
|
pbcommon.EnterpriseMetaToStructs(f, t)
|
2022-03-22 20:30:00 +00:00
|
|
|
return *t
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewIssuedCertFromStructs(in *structs.IssuedCert) (*IssuedCert, error) {
|
|
|
|
t := new(IssuedCert)
|
|
|
|
IssuedCertFromStructsIssuedCert(in, t)
|
|
|
|
return t, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewCARootsFromStructs(in *structs.IndexedCARoots) (*CARoots, error) {
|
|
|
|
t := new(CARoots)
|
|
|
|
CARootsFromStructsIndexedCARoots(in, t)
|
|
|
|
return t, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func CARootsToStructs(in *CARoots) (*structs.IndexedCARoots, error) {
|
|
|
|
t := new(structs.IndexedCARoots)
|
|
|
|
CARootsToStructsIndexedCARoots(in, t)
|
|
|
|
return t, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewCARootFromStructs(in *structs.CARoot) (*CARoot, error) {
|
|
|
|
t := new(CARoot)
|
|
|
|
CARootFromStructsCARoot(in, t)
|
|
|
|
return t, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func CARootToStructs(in *CARoot) (*structs.CARoot, error) {
|
|
|
|
t := new(structs.CARoot)
|
|
|
|
CARootToStructsCARoot(in, t)
|
|
|
|
return t, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func IssuedCertToStructs(in *IssuedCert) (*structs.IssuedCert, error) {
|
|
|
|
t := new(structs.IssuedCert)
|
|
|
|
IssuedCertToStructsIssuedCert(in, t)
|
|
|
|
return t, nil
|
2022-03-16 16:12:29 +00:00
|
|
|
}
|