public override void ExecuteCmdlet()
{
if (this.TrafficManagerProfile.Endpoints == null)
{
this.TrafficManagerProfile.Endpoints = new List<TrafficManagerEndpoint>();
}
if (this.TrafficManagerProfile.Endpoints.Any(endpoint => string.Equals(this.EndpointName, endpoint.Name)))
{
throw new PSArgumentException(string.Format(ProjectResources.Error_AddExistingEndpoint, this.EndpointName));
}
this.TrafficManagerProfile.Endpoints.Add(
new TrafficManagerEndpoint
{
Name = this.EndpointName,
Type = this.Type,
TargetResourceId = this.TargetResourceId,
Target = this.Target,
EndpointStatus = this.EndpointStatus,
Weight = this.Weight,
Priority = this.Priority,
Location = this.EndpointLocation,
MinChildEndpoints = this.MinChildEndpoints,
});
this.WriteVerbose(ProjectResources.Success);
this.WriteObject(this.TrafficManagerProfile);
}
}