当前位置: 首页>>代码示例>>Java>>正文


Java PurchasePlan类代码示例

本文整理汇总了Java中com.microsoft.azure.management.compute.PurchasePlan的典型用法代码示例。如果您正苦于以下问题:Java PurchasePlan类的具体用法?Java PurchasePlan怎么用?Java PurchasePlan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PurchasePlan类属于com.microsoft.azure.management.compute包,在下文中一共展示了PurchasePlan类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: withPlan

import com.microsoft.azure.management.compute.PurchasePlan; //导入依赖的package包/类
@Override
public VirtualMachineImpl withPlan(PurchasePlan plan) {
    this.inner().withPlan(new Plan());
    this.inner().plan()
            .withPublisher(plan.publisher())
            .withProduct(plan.product())
            .withName(plan.name());
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:10,代码来源:VirtualMachineImpl.java

示例2: parseCustomImagePurchasePlanFromConfig

import com.microsoft.azure.management.compute.PurchasePlan; //导入依赖的package包/类
/**
 * Parses and constructs a custom image purchase plan from instance config. The custom image plan
 * config must have the format: /publisher/<value>/product/<value>/name/<value>
 *
 * @param template instance config
 * @param templateLocalizationContext localization context
 * @return null when no purchase plan is specified or a constructed PurchasePlan object
 * @throws ValidationException when the custom image purchase plan config is not valid
 */
public static PurchasePlan parseCustomImagePurchasePlanFromConfig(final Configured template,
    LocalizationContext templateLocalizationContext) throws ValidationException {
  final String customImagePlan = template.getConfigurationValue(
      AzureComputeInstanceTemplateConfigurationProperty.CUSTOM_IMAGE_PLAN,
      templateLocalizationContext);
  final String invalidConfigErrMsg = "Invalid Custom Image Purchase Plan configuration: %s. " +
      "Allowed configs are 1) <empty string> (for no plan specified); or 2) string with the " +
      "format: /publisher/<publisher>/product/<product>/name/<name>.";

  if (customImagePlan == null || customImagePlan.isEmpty()) {
    return null;
  }

  String[] splitPath = customImagePlan.split("/");
  if (splitPath.length != 7) {
    throw new ValidationException(String.format(invalidConfigErrMsg, customImagePlan));
  }

  Map<String, String> customImagePlanCfgMap = new HashMap<>();
  for (int i = 1; i < splitPath.length; i += 2) {
    customImagePlanCfgMap.put(splitPath[i], splitPath[i + 1]);
  }

  String name = customImagePlanCfgMap.get(CUSTOM_IMAGE_PLAN_NAME_KEY);
  String product = customImagePlanCfgMap.get(CUSTOM_IMAGE_PLAN_PRODUCT_KEY);
  String publisher = customImagePlanCfgMap.get(CUSTOM_IMAGE_PLAN_PUBLISHER_KEY);

  if (name == null || product == null || publisher == null) {
    throw new ValidationException(String.format(invalidConfigErrMsg, customImagePlan));
  }

  PurchasePlan plan = new PurchasePlan()
      .withName(name)
      .withProduct(product)
      .withPublisher(publisher);
  return plan;
}
 
开发者ID:cloudera,项目名称:director-azure-plugin,代码行数:47,代码来源:Configurations.java

示例3: plan

import com.microsoft.azure.management.compute.PurchasePlan; //导入依赖的package包/类
@Override
public PurchasePlan plan() {
    return inner().plan();
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:VirtualMachineImageImpl.java

示例4: withPromotionalPlan

import com.microsoft.azure.management.compute.PurchasePlan; //导入依赖的package包/类
@Override
public VirtualMachineImpl withPromotionalPlan(PurchasePlan plan, String promotionCode) {
    this.withPlan(plan);
    this.inner().plan().withPromotionCode(promotionCode);
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:7,代码来源:VirtualMachineImpl.java

示例5: plan

import com.microsoft.azure.management.compute.PurchasePlan; //导入依赖的package包/类
/**
 * Get the plan value.
 *
 * @return the plan value
 */
public PurchasePlan plan() {
    return this.plan;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:9,代码来源:VirtualMachineImageInner.java

示例6: withPlan

import com.microsoft.azure.management.compute.PurchasePlan; //导入依赖的package包/类
/**
 * Set the plan value.
 *
 * @param plan the plan value to set
 * @return the VirtualMachineImageInner object itself.
 */
public VirtualMachineImageInner withPlan(PurchasePlan plan) {
    this.plan = plan;
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:VirtualMachineImageInner.java


注:本文中的com.microsoft.azure.management.compute.PurchasePlan类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。