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

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

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

Azure.storageAccounts介绍

暂无

代码示例

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

  1. @Override
  2. public String call() throws Exception {
  3. azureClient.storageAccounts().getByResourceGroup(resourceGroupName, "CI_SYSTEM");
  4. return Constants.OP_SUCCESS;
  5. }
  6. };

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

  1. protected StorageAccount findStorageAccount(String storageId)
  2. {
  3. Azure client;
  4. if(storageId.startsWith("/subscriptions/")) {
  5. client = getClient(storageId.split("/")[2]);
  6. } else {
  7. client = getClient();
  8. }
  9. StorageAccount sAccount = client.storageAccounts().getById(storageId);
  10. if (sAccount == null) {
  11. throw new GradleException("invalid storageId or storage not found: " + storageId);
  12. }
  13. return sAccount;
  14. }

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

  1. public static boolean checkStorageNameAvailability(Azure azureClient, String name) {
  2. if (azureClient != null) {
  3. return azureClient.storageAccounts().checkNameAvailability(name).isAvailable();
  4. } else {
  5. return false;
  6. }
  7. }

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

  1. @Override
  2. public StorageAccount internalGet(String key) {
  3. return azure.storageAccounts().getByResourceGroup(azureProperties.getResourceGroup(), key);
  4. }

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

  1. /**
  2. * Get StorageAccount by resourceGroup name and storageAccount name.
  3. *
  4. * @param azureClient
  5. * @param targetStorageAccount
  6. * @param resourceGroupName
  7. * @return StorageAccount object
  8. */
  9. private StorageAccount getStorageAccount(
  10. Azure azureClient, String targetStorageAccount, String resourceGroupName)
  11. throws AzureCloudException {
  12. try {
  13. return azureClient.storageAccounts().getByResourceGroup(resourceGroupName, targetStorageAccount);
  14. } catch (Exception e) {
  15. throw AzureCloudException.create(e);
  16. }
  17. }

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

  1. public static List<String> getAvailableStorageAccounts(Azure azureClient, String vmImageSizeType) {
  2. List<String> result = new ArrayList<>();
  3. if (azureClient != null) {
  4. for (StorageAccount storageAccount : azureClient.storageAccounts().list()) {
  5. if (vmImageSizeType != null) {
  6. if (storageAccount.sku().name().name().toLowerCase().equals(vmImageSizeType.toLowerCase())) {
  7. result.add(storageAccount.name());
  8. }
  9. } else {
  10. result.add(storageAccount.name());
  11. }
  12. }
  13. }
  14. return result;
  15. }

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

  1. public CloudBlobContainer getCloudBlobContainer(
  2. Azure azureClient, String resourceGroupName, String targetStorageAccount, String blobContainerName)
  3. throws AzureCloudException {
  4. StorageAccount storageAccount = null;
  5. try {
  6. storageAccount = azureClient.storageAccounts()
  7. .getByResourceGroup(resourceGroupName, targetStorageAccount);
  8. } catch (Exception e) {
  9. throw AzureCloudException.create(e);
  10. }
  11. CloudStorageAccount account = getCloudStorageAccount(storageAccount);
  12. return getCloudBlobContainer(account, blobContainerName);
  13. }

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

  1. public static List<AzureDockerStorageAccount> getStorageAccounts(Azure azureClient) {
  2. List<AzureDockerStorageAccount> result = new ArrayList<>();
  3. if (azureClient != null) {
  4. for (StorageAccount storageAccount : azureClient.storageAccounts().list()) {
  5. AzureDockerStorageAccount dockerStorageAccount = new AzureDockerStorageAccount();
  6. dockerStorageAccount.name = storageAccount.name();
  7. dockerStorageAccount.region = storageAccount.regionName();
  8. dockerStorageAccount.resourceGroup = storageAccount.resourceGroupName();
  9. dockerStorageAccount.sid = azureClient.subscriptionId();
  10. dockerStorageAccount.skuType = storageAccount.sku().name().name();
  11. result.add(dockerStorageAccount);
  12. }
  13. }
  14. return result;
  15. }

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

  1. resourceGroupReferenceType, newResourceGroupName, existingResourceGroupName);
  2. List<StorageAccount> storageAccountList =
  3. azureClient.storageAccounts().listByResourceGroup(resourceGroupName);
  4. for (StorageAccount storageAccount : storageAccountList) {
  5. if (storageAccount.sku().name().toString().equalsIgnoreCase(storageAccountType)) {

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

  1. if (azureClient.storageAccounts().getByResourceGroup(resourceGroupName, targetStorageAccount) == null) {
  2. azureClient.storageAccounts().define(targetStorageAccount)
  3. .withRegion(location)
  4. .withExistingResourceGroup(resourceGroupName)

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

  1. @Override
  2. public StorageAccount internalCreate(String key) {
  3. return azure.storageAccounts().define(key).withRegion(azureProperties.getRegion())
  4. .withExistingResourceGroup(azureProperties.getResourceGroup()).create();
  5. }
  6. }

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

  1. try {
  2. Azure azure = azureManager.getAzure(sid);
  3. List<com.microsoft.azure.management.storage.StorageAccount> storageAccounts = azure.storageAccounts().list();
  4. for (StorageAccount sm : storageAccounts) {
  5. addChildNode(new StorageNode(this, sid, sm));

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

  1. azureClient.storageAccounts().checkNameAvailability(storageAccountName);
  2. isAvailable = checkResult.isAvailable();
  3. if (!isAvailable && Reason.ACCOUNT_NAME_INVALID.equals(checkResult.reason())) {
  4. azureClient.storageAccounts().getByResourceGroup(resourceGroupName, storageAccountName);
  5. if (null == checkAccount) {
  6. return Messages.Azure_GC_Template_SA_Already_Exists();

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

  1. putVariable(tmp, "startupScriptName", scriptName);
  2. List<StorageAccountKey> storageKeys = azureClient.storageAccounts()
  3. .getByResourceGroup(template.getResourceGroupName(), storageAccountName)
  4. .getKeys();

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

  1. @Override
  2. protected void azureNodeAction(NodeActionEvent e)
  3. throws AzureCmdException {
  4. try {
  5. AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
  6. // not signed in
  7. if (azureManager == null) {
  8. return;
  9. }
  10. Azure azure = azureManager.getAzure(subscriptionId);
  11. azure.storageAccounts().deleteByResourceGroup(storageAccount.resourceGroupName(), storageAccount.name());
  12. DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
  13. @Override
  14. public void run() {
  15. // instruct parent node to remove this node
  16. getParent().removeDirectChildNode(StorageNode.this);
  17. }
  18. });
  19. } catch (Exception ex) {
  20. DefaultLoader.getUIHelper().showException("An error occurred while attempting to delete storage account.", ex,
  21. "MS Services - Error Deleting Storage Account", false, true);
  22. }
  23. }

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

  1. if (newHost.hostVM.storageAccountName.contains("@")) {
  2. for (StorageAccount item : azureClient.storageAccounts().list()) {
  3. String storageAccountName = item.name() + "@";
  4. if (storageAccountName.equals(newHost.hostVM.storageAccountName)) {

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

  1. public static StorageAccount createStorageAccount(String subscriptionId, String name, String region, boolean newResourceGroup, String resourceGroup,
  2. Kind kind, AccessTier accessTier, boolean enableEncription, String skuName) throws Exception {
  3. AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
  4. Azure azure = azureManager.getAzure(subscriptionId);
  5. StorageAccount.DefinitionStages.WithGroup newStorageAccountBlank = azure.storageAccounts().define(name).withRegion(region);
  6. StorageAccount.DefinitionStages.WithCreate newStorageAccountWithGroup;
  7. if (newResourceGroup) {
  8. newStorageAccountWithGroup = newStorageAccountBlank.withNewResourceGroup(resourceGroup);
  9. } else {
  10. newStorageAccountWithGroup = newStorageAccountBlank.withExistingResourceGroup(resourceGroup);
  11. }
  12. switch (kind) {
  13. case STORAGE:
  14. newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKind();
  15. break;
  16. case STORAGE_V2:
  17. newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKindV2();
  18. break;
  19. case BLOB_STORAGE:
  20. newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobStorageAccountKind().withAccessTier(accessTier);
  21. break;
  22. default:
  23. throw new Exception("Unknown Storage Account Kind:" + kind.toString());
  24. }
  25. if (enableEncription) {
  26. newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobEncryption();
  27. }
  28. return newStorageAccountWithGroup.withSku(StorageAccountSkuType.fromSkuName(SkuName.fromString(skuName))).create();
  29. }

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

  1. StorageAccount.DefinitionStages.WithGroup withGroupAccount = azure.storageAccounts().define(newStorageAccount.getName()).withRegion(newStorageAccount.getLocation());
  2. if (newStorageAccount.isNewResourceGroup()) {
  3. newAccount = withGroupAccount.withNewResourceGroup(newStorageAccount.getResourceGroupName());

相关文章