-
Notifications
You must be signed in to change notification settings - Fork 1
/
serde.go
36 lines (32 loc) · 1.49 KB
/
serde.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Copyright 2020 The Magma Authors.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package configurator
import (
"github.com/go-magma/magma/orc8r/cloud/go/serde"
)
// NewNetworkConfigSerde returns a network config domain Serde implementation
// for a pointer to a structure implementing both BinaryMarshaler and
// BinaryUnmarshaler.
// If the modelPtr argument is not a pointer to a struct matching those
// requirements, this function will panic.
func NewNetworkConfigSerde(configType string, modelPtr serde.BinaryConvertible) serde.Serde {
return serde.NewBinarySerde(NetworkConfigSerdeDomain, configType, modelPtr)
}
// NewNetworkEntityConfigSerde returns a network entity config domain Serde
// implementation/ for a pointer to a structure implementing both
// BinaryMarshaler and BinaryUnmarshaler.
// If the modelPtr argument is not a pointer to a struct matching those
// requirements, this function will panic.
func NewNetworkEntityConfigSerde(configType string, modelPtr serde.BinaryConvertible) serde.Serde {
return serde.NewBinarySerde(NetworkEntitySerdeDomain, configType, modelPtr)
}