Search in sources :

Example 1 with GeoFilter

use of com.microsoft.azure.management.cdn.GeoFilter in project azure-sdk-for-java by Azure.

the class CdnEndpointImpl method withGeoFilter.

@Override
public CdnEndpointImpl withGeoFilter(String relativePath, GeoFilterActions action, Collection<CountryIsoCode> countryCodes) {
    GeoFilter geoFilter = this.createGeoFiltersObject(relativePath, action);
    if (geoFilter.countryCodes() == null) {
        geoFilter.withCountryCodes(new ArrayList<String>());
    } else {
        geoFilter.countryCodes().clear();
    }
    for (CountryIsoCode countryCode : countryCodes) {
        geoFilter.countryCodes().add(countryCode.toString());
    }
    this.inner().geoFilters().add(geoFilter);
    return this;
}
Also used : GeoFilter(com.microsoft.azure.management.cdn.GeoFilter) CountryIsoCode(com.microsoft.azure.management.resources.fluentcore.arm.CountryIsoCode)

Example 2 with GeoFilter

use of com.microsoft.azure.management.cdn.GeoFilter in project azure-sdk-for-java by Azure.

the class TestCdn method print.

@Override
public void print(CdnProfile profile) {
    StringBuilder info = new StringBuilder();
    info.append("CDN Profile: ").append(profile.id()).append("\n\tName: ").append(profile.name()).append("\n\tResource group: ").append(profile.resourceGroupName()).append("\n\tRegion: ").append(profile.regionName()).append("\n\tSku: ").append(profile.sku().name()).append("\n\tTags: ").append(profile.tags());
    Map<String, CdnEndpoint> cdnEndpoints = profile.endpoints();
    if (!cdnEndpoints.isEmpty()) {
        info.append("\n\tCDN endpoints:");
        int idx = 1;
        for (CdnEndpoint endpoint : cdnEndpoints.values()) {
            info.append("\n\t\tCDN endpoint: #").append(idx++).append("\n\t\t\tId: ").append(endpoint.id()).append("\n\t\t\tName: ").append(endpoint.name()).append("\n\t\t\tState: ").append(endpoint.resourceState()).append("\n\t\t\tHost name: ").append(endpoint.hostName()).append("\n\t\t\tOrigin host name: ").append(endpoint.originHostName()).append("\n\t\t\tOrigin host header: ").append(endpoint.originHostHeader()).append("\n\t\t\tOrigin path: ").append(endpoint.originPath()).append("\n\t\t\tOptimization type: ").append(endpoint.optimizationType()).append("\n\t\t\tQuery string caching behavior: ").append(endpoint.queryStringCachingBehavior()).append("\n\t\t\tHttp allowed: ").append(endpoint.isHttpAllowed()).append("\t\tHttp port: ").append(endpoint.httpPort()).append("\n\t\t\tHttps allowed: ").append(endpoint.isHttpsAllowed()).append("\t\tHttps port: ").append(endpoint.httpsPort()).append("\n\t\t\tCompression enabled: ").append(endpoint.isCompressionEnabled());
            info.append("\n\t\t\tContent types to compress: ");
            for (String contentTypeToCompress : endpoint.contentTypesToCompress()) {
                info.append("\n\t\t\t\t").append(contentTypeToCompress);
            }
            info.append("\n\t\t\tGeo filters: ");
            for (GeoFilter geoFilter : endpoint.geoFilters()) {
                info.append("\n\t\t\t\tAction: ").append(geoFilter.action());
                info.append("\n\t\t\t\tRelativePath: ").append(geoFilter.relativePath());
                info.append("\n\t\t\t\tCountry codes: ");
                for (String countryCode : geoFilter.countryCodes()) {
                    info.append("\n\t\t\t\t\t").append(countryCode);
                }
            }
            info.append("\n\t\t\tCustom domains: ");
            for (String customDomain : endpoint.customDomains()) {
                info.append("\n\t\t\t\t").append(customDomain);
            }
        }
    }
    System.out.println(info.toString());
}
Also used : CdnEndpoint(com.microsoft.azure.management.cdn.CdnEndpoint) GeoFilter(com.microsoft.azure.management.cdn.GeoFilter) CdnEndpoint(com.microsoft.azure.management.cdn.CdnEndpoint)

Example 3 with GeoFilter

use of com.microsoft.azure.management.cdn.GeoFilter in project azure-sdk-for-java by Azure.

the class CdnEndpointImpl method withGeoFilter.

@Override
public CdnEndpointImpl withGeoFilter(String relativePath, GeoFilterActions action, CountryIsoCode countryCode) {
    GeoFilter geoFilter = this.createGeoFiltersObject(relativePath, action);
    if (geoFilter.countryCodes() == null) {
        geoFilter.withCountryCodes(new ArrayList<String>());
    }
    geoFilter.countryCodes().add(countryCode.toString());
    this.inner().geoFilters().add(geoFilter);
    return this;
}
Also used : GeoFilter(com.microsoft.azure.management.cdn.GeoFilter)

Example 4 with GeoFilter

use of com.microsoft.azure.management.cdn.GeoFilter in project azure-sdk-for-java by Azure.

the class CdnEndpointImpl method createGeoFiltersObject.

private GeoFilter createGeoFiltersObject(String relativePath, GeoFilterActions action) {
    if (this.inner().geoFilters() == null) {
        this.inner().withGeoFilters(new ArrayList<GeoFilter>());
    }
    GeoFilter geoFilter = null;
    for (GeoFilter filter : this.inner().geoFilters()) {
        if (filter.relativePath().equals(relativePath)) {
            geoFilter = filter;
            break;
        }
    }
    if (geoFilter == null) {
        geoFilter = new GeoFilter();
    } else {
        this.inner().geoFilters().remove(geoFilter);
    }
    geoFilter.withRelativePath(relativePath).withAction(action);
    return geoFilter;
}
Also used : GeoFilter(com.microsoft.azure.management.cdn.GeoFilter)

Aggregations

GeoFilter (com.microsoft.azure.management.cdn.GeoFilter)4 CdnEndpoint (com.microsoft.azure.management.cdn.CdnEndpoint)1 CountryIsoCode (com.microsoft.azure.management.resources.fluentcore.arm.CountryIsoCode)1