// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package arm

import "encoding/json"

type FirewallPoliciesRuleCollectionGroup_STATUS struct {
	// Etag: A unique read-only string that changes whenever the resource is updated.
	Etag *string `json:"etag,omitempty"`

	// Id: Resource ID.
	Id *string `json:"id,omitempty"`

	// Name: The name of the resource that is unique within a resource group. This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Properties: The properties of the firewall policy rule collection group.
	Properties *FirewallPolicyRuleCollectionGroupProperties_STATUS `json:"properties,omitempty"`

	// Type: Rule Group type.
	Type *string `json:"type,omitempty"`
}

// Properties of the rule collection group.
type FirewallPolicyRuleCollectionGroupProperties_STATUS struct {
	// Priority: Priority of the Firewall Policy Rule Collection Group resource.
	Priority *int `json:"priority,omitempty"`

	// ProvisioningState: The provisioning state of the firewall policy rule collection group resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// RuleCollections: Group of Firewall Policy rule collections.
	RuleCollections []FirewallPolicyRuleCollection_STATUS `json:"ruleCollections,omitempty"`

	// Size: A read-only string that represents the size of the FirewallPolicyRuleCollectionGroupProperties in MB. (ex 1.2MB)
	Size *string `json:"size,omitempty"`
}

type FirewallPolicyRuleCollection_STATUS struct {
	// FirewallPolicyFilter: Mutually exclusive with all other properties
	FirewallPolicyFilter *FirewallPolicyFilterRuleCollection_STATUS `json:"firewallPolicyFilterRuleCollection,omitempty"`

	// FirewallPolicyNat: Mutually exclusive with all other properties
	FirewallPolicyNat *FirewallPolicyNatRuleCollection_STATUS `json:"firewallPolicyNatRuleCollection,omitempty"`
}

// MarshalJSON defers JSON marshaling to the first non-nil property, because FirewallPolicyRuleCollection_STATUS represents a discriminated union (JSON OneOf)
func (collection FirewallPolicyRuleCollection_STATUS) MarshalJSON() ([]byte, error) {
	if collection.FirewallPolicyFilter != nil {
		return json.Marshal(collection.FirewallPolicyFilter)
	}

	if collection.FirewallPolicyNat != nil {
		return json.Marshal(collection.FirewallPolicyNat)
	}

	return nil, nil
}

// UnmarshalJSON unmarshals the FirewallPolicyRuleCollection_STATUS
func (collection *FirewallPolicyRuleCollection_STATUS) UnmarshalJSON(data []byte) error {
	var rawJson map[string]interface{}
	err := json.Unmarshal(data, &rawJson)
	if err != nil {
		return err
	}
	discriminator := rawJson["ruleCollectionType"]
	if discriminator == "FirewallPolicyFilterRuleCollection" {
		collection.FirewallPolicyFilter = &FirewallPolicyFilterRuleCollection_STATUS{}
		return json.Unmarshal(data, collection.FirewallPolicyFilter)
	}
	if discriminator == "FirewallPolicyNatRuleCollection" {
		collection.FirewallPolicyNat = &FirewallPolicyNatRuleCollection_STATUS{}
		return json.Unmarshal(data, collection.FirewallPolicyNat)
	}

	// No error
	return nil
}

type FirewallPolicyFilterRuleCollection_STATUS struct {
	// Action: The action type of a Filter rule collection.
	Action *FirewallPolicyFilterRuleCollectionAction_STATUS `json:"action,omitempty"`

	// Name: The name of the rule collection.
	Name *string `json:"name,omitempty"`

	// Priority: Priority of the Firewall Policy Rule Collection resource.
	Priority *int `json:"priority,omitempty"`

	// RuleCollectionType: The type of the rule collection.
	RuleCollectionType FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS `json:"ruleCollectionType,omitempty"`

	// Rules: List of rules included in a rule collection.
	Rules []FirewallPolicyRule_STATUS `json:"rules,omitempty"`
}

