@Override public LoginCredentials apply(Object resourceToAuthenticate) { if (creds != null) return creds; Builder credentials = LoginCredentials.builder().user("root"); if (resourceToAuthenticate != null) { String owner = null; if (resourceToAuthenticate instanceof Image) { owner = Image.class.cast(resourceToAuthenticate).getImageOwnerId(); } else if (resourceToAuthenticate instanceof org.jclouds.compute.domain.Image) { owner = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("owner"); } checkArgument(owner != null, "Resource must be an image (for EC2)"); // canonical/alestic images use the ubuntu user to login if (owner.matches("063491364108|099720109477")) { credentials.user("ubuntu"); // http://typepad.com/2010/09/introducing-amazon-linux-ami.html } else if (owner.equals("137112412989")) { credentials.user("ec2-user"); } } return credentials.build(); } }
@Override public LoginCredentials apply(Object resourceToAuthenticate) { if (creds != null) return creds; Builder credentials = LoginCredentials.builder().user("root"); if (resourceToAuthenticate != null) { String owner = null; if (resourceToAuthenticate instanceof Image) { owner = Image.class.cast(resourceToAuthenticate).getImageOwnerId(); } else if (resourceToAuthenticate instanceof org.jclouds.compute.domain.Image) { owner = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("owner"); } checkArgument(owner != null, "Resource must be an image (for EC2)"); // canonical/alestic images use the ubuntu user to login if (owner.matches("063491364108|099720109477")) { credentials.user("ubuntu"); // http://typepad.com/2010/09/introducing-amazon-linux-ami.html } else if (owner.equals("137112412989")) { credentials.user("ec2-user"); } } return credentials.build(); } }
@Override public LoginCredentials apply(Object resourceToAuthenticate) { if (creds != null) return creds; Builder credentials = LoginCredentials.builder().user("root"); if (resourceToAuthenticate != null) { String owner = null; if (resourceToAuthenticate instanceof Image) { owner = Image.class.cast(resourceToAuthenticate).getImageOwnerId(); } else if (resourceToAuthenticate instanceof org.jclouds.compute.domain.Image) { owner = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("owner"); } checkArgument(owner != null, "Resource must be an image (for EC2)"); // canonical/alestic images use the ubuntu user to login if (owner.matches("063491364108|099720109477")) { credentials.user("ubuntu"); // http://typepad.com/2010/09/introducing-amazon-linux-ami.html } else if (owner.equals("137112412989")) { credentials.user("ec2-user"); } } return credentials.build(); } }
@Override public LoginCredentials apply(Object resourceToAuthenticate) { if (creds != null) return creds; Builder credentials = LoginCredentials.builder().user("root"); if (resourceToAuthenticate != null) { String owner = null; String name = null; if (resourceToAuthenticate instanceof Image) { owner = Image.class.cast(resourceToAuthenticate).getImageOwnerId(); name = Image.class.cast(resourceToAuthenticate).getName(); } else if (resourceToAuthenticate instanceof org.jclouds.compute.domain.Image) { owner = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("owner"); name = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("name"); } checkArgument(owner != null, "Resource must be an image (for EC2)"); // canonical/alestic images use the ubuntu user to login if (owner.matches("063491364108|099720109477")) { credentials.user("ubuntu"); // http://typepad.com/2010/09/introducing-amazon-linux-ami.html } else if (owner.equals("137112412989")) { credentials.user("ec2-user"); } else if (owner.equals("679593333241") && name != null && name.startsWith("CentOS")) { credentials.user("centos"); } } return credentials.build(); } }
@Override public LoginCredentials apply(Object resourceToAuthenticate) { if (creds != null) return creds; Builder credentials = LoginCredentials.builder().user("root"); if (resourceToAuthenticate != null) { String owner = null; String name = null; if (resourceToAuthenticate instanceof Image) { owner = Image.class.cast(resourceToAuthenticate).getImageOwnerId(); name = Image.class.cast(resourceToAuthenticate).getName(); } else if (resourceToAuthenticate instanceof org.jclouds.compute.domain.Image) { owner = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("owner"); name = org.jclouds.compute.domain.Image.class.cast(resourceToAuthenticate).getUserMetadata().get("name"); } checkArgument(owner != null, "Resource must be an image (for EC2)"); // canonical/alestic images use the ubuntu user to login if (owner.matches("063491364108|099720109477")) { credentials.user("ubuntu"); // http://typepad.com/2010/09/introducing-amazon-linux-ami.html } else if (owner.equals("137112412989")) { credentials.user("ec2-user"); } else if (owner.equals("679593333241") && name != null && name.startsWith("CentOS")) { credentials.user("centos"); } } return credentials.build(); } }
builder.name(from.getName()); builder.description(from.getDescription() != null ? from.getDescription() : from.getImageLocation()); builder.userMetadata(ImmutableMap.<String, String> builder().put("owner", from.getImageOwnerId()).put( "rootDeviceType", from.getRootDeviceType().value()).put("virtualizationType", from.getVirtualizationType().value()).put("hypervisor", from.getHypervisor().value()).build());
builder.name(from.getName()); builder.description(from.getDescription() != null ? from.getDescription() : from.getImageLocation()); builder.userMetadata(ImmutableMap.<String, String> builder().put("owner", from.getImageOwnerId()).put( "rootDeviceType", from.getRootDeviceType().value()).put("virtualizationType", from.getVirtualizationType().value()).put("hypervisor", from.getHypervisor().value()).build());
builder.name(from.getName()); builder.description(from.getDescription() != null ? from.getDescription() : from.getImageLocation()); builder.userMetadata(ImmutableMap.<String, String> builder().put("owner", from.getImageOwnerId()).put( "rootDeviceType", from.getRootDeviceType().value()).put("virtualizationType", from.getVirtualizationType().value()).put("hypervisor", from.getHypervisor().value()).build());
builder.name(from.getName()); builder.description(from.getDescription() != null ? from.getDescription() : from.getImageLocation()); builder.userMetadata(ImmutableMap.<String, String> builder().put("owner", from.getImageOwnerId()).put( "rootDeviceType", from.getRootDeviceType().value()).put("virtualizationType", from.getVirtualizationType().value()).put("hypervisor", from.getHypervisor().value()).build());
builder.name(from.getName()); builder.description(from.getDescription() != null ? from.getDescription() : from.getImageLocation()); builder.userMetadata(ImmutableMap.<String, String> builder().put("owner", from.getImageOwnerId()).put( "rootDeviceType", from.getRootDeviceType().value()).put("virtualizationType", from.getVirtualizationType().value()).put("hypervisor", from.getHypervisor().value()).build());