com.amazonaws.services.ec2.model.Instance.getPlacement()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(179)

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

Instance.getPlacement介绍

[英]The location where the instance launched, if applicable.
[中]实例启动的位置(如果适用)。

代码示例

代码示例来源:origin: aws/aws-sdk-java

if (getMonitoring() != null)
  sb.append("Monitoring: ").append(getMonitoring()).append(",");
if (getPlacement() != null)
  sb.append("Placement: ").append(getPlacement()).append(",");
if (getPlatform() != null)
  sb.append("Platform: ").append(getPlatform()).append(",");

代码示例来源:origin: aws/aws-sdk-java

hashCode = prime * hashCode + ((getLaunchTime() == null) ? 0 : getLaunchTime().hashCode());
hashCode = prime * hashCode + ((getMonitoring() == null) ? 0 : getMonitoring().hashCode());
hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode());
hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode());
hashCode = prime * hashCode + ((getPrivateDnsName() == null) ? 0 : getPrivateDnsName().hashCode());

代码示例来源:origin: aws/aws-sdk-java

if (other.getMonitoring() != null && other.getMonitoring().equals(this.getMonitoring()) == false)
  return false;
if (other.getPlacement() == null ^ this.getPlacement() == null)
  return false;
if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false)
  return false;
if (other.getPlatform() == null ^ this.getPlatform() == null)

代码示例来源:origin: aws-amplify/aws-sdk-android

if (getInstanceType() != null) sb.append("InstanceType: " + getInstanceType() + ",");
if (getLaunchTime() != null) sb.append("LaunchTime: " + getLaunchTime() + ",");
if (getPlacement() != null) sb.append("Placement: " + getPlacement() + ",");
if (getKernelId() != null) sb.append("KernelId: " + getKernelId() + ",");
if (getRamdiskId() != null) sb.append("RamdiskId: " + getRamdiskId() + ",");

代码示例来源:origin: aws-amplify/aws-sdk-android

hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode()); 
hashCode = prime * hashCode + ((getLaunchTime() == null) ? 0 : getLaunchTime().hashCode()); 
hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode()); 
hashCode = prime * hashCode + ((getKernelId() == null) ? 0 : getKernelId().hashCode()); 
hashCode = prime * hashCode + ((getRamdiskId() == null) ? 0 : getRamdiskId().hashCode());

代码示例来源:origin: aws-amplify/aws-sdk-android

if (other.getLaunchTime() == null ^ this.getLaunchTime() == null) return false;
if (other.getLaunchTime() != null && other.getLaunchTime().equals(this.getLaunchTime()) == false) return false; 
if (other.getPlacement() == null ^ this.getPlacement() == null) return false;
if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false) return false; 
if (other.getKernelId() == null ^ this.getKernelId() == null) return false;
if (other.getKernelId() != null && other.getKernelId().equals(this.getKernelId()) == false) return false;

代码示例来源:origin: com.proofpoint.galaxy/galaxy-coordinator

public static String getLocation(com.amazonaws.services.ec2.model.Instance instance, String role)
{
  String zone = instance.getPlacement().getAvailabilityZone();
  String region = zone.substring(0, zone.length() - 1);
  return Joiner.on('/').join("", "ec2", region, zone, instance.getInstanceId(), role);
}

代码示例来源:origin: com.elastisys.scale/cloudpool.aws.commons

/**
 * Returns the region (for example, {@code eu-west-1}) that the
 * {@link Instance} was launched in by looking at the availability zone.
 *
 * @param instance
 * @return
 */
private String extractRegion(Instance instance) {
  if (instance.getPlacement() == null || instance.getPlacement().getAvailabilityZone() == null) {
    LOG.warn("failed to extract region for {}: " + "no placement/availability zone information available",
        instance.getInstanceId());
    return "unknown";
  }
  // availability zone is region + letter, for instance 'eu-west-1a'
  String availabilityZone = instance.getPlacement().getAvailabilityZone();
  String region = availabilityZone.substring(0, availabilityZone.length() - 1);
  return region;
}

代码示例来源:origin: airlift/airship

public static String getLocation(com.amazonaws.services.ec2.model.Instance instance, String role)
{
  String zone = instance.getPlacement().getAvailabilityZone();
  String region = zone.substring(0, zone.length() - 1);
  return Joiner.on('/').join("", "ec2", region, zone, instance.getInstanceId(), role);
}

