Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Put the AMI owner into a command line argument

  • Loading branch information...
commit 46838e06b81cb1d7d3c50504e0c13d68d9869fb4 1 parent a6ba079
@richardcloudsoft richardcloudsoft authored
View
11 ec2-windows/src/main/java/org/jclouds/examples/ec2/windows/Arguments.java
@@ -16,6 +16,8 @@
private String imageNamePattern = IMAGE_NAME_PATTERN_DEFAULT;
private static final String INSTANCE_TYPE_DEFAULT = InstanceType.M1_SMALL;
private String instanceType = INSTANCE_TYPE_DEFAULT;
+ private static final String AMI_OWNER_DEFAULT = "801119661308";
+ private String amiOwner = AMI_OWNER_DEFAULT;
public String getIdentity() {
return identity;
@@ -37,6 +39,10 @@ public String getInstanceType() {
return instanceType;
}
+ public String getAmiOwner() {
+ return amiOwner;
+ }
+
@Option(name = "--identity", aliases = "-i", required = true, usage = "your AWS access key ID")
public void setIdentity(String identity) {
this.identity = identity;
@@ -61,4 +67,9 @@ public void setImageNamePattern(String imageNamePattern) {
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
+
+ @Option(name = "--ami-owner", aliases = "-o", usage = "AMI owner account ID; default=" + AMI_OWNER_DEFAULT)
+ public void setAmiOwner(String amiOwner) {
+ this.amiOwner = amiOwner;
+ }
}
View
2  ec2-windows/src/main/java/org/jclouds/examples/ec2/windows/MainApp.java
@@ -72,7 +72,7 @@ public static void main(String[] args) throws Exception {
private void run() throws Exception {
Properties overrides = new Properties();
- overrides.put(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY, "owner-id=801119661308;state=available;image-type=machine");
+ overrides.put(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY, "owner-id=" + arguments.getAmiOwner() + ";state=available;image-type=machine");
ImmutableSet<Module> modules = ImmutableSet.<Module>of(
new SLF4JLoggingModule(), // OverThere uses SLF4J so we will as well
Please sign in to comment.
Something went wrong with that request. Please try again.