public async Task PublicIpAddressApiTest() { var subscription = await ArmClient.GetDefaultSubscriptionAsync(); string resourceGroupName = Recording.GenerateAssetName("csmrg"); string location = TestEnvironment.Location; var resourceGroup = await CreateResourceGroup(resourceGroupName); // Create the parameter for PUT PublicIPAddress string publicIpName = Recording.GenerateAssetName("ipname"); string domainNameLabel = Recording.GenerateAssetName("domain"); var publicIp = new PublicIPAddressData() { Location = location, Tags = { { "key", "value" } }, PublicIPAllocationMethod = IPAllocationMethod.Dynamic, DnsSettings = new PublicIPAddressDnsSettings() { DomainNameLabel = domainNameLabel } }; // Put PublicIPAddress var publicIPAddressCollection = resourceGroup.GetPublicIPAddresses(); var putPublicIpAddressResponseOperation = await publicIPAddressCollection.CreateOrUpdateAsync(publicIpName, publicIp); Response <PublicIPAddress> putPublicIpAddressResponse = await putPublicIpAddressResponseOperation.WaitForCompletionAsync();; Assert.AreEqual("Succeeded", putPublicIpAddressResponse.Value.Data.ProvisioningState.ToString()); // Get PublicIPAddress Response <PublicIPAddress> getPublicIpAddressResponse = await publicIPAddressCollection.GetAsync(publicIpName); Assert.AreEqual(4, getPublicIpAddressResponse.Value.Data.IdleTimeoutInMinutes); Assert.NotNull(getPublicIpAddressResponse.Value.Data.ResourceGuid); // Get List of PublicIPAddress AsyncPageable <PublicIPAddress> getPublicIpAddressListResponseAP = publicIPAddressCollection.GetAllAsync(); List <PublicIPAddress> getPublicIpAddressListResponse = await getPublicIpAddressListResponseAP.ToEnumerableAsync(); Has.One.EqualTo(getPublicIpAddressListResponse); ArePublicIpAddressesEqual(getPublicIpAddressResponse.Value.Data, getPublicIpAddressListResponse.First().Data); // Get List of PublicIPAddress in a subscription AsyncPageable <PublicIPAddress> getPublicIpAddressListSubscriptionResponseAP = subscription.GetPublicIPAddressesAsync(); List <PublicIPAddress> getPublicIpAddressListSubscriptionResponse = await getPublicIpAddressListSubscriptionResponseAP.ToEnumerableAsync(); Assert.IsNotEmpty(getPublicIpAddressListSubscriptionResponse); // Delete PublicIPAddress var deleteOperation = await getPublicIpAddressResponse.Value.DeleteAsync(); await deleteOperation.WaitForCompletionResponseAsync();; // Get PublicIPAddress getPublicIpAddressListResponseAP = publicIPAddressCollection.GetAllAsync(); getPublicIpAddressListResponse = await getPublicIpAddressListResponseAP.ToEnumerableAsync(); Assert.IsEmpty(getPublicIpAddressListResponse); }
internal NetworkInterfaceIPConfiguration(string id, string name, string etag, string type, SubResource gatewayLoadBalancer, IList <VirtualNetworkTapData> virtualNetworkTaps, IList <ApplicationGatewayBackendAddressPool> applicationGatewayBackendAddressPools, IList <BackendAddressPoolData> loadBalancerBackendAddressPools, IList <InboundNatRuleData> loadBalancerInboundNatRules, string privateIPAddress, IPAllocationMethod?privateIPAllocationMethod, IPVersion?privateIPAddressVersion, SubnetData subnet, bool?primary, PublicIPAddressData publicIPAddress, IList <ApplicationSecurityGroupData> applicationSecurityGroups, ProvisioningState?provisioningState, NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties privateLinkConnectionProperties) : base(id) { Name = name; Etag = etag; Type = type; GatewayLoadBalancer = gatewayLoadBalancer; VirtualNetworkTaps = virtualNetworkTaps; ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; LoadBalancerInboundNatRules = loadBalancerInboundNatRules; PrivateIPAddress = privateIPAddress; PrivateIPAllocationMethod = privateIPAllocationMethod; PrivateIPAddressVersion = privateIPAddressVersion; Subnet = subnet; Primary = primary; PublicIPAddress = publicIPAddress; ApplicationSecurityGroups = applicationSecurityGroups; ProvisioningState = provisioningState; PrivateLinkConnectionProperties = privateLinkConnectionProperties; }
private static void ArePublicIpAddressesEqual(PublicIPAddressData publicIpAddress1, PublicIPAddressData publicIpAddress2) { Assert.AreEqual(publicIpAddress1.Name, publicIpAddress2.Name); Assert.AreEqual(publicIpAddress1.Location, publicIpAddress2.Location); // TODO //Assert.AreEqual(publicIpAddress1.Id, publicIpAddress2.Id); Assert.AreEqual(publicIpAddress1.DnsSettings.DomainNameLabel, publicIpAddress2.DnsSettings.DomainNameLabel); Assert.AreEqual(publicIpAddress1.DnsSettings.Fqdn, publicIpAddress2.DnsSettings.Fqdn); Assert.AreEqual(publicIpAddress1.IdleTimeoutInMinutes, publicIpAddress2.IdleTimeoutInMinutes); Assert.AreEqual(publicIpAddress1.Tags.Count, publicIpAddress2.Tags.Count); Assert.AreEqual(publicIpAddress1.PublicIPAddressVersion, publicIpAddress2.PublicIPAddressVersion); }
internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> type = default; Optional <IList <string> > zones = default; Optional <string> id = default; Optional <IReadOnlyList <WritableSubResource> > inboundNatRules = default; Optional <IReadOnlyList <WritableSubResource> > inboundNatPools = default; Optional <IReadOnlyList <WritableSubResource> > outboundRules = default; Optional <IReadOnlyList <WritableSubResource> > loadBalancingRules = default; Optional <string> privateIPAddress = default; Optional <IPAllocationMethod> privateIPAllocationMethod = default; Optional <IPVersion> privateIPAddressVersion = default; Optional <SubnetData> subnet = default; Optional <PublicIPAddressData> publicIPAddress = default; Optional <WritableSubResource> publicIPPrefix = default; Optional <WritableSubResource> gatewayLoadBalancer = default; Optional <ProvisioningState> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("zones")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } zones = array; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("inboundNatRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } inboundNatRules = array; continue; } if (property0.NameEquals("inboundNatPools")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } inboundNatPools = array; continue; } if (property0.NameEquals("outboundRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } outboundRules = array; continue; } if (property0.NameEquals("loadBalancingRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } loadBalancingRules = array; continue; } if (property0.NameEquals("privateIPAddress")) { privateIPAddress = property0.Value.GetString(); continue; } if (property0.NameEquals("privateIPAllocationMethod")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); continue; } if (property0.NameEquals("privateIPAddressVersion")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAddressVersion = new IPVersion(property0.Value.GetString()); continue; } if (property0.NameEquals("subnet")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } subnet = SubnetData.DeserializeSubnetData(property0.Value); continue; } if (property0.NameEquals("publicIPAddress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicIPAddress = PublicIPAddressData.DeserializePublicIPAddressData(property0.Value); continue; } if (property0.NameEquals("publicIPPrefix")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicIPPrefix = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("gatewayLoadBalancer")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } gatewayLoadBalancer = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } continue; } } return(new FrontendIPConfiguration(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(zones), Optional.ToList(inboundNatRules), Optional.ToList(inboundNatPools), Optional.ToList(outboundRules), Optional.ToList(loadBalancingRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, publicIPAddress.Value, publicIPPrefix, gatewayLoadBalancer, Optional.ToNullable(provisioningState))); }
internal IPConfiguration(string id, string name, string etag, string privateIPAddress, IPAllocationMethod?privateIPAllocationMethod, SubnetData subnet, PublicIPAddressData publicIPAddress, ProvisioningState?provisioningState) : base(id) { Name = name; Etag = etag; PrivateIPAddress = privateIPAddress; PrivateIPAllocationMethod = privateIPAllocationMethod; Subnet = subnet; PublicIPAddress = publicIPAddress; ProvisioningState = provisioningState; }
public async Task CreateOrUpdate() { VirtualNetworkCollection virtualNetworkCollection = resourceGroup.GetVirtualNetworks(); string vnetName = "myVnet"; // Use the same location as the resource group VirtualNetworkData vnetInput = new VirtualNetworkData() { Location = resourceGroup.Data.Location, AddressSpace = new AddressSpace() { AddressPrefixes = { "10.0.0.0/16", } }, DhcpOptions = new DhcpOptions() { DnsServers = { "10.1.1.1", "10.1.2.4" } }, Subnets = { new SubnetData() { Name = "mySubnet", AddressPrefix = "10.0.1.0/24" } } }; VirtualNetwork virtualNetwork = await virtualNetworkCollection.CreateOrUpdate(true, vnetName, vnetInput).WaitForCompletionAsync(); #region Snippet:Managing_Networks_CreateANetworkInterface PublicIPAddressCollection publicIPAddressCollection = resourceGroup.GetPublicIPAddresses(); string publicIPAddressName = "myIPAddress"; PublicIPAddressData publicIPInput = new PublicIPAddressData() { Location = resourceGroup.Data.Location, PublicIPAllocationMethod = IPAllocationMethod.Dynamic, DnsSettings = new PublicIPAddressDnsSettings() { DomainNameLabel = "myDomain" } }; PublicIPAddress publicIPAddress = await publicIPAddressCollection.CreateOrUpdate(true, publicIPAddressName, publicIPInput).WaitForCompletionAsync(); NetworkInterfaceCollection networkInterfaceCollection = resourceGroup.GetNetworkInterfaces(); string networkInterfaceName = "myNetworkInterface"; NetworkInterfaceData networkInterfaceInput = new NetworkInterfaceData() { Location = resourceGroup.Data.Location, IpConfigurations = { new NetworkInterfaceIPConfigurationData() { Name = "ipConfig", PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, PublicIPAddress = new PublicIPAddressData() { Id = publicIPAddress.Id }, Subnet = new SubnetData() { // use the virtual network just created Id = virtualNetwork.Data.Subnets[0].Id } } } }; NetworkInterface networkInterface = await networkInterfaceCollection.CreateOrUpdate(true, networkInterfaceName, networkInterfaceInput).WaitForCompletionAsync(); #endregion }
public async Task GlobalSetUp() { Subscription subscription = await GlobalClient.GetDefaultSubscriptionAsync(); var rgLro = await subscription.GetResourceGroups().CreateOrUpdateAsync(SessionRecording.GenerateAssetName("FirewallPolicyRG-"), new ResourceGroupData(Location.WestUS2)); ResourceGroup rg = rgLro.Value; _resourceGroupIdentifier = rg.Id; VirtualNetworkData vnetData = new VirtualNetworkData() { Location = Location.WestUS2, AddressSpace = new AddressSpace() { AddressPrefixes = { "10.26.0.0/16", } }, Subnets = { new SubnetData() { Name = "Default", AddressPrefix = "10.26.1.0/26", }, new SubnetData() { Name = "AzureFirewallSubnet", AddressPrefix = "10.26.2.0/26", }, }, }; var vnetLro = await rg.GetVirtualNetworks().CreateOrUpdateAsync(SessionRecording.GenerateAssetName("vnet-"), vnetData); _network = vnetLro.Value; _networkIdentifier = _network.Id; PublicIPAddressData ipData = new PublicIPAddressData() { Location = Location.WestUS2, PublicIPAllocationMethod = IPAllocationMethod.Static, Sku = new PublicIPAddressSku() { Name = PublicIPAddressSkuName.Standard }, }; var ipLro = await rg.GetPublicIPAddresses().CreateOrUpdateAsync(SessionRecording.GenerateAssetName("publicIp-"), ipData); _publicIPAddress = ipLro.Value; _publicIPAddressIdentifier = _publicIPAddress.Id; AzureFirewallData firewallData = new AzureFirewallData(); firewallData.Location = Location.WestUS2; firewallData.IpConfigurations.Add(new AzureFirewallIPConfiguration() { Name = "fwpip", PublicIPAddress = new WritableSubResource() { Id = _publicIPAddressIdentifier }, Subnet = new WritableSubResource() { Id = _networkIdentifier.AppendChildResource("subnets", "AzureFirewallSubnet") }, }); var firewallLro = await rg.GetAzureFirewalls().CreateOrUpdateAsync(SessionRecording.GenerateAssetName("firewall-"), firewallData); _firewall = firewallLro.Value; _firewallIdentifier = _firewall.Id; await StopSessionRecordingAsync(); }
internal FrontendIPConfiguration(string id, string name, string etag, string type, IList <string> zones, IReadOnlyList <SubResource> inboundNatRules, IReadOnlyList <SubResource> inboundNatPools, IReadOnlyList <SubResource> outboundRules, IReadOnlyList <SubResource> loadBalancingRules, string privateIPAddress, IPAllocationMethod?privateIPAllocationMethod, IPVersion?privateIPAddressVersion, SubnetData subnet, PublicIPAddressData publicIPAddress, SubResource publicIPPrefix, SubResource gatewayLoadBalancer, ProvisioningState?provisioningState) : base(id) { Name = name; Etag = etag; Type = type; Zones = zones; InboundNatRules = inboundNatRules; InboundNatPools = inboundNatPools; OutboundRules = outboundRules; LoadBalancingRules = loadBalancingRules; PrivateIPAddress = privateIPAddress; PrivateIPAllocationMethod = privateIPAllocationMethod; PrivateIPAddressVersion = privateIPAddressVersion; Subnet = subnet; PublicIPAddress = publicIPAddress; PublicIPPrefix = publicIPPrefix; GatewayLoadBalancer = gatewayLoadBalancer; ProvisioningState = provisioningState; }
internal static IPConfiguration DeserializeIPConfiguration(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> id = default; Optional <string> privateIPAddress = default; Optional <IPAllocationMethod> privateIPAllocationMethod = default; Optional <SubnetData> subnet = default; Optional <PublicIPAddressData> publicIPAddress = default; Optional <ProvisioningState> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("privateIPAddress")) { privateIPAddress = property0.Value.GetString(); continue; } if (property0.NameEquals("privateIPAllocationMethod")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); continue; } if (property0.NameEquals("subnet")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } subnet = SubnetData.DeserializeSubnetData(property0.Value); continue; } if (property0.NameEquals("publicIPAddress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicIPAddress = PublicIPAddressData.DeserializePublicIPAddressData(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } continue; } } return(new IPConfiguration(id.Value, name.Value, etag.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState))); }
internal IPConfiguration(ResourceIdentifier id, string name, ResourceType?resourceType, ETag?etag, string privateIPAddress, IPAllocationMethod?privateIPAllocationMethod, SubnetData subnet, PublicIPAddressData publicIPAddress, NetworkProvisioningState?provisioningState) : base(id, name, resourceType) { Etag = etag; PrivateIPAddress = privateIPAddress; PrivateIPAllocationMethod = privateIPAllocationMethod; Subnet = subnet; PublicIPAddress = publicIPAddress; ProvisioningState = provisioningState; }
internal static NetworkInterfaceIPConfiguration DeserializeNetworkInterfaceIPConfiguration(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> type = default; Optional <string> id = default; Optional <WritableSubResource> gatewayLoadBalancer = default; Optional <IList <VirtualNetworkTapData> > virtualNetworkTaps = default; Optional <IList <ApplicationGatewayBackendAddressPool> > applicationGatewayBackendAddressPools = default; Optional <IList <BackendAddressPoolData> > loadBalancerBackendAddressPools = default; Optional <IList <InboundNatRuleData> > loadBalancerInboundNatRules = default; Optional <string> privateIPAddress = default; Optional <IPAllocationMethod> privateIPAllocationMethod = default; Optional <IPVersion> privateIPAddressVersion = default; Optional <SubnetData> subnet = default; Optional <bool> primary = default; Optional <PublicIPAddressData> publicIPAddress = default; Optional <IList <ApplicationSecurityGroupData> > applicationSecurityGroups = default; Optional <ProvisioningState> provisioningState = default; Optional <NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties> privateLinkConnectionProperties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("gatewayLoadBalancer")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } gatewayLoadBalancer = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("virtualNetworkTaps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualNetworkTapData> array = new List <VirtualNetworkTapData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualNetworkTapData.DeserializeVirtualNetworkTapData(item)); } virtualNetworkTaps = array; continue; } if (property0.NameEquals("applicationGatewayBackendAddressPools")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ApplicationGatewayBackendAddressPool> array = new List <ApplicationGatewayBackendAddressPool>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ApplicationGatewayBackendAddressPool.DeserializeApplicationGatewayBackendAddressPool(item)); } applicationGatewayBackendAddressPools = array; continue; } if (property0.NameEquals("loadBalancerBackendAddressPools")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <BackendAddressPoolData> array = new List <BackendAddressPoolData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(BackendAddressPoolData.DeserializeBackendAddressPoolData(item)); } loadBalancerBackendAddressPools = array; continue; } if (property0.NameEquals("loadBalancerInboundNatRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <InboundNatRuleData> array = new List <InboundNatRuleData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(InboundNatRuleData.DeserializeInboundNatRuleData(item)); } loadBalancerInboundNatRules = array; continue; } if (property0.NameEquals("privateIPAddress")) { privateIPAddress = property0.Value.GetString(); continue; } if (property0.NameEquals("privateIPAllocationMethod")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); continue; } if (property0.NameEquals("privateIPAddressVersion")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAddressVersion = new IPVersion(property0.Value.GetString()); continue; } if (property0.NameEquals("subnet")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } subnet = SubnetData.DeserializeSubnetData(property0.Value); continue; } if (property0.NameEquals("primary")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } primary = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicIPAddress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicIPAddress = PublicIPAddressData.DeserializePublicIPAddressData(property0.Value); continue; } if (property0.NameEquals("applicationSecurityGroups")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ApplicationSecurityGroupData> array = new List <ApplicationSecurityGroupData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ApplicationSecurityGroupData.DeserializeApplicationSecurityGroupData(item)); } applicationSecurityGroups = array; continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("privateLinkConnectionProperties")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateLinkConnectionProperties = NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties.DeserializeNetworkInterfaceIPConfigurationPrivateLinkConnectionProperties(property0.Value); continue; } } continue; } } return(new NetworkInterfaceIPConfiguration(id.Value, name.Value, etag.Value, type.Value, gatewayLoadBalancer, Optional.ToList(virtualNetworkTaps), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, Optional.ToNullable(primary), publicIPAddress.Value, Optional.ToList(applicationSecurityGroups), Optional.ToNullable(provisioningState), privateLinkConnectionProperties.Value)); }
PublicIPAddress IOperationSource <PublicIPAddress> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); return(new PublicIPAddress(_operationBase, PublicIPAddressData.DeserializePublicIPAddressData(document.RootElement))); }