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

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

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

Azure.appServices介绍

暂无

代码示例

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

  1. public static AppServicePlan getAppServicePlan(final String servicePlanName, final Azure azureClient,
  2. final String resourceGroup, final String servicePlanResourceGroup) {
  3. if (StringUtils.isNotEmpty(servicePlanName)) {
  4. final String servicePlanResGrp = getAppServicePlanResourceGroup(resourceGroup, servicePlanResourceGroup);
  5. return azureClient.appServices().appServicePlans()
  6. .getByResourceGroup(servicePlanResGrp, servicePlanName);
  7. }
  8. return null;
  9. }

代码示例来源:origin: com.microsoft.azure/azure-maven-plugin-lib

  1. public static AppServicePlan getAppServicePlan(final String servicePlanName, final Azure azureClient,
  2. final String resourceGroup, final String servicePlanResourceGroup) {
  3. if (StringUtils.isNotEmpty(servicePlanName)) {
  4. final String servicePlanResGrp = getAppServicePlanResourceGroup(resourceGroup, servicePlanResourceGroup);
  5. return azureClient.appServices().appServicePlans()
  6. .getByResourceGroup(servicePlanResGrp, servicePlanName);
  7. }
  8. return null;
  9. }

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

  1. /**
  2. * List app service plan by subscription id and resource group name.
  3. */
  4. public List<AppServicePlan> listAppServicePlanBySubscriptionIdAndResourceGroupName(String sid, String group) {
  5. List<AppServicePlan> appServicePlans = new ArrayList<>();
  6. try {
  7. Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
  8. appServicePlans.addAll(azure.appServices().appServicePlans().listByResourceGroup(group));
  9. } catch (Exception e) {
  10. e.printStackTrace();
  11. }
  12. return appServicePlans;
  13. }

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

  1. @Nullable
  2. public FunctionApp getFunctionApp() throws AzureAuthFailureException {
  3. try {
  4. return getAzureClient().appServices().functionApps().getByResourceGroup(getResourceGroup(), getAppName());
  5. } catch (AzureAuthFailureException authEx) {
  6. throw authEx;
  7. } catch (Exception ex) {
  8. this.getLog().debug(ex);
  9. // Swallow exception for non-existing Azure Functions
  10. }
  11. return null;
  12. }

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

  1. /**
  2. * List app service plan by subscription id.
  3. */
  4. public List<AppServicePlan> listAppServicePlanBySubscriptionId(String sid) throws IOException {
  5. return AuthMethodManager.getInstance().getAzureClient(sid).appServices().appServicePlans().list();
  6. }

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

  1. log.info(String.format(CREATE_SERVICE_PLAN, servicePlanName));
  2. final AppServicePlan.DefinitionStages.WithGroup withGroup = azure.appServices().appServicePlans()
  3. .define(servicePlanName).withRegion(region);

代码示例来源: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. public void onLoadWebAppProperty(final String sid, @NotNull final String webAppId, @Nullable final String name) {
  2. Observable.fromCallable(() -> {
  3. final Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
  4. final WebAppBase appBase = getWebAppBase(sid, webAppId, name);
  5. final AppServicePlan plan = azure.appServices().appServicePlans().getById(appBase.appServicePlanId());
  6. return generateProperty(appBase, plan);
  7. }).subscribeOn(getSchedulerProvider().io())
  8. .subscribe(property -> DefaultLoader.getIdeHelper().invokeLater(() -> {
  9. if (isViewDetached()) {
  10. return;
  11. }
  12. getMvpView().showProperty(property);
  13. }), e -> errorHandler((Exception) e));
  14. }

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

  1. private AppServicePlan.DefinitionStages.WithCreate prepareWithCreate(
  2. @NotNull Azure azure, @NotNull WebAppSettingModel model) throws Exception {
  3. final String[] tierSize = model.getPricing().split("_");
  4. if (tierSize.length != 2) {
  5. throw new Exception("Cannot get valid price tier");
  6. }
  7. final PricingTier pricingTier = new PricingTier(tierSize[0], tierSize[1]);
  8. final AppServicePlan.DefinitionStages.WithGroup withGroup = azure
  9. .appServices()
  10. .appServicePlans()
  11. .define(model.getAppServicePlanName())
  12. .withRegion(model.getRegion());
  13. final AppServicePlan.DefinitionStages.WithPricingTier withPricingTier;
  14. final String resourceGroup = model.getResourceGroup();
  15. if (model.isCreatingResGrp()) {
  16. withPricingTier = withGroup.withNewResourceGroup(resourceGroup);
  17. } else {
  18. withPricingTier = withGroup.withExistingResourceGroup(resourceGroup);
  19. }
  20. return withPricingTier.withPricingTier(pricingTier).withOperatingSystem(model.getOS());
  21. }

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

  1. protected void createFunctionApp() throws Exception {
  2. info(FUNCTION_APP_CREATE_START);
  3. final AppServicePlan plan = AppServiceUtils.getAppServicePlan(this.getAppServicePlanName(),
  4. this.getAzureClient(), this.getResourceGroup(), this.getAppServicePlanResourceGroup());
  5. final Blank functionApp = getAzureClient().appServices().functionApps().define(appName);
  6. final String resGrp = getResourceGroup();
  7. final WithCreate withCreate;
  8. if (plan == null) {
  9. final NewAppServicePlanWithGroup newAppServicePlanWithGroup = functionApp.withRegion(region);
  10. withCreate = configureResourceGroup(newAppServicePlanWithGroup, resGrp);
  11. configurePricingTier(withCreate, getPricingTier());
  12. } else {
  13. final ExistingAppServicePlanWithGroup planWithGroup = functionApp.withExistingAppServicePlan(plan);
  14. withCreate = isResourceGroupExist(resGrp) ?
  15. planWithGroup.withExistingResourceGroup(resGrp) :
  16. planWithGroup.withNewResourceGroup(resGrp);
  17. }
  18. configureAppSettings(withCreate::withAppSettings, getAppSettings());
  19. withCreate.create();
  20. info(String.format(FUNCTION_APP_CREATED, getAppName()));
  21. }

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

  1. if (model.isCreatingNewResourceGroup()) {
  2. asp = azure.appServices().appServicePlans()
  3. .define(model.getAppServicePlanName())
  4. .withRegion(Region.findByLabelOrName(model.getLocationName()))
  5. } else {
  6. asp = azure.appServices().appServicePlans()
  7. .define(model.getAppServicePlanName())
  8. .withRegion(Region.findByLabelOrName(model.getLocationName()))
  9. AppServicePlan asp = azure.appServices().appServicePlans().getById(model.getAppServicePlanId());
  10. if (model.isCreatingNewResourceGroup()) {

相关文章