Exemplo n.º 1
0
        internal static BackendAddressPool CreateBackendAddressPoolConfig(
            string backendPoolName,
            string subscriptionId)
        {
            var backendAddressPool = new BackendAddressPool();

            backendAddressPool.Name = backendPoolName;

            backendAddressPool.Id =
                LoadBalancerStrategy.GetResourceNotSetId(
                    subscriptionId,
                    LoadBalancerStrategy.LoadBalancerBackendAddressPoolName,
                    backendAddressPool.Name);

            return(backendAddressPool);
        }
Exemplo n.º 2
0
        internal static FrontendIPConfiguration CreateFrontendIpConfig(
            string froontendPoolName,
            string subscriptionId,
            string subnetId,
            string publicIpAddressId,
            string privateIpAddress,
            IList <string> zones)
        {
            var frontendIpConfig = new FrontendIPConfiguration();

            frontendIpConfig.Name  = froontendPoolName;
            frontendIpConfig.Zones = zones;

            if (!string.IsNullOrEmpty(subnetId))
            {
                frontendIpConfig.Subnet = new Subnet(subnetId);

                if (!string.IsNullOrEmpty(privateIpAddress))
                {
                    frontendIpConfig.PrivateIPAddress          = privateIpAddress;
                    frontendIpConfig.PrivateIPAllocationMethod = LoadBalancerStrategy.Static;
                }
                else
                {
                    frontendIpConfig.PrivateIPAllocationMethod = LoadBalancerStrategy.Dynamic;
                }
            }
            else if (!string.IsNullOrEmpty(publicIpAddressId))
            {
                frontendIpConfig.PublicIPAddress = new PublicIPAddress(publicIpAddressId);
            }

            frontendIpConfig.Id =
                LoadBalancerStrategy.GetResourceNotSetId(
                    subscriptionId,
                    LoadBalancerStrategy.LoadBalancerFrontendIpConfigName,
                    frontendIpConfig.Name);

            return(frontendIpConfig);
        }