use of com.microsoft.azure.management.cdn.EdgeNode in project azure-sdk-for-java by Azure.
the class TestCdn method createResource.
@Override
public CdnProfile createResource(CdnProfiles profiles) throws Exception {
final Region region = Region.US_EAST;
final String groupName = "rg" + this.testId;
final String cdnProfileName = "cdnProfile" + this.testId;
final String cdnEndpointName = "cdnEndpoint" + this.testId;
final String cdnOriginHostName = "mylinuxapp.azurewebsites.net";
CdnProfile cdnProfile = profiles.define(cdnProfileName).withRegion(region).withNewResourceGroup(groupName).withStandardAkamaiSku().defineNewEndpoint(cdnEndpointName).withOrigin(cdnOriginHostName).withGeoFilter("/path/videos", GeoFilterActions.BLOCK, CountryIsoCode.ARGENTINA).withGeoFilter("/path/images", GeoFilterActions.BLOCK, CountryIsoCode.BELGIUM).withContentTypeToCompress("text/plain").withCompressionEnabled(true).withQueryStringCachingBehavior(QueryStringCachingBehavior.BYPASS_CACHING).withHttpsAllowed(true).withHttpsPort(444).withHttpAllowed(false).withHttpPort(85).attach().create();
Assert.assertTrue(cdnProfile.sku().name().equals(SkuName.STANDARD_AKAMAI));
Assert.assertNotNull(cdnProfile.endpoints());
Assert.assertEquals(1, cdnProfile.endpoints().size());
CdnEndpoint endpoint = cdnProfile.endpoints().get(cdnEndpointName);
Assert.assertNotNull(endpoint);
Assert.assertEquals(cdnOriginHostName, endpoint.originHostName());
Assert.assertEquals(444, endpoint.httpsPort());
Assert.assertEquals(85, endpoint.httpPort());
Assert.assertFalse(endpoint.isHttpAllowed());
Assert.assertTrue(endpoint.isHttpsAllowed());
Assert.assertTrue(endpoint.isCompressionEnabled());
Assert.assertEquals(QueryStringCachingBehavior.BYPASS_CACHING, endpoint.queryStringCachingBehavior());
Assert.assertNotNull(endpoint.geoFilters());
Assert.assertEquals(QueryStringCachingBehavior.BYPASS_CACHING, endpoint.queryStringCachingBehavior());
for (ResourceUsage usage : profiles.listResourceUsage()) {
Assert.assertNotNull(usage);
Assert.assertEquals("profile", usage.resourceType());
}
for (EdgeNode node : profiles.listEdgeNodes()) {
Assert.assertNotNull(node);
}
for (ResourceUsage usage : cdnProfile.listResourceUsage()) {
Assert.assertNotNull(usage);
Assert.assertEquals("endpoint", usage.resourceType());
}
for (CdnEndpoint ep : cdnProfile.endpoints().values()) {
for (ResourceUsage usage : ep.listResourceUsage()) {
Assert.assertNotNull(usage);
Assert.assertTrue("customdomain".equals(usage.resourceType()) || "geofilter".equals(usage.resourceType()));
}
}
return cdnProfile;
}
Aggregations