internal static FirewallPolicyNatRule DeserializeFirewallPolicyNatRule(JsonElement element) { Optional <FirewallPolicyNatRuleAction> action = default; Optional <string> translatedAddress = default; Optional <string> translatedPort = default; Optional <FirewallPolicyRuleCondition> ruleCondition = default; FirewallPolicyRuleType ruleType = default; Optional <string> name = default; Optional <int> priority = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action")) { action = FirewallPolicyNatRuleAction.DeserializeFirewallPolicyNatRuleAction(property.Value); continue; } if (property.NameEquals("translatedAddress")) { translatedAddress = property.Value.GetString(); continue; } if (property.NameEquals("translatedPort")) { translatedPort = property.Value.GetString(); continue; } if (property.NameEquals("ruleCondition")) { ruleCondition = FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(property.Value); continue; } if (property.NameEquals("ruleType")) { ruleType = new FirewallPolicyRuleType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyNatRule(ruleType, name.Value, Optional.ToNullable(priority), action.Value, translatedAddress.Value, translatedPort.Value, ruleCondition.Value)); }
internal static FirewallPolicyNatRule DeserializeFirewallPolicyNatRule(JsonElement element) { FirewallPolicyNatRuleAction action = default; string translatedAddress = default; string translatedPort = default; FirewallPolicyRuleCondition ruleCondition = default; FirewallPolicyRuleType ruleType = default; string name = default; int? priority = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } action = FirewallPolicyNatRuleAction.DeserializeFirewallPolicyNatRuleAction(property.Value); continue; } if (property.NameEquals("translatedAddress")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } translatedAddress = property.Value.GetString(); continue; } if (property.NameEquals("translatedPort")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } translatedPort = property.Value.GetString(); continue; } if (property.NameEquals("ruleCondition")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } ruleCondition = FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(property.Value); continue; } if (property.NameEquals("ruleType")) { ruleType = new FirewallPolicyRuleType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("priority")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } priority = property.Value.GetInt32(); continue; } } return(new FirewallPolicyNatRule(ruleType, name, priority, action, translatedAddress, translatedPort, ruleCondition)); }