/
zz_generated_models_serde.go
55 lines (48 loc) · 1.69 KB
/
zz_generated_models_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armhanaonazure
import (
"encoding/json"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
)
// MarshalJSON implements the json.Marshaller interface for type SapMonitor.
func (s SapMonitor) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "id", s.ID)
populate(objectMap, "location", s.Location)
populate(objectMap, "name", s.Name)
populate(objectMap, "properties", s.Properties)
populate(objectMap, "tags", s.Tags)
populate(objectMap, "type", s.Type)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type Tags.
func (t Tags) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "tags", t.Tags)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type TrackedResource.
func (t TrackedResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "id", t.ID)
populate(objectMap, "location", t.Location)
populate(objectMap, "name", t.Name)
populate(objectMap, "tags", t.Tags)
populate(objectMap, "type", t.Type)
return json.Marshal(objectMap)
}
func populate(m map[string]interface{}, k string, v interface{}) {
if v == nil {
return
} else if azcore.IsNullValue(v) {
m[k] = nil
} else if !reflect.ValueOf(v).IsNil() {
m[k] = v
}
}