mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
Merge pull request #11436 from hashicorp/api/exports-marshal
[OSS] Ensure partition-exports kind gets marshaled
This commit is contained in:
commit
ab425e3ca1
@ -1,6 +1,7 @@
|
||||
package structs
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/consul/acl"
|
||||
@ -158,3 +159,19 @@ func (e *PartitionExportsConfigEntry) GetEnterpriseMeta() *EnterpriseMeta {
|
||||
|
||||
return &e.EnterpriseMeta
|
||||
}
|
||||
|
||||
// MarshalJSON adds the Kind field so that the JSON can be decoded back into the
|
||||
// correct type.
|
||||
// This method is implemented on the structs type (as apposed to the api type)
|
||||
// because that is what the API currently uses to return a response.
|
||||
func (e *PartitionExportsConfigEntry) MarshalJSON() ([]byte, error) {
|
||||
type Alias PartitionExportsConfigEntry
|
||||
source := &struct {
|
||||
Kind string
|
||||
*Alias
|
||||
}{
|
||||
Kind: PartitionExports,
|
||||
Alias: (*Alias)(e),
|
||||
}
|
||||
return json.Marshal(source)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user