代码示例来源:origin: pinterest/soundwave

protected HashMap getAwsInstanceProperties(Instance awsInstance) throws Exception {
  HashMap map = mapper.readValue(mapper.writeValueAsString(awsInstance), HashMap.class);

  if (awsInstance.getMonitoring() != null && awsInstance.getMonitoring().getState() != null) {
   //Have to comply with the current AWS_V1 schema
   map.put("monitoring", awsInstance.getMonitoring().getState().toString());
  }

  if (awsInstance.getPlacement() != null
    && awsInstance.getPlacement().getAvailabilityZone() != null) {
   //Be backward compatible for tools
   Map placement = (Map) map.get("placement");
   if (placement != null) {
    placement.put("availability_zone", awsInstance.getPlacement().getAvailabilityZone());
   }
  }
  return map;
 }
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-ec2

if (getMonitoring() != null)
  sb.append("Monitoring: ").append(getMonitoring()).append(",");
if (getPlacement() != null)
  sb.append("Placement: ").append(getPlacement()).append(",");
if (getPlatform() != null)
  sb.append("Platform: ").append(getPlatform()).append(",");

代码示例来源:origin: pinterest/soundwave

@Override
 public EsInstance createFromEC2(Instance awsInstance) throws Exception {
  Preconditions.checkNotNull(awsInstance);

  EsInstance esInstance = new EsInstance();

  esInstance.setId(awsInstance.getInstanceId());
  esInstance.setState(awsInstance.getState().getName());
  esInstance.setLocation(awsInstance.getPlacement().getAvailabilityZone());

  //Region=location-last char. This is what CMDBV1 and people on internet do.
  //There should be a better way. Right now, keep as what it is
  esInstance.setRegion(
    esInstance.getLocation().substring(0, esInstance.getLocation().length() - 1));
  esInstance.setAwsLaunchTime(awsInstance.getLaunchTime());
  esInstance.setSubnetId(awsInstance.getSubnetId());
  esInstance.setVpcId(awsInstance.getVpcId());

  //Convert AWS instance to a map of property bags and save it.
  esInstance.getCloud()
    .put("aws", getAwsInstanceProperties(awsInstance));

  Date utcNow = DateTime.now(DateTimeZone.UTC).toDate();
  esInstance.setCreatedTime(utcNow);
  esInstance.setUpdatedTime(utcNow);

  return esInstance;
 }
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-ec2

hashCode = prime * hashCode + ((getLaunchTime() == null) ? 0 : getLaunchTime().hashCode());
hashCode = prime * hashCode + ((getMonitoring() == null) ? 0 : getMonitoring().hashCode());
hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode());
hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode());
hashCode = prime * hashCode + ((getPrivateDnsName() == null) ? 0 : getPrivateDnsName().hashCode());

代码示例来源:origin: airbnb/billow

this.lifecycle = instance.getInstanceLifecycle();
this.hypervisor = instance.getHypervisor();
this.az = instance.getPlacement().getAvailabilityZone();
this.group = instance.getPlacement().getGroupName();
this.tenancy = instance.getPlacement().getTenancy();
this.vpc = instance.getVpcId();
this.platform = instance.getPlatform();

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

/**
 * @see org.apache.airavata.xbaya.ui.widgets.TableRenderable#getValue(int)
 */
@Override
public Object getValue(int index) {
  switch (index) {
  case 0:
    return this.instance.getInstanceId();
  case 1:
    return this.instance.getImageId();
  case 2:
    return this.instance.getRootDeviceType();
  case 3:
    return this.instance.getInstanceType();
  case 4:
    return this.instance.getState().getName();
  case 5:
    return this.instance.getKeyName();
  case 6:
    return this.instance.getMonitoring().getState();
  case 7:
    return this.instance.getVirtualizationType();
  case 8:
    return this.instance.getPlacement().getGroupName();
  default:
    return null;
  }
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-ec2

if (other.getMonitoring() != null && other.getMonitoring().equals(this.getMonitoring()) == false)
  return false;
if (other.getPlacement() == null ^ this.getPlacement() == null)
  return false;
if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false)
  return false;
if (other.getPlatform() == null ^ this.getPlatform() == null)

相关文章

Instance类方法