public SetConfigApplicationGateway(IApplicationGatewayOperations applicationGatewayClient, string gatewayName, ApplicationGatewaySetConfiguration config) { this.applicationGatewayClient = applicationGatewayClient; this.gatewayName = gatewayName; this.config = config; }
public ApplicationGatewayOperationResponse SetConfigApplicationGateway(string gatewayName, ApplicationGatewaySetConfiguration config) { SetConfigApplicationGateway operation = new SetConfigApplicationGateway(applicationGatewayClient, gatewayName, config); testClient.InvokeTestOperation(operation); return operation.InvokeResponse; }
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; }
private static void VerifyGetApplicationGatewayConfigDetails( ApplicationGatewaySetConfiguration setConfig, ApplicationGatewayGetConfiguration getConfig) { Assert.Equal(setConfig.FrontendIPConfigurations.Count, getConfig.FrontendIPConfigurations.Count); foreach (var getVar in setConfig.FrontendIPConfigurations) { Assert.True(getConfig.FrontendIPConfigurations.Any(setVar => (String.Equals(setVar.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase) && setVar.StaticIPAddress == getVar.StaticIPAddress && setVar.Type == getVar.Type))); } Assert.Equal(setConfig.FrontendPorts.Count, getConfig.FrontendPorts.Count); foreach (var getVar in setConfig.FrontendPorts) { Assert.True(getConfig.FrontendPorts.Any(setVar => (String.Equals(setVar.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase) && setVar.Port == getVar.Port))); } Assert.Equal(setConfig.Probes.Count, getConfig.Probes.Count); foreach (var getVar in setConfig.Probes) { Assert.True(getConfig.Probes.Any(setVar => (String.Equals(setVar.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase) && (String.Equals(setVar.Protocol, getVar.Protocol, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.Path, getVar.Path, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.Host, getVar.Host, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.Path, getVar.Path, StringComparison.InvariantCultureIgnoreCase)) && (setVar.Interval == getVar.Interval) && (setVar.Timeout == getVar.Timeout) && (setVar.UnhealthyThreshold == getVar.UnhealthyThreshold)))); } Assert.Equal(setConfig.BackendAddressPools.Count, getConfig.BackendAddressPools.Count); foreach (var getVar in setConfig.BackendAddressPools) { var setVar = getConfig.BackendAddressPools.FirstOrDefault(addrPool => (String.Equals(addrPool.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase))); Assert.NotNull(setVar); Assert.Equal(getVar.BackendServers.Count, setVar.BackendServers.Count); foreach (var getPool in getVar.BackendServers) { Assert.True(getVar.BackendServers.Any(setPool => (String.Equals(setPool.IPAddress, getPool.IPAddress, StringComparison.InvariantCultureIgnoreCase)))); } } Assert.Equal(setConfig.BackendHttpSettingsList.Count, getConfig.BackendHttpSettingsList.Count); foreach (var getVar in setConfig.BackendHttpSettingsList) { Assert.True(getConfig.BackendHttpSettingsList.Any(setVar => (String.Equals(setVar.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase)) && (setVar.Port == getVar.Port) && (setVar.Protocol == getVar.Protocol) && (String.Equals(setVar.CookieBasedAffinity, getVar.CookieBasedAffinity, StringComparison.InvariantCultureIgnoreCase)) && (setVar.RequestTimeout == getVar.RequestTimeout) && (String.Equals(setVar.Probe, getVar.Probe, StringComparison.InvariantCultureIgnoreCase)))); } Assert.Equal(setConfig.HttpListeners.Count, getConfig.HttpListeners.Count); foreach (var getVar in setConfig.HttpListeners) { Assert.True(getConfig.HttpListeners.Any(setVar => (String.Equals(setVar.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.FrontendPort, getVar.FrontendPort, StringComparison.InvariantCultureIgnoreCase)) && (setVar.Protocol == getVar.Protocol) && (String.Equals(setVar.SslCert, getVar.SslCert, StringComparison.InvariantCultureIgnoreCase)))); } Assert.Equal(setConfig.HttpLoadBalancingRules.Count, getConfig.HttpLoadBalancingRules.Count); foreach (var getVar in setConfig.HttpLoadBalancingRules) { Assert.True(getConfig.HttpLoadBalancingRules.Any(setVar => (String.Equals(setVar.Name, getVar.Name, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.Type, getVar.Type, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.BackendHttpSettings, getVar.BackendHttpSettings, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.Listener, getVar.Listener, StringComparison.InvariantCultureIgnoreCase)) && (String.Equals(setVar.BackendAddressPool, getVar.BackendAddressPool, StringComparison.InvariantCultureIgnoreCase)))); } }
/// <summary> /// The Begin Set Application Gateway config operation sets the /// specified config on the application gateway (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154114.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Network.IApplicationGatewayOperations. /// </param> /// <param name='gatewayName'> /// Required. Gateway name /// </param> /// <param name='config'> /// Required. The Begin Set Application Gateway Config operation sets /// the specified config on the application gateway /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<GatewayOperationResponse> BeginSetConfigAsync(this IApplicationGatewayOperations operations, string gatewayName, ApplicationGatewaySetConfiguration config) { return operations.BeginSetConfigAsync(gatewayName, config, CancellationToken.None); }
/// <summary> /// The Begin Set Application Gateway config operation sets the /// specified config on the application gateway (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154114.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Network.IApplicationGatewayOperations. /// </param> /// <param name='gatewayName'> /// Required. Gateway name /// </param> /// <param name='config'> /// Required. The Begin Set Application Gateway Config operation sets /// the specified config on the application gateway /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static GatewayOperationResponse BeginSetConfig(this IApplicationGatewayOperations operations, string gatewayName, ApplicationGatewaySetConfiguration config) { return Task.Factory.StartNew((object s) => { return ((IApplicationGatewayOperations)s).BeginSetConfigAsync(gatewayName, config); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
private static ApplicationGatewaySetConfiguration GenerateConfig() { ApplicationGatewaySetConfiguration config = new ApplicationGatewaySetConfiguration(); var frontEndIP1 = new FrontendIPConfiguration { Name = "FrontendIP1", Type = "Private", StaticIPAddress = "10.0.0.10" }; var frontEndPort1 = new FrontendPort { Name = "Port1", Port = 80, }; 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", }; 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.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; }
private static void VerifyGetApplicationGatewayConfigDetails( ApplicationGatewaySetConfiguration setConfig, ApplicationGatewayGetConfiguration getConfig) { Assert.Equal(setConfig.FrontendIPConfigurations.Count, getConfig.FrontendIPConfigurations.Count); foreach (var getVar in setConfig.FrontendIPConfigurations) { Assert.True(getConfig.FrontendIPConfigurations.Any(setVar => (string.Equals(setVar.Name, getVar.Name) && setVar.StaticIPAddress == getVar.StaticIPAddress && setVar.Type == getVar.Type))); } Assert.Equal(setConfig.FrontendPorts.Count, getConfig.FrontendPorts.Count); foreach (var getVar in setConfig.FrontendPorts) { Assert.True(getConfig.FrontendPorts.Any(setVar => (string.Equals(setVar.Name, getVar.Name) && setVar.Port == getVar.Port))); } Assert.Equal(setConfig.BackendAddressPools.Count, getConfig.BackendAddressPools.Count); foreach (var getVar in setConfig.BackendAddressPools) { var setVar = getConfig.BackendAddressPools.FirstOrDefault(addrPool => (string.Equals(addrPool.Name, getVar.Name))); Assert.NotNull(setVar); Assert.Equal(getVar.BackendServers.Count, setVar.BackendServers.Count); foreach (var getPool in getVar.BackendServers) { Assert.True(getVar.BackendServers.Any(setPool => (string.Equals(setPool.IPAddress, getPool.IPAddress)))); } } Assert.Equal(setConfig.BackendHttpSettingsList.Count, getConfig.BackendHttpSettingsList.Count); foreach (var getVar in setConfig.BackendHttpSettingsList) { Assert.True(getConfig.BackendHttpSettingsList.Any(setVar => (string.Equals(setVar.Name, getVar.Name)) && (setVar.Port == getVar.Port) && (setVar.Protocol == getVar.Protocol) && (string.Equals(setVar.CookieBasedAffinity, getVar.CookieBasedAffinity)))); } Assert.Equal(setConfig.HttpListeners.Count, getConfig.HttpListeners.Count); foreach (var getVar in setConfig.HttpListeners) { Assert.True(getConfig.HttpListeners.Any(setVar => (string.Equals(setVar.Name, getVar.Name)) && (string.Equals(setVar.FrontendPort, getVar.FrontendPort)) && (setVar.Protocol == getVar.Protocol) && (string.Equals(setVar.SslCert, getVar.SslCert)))); } Assert.Equal(setConfig.HttpLoadBalancingRules.Count, getConfig.HttpLoadBalancingRules.Count); foreach (var getVar in setConfig.HttpLoadBalancingRules) { Assert.True(getConfig.HttpLoadBalancingRules.Any(setVar => (string.Equals(setVar.Name, getVar.Name)) && (string.Equals(setVar.Type, getVar.Type)) && (string.Equals(setVar.BackendHttpSettings, getVar.BackendHttpSettings)) && (string.Equals(setVar.Listener, getVar.Listener)) && (string.Equals(setVar.BackendAddressPool, getVar.BackendAddressPool)))); } }