-
Notifications
You must be signed in to change notification settings - Fork 800
/
zz_generated_models_serde.go
169 lines (153 loc) · 5.86 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// 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.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
package armelastic
import (
"encoding/json"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
)
// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody.
func (e ErrorResponseBody) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "code", e.Code)
populate(objectMap, "details", e.Details)
populate(objectMap, "message", e.Message)
populate(objectMap, "target", e.Target)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type LogRules.
func (l LogRules) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "filteringTags", l.FilteringTags)
populate(objectMap, "sendAadLogs", l.SendAADLogs)
populate(objectMap, "sendActivityLogs", l.SendActivityLogs)
populate(objectMap, "sendSubscriptionLogs", l.SendSubscriptionLogs)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type MonitorResource.
func (m MonitorResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "id", m.ID)
populate(objectMap, "identity", m.Identity)
populate(objectMap, "location", m.Location)
populate(objectMap, "name", m.Name)
populate(objectMap, "properties", m.Properties)
populate(objectMap, "sku", m.SKU)
populate(objectMap, "systemData", m.SystemData)
populate(objectMap, "tags", m.Tags)
populate(objectMap, "type", m.Type)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type MonitorResourceListResponse.
func (m MonitorResourceListResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", m.NextLink)
populate(objectMap, "value", m.Value)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type MonitorResourceUpdateParameters.
func (m MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "tags", m.Tags)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type MonitoredResourceListResponse.
func (m MonitoredResourceListResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", m.NextLink)
populate(objectMap, "value", m.Value)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type MonitoringTagRulesListResponse.
func (m MonitoringTagRulesListResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", m.NextLink)
populate(objectMap, "value", m.Value)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type OperationListResult.
func (o OperationListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", o.NextLink)
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// MarshalJSON implements the json.Marshaller interface for type SystemData.
func (s SystemData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt)
populate(objectMap, "createdBy", s.CreatedBy)
populate(objectMap, "createdByType", s.CreatedByType)
populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt)
populate(objectMap, "lastModifiedBy", s.LastModifiedBy)
populate(objectMap, "lastModifiedByType", s.LastModifiedByType)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
func (s *SystemData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return err
}
for key, val := range rawMsg {
var err error
switch key {
case "createdAt":
err = unpopulateTimeRFC3339(val, &s.CreatedAt)
delete(rawMsg, key)
case "createdBy":
err = unpopulate(val, &s.CreatedBy)
delete(rawMsg, key)
case "createdByType":
err = unpopulate(val, &s.CreatedByType)
delete(rawMsg, key)
case "lastModifiedAt":
err = unpopulateTimeRFC3339(val, &s.LastModifiedAt)
delete(rawMsg, key)
case "lastModifiedBy":
err = unpopulate(val, &s.LastModifiedBy)
delete(rawMsg, key)
case "lastModifiedByType":
err = unpopulate(val, &s.LastModifiedByType)
delete(rawMsg, key)
}
if err != nil {
return err
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type VMHostListResponse.
func (v VMHostListResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "nextLink", v.NextLink)
populate(objectMap, "value", v.Value)
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
}
}
func unpopulate(data json.RawMessage, v interface{}) error {
if data == nil {
return nil
}
return json.Unmarshal(data, v)
}