本文整理汇总了Java中com.amazonaws.services.ec2.model.InstanceType.fromValue方法的典型用法代码示例。如果您正苦于以下问题:Java InstanceType.fromValue方法的具体用法?Java InstanceType.fromValue怎么用?Java InstanceType.fromValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.ec2.model.InstanceType
的用法示例。
在下文中一共展示了InstanceType.fromValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstanceType
import com.amazonaws.services.ec2.model.InstanceType; //导入方法依赖的package包/类
/**
* Get the size of the instance
*
* @param size
* The size requested
* @return The size assigned
*/
private static InstanceType getInstanceType(String size) {
InstanceType output = InstanceType.C42xlarge;
try {
output = InstanceType.fromValue(size);
} catch (Exception e) {
LOG.warn("Error parsing vminstanceType " + size, e);
}
return output;
}
示例2: validateMachineHasInstanceType
import com.amazonaws.services.ec2.model.InstanceType; //导入方法依赖的package包/类
private void validateMachineHasInstanceType(List<String> results, Machine machine) {
if (StringUtils.isEmpty(machine.getInstanceType()))
results.add(ERROR + "You must provide an instance type for the machine");
else {
String instanceType = machine.getInstanceType();
try {
InstanceType.fromValue(instanceType);
results.add(SUCCESS + "Valid instance type");
} catch (IllegalArgumentException e) {
results.add(ERROR + "Unknown instance type");
}
}
}
示例3: validate
import com.amazonaws.services.ec2.model.InstanceType; //导入方法依赖的package包/类
/**
* Performs basic validation of this configuration.
*
* @throws IllegalArgumentException
*/
public void validate() throws IllegalArgumentException {
checkArgument(this.instanceType != null, "provisioningTemplate: missing instanceType");
try {
InstanceType.fromValue(this.instanceType);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
String.format("provisioingTemplate: unrecognized instanceType: %s", this.instanceType));
}
checkArgument(this.amiId != null, "provisioningTemplate: missing amiId");
checkArgument(this.subnetIds != null, "provisioningTemplate: missing subnetIds");
checkArgument(!this.subnetIds.isEmpty(), "provisioningTemplate: at least one subnet id must be specified");
}
示例4: getInstanceType
import com.amazonaws.services.ec2.model.InstanceType; //导入方法依赖的package包/类
private InstanceType getInstanceType(IProperty[] macProps) {
String instanceTypeString = Utils.getInstanceType(macProps, controllerServices);
InstanceType instanceType = InstanceType.M1Small;
try {
instanceType = InstanceType.fromValue(instanceTypeString);
} catch (IllegalArgumentException e) { //Should never occur
logger.log(Level.INFO, "Invalid instance type. Using m1.small", e);
}
return instanceType;
}
示例5: getInstanceType
import com.amazonaws.services.ec2.model.InstanceType; //导入方法依赖的package包/类
/**
* The name of the instance type to launch. For example, {@code m1.medium}.
*
* @return
*/
public InstanceType getInstanceType() {
return InstanceType.fromValue(this.instanceType);
}