Search in sources :

Example 51 with Region

use of com.microsoft.azure.management.resources.fluentcore.arm.Region in project azure-tools-for-java by Microsoft.

the class AzureNewDockerHostStep method updateDockerLocationGroup.

private void updateDockerLocationGroup() {
    AzureDockerSubscription currentSubscription = (AzureDockerSubscription) dockerSubscriptionComboBox.getSelectedItem();
    updateDockerLocationComboBox(currentSubscription);
    dockerLocationComboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            AzureDockerSubscription currentSubscription = (AzureDockerSubscription) dockerSubscriptionComboBox.getSelectedItem();
            //        updateDockerHostSelectRGComboBox(currentSubscription);
            String region = (String) dockerLocationComboBox.getSelectedItem();
            if (!region.equals(SELECT_REGION)) {
                Region regionObj = Region.findByLabelOrName(region);
                String selectedRegion = regionObj != null ? regionObj.name() : region;
                if (preferredLocation == null && selectedRegion != null) {
                    // remove the SELECT_REGION entry (first entry in the list)
                    dockerLocationComboBox.removeItemAt(0);
                    dockerLocationLabel.setVisible(false);
                }
                preferredLocation = selectedRegion;
                updateDockerSelectVnetComboBox(currentSubscription, selectedRegion);
                setDialogButtonsState(doValidate(false) == null);
            } else {
                updateDockerSelectVnetComboBox(currentSubscription, null);
                setDialogButtonsState(false);
            }
            updateDockerHostVMSizeComboBox(dockerHostVMPreferredSizesCheckBox.isSelected());
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) Region(com.microsoft.azure.management.resources.fluentcore.arm.Region)

Example 52 with Region

use of com.microsoft.azure.management.resources.fluentcore.arm.Region in project azure-sdk-for-java by Azure.

the class ServiceBusOperationsTests method canCRUDOnSimpleNamespace.

@Test
public void canCRUDOnSimpleNamespace() {
    Region region = Region.US_EAST;
    Creatable<ResourceGroup> rgCreatable = resourceManager.resourceGroups().define(RG_NAME).withRegion(region);
    String namespaceDNSLabel = generateRandomResourceName("jvsbns", 15);
    serviceBusManager.namespaces().define(namespaceDNSLabel).withRegion(region).withNewResourceGroup(rgCreatable).withSku(NamespaceSku.PREMIUM_CAPACITY1).create();
    ServiceBusNamespace namespace = serviceBusManager.namespaces().getByResourceGroup(RG_NAME, namespaceDNSLabel);
    Assert.assertNotNull(namespace);
    Assert.assertNotNull(namespace.inner());
    PagedList<ServiceBusNamespace> namespaces = serviceBusManager.namespaces().listByResourceGroup(RG_NAME);
    Assert.assertNotNull(namespaces);
    Assert.assertTrue(namespaces.size() > 0);
    boolean found = false;
    for (ServiceBusNamespace n : namespaces) {
        if (n.name().equalsIgnoreCase(namespace.name())) {
            found = true;
            break;
        }
    }
    Assert.assertTrue(found);
    Assert.assertNotNull(namespace.dnsLabel());
    Assert.assertTrue(namespace.dnsLabel().equalsIgnoreCase(namespaceDNSLabel));
    Assert.assertNotNull(namespace.fqdn());
    Assert.assertTrue(namespace.fqdn().contains(namespaceDNSLabel));
    Assert.assertNotNull(namespace.sku());
    Assert.assertTrue(namespace.sku().equals(NamespaceSku.PREMIUM_CAPACITY1));
    Assert.assertNotNull(namespace.region());
    Assert.assertTrue(namespace.region().equals(region));
    Assert.assertNotNull(namespace.resourceGroupName());
    Assert.assertTrue(namespace.resourceGroupName().equalsIgnoreCase(RG_NAME));
    Assert.assertNotNull(namespace.createdAt());
    Assert.assertNotNull(namespace.queues());
    Assert.assertEquals(0, namespace.queues().list().size());
    Assert.assertNotNull(namespace.topics());
    Assert.assertEquals(0, namespace.topics().list().size());
    Assert.assertNotNull(namespace.authorizationRules());
    PagedList<NamespaceAuthorizationRule> defaultNsRules = namespace.authorizationRules().list();
    Assert.assertEquals(1, defaultNsRules.size());
    NamespaceAuthorizationRule defaultNsRule = defaultNsRules.get(0);
    Assert.assertTrue(defaultNsRule.name().equalsIgnoreCase("RootManageSharedAccessKey"));
    Assert.assertNotNull(defaultNsRule.rights());
    Assert.assertNotNull(defaultNsRule.namespaceName());
    Assert.assertTrue(defaultNsRule.namespaceName().equalsIgnoreCase(namespaceDNSLabel));
    Assert.assertNotNull(defaultNsRule.resourceGroupName());
    Assert.assertTrue(defaultNsRule.resourceGroupName().equalsIgnoreCase(RG_NAME));
    namespace.update().withSku(NamespaceSku.PREMIUM_CAPACITY2).apply();
    Assert.assertTrue(namespace.sku().equals(NamespaceSku.PREMIUM_CAPACITY2));
// TODO: There is a bug in LRO implementation of ServiceBusNamespace DELETE operation (Last poll returns 404, reported this to RP]
//
// serviceBusManager.namespaces().deleteByGroup(RG_NAME, namespace.name());
}
Also used : Region(com.microsoft.azure.management.resources.fluentcore.arm.Region) ResourceGroup(com.microsoft.azure.management.resources.ResourceGroup) Test(org.junit.Test)

Aggregations

Region (com.microsoft.azure.management.resources.fluentcore.arm.Region)52 VirtualMachine (com.microsoft.azure.management.compute.VirtualMachine)20 ArrayList (java.util.ArrayList)19 Network (com.microsoft.azure.management.network.Network)16 ResourceGroup (com.microsoft.azure.management.resources.ResourceGroup)14 Test (org.junit.Test)12 Disk (com.microsoft.azure.management.compute.Disk)8 PublicIPAddress (com.microsoft.azure.management.network.PublicIPAddress)8 Date (java.util.Date)8 Creatable (com.microsoft.azure.management.resources.fluentcore.model.Creatable)7 VirtualMachineDataDisk (com.microsoft.azure.management.compute.VirtualMachineDataDisk)6 NetworkInterface (com.microsoft.azure.management.network.NetworkInterface)6 StorageAccount (com.microsoft.azure.management.storage.StorageAccount)6 VirtualMachineScaleSet (com.microsoft.azure.management.compute.VirtualMachineScaleSet)4 LoadBalancer (com.microsoft.azure.management.network.LoadBalancer)4 Indexable (com.microsoft.azure.management.resources.fluentcore.model.Indexable)4 StopWatch (org.apache.commons.lang3.time.StopWatch)4 JSchException (com.jcraft.jsch.JSchException)3 VirtualMachineCustomImage (com.microsoft.azure.management.compute.VirtualMachineCustomImage)3 TrafficManagerProfile (com.microsoft.azure.management.trafficmanager.TrafficManagerProfile)3