public override void Execute() { base.Execute(); var existingbackendAddressPool = this.LoadBalancer.BackendAddressPools.SingleOrDefault(resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (existingbackendAddressPool != null) { throw new ArgumentException("BackendAddressPool with the specified name already exists"); } var backendAddressPool = new PSBackendAddressPool(); backendAddressPool.Name = this.Name; backendAddressPool.Id = ChildResourceHelper.GetResourceId( this.NetworkClient.NetworkManagementClient.SubscriptionId, this.LoadBalancer.ResourceGroupName, this.LoadBalancer.Name, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerBackendAddressPoolName, this.Name); this.LoadBalancer.BackendAddressPools.Add(backendAddressPool); WriteObject(this.LoadBalancer); }
protected override void ProcessRecord() { base.ProcessRecord(); var backendAddressPool = new PSBackendAddressPool(); backendAddressPool.Name = this.Name; backendAddressPool.Id = ChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerBackendAddressPoolName, this.Name); WriteObject(backendAddressPool); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var backendAddressPool = new PSBackendAddressPool(); backendAddressPool.Name = this.Name; backendAddressPool.Id = ChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerBackendAddressPoolName, this.Name); WriteObject(backendAddressPool); }