protected override void ProcessRecord() { base.ProcessRecord(); if (!this.IsApplicationGatewayPresent(this.ApplicationGateway.ResourceGroupName, this.ApplicationGateway.Name)) { throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound); } // Normalize the IDs ApplicationGatewayChildResourceHelper.NormalizeChildResourcesId(this.ApplicationGateway); // Map to the sdk object var appGwModel = Mapper.Map <MNM.ApplicationGateway>(this.ApplicationGateway); appGwModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayType; appGwModel.Tags = TagsConversionHelper.CreateTagDictionary(this.ApplicationGateway.Tag, validate: true); // Execute the Create VirtualNetwork call this.ApplicationGatewayClient.CreateOrUpdate(this.ApplicationGateway.ResourceGroupName, this.ApplicationGateway.Name, appGwModel); var getApplicationGateway = this.GetApplicationGateway(this.ApplicationGateway.ResourceGroupName, this.ApplicationGateway.Name); WriteObject(getApplicationGateway); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var gatewayIPConfiguration = this.ApplicationGateway.GatewayIPConfigurations.SingleOrDefault (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (gatewayIPConfiguration == null) { throw new ArgumentException("Application gateway IP configuration with the specified name does not exist"); } gatewayIPConfiguration = new PSApplicationGatewayIPConfiguration(); gatewayIPConfiguration.Name = this.Name; if (!string.IsNullOrEmpty(this.SubnetId)) { var gatewayIPConfig = new PSResourceId(); gatewayIPConfig.Id = this.SubnetId; gatewayIPConfiguration.Subnet = gatewayIPConfig; } gatewayIPConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayIpConfigurationName, this.Name); this.ApplicationGateway.GatewayIPConfigurations.Add(gatewayIPConfiguration); WriteObject(this.ApplicationGateway); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var backendAddressPool = new PSApplicationGatewayBackendAddressPool(); backendAddressPool.Name = this.Name; if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResource)) { backendAddressPool.BackendAddresses = this.BackendAddresses; } else { foreach (string id in this.BackendIpConfigurationIds) { var backendIpConfig = new PSResourceId(); backendIpConfig.Id = id; backendAddressPool.BackendIpConfigurations.Add(backendIpConfig); } } backendAddressPool.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayBackendAddressPoolName, this.Name); WriteObject(backendAddressPool); }
public PSApplicationGatewayRedirectConfiguration NewObject() { var redirectConfiguration = new PSApplicationGatewayRedirectConfiguration(); redirectConfiguration.Name = this.Name; redirectConfiguration.RedirectType = this.RedirectType; redirectConfiguration.TargetUrl = this.TargetUrl; if (this.IncludePath != null) { redirectConfiguration.IncludePath = this.IncludePath; } if (this.IncludeQueryString != null) { redirectConfiguration.IncludeQueryString = this.IncludeQueryString; } if (this.TargetListener != null) { this.TargetListenerID = this.TargetListener.Id; } if (!string.IsNullOrEmpty(this.TargetListenerID)) { redirectConfiguration.TargetListener = new PSResourceId(); redirectConfiguration.TargetListener.Id = this.TargetListenerID; } redirectConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayRedirectConfigurationName, this.Name); return(redirectConfiguration); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var sslCertificate = this.ApplicationGateway.SslCertificates.SingleOrDefault(resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (sslCertificate != null) { throw new ArgumentException("Ssl certificate with the specified name already exists"); } sslCertificate = new PSApplicationGatewaySslCertificate(); sslCertificate.Name = this.Name; sslCertificate.Data = this.Data; sslCertificate.Password = this.Password; sslCertificate.PublicCertData = this.PublicCertData; sslCertificate.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaySslCertificateName, this.Name); this.ApplicationGateway.SslCertificates.Add(sslCertificate); WriteObject(this.ApplicationGateway); }
public PSApplicationGatewayBackendHttpSettings NewObject() { var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings(); backendHttpSettings.Name = this.Name; backendHttpSettings.Port = this.Port; backendHttpSettings.Protocol = this.Protocol; backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity; if (0 == this.RequestTimeout) { backendHttpSettings.RequestTimeout = 30; } else { backendHttpSettings.RequestTimeout = this.RequestTimeout; } if (!string.IsNullOrEmpty(this.ProbeId)) { backendHttpSettings.Probe = new PSResourceId(); backendHttpSettings.Probe.Id = this.ProbeId; } backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName, this.Name); return(backendHttpSettings); }
public PSApplicationGatewayHttpListener NewObject() { var httpListener = new PSApplicationGatewayHttpListener(); httpListener.Name = this.Name; httpListener.Protocol = this.Protocol; if (!string.IsNullOrEmpty(this.FrontendIPConfigurationId)) { httpListener.FrontendIpConfiguration = new PSResourceId(); httpListener.FrontendIpConfiguration.Id = this.FrontendIPConfigurationId; } if (!string.IsNullOrEmpty(this.FrontendPortId)) { httpListener.FrontendPort = new PSResourceId(); httpListener.FrontendPort.Id = this.FrontendPortId; } if (!string.IsNullOrEmpty(this.SslCertificateId)) { httpListener.SslCertificate = new PSResourceId(); httpListener.SslCertificate.Id = this.SslCertificateId; } httpListener.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayHttpListenerName, this.Name); return(httpListener); }
public PSApplicationGatewayFrontendIPConfiguration NewObject() { var frontendIPConfig = new PSApplicationGatewayFrontendIPConfiguration(); frontendIPConfig.Name = this.Name; if (!string.IsNullOrEmpty(this.SubnetId)) { frontendIPConfig.Subnet = new PSResourceId(); frontendIPConfig.Subnet.Id = this.SubnetId; if (!string.IsNullOrEmpty(this.PrivateIPAddress)) { frontendIPConfig.PrivateIPAddress = this.PrivateIPAddress; frontendIPConfig.PrivateIPAllocationMethod = Management.Network.Models.IpAllocationMethod.Static; } else { frontendIPConfig.PrivateIPAllocationMethod = Management.Network.Models.IpAllocationMethod.Dynamic; } } if (!string.IsNullOrEmpty(this.PublicIPAddressId)) { frontendIPConfig.PublicIPAddress = new PSResourceId(); frontendIPConfig.PublicIPAddress.Id = this.PublicIPAddressId; } frontendIPConfig.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendIPConfigName, this.Name); return(frontendIPConfig); }
public PSApplicationGatewayUrlPathMap NewObject() { var urlPathMap = new PSApplicationGatewayUrlPathMap(); urlPathMap.Name = this.Name; urlPathMap.PathRules = this.PathRules; if (!string.IsNullOrEmpty(this.DefaultBackendAddressPoolId)) { urlPathMap.DefaultBackendAddressPool = new PSResourceId(); urlPathMap.DefaultBackendAddressPool.Id = this.DefaultBackendAddressPoolId; } if (!string.IsNullOrEmpty(this.DefaultBackendHttpSettingsId)) { urlPathMap.DefaultBackendHttpSettings = new PSResourceId(); urlPathMap.DefaultBackendHttpSettings.Id = this.DefaultBackendHttpSettingsId; } urlPathMap.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayUrlPathMapName, this.Name); return(urlPathMap); }
public PSApplicationGatewayProbe NewObject() { var probe = new PSApplicationGatewayProbe(); probe.Name = this.Name; probe.Protocol = this.Protocol; probe.Host = this.HostName; probe.Path = this.Path; probe.Interval = this.Interval; probe.Timeout = this.Timeout; probe.UnhealthyThreshold = this.UnhealthyThreshold; if (this.PickHostNameFromBackendHttpSettings.IsPresent) { probe.PickHostNameFromBackendHttpSettings = true; } probe.MinServers = this.MinServers; probe.Match = this.Match; probe.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayProbeName, this.Name); return(probe); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var backendHttpSettings = this.ApplicationGateway.BackendHttpSettingsCollection.SingleOrDefault (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (backendHttpSettings == null) { throw new ArgumentException("Backend http settings with the specified name does not exist"); } backendHttpSettings = new PSApplicationGatewayBackendHttpSettings(); backendHttpSettings.Name = this.Name; backendHttpSettings.Port = this.Port; backendHttpSettings.Protocol = this.Protocol; backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity; backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName, this.Name); this.ApplicationGateway.BackendHttpSettingsCollection.Add(backendHttpSettings); WriteObject(this.ApplicationGateway); }
public PSApplicationGatewayRequestRoutingRule NewObject() { var requestRoutingRule = new PSApplicationGatewayRequestRoutingRule(); requestRoutingRule.Name = this.Name; requestRoutingRule.RuleType = this.RuleType; if (!string.IsNullOrEmpty(this.BackendHttpSettingsId)) { requestRoutingRule.BackendHttpSettings = new PSResourceId(); requestRoutingRule.BackendHttpSettings.Id = this.BackendHttpSettingsId; } if (!string.IsNullOrEmpty(this.HttpListenerId)) { requestRoutingRule.HttpListener = new PSResourceId(); requestRoutingRule.HttpListener.Id = this.HttpListenerId; } if (!string.IsNullOrEmpty(this.BackendAddressPoolId)) { requestRoutingRule.BackendAddressPool = new PSResourceId(); requestRoutingRule.BackendAddressPool.Id = this.BackendAddressPoolId; } requestRoutingRule.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayRequestRoutingRuleName, this.Name); return(requestRoutingRule); }
public PSApplicationGatewayHttpListener NewObject() { var httpListener = new PSApplicationGatewayHttpListener(); httpListener.Name = this.Name; httpListener.Protocol = this.Protocol; httpListener.HostName = this.HostName; if (string.Equals(this.RequireServerNameIndication, "true", StringComparison.OrdinalIgnoreCase)) { httpListener.RequireServerNameIndication = true; } else if (string.Equals(this.RequireServerNameIndication, "false", StringComparison.OrdinalIgnoreCase)) { httpListener.RequireServerNameIndication = false; } else if (string.Equals(this.Protocol, "https", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(this.HostName)) { // Set default as true to be at parity with portal. httpListener.RequireServerNameIndication = true; } if (!string.IsNullOrEmpty(this.FrontendIPConfigurationId)) { httpListener.FrontendIpConfiguration = new PSResourceId(); httpListener.FrontendIpConfiguration.Id = this.FrontendIPConfigurationId; } if (!string.IsNullOrEmpty(this.FrontendPortId)) { httpListener.FrontendPort = new PSResourceId(); httpListener.FrontendPort.Id = this.FrontendPortId; } if (!string.IsNullOrEmpty(this.SslCertificateId)) { httpListener.SslCertificate = new PSResourceId(); httpListener.SslCertificate.Id = this.SslCertificateId; } if (!string.IsNullOrEmpty(this.FirewallPolicyId)) { httpListener.FirewallPolicy = new PSResourceId(); httpListener.FirewallPolicy.Id = this.FirewallPolicyId; } if (this.CustomErrorConfiguration != null) { httpListener.CustomErrorConfigurations = this.CustomErrorConfiguration?.ToList(); } httpListener.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayHttpListenerName, this.Name); return(httpListener); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var backendAddressPool = this.ApplicationGateway.BackendAddressPools.SingleOrDefault (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (backendAddressPool != null) { throw new ArgumentException("Backend address pool with the specified name already exists"); } backendAddressPool = new PSApplicationGatewayBackendAddressPool(); backendAddressPool.Name = this.Name; if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId)) { backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List <PSResourceId>(); foreach (string id in this.BackendIPConfigurationIds) { var backendIpConfig = new PSResourceId(); backendIpConfig.Id = id; backendAddressPool.BackendIpConfigurations.Add(backendIpConfig); } } else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP)) { backendAddressPool.BackendAddresses = new System.Collections.Generic.List <PSApplicationGatewayBackendAddress>(); foreach (string ip in this.BackendIPAddresses) { var backendAddress = new PSApplicationGatewayBackendAddress(); backendAddress.IpAddress = ip; backendAddressPool.BackendAddresses.Add(backendAddress); } } else { backendAddressPool.BackendAddresses = new System.Collections.Generic.List <PSApplicationGatewayBackendAddress>(); foreach (string fqdn in this.BackendFqdns) { var backendAddress = new PSApplicationGatewayBackendAddress(); backendAddress.Fqdn = fqdn; backendAddressPool.BackendAddresses.Add(backendAddress); } } backendAddressPool.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayBackendAddressPoolName, this.Name); this.ApplicationGateway.BackendAddressPools.Add(backendAddressPool); WriteObject(this.ApplicationGateway); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); // Get the subnetId and publicIp AddressId from the object if specified if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResource)) { if (Subnet != null) { this.SubnetId = this.Subnet.Id; } if (PublicIpAddress != null) { this.PublicIpAddressId = this.PublicIpAddress.Id; } } var frontendIpConfig = new PSApplicationGatewayFrontendIpConfiguration(); frontendIpConfig.Name = this.Name; if (!string.IsNullOrEmpty(this.SubnetId)) { frontendIpConfig.Subnet = new PSResourceId(); frontendIpConfig.Subnet.Id = this.SubnetId; if (!string.IsNullOrEmpty(this.PrivateIpAddress)) { frontendIpConfig.PrivateIpAddress = this.PrivateIpAddress; frontendIpConfig.PrivateIpAllocationMethod = Management.Network.Models.IpAllocationMethod.Static; } else { frontendIpConfig.PrivateIpAllocationMethod = Management.Network.Models.IpAllocationMethod.Dynamic; } } if (!string.IsNullOrEmpty(this.PublicIpAddressId)) { frontendIpConfig.PublicIpAddress = new PSResourceId(); frontendIpConfig.PublicIpAddress.Id = this.PublicIpAddressId; } frontendIpConfig.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendIpConfigName, this.Name); WriteObject(frontendIpConfig); }
public PSApplicationGatewayRewriteRuleSet NewObject() { var rewriteRuleSet = new PSApplicationGatewayRewriteRuleSet { Name = this.Name, RewriteRules = this.RewriteRule, Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayRewriteRuleSetName, this.Name) }; return(rewriteRuleSet); }
public PSApplicationGatewayTrustedClientCertificate NewObject() { var clientCertificate = new PSApplicationGatewayTrustedClientCertificate(); clientCertificate.Name = this.Name; clientCertificate.Data = Convert.ToBase64String(File.ReadAllBytes(this.CertificateFile)); clientCertificate.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayTrustedClientCertificateName, this.Name); return(clientCertificate); }
public PSApplicationGatewayBackendHttpSettings NewObject() { var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings(); backendHttpSettings.Name = this.Name; backendHttpSettings.Port = this.Port; backendHttpSettings.Protocol = this.Protocol; backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity; backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName, this.Name); return(backendHttpSettings); }
public PSApplicationGatewayPrivateLinkConfiguration NewObject() { var privateLinkConfiguration = new PSApplicationGatewayPrivateLinkConfiguration(); privateLinkConfiguration.Name = this.Name; privateLinkConfiguration.IpConfigurations = this.IpConfiguration?.ToList(); privateLinkConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayPrivateLinkConfigurationName, this.Name); return(privateLinkConfiguration); }
public PSApplicationGatewayFrontendPort NewObject() { var frontendPort = new PSApplicationGatewayFrontendPort(); frontendPort.Name = this.Name; frontendPort.Port = this.Port; frontendPort.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendPortName, this.Name); return(frontendPort); }
public PSApplicationGatewayAuthenticationCertificate NewObject() { X509Certificate2 cert = new X509Certificate2(CertificateFile); var authCertificate = new PSApplicationGatewayAuthenticationCertificate(); authCertificate.Name = this.Name; authCertificate.Data = Convert.ToBase64String(cert.Export(X509ContentType.Cert)); authCertificate.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayAuthenticationCertificateName, this.Name); return(authCertificate); }
public PSApplicationGatewayRequestRoutingRule NewObject() { var requestRoutingRule = new PSApplicationGatewayRequestRoutingRule(); requestRoutingRule.Name = this.Name; requestRoutingRule.RuleType = this.RuleType; requestRoutingRule.Priority = this.Priority; if (!string.IsNullOrEmpty(this.BackendHttpSettingsId)) { requestRoutingRule.BackendHttpSettings = new PSResourceId(); requestRoutingRule.BackendHttpSettings.Id = this.BackendHttpSettingsId; } if (!string.IsNullOrEmpty(this.HttpListenerId)) { requestRoutingRule.HttpListener = new PSResourceId(); requestRoutingRule.HttpListener.Id = this.HttpListenerId; } if (!string.IsNullOrEmpty(this.BackendAddressPoolId)) { requestRoutingRule.BackendAddressPool = new PSResourceId(); requestRoutingRule.BackendAddressPool.Id = this.BackendAddressPoolId; } if (!string.IsNullOrEmpty(this.UrlPathMapId)) { requestRoutingRule.UrlPathMap = new PSResourceId(); requestRoutingRule.UrlPathMap.Id = this.UrlPathMapId; } if (!string.IsNullOrEmpty(this.RewriteRuleSetId)) { requestRoutingRule.RewriteRuleSet = new PSResourceId(); requestRoutingRule.RewriteRuleSet.Id = this.RewriteRuleSetId; } if (!string.IsNullOrEmpty(this.RedirectConfigurationId)) { requestRoutingRule.RedirectConfiguration = new PSResourceId(); requestRoutingRule.RedirectConfiguration.Id = this.RedirectConfigurationId; } requestRoutingRule.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayRequestRoutingRuleName, this.Name); return(requestRoutingRule); }
public PSApplicationGatewaySslCertificate NewObject() { var sslCertificate = new PSApplicationGatewaySslCertificate(); sslCertificate.Name = this.Name; sslCertificate.Data = Convert.ToBase64String(File.ReadAllBytes(CertificateFile)); #pragma warning disable 0618 sslCertificate.Password = this.Password; #pragma warning restore 0618 sslCertificate.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaySslCertificateName, this.Name); return(sslCertificate); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var frontendPort = new PSApplicationGatewayFrontendPort(); frontendPort.Name = this.Name; frontendPort.Port = this.Port; frontendPort.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendPortName, this.Name); WriteObject(frontendPort); }
public PSApplicationGatewaySslCertificate NewObject() { X509Certificate2 cert = new X509Certificate2(CertificateFile, Password, X509KeyStorageFlags.Exportable); var sslCertificate = new PSApplicationGatewaySslCertificate(); sslCertificate.Name = this.Name; sslCertificate.Data = Convert.ToBase64String(cert.Export(X509ContentType.Pfx, Password)); sslCertificate.Password = this.Password; sslCertificate.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaySslCertificateName, this.Name); return(sslCertificate); }
public PSApplicationGatewayRedirectConfiguration NewObject() { var redirectConfiguration = new PSApplicationGatewayRedirectConfiguration(); redirectConfiguration.Name = this.Name; redirectConfiguration.RedirectType = this.RedirectType; if (this.TargetUrl != null && this.TargetListenerID != null && this.TargetListener != null) { throw new ArgumentException("Please either specify a target url or a target listener."); } if (this.TargetUrl != null && (this.TargetListenerID != null || this.TargetListener != null)) { throw new ArgumentException("Both target url or target listener can not be specified."); } redirectConfiguration.TargetUrl = this.TargetUrl; if (this.IncludePath != null) { redirectConfiguration.IncludePath = this.IncludePath; } if (this.IncludeQueryString != null) { redirectConfiguration.IncludeQueryString = this.IncludeQueryString; } if (!string.IsNullOrEmpty(this.TargetListenerID)) { redirectConfiguration.TargetListener = new PSResourceId(); redirectConfiguration.TargetListener.Id = this.TargetListener.Id; } redirectConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayRedirectConfigurationName, this.Name); return(redirectConfiguration); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var backendAddressPool = new PSApplicationGatewayBackendAddressPool(); backendAddressPool.Name = this.Name; if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId)) { backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List <PSResourceId>(); foreach (string id in this.BackendIPConfigurationIds) { var backendIpConfig = new PSResourceId(); backendIpConfig.Id = id; backendAddressPool.BackendIpConfigurations.Add(backendIpConfig); } } else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP)) { backendAddressPool.BackendAddresses = new System.Collections.Generic.List <PSApplicationGatewayBackendAddress>(); foreach (string ip in this.BackendIPAddresses) { var backendAddress = new PSApplicationGatewayBackendAddress(); backendAddress.IpAddress = ip; backendAddressPool.BackendAddresses.Add(backendAddress); } } else { backendAddressPool.BackendAddresses = new System.Collections.Generic.List <PSApplicationGatewayBackendAddress>(); foreach (string fqdn in this.BackendFqdns) { var backendAddress = new PSApplicationGatewayBackendAddress(); backendAddress.Fqdn = fqdn; backendAddressPool.BackendAddresses.Add(backendAddress); } } backendAddressPool.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayBackendAddressPoolName, this.Name); WriteObject(backendAddressPool); }
public PSApplicationGatewayBackendHttpSettings NewObject() { var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings(); backendHttpSettings.Name = this.Name; backendHttpSettings.Port = this.Port; backendHttpSettings.Protocol = this.Protocol; backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity; if (0 == this.RequestTimeout) { backendHttpSettings.RequestTimeout = 30; } else { backendHttpSettings.RequestTimeout = this.RequestTimeout; } if (this.ConnectionDraining != null) { backendHttpSettings.ConnectionDraining = this.ConnectionDraining; } if (!string.IsNullOrEmpty(this.ProbeId)) { backendHttpSettings.Probe = new PSResourceId(); backendHttpSettings.Probe.Id = this.ProbeId; } if (this.AuthenticationCertificates != null && this.AuthenticationCertificates.Count > 0) { backendHttpSettings.AuthenticationCertificates = new List <PSResourceId>(); foreach (var authcert in this.AuthenticationCertificates) { backendHttpSettings.AuthenticationCertificates.Add( new PSResourceId() { Id = authcert.Id }); } } backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName, this.Name); return(backendHttpSettings); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var sslCertificate = new PSApplicationGatewaySslCertificate(); sslCertificate.Name = this.Name; sslCertificate.Data = this.Data; sslCertificate.Password = this.Password; sslCertificate.PublicCertData = this.PublicCertData; sslCertificate.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaySslCertificateName, this.Name); WriteObject(sslCertificate); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var requestRoutingRule = this.ApplicationGateway.RequestRoutingRules.SingleOrDefault (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (requestRoutingRule == null) { throw new ArgumentException("RequestRoutingRule with the specified name does not exist"); } requestRoutingRule = new PSApplicationGatewayRequestRoutingRule(); requestRoutingRule.Name = this.Name; requestRoutingRule.RuleType = this.RuleType; if (!string.IsNullOrEmpty(this.BackendHttpSettingsId)) { requestRoutingRule.BackendHttpSettings = new PSResourceId(); requestRoutingRule.BackendHttpSettings.Id = this.BackendHttpSettingsId; } if (!string.IsNullOrEmpty(this.HttpListenerId)) { requestRoutingRule.HttpListener = new PSResourceId(); requestRoutingRule.HttpListener.Id = this.HttpListenerId; } if (!string.IsNullOrEmpty(this.BackendAddressPoolId)) { requestRoutingRule.BackendAddressPool = new PSResourceId(); requestRoutingRule.BackendAddressPool.Id = this.BackendAddressPoolId; } requestRoutingRule.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayRequestRoutingRuleName, this.Name); this.ApplicationGateway.RequestRoutingRules.Add(requestRoutingRule); WriteObject(this.ApplicationGateway); }