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

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

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

@Override
  public String call() throws Exception {
    azureClient.storageAccounts().getByResourceGroup(resourceGroupName, "CI_SYSTEM");
    return Constants.OP_SUCCESS;
  }
};

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

protected StorageAccount findStorageAccount(String storageId)
{
  Azure client;
  if(storageId.startsWith("/subscriptions/")) {
    client = getClient(storageId.split("/")[2]);
  } else {
    client = getClient();
  }
  StorageAccount sAccount = client.storageAccounts().getById(storageId);
  if (sAccount == null) {
    throw new GradleException("invalid storageId or storage not found: " + storageId);
  }
  return sAccount;
}

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

public static boolean checkStorageNameAvailability(Azure azureClient, String name) {
 if (azureClient != null) {
  return azureClient.storageAccounts().checkNameAvailability(name).isAvailable();
 } else {
  return false;
 }
}

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

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

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

/**
 * Get StorageAccount by resourceGroup name and storageAccount name.
 *
 * @param azureClient
 * @param targetStorageAccount
 * @param resourceGroupName
 * @return StorageAccount object
 */
private StorageAccount getStorageAccount(
    Azure azureClient, String targetStorageAccount, String resourceGroupName)
    throws AzureCloudException {
  try {
    return azureClient.storageAccounts().getByResourceGroup(resourceGroupName, targetStorageAccount);
  } catch (Exception e) {
    throw AzureCloudException.create(e);
  }
}

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

public static List<String> getAvailableStorageAccounts(Azure azureClient, String vmImageSizeType) {
 List<String> result = new ArrayList<>();
 if (azureClient != null) {
  for (StorageAccount storageAccount : azureClient.storageAccounts().list()) {
   if (vmImageSizeType != null) {
    if (storageAccount.sku().name().name().toLowerCase().equals(vmImageSizeType.toLowerCase())) {
     result.add(storageAccount.name());
    }
   } else {
    result.add(storageAccount.name());
   }
  }
 }
 return result;
}

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

public CloudBlobContainer getCloudBlobContainer(
    Azure azureClient, String resourceGroupName, String targetStorageAccount, String blobContainerName)
    throws AzureCloudException {
  StorageAccount storageAccount = null;
  try {
    storageAccount = azureClient.storageAccounts()
        .getByResourceGroup(resourceGroupName, targetStorageAccount);
  } catch (Exception e) {
    throw AzureCloudException.create(e);
  }
  CloudStorageAccount account = getCloudStorageAccount(storageAccount);
  return getCloudBlobContainer(account, blobContainerName);
}

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

public static List<AzureDockerStorageAccount> getStorageAccounts(Azure azureClient) {
 List<AzureDockerStorageAccount> result = new ArrayList<>();
 if (azureClient != null) {
  for (StorageAccount storageAccount : azureClient.storageAccounts().list()) {
   AzureDockerStorageAccount dockerStorageAccount = new AzureDockerStorageAccount();
   dockerStorageAccount.name = storageAccount.name();
   dockerStorageAccount.region = storageAccount.regionName();
   dockerStorageAccount.resourceGroup = storageAccount.resourceGroupName();
   dockerStorageAccount.sid = azureClient.subscriptionId();
   dockerStorageAccount.skuType = storageAccount.sku().name().name();
   result.add(dockerStorageAccount);
  }
 }
 return result;
}

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

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

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

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

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

@Override
  public StorageAccount internalCreate(String key) {
    return azure.storageAccounts().define(key).withRegion(azureProperties.getRegion())
          .withExistingResourceGroup(azureProperties.getResourceGroup()).create();
  }
}

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

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

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

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

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

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

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

@Override
protected void azureNodeAction(NodeActionEvent e)
    throws AzureCmdException {
  try {
    AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
    // not signed in
    if (azureManager == null) {
      return;
    }
    Azure azure = azureManager.getAzure(subscriptionId);
    azure.storageAccounts().deleteByResourceGroup(storageAccount.resourceGroupName(), storageAccount.name());
    DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
      @Override
      public void run() {
        // instruct parent node to remove this node
        getParent().removeDirectChildNode(StorageNode.this);
      }
    });
  } catch (Exception ex) {
    DefaultLoader.getUIHelper().showException("An error occurred while attempting to delete storage account.", ex,
        "MS Services - Error Deleting Storage Account", false, true);
  }
}

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

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

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

public static StorageAccount createStorageAccount(String subscriptionId, String name, String region, boolean newResourceGroup, String resourceGroup,
                         Kind kind, AccessTier accessTier, boolean enableEncription, String skuName) throws Exception {
  AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
  Azure azure = azureManager.getAzure(subscriptionId);
  StorageAccount.DefinitionStages.WithGroup newStorageAccountBlank = azure.storageAccounts().define(name).withRegion(region);
  StorageAccount.DefinitionStages.WithCreate newStorageAccountWithGroup;
  if (newResourceGroup) {
    newStorageAccountWithGroup = newStorageAccountBlank.withNewResourceGroup(resourceGroup);
  } else {
    newStorageAccountWithGroup = newStorageAccountBlank.withExistingResourceGroup(resourceGroup);
  }
  switch (kind) {
    case STORAGE:
        newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKind();
        break;
    case STORAGE_V2:
        newStorageAccountWithGroup = newStorageAccountWithGroup.withGeneralPurposeAccountKindV2();
        break;
    case BLOB_STORAGE:
        newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobStorageAccountKind().withAccessTier(accessTier);
        break;
    default:
        throw new Exception("Unknown Storage Account Kind:" + kind.toString());
  }
  if (enableEncription) {
    newStorageAccountWithGroup = newStorageAccountWithGroup.withBlobEncryption();
  }
  return newStorageAccountWithGroup.withSku(StorageAccountSkuType.fromSkuName(SkuName.fromString(skuName))).create();
}

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

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

相关文章