com.microsoft.azure.management.Azure.resourceGroups()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(246)

本文整理了Java中com.microsoft.azure.management.Azure.resourceGroups()方法的一些代码示例,展示了Azure.resourceGroups()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Azure.resourceGroups()方法的具体详情如下:
包路径:com.microsoft.azure.management.Azure
类名称:Azure
方法名:resourceGroups

Azure.resourceGroups介绍

暂无

代码示例

代码示例来源:origin: Microsoft/spring-cloud-azure

@Override
public ResourceGroup internalGet(String key) {
  return azure.resourceGroups().getByName(key);
}

代码示例来源:origin: Microsoft/azure-tools-for-java

public static boolean canCreateNewResGrp(Azure azure, String resGrpName) {
    return (!azure.resourceGroups().checkExistence(resGrpName));
  }
}

代码示例来源:origin: Microsoft/azure-tools-for-java

public static List<String> getResourceGroups(Azure azureClient) {
 List<String> result = new ArrayList<>();
 if (azureClient != null) {
  for (ResourceGroup resourceGroup : azureClient.resourceGroups().list()) {
   result.add(resourceGroup.name());
  }
 }
 return result;
}

代码示例来源:origin: Microsoft/azure-maven-plugins

protected boolean isResourceGroupExist(final String resourceGroup) throws Exception {
  return getAzureClient().resourceGroups().contain(resourceGroup);
}

代码示例来源:origin: Microsoft/azure-tools-for-java

/**
 * List Resource Group by Subscription ID.
 *
 * @param sid subscription Id
 * @return List of ResourceGroup instances
 */
public List<ResourceGroup> getResourceGroupsBySubscriptionId(String sid) {
  List<ResourceGroup> ret = new ArrayList<>();
  try {
    Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
    ret.addAll(azure.resourceGroups().list());
  } catch (IOException e) {
    e.printStackTrace();
  }
  return ret;
}

代码示例来源:origin: Microsoft/azure-tools-for-java

/**
 * Get Resource Group by Subscription ID and Resource Group name.
 */
public ResourceGroup getResourceGroupBySubscriptionIdAndName(String sid, String name) throws Exception {
  ResourceGroup resourceGroup;
  Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
  try {
    resourceGroup = azure.resourceGroups().getByName(name);
    if (resourceGroup == null) {
      throw new Exception(CANNOT_GET_RESOURCE_GROUP);
    }
  } catch (Exception e) {
    throw new Exception(CANNOT_GET_RESOURCE_GROUP);
  }
  return resourceGroup;
}

代码示例来源:origin: gradle.plugin.com.intershop.gradle.plugin.azure/azurePlugin

@TaskAction
  public void deleteResourceGroup()
  {
    String rgName = resourceGroupName.get();

    if (getClient().resourceGroups().contain(rgName))
    {
      getClient().resourceGroups().deleteByName(rgName);

      getLogger().info("ResourceGroup " + rgName + " deleted");
    }
  }
}

代码示例来源:origin: Microsoft/azure-tools-for-java

@SuppressWarnings("unused")
private static void printResourceGroups(AzureManager manager) throws Exception {
  Set<String> sidList = manager.getSubscriptionManager().getAccountSidList();
  for (String sid: sidList) {
    Azure azure = manager.getAzure(sid);
    System.out.println("==> Resource groups / " + sid);
    ResourceGroups rgs = azure.resourceGroups();
    for (ResourceGroup rg : rgs.list()) {
      System.out.println("    " + rg.name());
    }
  }
}

代码示例来源:origin: Microsoft/azure-tools-for-java

public static Map<String, Pair<Vault, KeyVaultClient>> refreshDockerVaults(List<AzureDockerSubscription> azureDockerSubscriptions) {
 Map<String, Pair<Vault, KeyVaultClient>> vaults = new HashMap<>();
 if (DEBUG) System.out.format("\tGet AzureDockerHostsManage Docker key vault: %s\n", new Date().toString());
 try {
  for (AzureDockerSubscription dockerSubscription : azureDockerSubscriptions) {
   // TODO
   for (ResourceGroup group : dockerSubscription.azureClient.resourceGroups().list()) {
    for (Vault vault : dockerSubscription.azureClient.vaults().listByResourceGroup(group.name())) {
     if (DEBUG) System.out.format("\tGet AzureDockerHostsManage Docker vault: %s at %s\n", vault.name(), new Date().toString());
     if (vault.tags().get("dockerhost") != null) {
      if (DEBUG) System.out.format("\t\t...adding Docker vault: %s at %s\n", vault.name(), new Date().toString());
      vaults.put(vault.name(), new Pair<>(vault, dockerSubscription.keyVaultClient));
     }
    }
   }
  }
 } catch (Exception e) {
  e.printStackTrace();
  DefaultLoader.getUIHelper().showError(e.getMessage(), "Error loading key vaults");
 }
 return vaults;
}

