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


Java Instance.getImageId方法代码示例

本文整理汇总了Java中com.amazonaws.services.ec2.model.Instance.getImageId方法的典型用法代码示例。如果您正苦于以下问题:Java Instance.getImageId方法的具体用法?Java Instance.getImageId怎么用?Java Instance.getImageId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.ec2.model.Instance的用法示例。


在下文中一共展示了Instance.getImageId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkInstanceIsManagedByDirector

import com.amazonaws.services.ec2.model.Instance; //导入方法依赖的package包/类
/**
 * Performs a sequence of strict instance ownership checks to avoid any potential harmful
 * accidents.
 *
 * @param instance the instance
 * @param template the template from which the instance was created, or <code>null</code>
 *                 if it is unknown (such as during a delete call)
 * @return the virtual instance ID
 * @throws IllegalStateException if the instance fails an ownership check
 */
private String checkInstanceIsManagedByDirector(Instance instance, EC2InstanceTemplate template) {
  String virtualInstanceId = getVirtualInstanceId(instance.getTags(), "instance");
  String instanceIds = instance.getInstanceId() + " / " + virtualInstanceId;
  String instanceKeyName = instance.getKeyName();

  if (template != null) {
    if (!template.getKeyName().equals(Optional.fromNullable(instanceKeyName))) {
      LOG.warn("Found unexpected key name: {} for instance: {}", instanceKeyName, instanceIds);
    }
    String instanceType = instance.getInstanceType();
    if (!template.getType().equals(instanceType)) {
      LOG.warn("Found unexpected type: {} for instance: {}", instanceType, instanceIds);
    }
    String instanceImageId = instance.getImageId();
    if (!template.getImage().equals(instanceImageId)) {
      LOG.warn("Found unexpected image: {} for instance: {}", instanceImageId, instanceIds);
    }
  }
  return virtualInstanceId;
}
 
开发者ID:cloudera,项目名称:director-aws-plugin,代码行数:31,代码来源:EC2Provider.java

示例2: getPropertyValue

import com.amazonaws.services.ec2.model.Instance; //导入方法依赖的package包/类
@Override
protected String getPropertyValue(Instance instance) {
  return instance.getImageId();
}
 
开发者ID:cloudera,项目名称:director-aws-plugin,代码行数:5,代码来源:EC2Instance.java


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