本文整理了Java中com.microsoft.azure.management.Azure.appServices()
方法的一些代码示例,展示了Azure.appServices()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Azure.appServices()
方法的具体详情如下:
包路径:com.microsoft.azure.management.Azure
类名称:Azure
方法名:appServices
暂无
代码示例来源:origin: Microsoft/azure-maven-plugins
public static AppServicePlan getAppServicePlan(final String servicePlanName, final Azure azureClient,
final String resourceGroup, final String servicePlanResourceGroup) {
if (StringUtils.isNotEmpty(servicePlanName)) {
final String servicePlanResGrp = getAppServicePlanResourceGroup(resourceGroup, servicePlanResourceGroup);
return azureClient.appServices().appServicePlans()
.getByResourceGroup(servicePlanResGrp, servicePlanName);
}
return null;
}
代码示例来源:origin: com.microsoft.azure/azure-maven-plugin-lib
public static AppServicePlan getAppServicePlan(final String servicePlanName, final Azure azureClient,
final String resourceGroup, final String servicePlanResourceGroup) {
if (StringUtils.isNotEmpty(servicePlanName)) {
final String servicePlanResGrp = getAppServicePlanResourceGroup(resourceGroup, servicePlanResourceGroup);
return azureClient.appServices().appServicePlans()
.getByResourceGroup(servicePlanResGrp, servicePlanName);
}
return null;
}
代码示例来源:origin: Microsoft/azure-tools-for-java
/**
* List app service plan by subscription id and resource group name.
*/
public List<AppServicePlan> listAppServicePlanBySubscriptionIdAndResourceGroupName(String sid, String group) {
List<AppServicePlan> appServicePlans = new ArrayList<>();
try {
Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
appServicePlans.addAll(azure.appServices().appServicePlans().listByResourceGroup(group));
} catch (Exception e) {
e.printStackTrace();
}
return appServicePlans;
}
代码示例来源:origin: Microsoft/azure-maven-plugins
@Nullable
public FunctionApp getFunctionApp() throws AzureAuthFailureException {
try {
return getAzureClient().appServices().functionApps().getByResourceGroup(getResourceGroup(), getAppName());
} catch (AzureAuthFailureException authEx) {
throw authEx;
} catch (Exception ex) {
this.getLog().debug(ex);
// Swallow exception for non-existing Azure Functions
}
return null;
}
代码示例来源:origin: Microsoft/azure-tools-for-java
/**
* List app service plan by subscription id.
*/
public List<AppServicePlan> listAppServicePlanBySubscriptionId(String sid) throws IOException {
return AuthMethodManager.getInstance().getAzureClient(sid).appServices().appServicePlans().list();
}
代码示例来源:origin: Microsoft/azure-maven-plugins
log.info(String.format(CREATE_SERVICE_PLAN, servicePlanName));
final AppServicePlan.DefinitionStages.WithGroup withGroup = azure.appServices().appServicePlans()
.define(servicePlanName).withRegion(region);
代码示例来源: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
public void onLoadWebAppProperty(final String sid, @NotNull final String webAppId, @Nullable final String name) {
Observable.fromCallable(() -> {
final Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
final WebAppBase appBase = getWebAppBase(sid, webAppId, name);
final AppServicePlan plan = azure.appServices().appServicePlans().getById(appBase.appServicePlanId());
return generateProperty(appBase, plan);
}).subscribeOn(getSchedulerProvider().io())
.subscribe(property -> DefaultLoader.getIdeHelper().invokeLater(() -> {
if (isViewDetached()) {
return;
}
getMvpView().showProperty(property);
}), e -> errorHandler((Exception) e));
}
代码示例来源:origin: Microsoft/azure-tools-for-java
private AppServicePlan.DefinitionStages.WithCreate prepareWithCreate(
@NotNull Azure azure, @NotNull WebAppSettingModel model) throws Exception {
final String[] tierSize = model.getPricing().split("_");
if (tierSize.length != 2) {
throw new Exception("Cannot get valid price tier");
}
final PricingTier pricingTier = new PricingTier(tierSize[0], tierSize[1]);
final AppServicePlan.DefinitionStages.WithGroup withGroup = azure
.appServices()
.appServicePlans()
.define(model.getAppServicePlanName())
.withRegion(model.getRegion());
final AppServicePlan.DefinitionStages.WithPricingTier withPricingTier;
final String resourceGroup = model.getResourceGroup();
if (model.isCreatingResGrp()) {
withPricingTier = withGroup.withNewResourceGroup(resourceGroup);
} else {
withPricingTier = withGroup.withExistingResourceGroup(resourceGroup);
}
return withPricingTier.withPricingTier(pricingTier).withOperatingSystem(model.getOS());
}
代码示例来源: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-maven-plugins
protected void createFunctionApp() throws Exception {
info(FUNCTION_APP_CREATE_START);
final AppServicePlan plan = AppServiceUtils.getAppServicePlan(this.getAppServicePlanName(),
this.getAzureClient(), this.getResourceGroup(), this.getAppServicePlanResourceGroup());
final Blank functionApp = getAzureClient().appServices().functionApps().define(appName);
final String resGrp = getResourceGroup();
final WithCreate withCreate;
if (plan == null) {
final NewAppServicePlanWithGroup newAppServicePlanWithGroup = functionApp.withRegion(region);
withCreate = configureResourceGroup(newAppServicePlanWithGroup, resGrp);
configurePricingTier(withCreate, getPricingTier());
} else {
final ExistingAppServicePlanWithGroup planWithGroup = functionApp.withExistingAppServicePlan(plan);
withCreate = isResourceGroupExist(resGrp) ?
planWithGroup.withExistingResourceGroup(resGrp) :
planWithGroup.withNewResourceGroup(resGrp);
}
configureAppSettings(withCreate::withAppSettings, getAppSettings());
withCreate.create();
info(String.format(FUNCTION_APP_CREATED, getAppName()));
}
代码示例来源:origin: Microsoft/azure-tools-for-java
if (model.isCreatingNewResourceGroup()) {
asp = azure.appServices().appServicePlans()
.define(model.getAppServicePlanName())
.withRegion(Region.findByLabelOrName(model.getLocationName()))
} else {
asp = azure.appServices().appServicePlans()
.define(model.getAppServicePlanName())
.withRegion(Region.findByLabelOrName(model.getLocationName()))
AppServicePlan asp = azure.appServices().appServicePlans().getById(model.getAppServicePlanId());
if (model.isCreatingNewResourceGroup()) {
内容来源于网络,如有侵权,请联系作者删除!