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

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

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

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

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

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

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

  1. /**
  2. * List all web apps by subscription id.
  3. */
  4. @NotNull
  5. public List<ResourceEx<WebApp>> listWebApps(final String subscriptionId, final boolean force) {
  6. if (!force && subscriptionIdToWebApps.get(subscriptionId) != null) {
  7. return subscriptionIdToWebApps.get(subscriptionId);
  8. }
  9. List<ResourceEx<WebApp>> webApps = new ArrayList<>();
  10. try {
  11. final Azure azure = AuthMethodManager.getInstance().getAzureClient(subscriptionId);
  12. webApps = azure.webApps().list()
  13. .stream()
  14. .map(app -> new ResourceEx<WebApp>(app, subscriptionId))
  15. .collect(Collectors.toList());
  16. subscriptionIdToWebApps.put(subscriptionId, webApps);
  17. } catch (IOException e) {
  18. e.printStackTrace();
  19. }
  20. return webApps;
  21. }

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

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

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

  1. public WebApp getWebApp() throws AzureAuthFailureException {
  2. try {
  3. return getAzureClient().webApps().getByResourceGroup(getResourceGroup(), getAppName());
  4. } catch (AzureAuthFailureException authEx) {
  5. throw authEx;
  6. } catch (Exception ex) {
  7. // Swallow exception for non-existing web app
  8. }
  9. return null;
  10. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

代码示例来源: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. 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. public static void deleteAppService(WebAppDetails webAppDetails) throws IOException {
  2. AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
  3. Azure azure = azureManager.getAzure(webAppDetails.subscriptionDetail.getSubscriptionId());
  4. azure.webApps().deleteById(webAppDetails.webApp.id());
  5. // check asp still exists
  6. AppServicePlan asp = azure.appServices().appServicePlans().getById(webAppDetails.appServicePlan.id());
  7. System.out.println("asp is " + (asp == null ? "null -> removing form cache" : asp.name()));
  8. // update cache
  9. AzureModelController.removeWebAppFromResourceGroup(webAppDetails.resourceGroup, webAppDetails.webApp);
  10. if (asp == null) {
  11. AzureModelController.removeAppServicePlanFromResourceGroup(webAppDetails.appServicePlanResourceGroup, webAppDetails.appServicePlan);
  12. }
  13. }

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

  1. private WebApp.DefinitionStages.WithNewAppServicePlan prepareServicePlan(
  2. @NotNull Azure azure, @NotNull WebAppSettingModel model) {
  3. final WebApp.DefinitionStages.NewAppServicePlanWithGroup appWithGroup = azure
  4. .webApps()
  5. .define(model.getWebAppName())
  6. .withRegion(model.getRegion());
  7. final String resourceGroup = model.getResourceGroup();
  8. if (model.isCreatingResGrp()) {
  9. return appWithGroup.withNewResourceGroup(resourceGroup);
  10. }
  11. return appWithGroup.withExistingResourceGroup(resourceGroup);
  12. }

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

  1. private WebApp.DefinitionStages.WithDockerContainerImage withExistingLinuxServicePlan(
  2. @NotNull Azure azure, @NotNull WebAppSettingModel model) {
  3. AppServicePlan servicePlan = azure.appServices().appServicePlans().getById(model.getAppServicePlanId());
  4. WebApp.DefinitionStages.ExistingLinuxPlanWithGroup withGroup = azure
  5. .webApps()
  6. .define(model.getWebAppName())
  7. .withExistingLinuxPlan(servicePlan);
  8. if (model.isCreatingResGrp()) {
  9. return withGroup.withNewResourceGroup(model.getResourceGroup());
  10. }
  11. return withGroup.withExistingResourceGroup(model.getResourceGroup());
  12. }

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

  1. private WebApp.DefinitionStages.WithCreate withExistingWindowsServicePlan(
  2. @NotNull Azure azure, @NotNull WebAppSettingModel model) {
  3. AppServicePlan servicePlan = azure.appServices().appServicePlans().getById(model.getAppServicePlanId());
  4. WebApp.DefinitionStages.ExistingWindowsPlanWithGroup withGroup = azure
  5. .webApps()
  6. .define(model.getWebAppName())
  7. .withExistingWindowsPlan(servicePlan);
  8. if (model.isCreatingResGrp()) {
  9. return withGroup.withNewResourceGroup(model.getResourceGroup());
  10. }
  11. return withGroup.withExistingResourceGroup(model.getResourceGroup());
  12. }

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

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

相关文章