type FirewallPolicyNatRuleCollection_STATUS struct {
	// Action: The action type of a Nat rule collection.
	Action *FirewallPolicyNatRuleCollectionAction_STATUS `json:"action,omitempty"`

	// Name: The name of the rule collection.
	Name *string `json:"name,omitempty"`

	// Priority: Priority of the Firewall Policy Rule Collection resource.
	Priority *int `json:"priority,omitempty"`

	// RuleCollectionType: The type of the rule collection.
	RuleCollectionType FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS `json:"ruleCollectionType,omitempty"`

	// Rules: List of rules included in a rule collection.
	Rules []FirewallPolicyRule_STATUS `json:"rules,omitempty"`
}

type FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS string

const FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_FirewallPolicyFilterRuleCollection = FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS("FirewallPolicyFilterRuleCollection")

// Mapping from string to FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS
var firewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_Values = map[string]FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS{
	"firewallpolicyfilterrulecollection": FirewallPolicyFilterRuleCollection_RuleCollectionType_STATUS_FirewallPolicyFilterRuleCollection,
}

// Properties of the FirewallPolicyFilterRuleCollectionAction.
type FirewallPolicyFilterRuleCollectionAction_STATUS struct {
	// Type: The type of action.
	Type *FirewallPolicyFilterRuleCollectionActionType_STATUS `json:"type,omitempty"`
}

type FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS string

const FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS_FirewallPolicyNatRuleCollection = FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS("FirewallPolicyNatRuleCollection")

// Mapping from string to FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS
var firewallPolicyNatRuleCollection_RuleCollectionType_STATUS_Values = map[string]FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS{
	"firewallpolicynatrulecollection": FirewallPolicyNatRuleCollection_RuleCollectionType_STATUS_FirewallPolicyNatRuleCollection,
}

// Properties of the FirewallPolicyNatRuleCollectionAction.
type FirewallPolicyNatRuleCollectionAction_STATUS struct {
	// Type: The type of action.
	Type *FirewallPolicyNatRuleCollectionActionType_STATUS `json:"type,omitempty"`
}

type FirewallPolicyRule_STATUS struct {
	// Application: Mutually exclusive with all other properties
	Application *ApplicationRule_STATUS `json:"applicationRule,omitempty"`

	// Nat: Mutually exclusive with all other properties
	Nat *NatRule_STATUS `json:"natRule,omitempty"`

	// Network: Mutually exclusive with all other properties
	Network *NetworkRule_STATUS `json:"networkRule,omitempty"`
}

// MarshalJSON defers JSON marshaling to the first non-nil property, because FirewallPolicyRule_STATUS represents a discriminated union (JSON OneOf)
func (rule FirewallPolicyRule_STATUS) MarshalJSON() ([]byte, error) {
	if rule.Application != nil {
		return json.Marshal(rule.Application)
	}

	if rule.Nat != nil {
		return json.Marshal(rule.Nat)
	}

	if rule.Network != nil {
		return json.Marshal(rule.Network)
	}

	return nil, nil
}

// UnmarshalJSON unmarshals the FirewallPolicyRule_STATUS
func (rule *FirewallPolicyRule_STATUS) UnmarshalJSON(data []byte) error {
	var rawJson map[string]interface{}
	err := json.Unmarshal(data, &rawJson)
	if err != nil {
		return err
	}
	discriminator := rawJson["ruleType"]
	if discriminator == "ApplicationRule" {
		rule.Application = &ApplicationRule_STATUS{}
		return json.Unmarshal(data, rule.Application)
	}
	if discriminator == "NatRule" {
		rule.Nat = &NatRule_STATUS{}
		return json.Unmarshal(data, rule.Nat)
	}
	if discriminator == "NetworkRule" {
		rule.Network = &NetworkRule_STATUS{}
		return json.Unmarshal(data, rule.Network)
	}

	// No error
	return nil
}