代码示例来源:origin: Microsoft/spring-cloud-azure

@Override
  public ResourceGroup internalCreate(String key) {
    return azure.resourceGroups().define(key).withRegion(azureProperties.getRegion()).create();
  }
}

代码示例来源:origin: jenkinsci/azure-vm-agents-plugin

/**
 * Create Azure resource Group.
 *
 * @param azureClient
 * @param locationName
 * @param resourceGroupName
 */
private void createAzureResourceGroup(
    Azure azureClient, String locationName, String resourceGroupName) throws AzureCloudException {
  try {
    azureClient.resourceGroups()
        .define(resourceGroupName)
        .withRegion(locationName)
        .create();
  } catch (Exception e) {
    throw AzureCloudException.create(
        String.format(
            " Failed to create resource group with group name %s, location %s",
            resourceGroupName, locationName),
        e);
  }
}

代码示例来源:origin: jenkinsci/azure-vm-agents-plugin

public ListBoxModel doFillExistingResourceGroupNameItems(@QueryParameter String azureCredentialsId)
      throws IOException, ServletException {
    ListBoxModel model = new ListBoxModel();
    model.add("--- Select Resource Group ---", "");
    if (StringUtils.isBlank(azureCredentialsId)) {
      return model;
    }
    try {
      final Azure azureClient = AzureClientHolder.get(azureCredentialsId);
      for (ResourceGroup resourceGroup : azureClient.resourceGroups().list()) {
        model.add(resourceGroup.name());
      }
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Cannot list resource group name: ", e);
    } finally {
      return model;
    }
  }
}

代码示例来源:origin: gradle.plugin.com.intershop.gradle.plugin.azure/azurePlugin

Region rgRegion = resourceGroupRegion.get();
ResourceGroup rg = getClient().resourceGroups().getByName(rgName);
rg = getClient().resourceGroups()
        .define(rgName)
        .withRegion(rgRegion)

代码示例来源:origin: Microsoft/azure-tools-for-java

Azure azure = azureAuthenticated.withDefaultSubscription();
fileReporter.report("Checking: resourceGroups().list()...");
azure.resourceGroups().list();
fileReporter.report("Done.");
break;

代码示例来源:origin: Microsoft/azure-maven-plugins

public static WithCreate defineWindowsApp(final String resourceGroup,
                     final String appName,
                     final Azure azureClient, final AppServicePlan plan) throws Exception {
  assureWindowsPlan(plan);
  final ExistingWindowsPlanWithGroup existingWindowsPlanWithGroup = azureClient.webApps()
    .define(appName).withExistingWindowsPlan(plan);
  return azureClient.resourceGroups().contain(resourceGroup) ?
    existingWindowsPlanWithGroup.withExistingResourceGroup(resourceGroup) :
    existingWindowsPlanWithGroup.withNewResourceGroup(resourceGroup);
}

代码示例来源:origin: Microsoft/azure-maven-plugins

= azure.resourceGroups().contain(servicePlanResGrp) ?
withGroup.withExistingResourceGroup(servicePlanResGrp) :
withGroup.withNewResourceGroup(servicePlanResGrp);

代码示例来源:origin: Microsoft/azure-maven-plugins

public static WithDockerContainerImage defineLinuxApp(final String resourceGroup,
                           final String appName,
                           final Azure azureClient,
                           final AppServicePlan plan) throws Exception {
  assureLinuxPlan(plan);
  final ExistingLinuxPlanWithGroup existingLinuxPlanWithGroup = azureClient.webApps()
    .define(appName).withExistingLinuxPlan(plan);
  return azureClient.resourceGroups().contain(resourceGroup) ?
    existingLinuxPlanWithGroup.withExistingResourceGroup(resourceGroup) :
    existingLinuxPlanWithGroup.withNewResourceGroup(resourceGroup);
}

代码示例来源:origin: Microsoft/azure-tools-for-java

List<ResourceGroup> rgList = azure.resourceGroups().list();
srgMap.put(sd, rgList);
updateResGrDependency(azure, rgList, progressIndicator, rgwaMap, rgspMap);

代码示例来源:origin: Microsoft/azure-tools-for-java

Azure azure = azureManager.getAzure(sd.getSubscriptionId());
List<ResourceGroup> rgList = azure.resourceGroups().list();
sdrgMap.put(sd, rgList);

代码示例来源:origin: Microsoft/azure-tools-for-java

ResourceGroup resourceGroup = azureClient.resourceGroups()
  .define(newHost.hostVM.resourceGroupName)
  .withRegion(newHost.hostVM.region)

相关文章