Java Code Examples for com.microsoft.azure.management.resources.fluentcore.arm.Region#US_SOUTH_CENTRAL

The following examples show how to use com.microsoft.azure.management.resources.fluentcore.arm.Region#US_SOUTH_CENTRAL . 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: ResourceGroupsTests.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
@Test
public void canCreateResourceGroup() throws Exception {
    final String rgName = SdkContext.randomResourceName("rg", 9);
    Region region = Region.US_SOUTH_CENTRAL;
    // Create
    resourceGroups.define(rgName)
            .withRegion(Region.US_SOUTH_CENTRAL)
            .withTag("department", "finance")
            .withTag("tagname", "tagvalue")
            .create();
    // List
    ResourceGroup groupResult = null;
    for (ResourceGroup rg : resourceGroups.listByTag("department", "finance")) {
        if (rg.name().equals(rgName)) {
            groupResult = rg;
            break;
        }
    }
    Assert.assertNotNull(groupResult);
    Assert.assertEquals("finance", groupResult.tags().get("department"));
    Assert.assertEquals("tagvalue", groupResult.tags().get("tagname"));
    Assert.assertTrue(region.name().equalsIgnoreCase(groupResult.regionName()));

    // Check existence
    Assert.assertTrue(resourceGroups.checkExistence(rgName));

    // Get
    ResourceGroup getGroup = resourceGroups.getByName(rgName);
    Assert.assertNotNull(getGroup);
    Assert.assertEquals(rgName, getGroup.name());
    // Update
    ResourceGroup updatedGroup = getGroup.update()
            .withTag("tag1", "value1")
            .apply();
    Assert.assertEquals("value1", updatedGroup.tags().get("tag1"));
    Assert.assertTrue(region.name().equalsIgnoreCase(getGroup.regionName()));
    // Delete
    resourceGroups.deleteByName(rgName);
    Assert.assertFalse(resourceGroups.checkExistence(rgName));
}
 
Example 2
Source File: TestNetwork.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
@Override
public Network createResource(Networks networks) throws Exception {
    Region region = Region.US_SOUTH_CENTRAL;
    String groupName = "rg" + this.testId;

    String networkName = SdkContext.randomResourceName("net", 15);

    Network network = networks.define(networkName)
            .withRegion(region)
            .withNewResourceGroup(groupName)
            .withTag("tag1", "value1")
            .create();
    Assert.assertEquals("value1", network.tags().get("tag1"));
    return network;
}