Exemplo n.º 1
0
        /// <summary>
        /// Constructs an object used to create a <see cref="NetworkInterface"/>.
        /// </summary>
        /// <param name="ip"> The public IP address of the <see cref="NetworkInterface"/>. </param>
        /// <param name="subnetId"> The resource identifier of the subnet attached to this <see cref="NetworkInterface"/>. </param>
        /// <param name="location"> The <see cref="LocationData"/> that will contain the <see cref="NetworkInterface"/>. </param>
        /// <returns>An object used to create a <see cref="NetworkInterface"/>. </returns>
        public ArmBuilder <NetworkInterface, NetworkInterfaceData> Construct(string subnetId, PublicIPAddressData ip = default, LocationData location = null)
        {
            var nic = new Azure.ResourceManager.Network.Models.NetworkInterface()
            {
                Location         = location ?? DefaultLocation,
                IpConfigurations = new List <NetworkInterfaceIPConfiguration>()
                {
                    new NetworkInterfaceIPConfiguration()
                    {
                        Name    = "Primary",
                        Primary = true,
                        Subnet  = new Azure.ResourceManager.Network.Models.Subnet()
                        {
                            Id = subnetId
                        },
                        PrivateIPAllocationMethod = IPAllocationMethod.Dynamic,
                    }
                }
            };

            if (ip != null)
            {
                nic.IpConfigurations[0].PublicIPAddress = new PublicIPAddress()
                {
                    Id = ip.Id
                }
            }
            ;

            return(new ArmBuilder <NetworkInterface, NetworkInterfaceData>(this, new NetworkInterfaceData(nic)));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PublicIpAddress"/> class.
 /// </summary>
 /// <param name="options"> The client parameters to use in these operations. </param>
 /// <param name="resource"> The resource that is the target of operations. </param>
 internal PublicIpAddress(ResourceOperationsBase options, PublicIPAddressData resource)
     : base(options, resource.Id)
 {
     Data = resource;
 }
 public static PublicIpAddress PublicIpAddress(this ResourceGroupOperations resourceGroup, PublicIPAddressData publicIpAddress)
 {
     return(new PublicIpAddress(resourceGroup.ClientOptions, publicIpAddress));
 }
Exemplo n.º 4
0
 internal PublicIpAddress(AzureResourceManagerClientOptions options, PublicIPAddressData resource)
     : base(options, resource.Id)
 {
     Data = resource;
 }