public override void Execute() { base.Execute(); var existingProbe = this.LoadBalancer.Probes.SingleOrDefault(resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (existingProbe != null) { throw new ArgumentException("Probe with the specified name already exists"); } var probe = new PSProbe(); probe.Name = this.Name; probe.Port = this.Port; probe.Protocol = this.Protocol; probe.RequestPath = this.RequestPath; probe.IntervalInSeconds = this.IntervalInSeconds; probe.NumberOfProbes = this.ProbeCount; probe.Id = ChildResourceHelper.GetResourceId( this.NetworkClient.NetworkManagementClient.SubscriptionId, this.LoadBalancer.ResourceGroupName, this.LoadBalancer.Name, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerProbeName, this.Name); this.LoadBalancer.Probes.Add(probe); WriteObject(this.LoadBalancer); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var probe = new PSProbe(); probe.Name = this.Name; probe.Port = this.Port; probe.Protocol = this.Protocol; probe.RequestPath = this.RequestPath; probe.IntervalInSeconds = this.IntervalInSeconds; probe.NumberOfProbes = this.ProbeCount; probe.Id = ChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerProbeName, this.Name); WriteObject(probe); }