@Option(name = "-l", aliases = "--location", description = "Location to create container in", required = false, multiValued = false)
String locationString = "";
@Override
protected Object doExecute() throws Exception {
BlobStore blobStore = getBlobStore();
Location location = null;
if (!locationString.isEmpty()) {
for (Location loc : blobStore.listAssignableLocations()) {
if (loc.getId().equalsIgnoreCase(locationString)) {
location = loc;
break;
}
}
if (location == null) {
throw new IllegalArgumentException("unknown location: " + locationString);
}
}
for (String container : containerNames) {
boolean created = blobStore.createContainerInLocation(location, container);
if (!created) {
if (blobStore.containerExists(container)) {
throw new Exception("Container already exists: " + container);
}
throw new Exception("Could not create container: " + container);
}