-
Notifications
You must be signed in to change notification settings - Fork 38
/
model_outputproperties.go
59 lines (50 loc) · 2.09 KB
/
model_outputproperties.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
package subscriptions
import (
"encoding/json"
"fmt"
)
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type OutputProperties struct {
Datasource OutputDataSource `json:"datasource"`
Diagnostics *Diagnostics `json:"diagnostics,omitempty"`
Etag *string `json:"etag,omitempty"`
LastOutputEventTimestamps *[]LastOutputEventTimestamp `json:"lastOutputEventTimestamps,omitempty"`
Serialization Serialization `json:"serialization"`
SizeWindow *int64 `json:"sizeWindow,omitempty"`
TimeWindow *string `json:"timeWindow,omitempty"`
WatermarkSettings *OutputWatermarkProperties `json:"watermarkSettings,omitempty"`
}
var _ json.Unmarshaler = &OutputProperties{}
func (s *OutputProperties) UnmarshalJSON(bytes []byte) error {
type alias OutputProperties
var decoded alias
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling into OutputProperties: %+v", err)
}
s.Diagnostics = decoded.Diagnostics
s.Etag = decoded.Etag
s.LastOutputEventTimestamps = decoded.LastOutputEventTimestamps
s.SizeWindow = decoded.SizeWindow
s.TimeWindow = decoded.TimeWindow
s.WatermarkSettings = decoded.WatermarkSettings
var temp map[string]json.RawMessage
if err := json.Unmarshal(bytes, &temp); err != nil {
return fmt.Errorf("unmarshaling OutputProperties into map[string]json.RawMessage: %+v", err)
}
if v, ok := temp["datasource"]; ok {
impl, err := unmarshalOutputDataSourceImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'Datasource' for 'OutputProperties': %+v", err)
}
s.Datasource = impl
}
if v, ok := temp["serialization"]; ok {
impl, err := unmarshalSerializationImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'Serialization' for 'OutputProperties': %+v", err)
}
s.Serialization = impl
}
return nil
}