public override void ExecuteCmdlet() { base.ExecuteCmdlet(); 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 Execute() { base.Execute(); 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.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerProbeName, this.Name); WriteObject(probe); }
public override void Execute() { var vProbesIndex = this.LoadBalancer.Probes.IndexOf( this.LoadBalancer.Probes.SingleOrDefault( resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase))); if (vProbesIndex == -1) { throw new ArgumentException("Probes with the specified name does not exist"); } var vProbes = new PSProbe(); vProbes.Protocol = this.Protocol; vProbes.Port = this.Port; vProbes.IntervalInSeconds = this.IntervalInSeconds; vProbes.NumberOfProbes = this.ProbeCount; vProbes.RequestPath = this.RequestPath; vProbes.Name = this.Name; this.LoadBalancer.Probes[vProbesIndex] = vProbes; WriteObject(this.LoadBalancer, true); }
protected override void ProcessRecord() { base.ProcessRecord(); 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); }
public override void Execute() { var vProbes = new PSProbe(); vProbes.Protocol = this.Protocol; vProbes.Port = this.Port; vProbes.IntervalInSeconds = this.IntervalInSeconds; vProbes.NumberOfProbes = this.ProbeCount; vProbes.RequestPath = this.RequestPath; vProbes.Name = this.Name; var generatedId = string.Format( "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/loadBalancers/{2}/{3}/{4}", this.NetworkClient.NetworkManagementClient.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ResourceGroupNotSet, Microsoft.Azure.Commands.Network.Properties.Resources.LoadBalancerNameNotSet, "Probes", this.Name); vProbes.Id = generatedId; WriteObject(vProbes, true); }
public override void 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"); } // Probes if (this.LoadBalancer.Probes == null) { this.LoadBalancer.Probes = new List <PSProbe>(); } var vProbes = new PSProbe(); vProbes.Protocol = this.Protocol; vProbes.Port = this.Port; vProbes.IntervalInSeconds = this.IntervalInSeconds; vProbes.NumberOfProbes = this.ProbeCount; vProbes.RequestPath = this.RequestPath; vProbes.Name = this.Name; var generatedId = string.Format( "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/loadBalancers/{2}/{3}/{4}", this.NetworkClient.NetworkManagementClient.SubscriptionId, this.LoadBalancer.ResourceGroupName, this.LoadBalancer.Name, "Probes", this.Name); vProbes.Id = generatedId; this.LoadBalancer.Probes.Add(vProbes); WriteObject(this.LoadBalancer, true); }