Example #1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (BackendHttpSettings != null)
     {
         BackendHttpSettings.Validate();
     }
 }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (BackendHttpSettings != null)
     {
         BackendHttpSettings.Validate();
     }
     if (Servers != null)
     {
         foreach (var element in Servers)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }
        private static ApplicationGatewaySetConfiguration GenerateConfig()
        {
            ApplicationGatewaySetConfiguration config = new ApplicationGatewaySetConfiguration();

            var frontEndIP1 = new FrontendIPConfiguration
            {
                Name = "FrontendIP1",
                Type = "Private"
            };
            var frontEndPort1 = new FrontendPort
            {
                Name = "Port1",
                Port = 80,
            };

            var probe1 = new Probe
            {
                Name               = "Probe1",
                Protocol           = "Http",
                Host               = "127.0.0.1",
                Path               = "/",
                Interval           = 45,
                Timeout            = 25,
                UnhealthyThreshold = 2
            };

            var backendServer1 = new BackendServer
            {
                IPAddress = "10.0.0.1",
            };

            var backendServer2 = new BackendServer
            {
                IPAddress = "10.0.0.2",
            };
            var backendAddressPool1 = new BackendAddressPool
            {
                Name           = "Pool1",
                BackendServers = new List <BackendServer> {
                    backendServer1, backendServer2
                },
            };

            var backendHttpSettings1 = new BackendHttpSettings
            {
                Name                = "Setting1",
                Port                = 80,
                Protocol            = Protocol.Http,
                CookieBasedAffinity = "Enabled",
                RequestTimeout      = 45,
                Probe               = "Probe1"
            };

            var httpListener1 = new AGHttpListener
            {
                Name         = "Listener1",
                FrontendPort = "Port1",
                Protocol     = Protocol.Http,
                FrontendIP   = "FrontendIP1",
                //SslCert = string.Empty,
            };

            var httpLoadBalancingRule1 = new HttpLoadBalancingRule
            {
                Name = "Rule1",
                Type = "Basic",
                BackendHttpSettings = "Setting1",
                Listener            = "Listener1",
                BackendAddressPool  = "Pool1",
            };

            config.FrontendIPConfigurations = new List <FrontendIPConfiguration> {
                frontEndIP1
            };
            config.FrontendPorts = new List <FrontendPort> {
                frontEndPort1
            };
            config.Probes = new List <Probe> {
                probe1
            };
            config.BackendAddressPools = new List <BackendAddressPool> {
                backendAddressPool1
            };
            config.BackendHttpSettingsList = new List <BackendHttpSettings> {
                backendHttpSettings1
            };
            config.HttpListeners = new List <AGHttpListener> {
                httpListener1
            };
            config.HttpLoadBalancingRules = new List <HttpLoadBalancingRule> {
                httpLoadBalancingRule1
            };

            return(config);
        }