public static Profile CreateOrUpdateProfileWithMultiValue( TrafficManagerManagementClient trafficManagerClient, string resourceGroupName, string profileName, long?maxReturn = 2) { Profile expectedProfile = CreateOrUpdateDefaultEmptyProfile(trafficManagerClient, resourceGroupName, profileName, "MultiValue", "Disabled", maxReturn); expectedProfile.Endpoints = new List <Endpoint>(); for (int ndx = 0; ndx < 5; ndx++) { Endpoint endpoint = TrafficManagerHelper.GenerateDefaultEndpoint( $"My external endpoint {ndx}", $"1.2.3.{ndx}"); EndpointPropertiesSubnetsItem range = new EndpointPropertiesSubnetsItem($"1.2.{ndx}.0", $"1.2.{ndx}.250"); EndpointPropertiesSubnetsItem subnet = new EndpointPropertiesSubnetsItem($"3.4.{ndx}.0", null, 24); endpoint.Subnets = new List <EndpointPropertiesSubnetsItem> { range, subnet }; trafficManagerClient.Endpoints.CreateOrUpdate( resourceGroupName, profileName, "ExternalEndpoints", endpoint.Name, endpoint); expectedProfile.Endpoints.Add(endpoint); } return(expectedProfile); }
public static Profile CreateOrUpdateProfileWithCustomHeadersAndStatusCodeRanges( TrafficManagerManagementClient trafficManagerClient, string resourceGroupName, string profileName) { Profile expectedProfile = GenerateDefaultEmptyProfile(profileName); expectedProfile.MonitorConfig.CustomHeaders = new List <MonitorConfigCustomHeadersItem> { new MonitorConfigCustomHeadersItem("host", "www.contoso.com"), new MonitorConfigCustomHeadersItem("custom-name", "custom-value") }; expectedProfile.MonitorConfig.ExpectedStatusCodeRanges = new List <MonitorConfigExpectedStatusCodeRangesItem> { new MonitorConfigExpectedStatusCodeRangesItem(200, 499) }; trafficManagerClient.Profiles.CreateOrUpdate( resourceGroupName, profileName, expectedProfile); expectedProfile.Endpoints = new List <Endpoint>(); for (int ndx = 0; ndx < 3; ndx++) { Endpoint endpoint = TrafficManagerHelper.GenerateDefaultEndpoint( $"My external endpoint {ndx}", $"foobar.Contoso{ndx}.com"); endpoint.CustomHeaders = new List <EndpointPropertiesCustomHeadersItem> { new EndpointPropertiesCustomHeadersItem("custom-name", "custom-value-overriden") }; trafficManagerClient.Endpoints.CreateOrUpdate( resourceGroupName, profileName, "ExternalEndpoints", endpoint.Name, endpoint); expectedProfile.Endpoints.Add(endpoint); } return(expectedProfile); }