Example #1
0
        public LoadBalancer(Arm.LoadBalancer sourceLoadBalancer, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftNetwork, ArmConst.LoadBalancers, logProvider)
        {
            this.Source = sourceLoadBalancer;
            this.SetTargetName(sourceLoadBalancer.Name, targetSettings);

            foreach (Arm.FrontEndIpConfiguration armFrontEndIpConfiguration in sourceLoadBalancer.FrontEndIpConfigurations)
            {
                FrontEndIpConfiguration targetFrontEndIpConfiguration = new FrontEndIpConfiguration(this, armFrontEndIpConfiguration);
                _FrontEndIpConfiguration.Add(targetFrontEndIpConfiguration);

                if (armFrontEndIpConfiguration.PublicIP != null)
                {
                    this.LoadBalancerType = LoadBalancerType.Public;
                }
            }

            foreach (Arm.BackEndAddressPool armBackendAddressPool in sourceLoadBalancer.BackEndAddressPools)
            {
                BackEndAddressPool targetBackendAddressPool = new BackEndAddressPool(this, armBackendAddressPool);
                _BackEndAddressPools.Add(targetBackendAddressPool);
            }

            foreach (Arm.Probe armProbe in sourceLoadBalancer.Probes)
            {
                Probe targetProbe = new Probe(this, armProbe);
                _Probes.Add(targetProbe);
            }

            foreach (Arm.LoadBalancingRule armLoadBalancingRule in sourceLoadBalancer.LoadBalancingRules)
            {
                LoadBalancingRule targetLoadBalancingRule = new LoadBalancingRule(this, armLoadBalancingRule);
                _LoadBalancingRules.Add(targetLoadBalancingRule);
            }
        }
Example #2
0
        public LoadBalancer(Arm.LoadBalancer sourceLoadBalancer)
        {
            this.Source = sourceLoadBalancer;
            this.Name   = sourceLoadBalancer.Name;

            foreach (Arm.FrontEndIpConfiguration armFrontEndIpConfiguration in sourceLoadBalancer.FrontEndIpConfigurations)
            {
                FrontEndIpConfiguration targetFrontEndIpConfiguration = new FrontEndIpConfiguration(this, armFrontEndIpConfiguration);
                _FrontEndIpConfiguration.Add(targetFrontEndIpConfiguration);

                if (armFrontEndIpConfiguration.PublicIP != null)
                {
                    this.LoadBalancerType = LoadBalancerType.Public;
                }
            }

            foreach (Arm.BackEndAddressPool armBackendAddressPool in sourceLoadBalancer.BackEndAddressPools)
            {
                BackEndAddressPool targetBackendAddressPool = new BackEndAddressPool(this, armBackendAddressPool);
                _BackEndAddressPools.Add(targetBackendAddressPool);
            }

            foreach (Arm.Probe armProbe in sourceLoadBalancer.Probes)
            {
                Probe targetProbe = new Probe(this, armProbe);
                _Probes.Add(targetProbe);
            }

            foreach (Arm.LoadBalancingRule armLoadBalancingRule in sourceLoadBalancer.LoadBalancingRules)
            {
                LoadBalancingRule targetLoadBalancingRule = new LoadBalancingRule(this, armLoadBalancingRule);
                _LoadBalancingRules.Add(targetLoadBalancingRule);
            }
        }