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

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

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

Azure.webApps介绍

暂无

代码示例

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

/**
 * get the web app by ID.
 */
public WebApp getWebAppById(String sid, String id) throws Exception {
  Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
  WebApp app = azure.webApps().getById(id);
  if (app == null) {
    throw new Exception(CANNOT_GET_WEB_APP_WITH_ID + id); // TODO: specify the type of exception.
  }
  return app;
}

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

public void deleteWebApp(String sid, String appId) throws IOException {
  AuthMethodManager.getInstance().getAzureClient(sid).webApps().deleteById(appId);
  subscriptionIdToWebApps.remove(sid);
}

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

/**
 * List all web apps by subscription id.
 */
@NotNull
public List<ResourceEx<WebApp>> listWebApps(final String subscriptionId, final boolean force) {
  if (!force && subscriptionIdToWebApps.get(subscriptionId) != null) {
    return subscriptionIdToWebApps.get(subscriptionId);
  }
  List<ResourceEx<WebApp>> webApps = new ArrayList<>();
  try {
    final Azure azure = AuthMethodManager.getInstance().getAzureClient(subscriptionId);
    webApps = azure.webApps().list()
      .stream()
      .map(app -> new ResourceEx<WebApp>(app, subscriptionId))
      .collect(Collectors.toList());
    subscriptionIdToWebApps.put(subscriptionId, webApps);
  } catch (IOException e) {
    e.printStackTrace();
  }
  return webApps;
}

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

/**
 * Get all the deployment slots of a web app by the subscription id and web app id.
 */
public List<DeploymentSlot> getDeploymentSlots(final String subscriptionId, final String appId) throws IOException {
  final List<DeploymentSlot> deploymentSlots = new ArrayList<>();
  final WebApp webApp = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId);
  deploymentSlots.addAll(webApp.deploymentSlots().list());
  return deploymentSlots;
}

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

public WebApp getWebApp() throws AzureAuthFailureException {
  try {
    return getAzureClient().webApps().getByResourceGroup(getResourceGroup(), getAppName());
  } catch (AzureAuthFailureException authEx) {
    throw authEx;
  } catch (Exception ex) {
    // Swallow exception for non-existing web app
  }
  return null;
}

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

public void restartWebApp(String sid, String appid) throws IOException {
  AuthMethodManager.getInstance().getAzureClient(sid).webApps().getById(appid).restart();
}

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

public void startWebApp(String sid, String appid) throws IOException {
  AuthMethodManager.getInstance().getAzureClient(sid).webApps().getById(appid).start();
}

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

public void stopWebApp(String sid, String appid) throws IOException {
  AuthMethodManager.getInstance().getAzureClient(sid).webApps().getById(appid).stop();
}

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

public void deleteDeploymentSlotNode(final String subscriptionId, final String appId,
                   final String slotName) throws IOException {
  final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId);
  app.deploymentSlots().deleteByName(slotName);
}

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

public void restartDeploymentSlot(final String subscriptionId, final String appId,
                 final String slotName) throws IOException {
  final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId);
  app.deploymentSlots().getByName(slotName).restart();
}

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

public void startDeploymentSlot(final String subscriptionId, final String appId,
                final String slotName) throws IOException {
  final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId);
  app.deploymentSlots().getByName(slotName).start();
}

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

public void stopDeploymentSlot(final String subscriptionId, final String appId,
                final String slotName) throws IOException {
  final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId);
  app.deploymentSlots().getByName(slotName).stop();
}

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

public void swapSlotWithProduction(final String subscriptionId, final String appId,
                  final String slotName) throws IOException {
  final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId);
  final DeploymentSlot slot = app.deploymentSlots().getByName(slotName);
  slot.swap("production");
}

代码示例来源: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

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

public static void deleteAppService(WebAppDetails webAppDetails) throws IOException {
  AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
  Azure azure = azureManager.getAzure(webAppDetails.subscriptionDetail.getSubscriptionId());
  azure.webApps().deleteById(webAppDetails.webApp.id());
  // check asp still exists
  AppServicePlan asp = azure.appServices().appServicePlans().getById(webAppDetails.appServicePlan.id());
  System.out.println("asp is " + (asp == null ? "null -> removing form cache" : asp.name()));
  // update cache
  AzureModelController.removeWebAppFromResourceGroup(webAppDetails.resourceGroup, webAppDetails.webApp);
  if (asp == null) {
    AzureModelController.removeAppServicePlanFromResourceGroup(webAppDetails.appServicePlanResourceGroup, webAppDetails.appServicePlan);
  }
}

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

private WebApp.DefinitionStages.WithNewAppServicePlan prepareServicePlan(
  @NotNull Azure azure, @NotNull WebAppSettingModel model) {
  final WebApp.DefinitionStages.NewAppServicePlanWithGroup appWithGroup = azure
    .webApps()
    .define(model.getWebAppName())
    .withRegion(model.getRegion());
  final String resourceGroup = model.getResourceGroup();
  if (model.isCreatingResGrp()) {
    return appWithGroup.withNewResourceGroup(resourceGroup);
  }
  return appWithGroup.withExistingResourceGroup(resourceGroup);
}

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

private WebApp.DefinitionStages.WithDockerContainerImage withExistingLinuxServicePlan(
  @NotNull Azure azure, @NotNull WebAppSettingModel model) {
  AppServicePlan servicePlan = azure.appServices().appServicePlans().getById(model.getAppServicePlanId());
  WebApp.DefinitionStages.ExistingLinuxPlanWithGroup withGroup = azure
    .webApps()
    .define(model.getWebAppName())
    .withExistingLinuxPlan(servicePlan);
  if (model.isCreatingResGrp()) {
    return withGroup.withNewResourceGroup(model.getResourceGroup());
  }
  return withGroup.withExistingResourceGroup(model.getResourceGroup());
}

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

private WebApp.DefinitionStages.WithCreate withExistingWindowsServicePlan(
    @NotNull Azure azure, @NotNull WebAppSettingModel model) {
  AppServicePlan servicePlan = azure.appServices().appServicePlans().getById(model.getAppServicePlanId());
  WebApp.DefinitionStages.ExistingWindowsPlanWithGroup withGroup = azure
    .webApps()
    .define(model.getWebAppName())
    .withExistingWindowsPlan(servicePlan);
  if (model.isCreatingResGrp()) {
    return withGroup.withNewResourceGroup(model.getResourceGroup());
  }
  return withGroup.withExistingResourceGroup(model.getResourceGroup());
}

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

PricingTier pricingTier = new PricingTier(model.getPricingSkuTier(), model.getPricingSkuSize());
WebApp.DefinitionStages.Blank webAppDefinition = azure.webApps().define(model.getWebAppName());
if (model.isCreatingNewAppServicePlan()) {

相关文章