type ApplicationRule_STATUS struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// FqdnTags: List of FQDN Tags for this rule.
	FqdnTags []string `json:"fqdnTags,omitempty"`

	// HttpHeadersToInsert: List of HTTP/S headers to insert.
	HttpHeadersToInsert []FirewallPolicyHttpHeaderToInsert_STATUS `json:"httpHeadersToInsert,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// Protocols: Array of Application Protocols.
	Protocols []FirewallPolicyRuleApplicationProtocol_STATUS `json:"protocols,omitempty"`

	// RuleType: Rule Type.
	RuleType ApplicationRule_RuleType_STATUS `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`

	// TargetFqdns: List of FQDNs for this rule.
	TargetFqdns []string `json:"targetFqdns,omitempty"`

	// TargetUrls: List of Urls for this rule condition.
	TargetUrls []string `json:"targetUrls,omitempty"`

	// TerminateTLS: Terminate TLS connections for this rule.
	TerminateTLS *bool `json:"terminateTLS,omitempty"`

	// WebCategories: List of destination azure web categories.
	WebCategories []string `json:"webCategories,omitempty"`
}

// The action type of a rule.
type FirewallPolicyFilterRuleCollectionActionType_STATUS string

const (
	FirewallPolicyFilterRuleCollectionActionType_STATUS_Allow = FirewallPolicyFilterRuleCollectionActionType_STATUS("Allow")
	FirewallPolicyFilterRuleCollectionActionType_STATUS_Deny  = FirewallPolicyFilterRuleCollectionActionType_STATUS("Deny")
)

// Mapping from string to FirewallPolicyFilterRuleCollectionActionType_STATUS
var firewallPolicyFilterRuleCollectionActionType_STATUS_Values = map[string]FirewallPolicyFilterRuleCollectionActionType_STATUS{
	"allow": FirewallPolicyFilterRuleCollectionActionType_STATUS_Allow,
	"deny":  FirewallPolicyFilterRuleCollectionActionType_STATUS_Deny,
}

// The action type of a rule.
type FirewallPolicyNatRuleCollectionActionType_STATUS string

const FirewallPolicyNatRuleCollectionActionType_STATUS_DNAT = FirewallPolicyNatRuleCollectionActionType_STATUS("DNAT")

// Mapping from string to FirewallPolicyNatRuleCollectionActionType_STATUS
var firewallPolicyNatRuleCollectionActionType_STATUS_Values = map[string]FirewallPolicyNatRuleCollectionActionType_STATUS{
	"dnat": FirewallPolicyNatRuleCollectionActionType_STATUS_DNAT,
}

type NatRule_STATUS struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// DestinationPorts: List of destination ports.
	DestinationPorts []string `json:"destinationPorts,omitempty"`

	// IpProtocols: Array of FirewallPolicyRuleNetworkProtocols.
	IpProtocols []FirewallPolicyRuleNetworkProtocol_STATUS `json:"ipProtocols,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// RuleType: Rule Type.
	RuleType NatRule_RuleType_STATUS `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`

	// TranslatedAddress: The translated address for this NAT rule.
	TranslatedAddress *string `json:"translatedAddress,omitempty"`

	// TranslatedFqdn: The translated FQDN for this NAT rule.
	TranslatedFqdn *string `json:"translatedFqdn,omitempty"`

	// TranslatedPort: The translated port for this NAT rule.
	TranslatedPort *string `json:"translatedPort,omitempty"`
}

type NetworkRule_STATUS struct {
	// Description: Description of the rule.
	Description *string `json:"description,omitempty"`

	// DestinationAddresses: List of destination IP addresses or Service Tags.
	DestinationAddresses []string `json:"destinationAddresses,omitempty"`

	// DestinationFqdns: List of destination FQDNs.
	DestinationFqdns []string `json:"destinationFqdns,omitempty"`

	// DestinationIpGroups: List of destination IpGroups for this rule.
	DestinationIpGroups []string `json:"destinationIpGroups,omitempty"`

	// DestinationPorts: List of destination ports.
	DestinationPorts []string `json:"destinationPorts,omitempty"`

	// IpProtocols: Array of FirewallPolicyRuleNetworkProtocols.
	IpProtocols []FirewallPolicyRuleNetworkProtocol_STATUS `json:"ipProtocols,omitempty"`

	// Name: Name of the rule.
	Name *string `json:"name,omitempty"`

	// RuleType: Rule Type.
	RuleType NetworkRule_RuleType_STATUS `json:"ruleType,omitempty"`

	// SourceAddresses: List of source IP addresses for this rule.
	SourceAddresses []string `json:"sourceAddresses,omitempty"`

	// SourceIpGroups: List of source IpGroups for this rule.
	SourceIpGroups []string `json:"sourceIpGroups,omitempty"`
}

