forked from hashicorp/terraform-provider-azurerm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_routingruleproperties.go
49 lines (42 loc) · 2.21 KB
/
model_routingruleproperties.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
package frontdoors
import (
"encoding/json"
"fmt"
)
type RoutingRuleProperties struct {
AcceptedProtocols *[]FrontDoorProtocol `json:"acceptedProtocols,omitempty"`
EnabledState *RoutingRuleEnabledState `json:"enabledState,omitempty"`
FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"`
PatternsToMatch *[]string `json:"patternsToMatch,omitempty"`
ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"`
RouteConfiguration RouteConfiguration `json:"routeConfiguration"`
RulesEngine *SubResource `json:"rulesEngine,omitempty"`
WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"`
}
var _ json.Unmarshaler = &RoutingRuleProperties{}
func (s *RoutingRuleProperties) UnmarshalJSON(bytes []byte) error {
type alias RoutingRuleProperties
var decoded alias
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling into RoutingRuleProperties: %+v", err)
}
s.AcceptedProtocols = decoded.AcceptedProtocols
s.EnabledState = decoded.EnabledState
s.FrontendEndpoints = decoded.FrontendEndpoints
s.PatternsToMatch = decoded.PatternsToMatch
s.ResourceState = decoded.ResourceState
s.RulesEngine = decoded.RulesEngine
s.WebApplicationFirewallPolicyLink = decoded.WebApplicationFirewallPolicyLink
var temp map[string]json.RawMessage
if err := json.Unmarshal(bytes, &temp); err != nil {
return fmt.Errorf("unmarshaling RoutingRuleProperties into map[string]json.RawMessage: %+v", err)
}
if v, ok := temp["routeConfiguration"]; ok {
impl, err := unmarshalRouteConfigurationImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'RouteConfiguration' for 'RoutingRuleProperties': %+v", err)
}
s.RouteConfiguration = impl
}
return nil
}