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

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

本文整理了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

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

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

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

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

  1. public static List<String> getResourceGroups(Azure azureClient) {
  2. List<String> result = new ArrayList<>();
  3. if (azureClient != null) {
  4. for (ResourceGroup resourceGroup : azureClient.resourceGroups().list()) {
  5. result.add(resourceGroup.name());
  6. }
  7. }
  8. return result;
  9. }

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

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

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

  1. /**
  2. * List Resource Group by Subscription ID.
  3. *
  4. * @param sid subscription Id
  5. * @return List of ResourceGroup instances
  6. */
  7. public List<ResourceGroup> getResourceGroupsBySubscriptionId(String sid) {
  8. List<ResourceGroup> ret = new ArrayList<>();
  9. try {
  10. Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
  11. ret.addAll(azure.resourceGroups().list());
  12. } catch (IOException e) {
  13. e.printStackTrace();
  14. }
  15. return ret;
  16. }

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

  1. /**
  2. * Get Resource Group by Subscription ID and Resource Group name.
  3. */
  4. public ResourceGroup getResourceGroupBySubscriptionIdAndName(String sid, String name) throws Exception {
  5. ResourceGroup resourceGroup;
  6. Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
  7. try {
  8. resourceGroup = azure.resourceGroups().getByName(name);
  9. if (resourceGroup == null) {
  10. throw new Exception(CANNOT_GET_RESOURCE_GROUP);
  11. }
  12. } catch (Exception e) {
  13. throw new Exception(CANNOT_GET_RESOURCE_GROUP);
  14. }
  15. return resourceGroup;
  16. }

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

  1. @TaskAction
  2. public void deleteResourceGroup()
  3. {
  4. String rgName = resourceGroupName.get();
  5. if (getClient().resourceGroups().contain(rgName))
  6. {
  7. getClient().resourceGroups().deleteByName(rgName);
  8. getLogger().info("ResourceGroup " + rgName + " deleted");
  9. }
  10. }
  11. }

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

  1. @SuppressWarnings("unused")
  2. private static void printResourceGroups(AzureManager manager) throws Exception {
  3. Set<String> sidList = manager.getSubscriptionManager().getAccountSidList();
  4. for (String sid: sidList) {
  5. Azure azure = manager.getAzure(sid);
  6. System.out.println("==> Resource groups / " + sid);
  7. ResourceGroups rgs = azure.resourceGroups();
  8. for (ResourceGroup rg : rgs.list()) {
  9. System.out.println(" " + rg.name());
  10. }
  11. }
  12. }

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

  1. public static Map<String, Pair<Vault, KeyVaultClient>> refreshDockerVaults(List<AzureDockerSubscription> azureDockerSubscriptions) {
  2. Map<String, Pair<Vault, KeyVaultClient>> vaults = new HashMap<>();
  3. if (DEBUG) System.out.format("\tGet AzureDockerHostsManage Docker key vault: %s\n", new Date().toString());
  4. try {
  5. for (AzureDockerSubscription dockerSubscription : azureDockerSubscriptions) {
  6. // TODO
  7. for (ResourceGroup group : dockerSubscription.azureClient.resourceGroups().list()) {
  8. for (Vault vault : dockerSubscription.azureClient.vaults().listByResourceGroup(group.name())) {
  9. if (DEBUG) System.out.format("\tGet AzureDockerHostsManage Docker vault: %s at %s\n", vault.name(), new Date().toString());
  10. if (vault.tags().get("dockerhost") != null) {
  11. if (DEBUG) System.out.format("\t\t...adding Docker vault: %s at %s\n", vault.name(), new Date().toString());
  12. vaults.put(vault.name(), new Pair<>(vault, dockerSubscription.keyVaultClient));
  13. }
  14. }
  15. }
  16. }
  17. } catch (Exception e) {
  18. e.printStackTrace();
  19. DefaultLoader.getUIHelper().showError(e.getMessage(), "Error loading key vaults");
  20. }
  21. return vaults;
  22. }

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

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

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

  1. /**
  2. * Create Azure resource Group.
  3. *
  4. * @param azureClient
  5. * @param locationName
  6. * @param resourceGroupName
  7. */
  8. private void createAzureResourceGroup(
  9. Azure azureClient, String locationName, String resourceGroupName) throws AzureCloudException {
  10. try {
  11. azureClient.resourceGroups()
  12. .define(resourceGroupName)
  13. .withRegion(locationName)
  14. .create();
  15. } catch (Exception e) {
  16. throw AzureCloudException.create(
  17. String.format(
  18. " Failed to create resource group with group name %s, location %s",
  19. resourceGroupName, locationName),
  20. e);
  21. }
  22. }

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

  1. public ListBoxModel doFillExistingResourceGroupNameItems(@QueryParameter String azureCredentialsId)
  2. throws IOException, ServletException {
  3. ListBoxModel model = new ListBoxModel();
  4. model.add("--- Select Resource Group ---", "");
  5. if (StringUtils.isBlank(azureCredentialsId)) {
  6. return model;
  7. }
  8. try {
  9. final Azure azureClient = AzureClientHolder.get(azureCredentialsId);
  10. for (ResourceGroup resourceGroup : azureClient.resourceGroups().list()) {
  11. model.add(resourceGroup.name());
  12. }
  13. } catch (Exception e) {
  14. LOGGER.log(Level.WARNING, "Cannot list resource group name: ", e);
  15. } finally {
  16. return model;
  17. }
  18. }
  19. }

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

  1. Region rgRegion = resourceGroupRegion.get();
  2. ResourceGroup rg = getClient().resourceGroups().getByName(rgName);
  3. rg = getClient().resourceGroups()
  4. .define(rgName)
  5. .withRegion(rgRegion)

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

  1. Azure azure = azureAuthenticated.withDefaultSubscription();
  2. fileReporter.report("Checking: resourceGroups().list()...");
  3. azure.resourceGroups().list();
  4. fileReporter.report("Done.");
  5. break;

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

  1. public static WithCreate defineWindowsApp(final String resourceGroup,
  2. final String appName,
  3. final Azure azureClient, final AppServicePlan plan) throws Exception {
  4. assureWindowsPlan(plan);
  5. final ExistingWindowsPlanWithGroup existingWindowsPlanWithGroup = azureClient.webApps()
  6. .define(appName).withExistingWindowsPlan(plan);
  7. return azureClient.resourceGroups().contain(resourceGroup) ?
  8. existingWindowsPlanWithGroup.withExistingResourceGroup(resourceGroup) :
  9. existingWindowsPlanWithGroup.withNewResourceGroup(resourceGroup);
  10. }

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

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

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

  1. public static WithDockerContainerImage defineLinuxApp(final String resourceGroup,
  2. final String appName,
  3. final Azure azureClient,
  4. final AppServicePlan plan) throws Exception {
  5. assureLinuxPlan(plan);
  6. final ExistingLinuxPlanWithGroup existingLinuxPlanWithGroup = azureClient.webApps()
  7. .define(appName).withExistingLinuxPlan(plan);
  8. return azureClient.resourceGroups().contain(resourceGroup) ?
  9. existingLinuxPlanWithGroup.withExistingResourceGroup(resourceGroup) :
  10. existingLinuxPlanWithGroup.withNewResourceGroup(resourceGroup);
  11. }

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

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

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

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

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

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

相关文章