type ApplicationRule_RuleType_STATUS string

const ApplicationRule_RuleType_STATUS_ApplicationRule = ApplicationRule_RuleType_STATUS("ApplicationRule")

// Mapping from string to ApplicationRule_RuleType_STATUS
var applicationRule_RuleType_STATUS_Values = map[string]ApplicationRule_RuleType_STATUS{
	"applicationrule": ApplicationRule_RuleType_STATUS_ApplicationRule,
}

// name and value of HTTP/S header to insert
type FirewallPolicyHttpHeaderToInsert_STATUS struct {
	// HeaderName: Contains the name of the header
	HeaderName *string `json:"headerName,omitempty"`

	// HeaderValue: Contains the value of the header
	HeaderValue *string `json:"headerValue,omitempty"`
}

// Properties of the application rule protocol.
type FirewallPolicyRuleApplicationProtocol_STATUS struct {
	// Port: Port number for the protocol, cannot be greater than 64000.
	Port *int `json:"port,omitempty"`

	// ProtocolType: Protocol type.
	ProtocolType *FirewallPolicyRuleApplicationProtocolType_STATUS `json:"protocolType,omitempty"`
}

// The Network protocol of a Rule.
type FirewallPolicyRuleNetworkProtocol_STATUS string

const (
	FirewallPolicyRuleNetworkProtocol_STATUS_Any  = FirewallPolicyRuleNetworkProtocol_STATUS("Any")
	FirewallPolicyRuleNetworkProtocol_STATUS_ICMP = FirewallPolicyRuleNetworkProtocol_STATUS("ICMP")
	FirewallPolicyRuleNetworkProtocol_STATUS_TCP  = FirewallPolicyRuleNetworkProtocol_STATUS("TCP")
	FirewallPolicyRuleNetworkProtocol_STATUS_UDP  = FirewallPolicyRuleNetworkProtocol_STATUS("UDP")
)

// Mapping from string to FirewallPolicyRuleNetworkProtocol_STATUS
var firewallPolicyRuleNetworkProtocol_STATUS_Values = map[string]FirewallPolicyRuleNetworkProtocol_STATUS{
	"any":  FirewallPolicyRuleNetworkProtocol_STATUS_Any,
	"icmp": FirewallPolicyRuleNetworkProtocol_STATUS_ICMP,
	"tcp":  FirewallPolicyRuleNetworkProtocol_STATUS_TCP,
	"udp":  FirewallPolicyRuleNetworkProtocol_STATUS_UDP,
}

type NatRule_RuleType_STATUS string

const NatRule_RuleType_STATUS_NatRule = NatRule_RuleType_STATUS("NatRule")

// Mapping from string to NatRule_RuleType_STATUS
var natRule_RuleType_STATUS_Values = map[string]NatRule_RuleType_STATUS{
	"natrule": NatRule_RuleType_STATUS_NatRule,
}

type NetworkRule_RuleType_STATUS string

const NetworkRule_RuleType_STATUS_NetworkRule = NetworkRule_RuleType_STATUS("NetworkRule")

// Mapping from string to NetworkRule_RuleType_STATUS
var networkRule_RuleType_STATUS_Values = map[string]NetworkRule_RuleType_STATUS{
	"networkrule": NetworkRule_RuleType_STATUS_NetworkRule,
}

// The application protocol type of a Rule.
type FirewallPolicyRuleApplicationProtocolType_STATUS string

const (
	FirewallPolicyRuleApplicationProtocolType_STATUS_Http  = FirewallPolicyRuleApplicationProtocolType_STATUS("Http")
	FirewallPolicyRuleApplicationProtocolType_STATUS_Https = FirewallPolicyRuleApplicationProtocolType_STATUS("Https")
)

// Mapping from string to FirewallPolicyRuleApplicationProtocolType_STATUS
var firewallPolicyRuleApplicationProtocolType_STATUS_Values = map[string]FirewallPolicyRuleApplicationProtocolType_STATUS{
	"http":  FirewallPolicyRuleApplicationProtocolType_STATUS_Http,
	"https": FirewallPolicyRuleApplicationProtocolType_STATUS_Https,
}
