Skip to content

Commit

Permalink
Add inline-certificate as possible payload of config-entry wrapper
Browse files Browse the repository at this point in the history
Co-Authored-By: Andrew Stucki <3577250+andrewstucki@users.noreply.github.com>
  • Loading branch information
nathancoleman and andrewstucki committed Feb 15, 2023
1 parent fd61605 commit acf7549
Show file tree
Hide file tree
Showing 3 changed files with 1,141 additions and 1,101 deletions.
16 changes: 16 additions & 0 deletions proto/pbconfigentry/config_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ func ConfigEntryToStructs(s *ConfigEntry) structs.ConfigEntry {
pbcommon.RaftIndexToStructs(s.RaftIndex, &target.RaftIndex)
pbcommon.EnterpriseMetaToStructs(s.EnterpriseMeta, &target.EnterpriseMeta)
return &target
case Kind_KindInlineCertificate:
var target structs.InlineCertificateConfigEntry
target.Name = s.Name

InlineCertificateToStructs(s.GetInlineCertificate(), &target)
pbcommon.RaftIndexToStructs(s.RaftIndex, &target.RaftIndex)
pbcommon.EnterpriseMetaToStructs(s.EnterpriseMeta, &target.EnterpriseMeta)
return &target
case Kind_KindServiceDefaults:
var target structs.ServiceConfigEntry
target.Name = s.Name
Expand Down Expand Up @@ -177,6 +185,14 @@ func ConfigEntryFromStructs(s structs.ConfigEntry) *ConfigEntry {
configEntry.Entry = &ConfigEntry_HTTPRoute{
HTTPRoute: &route,
}
case *structs.InlineCertificateConfigEntry:
var cert InlineCertificate
InlineCertificateFromStructs(v, &cert)

configEntry.Kind = Kind_KindInlineCertificate
configEntry.Entry = &ConfigEntry_InlineCertificate{
InlineCertificate: &cert,
}
default:
panic(fmt.Sprintf("unable to convert %T to proto", s))
}
Expand Down
Loading

0 comments on commit acf7549

Please sign in to comment.