Java Code Examples for com.microsoft.azure.management.resources.fluentcore.arm.Region#findByLabelOrName()

The following examples show how to use com.microsoft.azure.management.resources.fluentcore.arm.Region#findByLabelOrName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AzureTests.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
@Test
@Ignore("Util to generate missing regions")
public void generateMissingRegion() {
    // Please double check generated code and make adjustment e.g. GERMANY_WEST_CENTRAL -> GERMANY_WESTCENTRAL

    StringBuilder sb = new StringBuilder();

    List<Location> locations = azure.getCurrentSubscription().listLocations();  // note the region is not complete since it depends on current subscription
    for (Location location : locations) {
        Region region = Region.findByLabelOrName(location.name());
        if (region == null) {
            sb.append("\n").append(
                    MessageFormat.format("public static final Region {0} = new Region(\"{1}\", \"{2}\");",
                            location.displayName().toUpperCase().replace(" ", "_"),
                            location.name(),
                            location.displayName())
            );
        }
    }

    Assert.assertTrue(sb.toString(), sb.length() == 0);
}
 
Example 2
Source File: WebhookImpl.java    From azure-libraries-for-java with MIT License 4 votes vote down vote up
@Override
public Region region() {
    return Region.findByLabelOrName(this.regionName());
}